diff --git a/ext/cdf/CMakeLists.txt b/ext/cdf/CMakeLists.txt index 0af65b4..d6e9927 100644 --- a/ext/cdf/CMakeLists.txt +++ b/ext/cdf/CMakeLists.txt @@ -4,7 +4,7 @@ # General settings ######################################################################################### if (NOT CDF_ROOT_DIR) - set(CDF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cdf35_0-dist) + set(CDF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cdf38_0-dist) endif () ######################################################################################### @@ -41,8 +41,8 @@ if(CDF_BUILD_ZLIB) set(ALL_SOURCE ${ALL_SOURCE} ${ZLIB_SOURCE}) endif(CDF_BUILD_ZLIB) - -add_definitions(-Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DHAVE_STDARG_H -DHAVE_UNISTD_H -DZ_PREFIX) +# old(cdf35_0-dist): add_definitions(-Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DHAVE_STDARG_H -DHAVE_UNISTD_H -DZ_PREFIX) +add_definitions(-c -nologo -W3 -Gm -GX -ZI -Od -D_WIN32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) if(__APPLE__) add_definitions(-Dmac ) endif(__APPLE__) diff --git a/ext/cdf/cdf35_0-dist/Release.notes b/ext/cdf/cdf35_0-dist/Release.notes deleted file mode 100644 index a682008..0000000 --- a/ext/cdf/cdf35_0-dist/Release.notes +++ /dev/null @@ -1,84 +0,0 @@ -/-----------------------------------/ -/ CDF V3.5.0.2 Release Notes / -/-----------------------------------/ - -1. Compatibility with CDF 3.4.*, 3.3.*, 3.2, 3.1 , 2.7.2 and Earlier Versions - -CDF V3.5.0 is backward compatible with the previous versions of CDF, and it -can read CDF files that were created with earlier versions. - -If a file was created with CDF 2.7 and read and modified by CDF 3.*, the -resultant file will be saved in the CDF 2.7 format, not CDF 3.*. The same -principle applies to files that were created with CDF 2.5 and 2.6. CDF -files that are created from scratch with CDF V3.5.0 are compatible in file -structure with all CDF 3.*, but not compatible (due to a 64-bit file offsets -used since CDF 3.0 versions) with CDF 2.7.2 or earlier, and an attempt to -read CDF 3.* files from CDF 2.7.2 or earlier will produce an error. Since a -couple of new data types bad been added in V3.4, applications based on V3.3.* -and earilier will not be able access the V3.4 and later files if the files -have the data in those new types. However, if the files of V3.4 and later do -not contain data of the new data types, V3.*-based applications should have no -problems accessing them. - -Users of CDF 3.1 or later versions will be able to create CDF files that -can be read by CDF 2.7.2 or earlier by using the CDFsetFileBackward function -(in C) or CDF_set_FileBackward subroutine (in Fortran), or using the -CDF_FILEBACKWARD environment variable on Unix/Linux (including Mac OS X) or -PC, or CDF$FILEBACKWARD on OpenVMS. See Section 4.18 of the CDF C -Reference Manual and the CDF Fortran Reference Manual for details on how to -create CDF 2.7-compatible files. - -All features added to the previous releases are included. Refer to the release -notes from the previous versions to view the specific features pertaining -to that release. - -2. Changes - -The following changes have been made/added: - - * The open source zlib (Version 1.2.8) is used as is to replace the GZIP - compression/decompression code implemented in the earlier versions. - * Added support for NaN, Inf and -Inf for floating point values. - * A few bugs were fixed. - * Modified the default encoding to Host when a new CDF is created. - * Fixed the minor memory leaks in the core and JNI libraries. - * Modified the blocking factor to improve the performance. - * Modified the default pad values from 0 or 0.0, which could be valid, to - something noticeables. Fill space(s) if the string-type value with less - than the defined variable is passed in when setting the pad value. - * Added some new features in the tool programs. - * Added support for Visual Basic on Windows. - -Please refer to CHANGES.txt for the dtailed code changes in various versions. - -3. How to Obtain the Latest Software - - Go to the CDF home page (http://cdf.gsfc.nasa.gov) and click the - Download CDF Software link. - - -4. Documentation - -The CDF documentation set consists of the following: - - cdf350ug.pdf (CDF User's Guide) - cdf350crm.pdf (CDF C Reference Manual) - cdf350frm.pdf (CDF Fortran Reference Manual) - cdf350prm.pdf (CDF Perl Reference Manual) - cdf350jrm.pdf (CDF Java Reference Manual) - cdf350csrm.pdf (CDF C# Reference Manual) - cdf350vbrm.pdf (CDF Visual Basic Reference Manual) - cdf35ifd.pdf (CDF Internal Format Description) - -These documents are available from the CDF home page (http://cdf.gsfc.nasa.gov). - -We have a user support office for CDF that you can contact when you need an -assistance. For requests, please send emails to: - - Internet -- gsfc-cdf-support@lists.nasa.gov - -Please let us know (via an email to CDFSUPPORT) if you get the distribution. -We would like to know who has the distribution so we know who to contact -when updates are available. - -CDFsupport diff --git a/ext/cdf/cdf35_0-dist/src/lib/zlib/ACKNOWLEDGMENT.txt b/ext/cdf/cdf35_0-dist/src/lib/zlib/ACKNOWLEDGMENT.txt deleted file mode 100644 index 097f82b..0000000 --- a/ext/cdf/cdf35_0-dist/src/lib/zlib/ACKNOWLEDGMENT.txt +++ /dev/null @@ -1,7 +0,0 @@ -This directory contains some of the compression/decompression codes from zlib, -(@zlib.net) of version 1.2.8, written by Jean-loup Gailly and Mark Adler. -Only the .c and .h source codes are included from the package without any -change to support the gzip functionality provided in the CDF. - -Refer to zlib.h for its copyright notice. - diff --git a/ext/cdf/cdf35_0-dist/src/lib/zlib/uncompr.c b/ext/cdf/cdf35_0-dist/src/lib/zlib/uncompr.c deleted file mode 100644 index 78b6d65..0000000 --- a/ext/cdf/cdf35_0-dist/src/lib/zlib/uncompr.c +++ /dev/null @@ -1,59 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: uncompr.c,v 1.1 2013/10/18 13:36:47 liu Exp $ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (z_const Bytef *)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/ext/cdf/cdf38_0-dist/CDFLeapSeconds.txt b/ext/cdf/cdf38_0-dist/CDFLeapSeconds.txt new file mode 100644 index 0000000..cf57b4d --- /dev/null +++ b/ext/cdf/cdf38_0-dist/CDFLeapSeconds.txt @@ -0,0 +1,48 @@ +; Source: +; Updated: 20161025 +; Leap Seconds Table - used by CDF +; Update it when a leap second(s) is added. +; Comment lines starts with ";" at column 1. +; Year Month Day Leap Seconds Drift + 1960 1 1 1.4178180 37300.0 0.001296 + 1961 1 1 1.4228180 37300.0 0.001296 + 1961 8 1 1.3728180 37300.0 0.001296 + 1962 1 1 1.8458580 37665.0 0.0011232 + 1963 11 1 1.9458580 37665.0 0.0011232 + 1964 1 1 3.2401300 38761.0 0.001296 + 1964 4 1 3.3401300 38761.0 0.001296 + 1964 9 1 3.4401300 38761.0 0.001296 + 1965 1 1 3.5401300 38761.0 0.001296 + 1965 3 1 3.6401300 38761.0 0.001296 + 1965 7 1 3.7401300 38761.0 0.001296 + 1965 9 1 3.8401300 38761.0 0.001296 + 1966 1 1 4.3131700 39126.0 0.002592 + 1968 2 1 4.2131700 39126.0 0.002592 + 1972 1 1 10.0 0.0 0.0 + 1972 7 1 11.0 0.0 0.0 + 1973 1 1 12.0 0.0 0.0 + 1974 1 1 13.0 0.0 0.0 + 1975 1 1 14.0 0.0 0.0 + 1976 1 1 15.0 0.0 0.0 + 1977 1 1 16.0 0.0 0.0 + 1978 1 1 17.0 0.0 0.0 + 1979 1 1 18.0 0.0 0.0 + 1980 1 1 19.0 0.0 0.0 + 1981 7 1 20.0 0.0 0.0 + 1982 7 1 21.0 0.0 0.0 + 1983 7 1 22.0 0.0 0.0 + 1985 7 1 23.0 0.0 0.0 + 1988 1 1 24.0 0.0 0.0 + 1990 1 1 25.0 0.0 0.0 + 1991 1 1 26.0 0.0 0.0 + 1992 7 1 27.0 0.0 0.0 + 1993 7 1 28.0 0.0 0.0 + 1994 7 1 29.0 0.0 0.0 + 1996 1 1 30.0 0.0 0.0 + 1997 7 1 31.0 0.0 0.0 + 1999 1 1 32.0 0.0 0.0 + 2006 1 1 33.0 0.0 0.0 + 2009 1 1 34.0 0.0 0.0 + 2012 7 1 35.0 0.0 0.0 + 2015 7 1 36.0 0.0 0.0 + 2017 1 1 37.0 0.0 0.0 diff --git a/ext/cdf/cdf35_0-dist/CDF_copyright.txt b/ext/cdf/cdf38_0-dist/CDF_copyright.txt similarity index 96% rename from ext/cdf/cdf35_0-dist/CDF_copyright.txt rename to ext/cdf/cdf38_0-dist/CDF_copyright.txt index 0ef3ed9..c9a317a 100644 --- a/ext/cdf/cdf35_0-dist/CDF_copyright.txt +++ b/ext/cdf/cdf38_0-dist/CDF_copyright.txt @@ -1,4 +1,4 @@ -Copyright 2014 +Common Data Format (CDF) Space Physics Data Facility NASA/Goddard Space Flight Center diff --git a/ext/cdf/cdf35_0-dist/CHANGES.txt b/ext/cdf/cdf38_0-dist/CHANGES.txt similarity index 58% rename from ext/cdf/cdf35_0-dist/CHANGES.txt rename to ext/cdf/cdf38_0-dist/CHANGES.txt index 8cc1431..74343a7 100644 --- a/ext/cdf/cdf35_0-dist/CHANGES.txt +++ b/ext/cdf/cdf38_0-dist/CHANGES.txt @@ -1,4 +1,4 @@ -CDF Changes Log, CDF V3.3 +CDF Changes Log, CDF V3.7 V2.0.0 11-Feb-91 Release of CDF V2.0. V2.1.0 7-Jun-91 Release of CDF V2.1. @@ -177,6 +177,123 @@ V3.5.0 25-Feb-13 The original beta version Minor code changes for filling space(s) for writing string type pad value. 64-bit Windows package now distributes 64-bit Cygwin-based libraries and tools. Bugs fixed. Added - support for nan, inf and -inf for floting point values in + support for nan, inf and -inf for floating point values in the tool programs. - +V3.6.0 5-Feb-15 for version 3.6.0.3 + Added a new leap second for 2015-07-01 to the leap second + table. Added a field "LeapSecondLastUpdated" in GDR to + record what leap second table a CDF is based upon. A set of + functions to read/write/validate the field is added. + Added an option to renumber the sparse variable records + after a record(s) is deleted. Added sort and detect options + in tool cdfconvert. Skip checking the file/path name's + characters when reading a CDF file. Enforce ASCII chars for + file name (not including the directory portion) only. Minor + bug fixes. + 1-May-15 for version 3.6.0.4 + Modified cdfjava.jar. Extended status text length. +V3.6.1 20-Sep-15 for version 3.6.1.0 + Used the preserved system temporary folder, e.g., /tmp + for Linux/Unix/MacOSX, to hold the temporary file(s) + while doing compression/decompression. Set + temporary file name using the random number generator with + process id and current time as the seed. Added support + for computing TT2000 from UTC if the passed day is DOY + (day of the year from January 1st). Added a few options + to cdfconvert tool program. +V3.6.2 20-Mar-16 for version 3.6.2.0 + Modified to Makefile and installation process to support + Mac OS X El Captain (10.11). Modified the library to handle + string data that has a shorter length than defined (number + of elements) when reading/writing. It will be filled with + spaces, starting from the NUL. + 13-May-16 for version 3.6.2.1 + Bug fixed for handling TT2000 time computing if only + year/month/day is given. Speed up the leap second + time/table validation. +V3.6.3 20-Oct-16 for version 3.6.3.0 + Added a new set of C-based APIs for reading the CDF data. + Each of these APIs, identified as CDFread..., will return + a pointer to the library allocated space for the data. + Caller is responsible to free the space after use. New + features were added to cdfstats and cdfdump tool programs. + A new leap second is added for 1/1/2017. + 10-Jan-17 for version 3.6.3.1 + Updated the leap second last updated header in a CDF from + the (latest) leap second table if the CDF is created based + on an existing master CDF that has an older leap second + table. +V3.6.4 10-Feb-17 for version 3.6.4.0 + For Unix-based systems, use C's "mkstemp" function to create + the temporary files, in the template form of + "mycdftmp.XXXXXX". On Windows, use VS's "_mktemp_s" to do + the same. Use the random number generator to create the + temporary file name as the last resort if C's function + fails to create one. + For Unix-based systems, the temporary files will be + created in the current directory if it is writable and + neither environment variable CDF_TMP nor TMPDIR is defined. + Otherwise, it will try the directory defined by the + environment variable CDF_TMP first and then TMPDIR. + If the current directory is not writable, then system's + "/tmp" is used. On Windows, both "TMP" and "TEMP" directory + will be tried if CDF_TMP is not defined. If all fail, + the last resort is to use the current directory. + Modified cdfexport to not truncate variable name while + displaying its data. Have a separate patch for supporting + IDL 8.6. +V3.7.0 11-May-18 for version 3.7.0.0 + For variable attribute, multi-strings are allowed. A header + field in the internal data structure for entry is used to + stored the number of strings. A function to free the + retrieved strings, when reading, is created. The data + validation control process, thru CDF_VALIDATE environment + variable, is modified to also skip the checksum + verification, in addition to the data sanity check, if the + validation is turned off. cdfconvert tool allows the output + of the converted file to replace the source file. + Added support for ARM ports, little or big-endian. The + string-typed data for attribute entry or variable data can + be Nul-terminated. The default pad value can also be empty. + Previously, space(s) is filled if the data length is + shorter than the defined number of elements. Added openVMS + on Itanium (IA64) ports: IA64VMSi, IA64VMSd and IA64VMSg. + Added cdfj.jar, the pure Java package for CDF read and + write without needing CDF library and JNI. A revised cdf + schema is included for CDF's XML support. +V3.7.1 21-Aug-18 for version 3.7.1.0 + Modified to make the encoded date/time string for CDF_EPOCH + and CDF_EPOCH16 in the form of ISO 8601 as the default, as + yyyy-mm-ddThh:mm:ss.ccc or yyyy-mm-ddThh:mm:ss.cccuuunnnppp + respectively. Enhanced the CDFML xsd schema. Do not throw + an error if the ILLEGAL_TT2000_VALUE is encountered. When + encoding its value into date/time string, it is presented + as 1707-09-22T12:12:10.961224195. (Read CDF's C document.) + Add a set of general encoding/parsing functions for each + of the CDF epoch data type. Added a set of time conversion + functions between CDF_EPOCH/CDF_EPOCH16/CDF_TIME_TT2000 time + and unix time. Reset the rVariables' dimension to zero if + a cdf is converted, by cdfconvert, with "zMode 2". +V3.8.0 27-Oct-19 for version 3.8.0.0 + Modified the code to use a variable's FILLVAL, replacing + its PAD value, for all record varying variable's virtual + record data if it exists. To use FILLVAL, it must have a + data type equivalent to its variable's. String typed + variable's pad value is filled with a single space and + followed by NUL(s), instead of multiple spaces. + Changed skt2cdf tool program to allow handling a skeleton + table directly from Windows (with \r\n at the end in each + line) on non-Windows systems. Added new options to + cdfconvert tool program to + 1. remove non-varying dimension(s) from the source + zVariable(s) if it does not have DEPEND_* attribute + defined to the destination variable. + 2. replace any pad value(s) in a variable's data by its + FILLVAL value, if FILLVAL attribute exists and has + an equivalent data type as variable's. + Modified the tool programs to use FORMAT attribute to encode + both data and metadata if the format is to be used. These + include all C-based and Java-based tools. A new option is + added to cdf2skt tool to allow users to choose how to + display variable's metadata and data, either with or witout + format. diff --git a/ext/cdf/cdf38_0-dist/HOWTO.run-Java-tools b/ext/cdf/cdf38_0-dist/HOWTO.run-Java-tools new file mode 100644 index 0000000..9c21304 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/HOWTO.run-Java-tools @@ -0,0 +1,71 @@ +How to run Java CDF Tools +------------------------- + +Note for Mac OS X users: + If you installed the pre-bulit package (universal binary), all + environment variables mentioned below are set automatically in + your log-in shell. They are defined when a terminal session is open. + Alternatively, you can doble-click the CDFToolsDriver.app from Finder + to invoke the application. No need to set up the environment variables, + either. If you build the libraries and tools from the source code, then + the following steps are needed to define the environment variables for + running the Java tools. + + For Windows users: + If use the pre-built package, just click the CDFToolsDriver from + "Start" -> "All Programs" -> "CDF Distribution...". + All are set when the is installed. + +1. Set the CLASSPATH environment variable. + + CLASSPATH should point to the the locations (full path names) of the + following files: + + /cdfjava/cdftools/CDFToolsDriver.jar + /cdfjava/classes/cdfjava.jar + /cdfjava/cdfml/cdfml.jar + + Example: + setenv CLASSPATH .:/home/cdf/cdf37_0-dist/cdfjava/classes/cdfjava.jar: \ + /home/cdf/cdf37_0-dist/cdfjava/cdftools/CDFToolsDriver.jar \ + /home/cdf/cdf37_0-dist/cdfjava/cdfml/cdfml.jar + + +2. Set the LD_LIBRARY_PATH environment variable. + + LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac OS X) should point to the + following files: + + - the location (full path name) of the libcdfNativeLibrary.[so|sl|jnilib] + + - the location (full path name) of the CDF library (libcdf.[so|sl|dylib] + + Example: + setenv LD_LIBRARY_PATH .:/home/cdf/cdf33_-dist/cdfjava/lib: \ + /home/cdf/cdf37_0-dist/lib + + Or, for Mac OS X, + + setenv DYLD_LIBRARY_PATH .:/Users/cdf/cdf37_0-dist/cdfjava/lib: \ + /Users/cdf/cdf37_0-dist/lib + + +3. Invoke a desired CDF tool as follows: + + At the operating system prompt, type "java CDFToolsDriver". + + This will bring up the main menu from which a desired tool can be invoked by + selecting the desired CDF tool with a single click. + + IMPORTANT NOTE: + Make sure you run the one of the definition files in the /bin + directory (e.g. definitions.[C | B | K] before you execute the + above command so that the CDF_BASE environment variable is defined. + +3. Please note: + For those programs that allow the option of directing the output + to the screen, instead of a file, make sure that the output is not + too big. The Java Virtual Machine may hung or run out of memory + for a big output. + +For any questions/comments, please send them to gsfc-cdf-support@lists.nasa.gov. diff --git a/ext/cdf/cdf38_0-dist/HOWTO.run_previous_version b/ext/cdf/cdf38_0-dist/HOWTO.run_previous_version new file mode 100644 index 0000000..3c35623 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/HOWTO.run_previous_version @@ -0,0 +1,104 @@ +How to access any CDF previous version +-------------------------------------- + +1. On Linux/Unix + + Assume the previous version had been built. Otherwise, download the source + and build it. + + Execute the definitions shell to set up proper environment variables and + aliases from a previous version in a terminal session: + + From Bourne shell: + + $ . /bin/definitions.B + + where is the base folder of a previous CDF version, e.g., + cdf36_0-dist. + + From C-shell or tcsh: + + $ source /bin/definitions.C + + Form Korn shell: + + $ . /bin/definitions.K + + Once, all environment variables and aliases are set, the dynamically loaded + libraries used in Java-CDF APIs, and CDF tools, e.g., cdfexport, cdfedit, + etc, will use the designated CDF version during the terminal session. + +2. Mac OS X + + Assume the CDF pre-built package had been downloaded and installed. + Otherwise, go to the CDF home page to download it, or follow the + instructions in Linux/Unix to build it from the source. + + Execute the definitions shell to set up proper environment variables and + aliases from a previous version in a terminal session: + + From Bourne shell: + + $ . /bin/definitions.B + + where is the base folder of a previous CDF version, e.g., + /Applications/cdf36_0-dist. + + From C-shell or tcsh: + + $ source /bin/definitions.C + + Form Korn shell: + + $ . /bin/definitions.K + + Once, all environment variables and aliases are set, the dynamically loaded + libraries used in Java-CDF APIs, and CDF tools, e.g., cdfexport, cdfedit, + etc, will use the designated CDF version during the terminal session. + + If you only want to run the Java-based CDF tools, CDFToolsDriver, you don't + need to run the aforementioned definitions shell. Double-click + /CDFToolsDriver.app from finder will run the tools of that version. + +3. On Windows + + Assume the CDF pre-built package had been downloaded and installed. + Otherwise, go to CDF home page to download it. + + Bring up a command-line terminal, then go to the directory that the + intended CDF version is located, e.g. c:\CDF distribution\cdf36_0-dist, + to check if the batch file: setenv.bat, exists. + + If it does, run setenv.bat to set up the environment variables. + If it does not, then copy the following code to setenv.bat + + @echo off + set mydir=%~dp0 + set CDF_BASE=%mydir% + set CDF_HELP=%mydir%help + set CLASSPATH=%mydir%CDFToolsDriver.jar;%mydir%lib\cdfjava.jar;%mydir%cdfml\cdfml.jar; + set PATH=%mydir%;%mydir%bin;%mydir%lib;%PATH% + set TERMINFO=%mydir%lib\terminfo + + If the previous CDF version is for V3.6.0 or later, add one more line to + the batch file: + + set CDF_LEAPSECONDSTABLE=%mydir%CDFLeapSeconds.txt + + Once setenv.bat is built, run it. + + All dynamically loaded libraries used in Java-CDF APIs, and CDF tools, + e.g., cdfexport, cdfedit, etc, will point to the designated CDF version + during the terminal session. + +4. OpenVMS + + Execute the definitions command to set up logical names and symbols from + a previous version in a terminal session: set the current directory to + the selected CDF version, e.g., [cdf36_0-dist]. Run the command: + @definitions. + + Once logical names and symbols are set, CDF tools, e.g., cdfexport, cdfedit, + etc, will point to the designated CDF version during the terminal session. + + diff --git a/ext/cdf/cdf38_0-dist/Help.all b/ext/cdf/cdf38_0-dist/Help.all new file mode 100644 index 0000000..d2b627d --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Help.all @@ -0,0 +1,440 @@ +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 (gsfc-cdf-support@lists.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? + FC_ Optional. Specifies non-default Fortran compiler. + CC__ Optional. Specifies non-default C compiler. + UCOPTIONS Optional. Specifies additional options passed to the C + compiler. + MAKE Optional. Specifies make utility to use. + + 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 SPARC machine. + Compile using the Sun Solaris Studio C + compiler (cc), include files, and system + libraries. This is for building 32-bit mode + programs but using 64-bit (off_t) offset, + instead of 32-bit (size_t). The cc compiler + is expected to be in you path, thus its path + is not fully specified. + + On some SOLARIS systems, a different C + compiler may be installed. If so, e.g., + using the Sun WorkShop SPARC C compiler + (at /opt/SUNWspro/bin/cc), specify + + CC_solaris_sparc=/opt/SUNWspro/bin/cc + + 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 SPARC machine. + This is similar to the above ENV by using + the Sun Solaris Studio C compiler. 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 the C compiler if the + compiler is not in your path or it is a + different compiler. + + 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 Solaris on Sparc 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=gnu64i For a Solaris on Intel (64-bit) building + 64-bit 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 Intel or AMD PC running Solaris + SPARC. Compile using the Sun Studio C + compiler (/usr/bin/cc), include + files, and system libraries. This + is for building 32-bit mode programs. + + ENV=x64 For a 64-bit PC (AMD or Intel-based or + Itanium systems). Compile using the Sun + Studio C compiler (/usr/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... + + 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=macosx For Mac OS X on a Power PC or Intel Mac. The possible + environments are... + + ENV=gnu32 Compile using the Gnu compiler (gcc) for + 32-bit. + + ENV=gnu Compile using the Gnu compiler (gcc) for + 64-bit. + + ENV=ppc Compile using the Apple-modified Gnu C + compiler (clang) in 32-bit mode for Power PC. + + ENV=i386 Compile using the Apple-modified Gnu C + compiler (clang) in 32-bit mode for Intel Mac. + + ENV=x86_64 Compile using the Apple-modified Gnu C + compiler (clang) in 64-bit mode for Intel Mac. + + All built, the stand-alone tool programs are linked + dynamically. To run the programs, the environment + variable DYLB_LIBRARY_PATH needs to point to the folder + that holds libcdf.dylib dynamic library: e.g., + export DYLB_LIBRARY_PATH=/lib Korn/Bourne shell + setenv DYLB_LIBRARY_PATH /lib csh/tcsh + if the CDF is installed at folder and + libcdf.dylib is in its lib sub-directory.. + + OS=linux For Linux on an IBM PC (Intel 32/64 or AMD64), a Mac + Power PC, a Dual Alpha and ARM (Raspbian/Fedora/Ubuntu). + 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 mode on 64-bit + machines, or 32-bit mode on 32-bit machines. + (ARM-architecture build uses this option.) + + 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 mode on + 64-bit machines. + + ENV=intel Compile using Intel's C++ (icc) for linux. + This is for building the programs using the + 64-bit (off_t) offset, instead of 32-bit + (long). It could build a 64-bit or 32-bit + mode on a 64-bit machine, depending the setup. + Or it will build a 32-bit mode on a 32-bit + machine. + + If Intel's Fortran compiler is being used, + specify + + FC_intel=ifort + + as part of the `make' command when + FORTRAN=yes is also specified. + + /***************************/ + /* NOTE for Ubuntu users */ + /***************************/ + By default, the Ubuntu operating system doesn't come with + ncurses.h that is needed to build the command-line + based interactive CDF tools (cdfedit and cdfexport). + If you don't need these two tools (other CDF tools will + still be built without ncurses.h) or don't have ncurses.h, + you need to disable the "CURSES" option to "no". + + OS=linux ENV=gnu CURSES=no all + + You can install the ncurses header files including + ncurses.h by installing the ncurses development + package with the following command: + + apt-get install libncurses5-dev + + + 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... + + 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. + All built, stand-alone tool programs will be linked + dynamically. To run the programs, PATH environment + variable needs to point to the folder that holds + libcdf.dll dynamic library: e.g., + set PATH=\lib:%PATH% for Windows command prompt + export PATH=/lib:$PATH for Bash under Cygwin + if the CDF is installed at folder and + libcdf.dll is in lib directory.. + + OS=freebsd For freeBSD 4/5/6 on a PC. The possible environments + are... + + ENV=gnu Compile using Gnu C (gcc). This seems to + be the C compiler most commonly found on + freeBSD systems. + + 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. The Curses-based + toolkit programs rely on `pdcurses' being + installed. + All built, stand-alone tool programs will be linked + dynamically. To run the programs, PATH environment + variable needs to point to the folder that holds + libcdf.dll dynamic library: e.g., + set PATH=\lib:%PATH% for Windows command prompt + export PATH=/lib:$PATH for Bash under MingW + if the CDF is installed at folder and + libcdf.dll is in lib directory.. + + 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. + + FC_= + This variable defaults to f77 or gfortran in most cases with the + following exceptions: + os=solaris : compiler=g77 + os=aix : compiler=xlf + os=cygwin : compiler=g77 + Note that if the Fortran compiler is not the default, there may be + problems with compilation/linking because CDF symbol names defined + in the Fortran interface to the C based CDF library will not match + those generated by the Fortran compiler. If problems are encountered, + it will generally be because the CDF library symbol names have two + trailing underscores while the Fortran compiler is using one trailing + underscore. The default behavior of the make process in generating + CDF library Fortran interface symbol names can be overridden with the + UCOPTIONS make variable. Trailing single underscores can be forced with + -Dsingle_underscore (i.e., UCOPTIONS=-Dsingle_underscore). No trailing + underscore or double trailing underscores can also be forced with + -Dno_underscore, -Ddouble_underscore or -fsecond-underscore respectively. + It is known that f77 and g77 requires double underscores while f90, f95, + and gfortran default to single underscores. + + UCOPTIONS= + This variable allows the addition of user supplied C options to those + already defined in the make process (dependent on OS and ENV). It + may be necessary to use this make variable to accommodate non-default + Fortran compilers (see FC_). + + CC__= + This variable defaults to gcc when env=gnu, ppc, ppc64, or i386 + and cc otherwise with the following exceptions: + os=solaris + env=sparc : compiler=/opt/SUNWspro/bin/cc + env=sparc64 : compiler=/opt/SUNWspro/bin/cc + os=linux + env=intel : compiler=icc + + MAKE= + This variable allows a different make utility to be used, instead of the + the default. It is more specifically applicable to Solaris on Intel as + its native make might have difficulties handling certain statements in + the Makefile. Use GNU version of make, gmake, will solve the problem. + +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 + + To build the CDF distribution on a linux machine using gnu compilers and + building the Fortran interface test programs with the non-default compiler, + gfortran... + + make OS=linux ENV=gnu FORTRAN=yes FC_linux=gfortran 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 --git a/ext/cdf/cdf38_0-dist/Help.install b/ext/cdf/cdf38_0-dist/Help.install new file mode 100644 index 0000000..953cb79 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Help.install @@ -0,0 +1,22 @@ +`make install' is used to install (copy) the files necessary for using CDF +into directories named `lib', `include', and `bin' (these directories will be +created if necessary). The only optional `make' variable is as follows... + + INSTALLDIR= + where is the directory path of where the `lib', `include', and + `bin' directories exist or will be created if necessary. If this is not + specified, a default path of `.' is used (which specifies the current + directory level). + +For example, to install the CDF distribution at the current directory level +enter the following... + + make install + +If you wanted to install the distribution at a different location, for +instance `/usr/local/cdf', enter the following... + + make INSTALLDIR=/usr/local/cdf install + +Note that `install' is at the end of the command line after the `make' +variable. diff --git a/ext/cdf/cdf38_0-dist/Help.test b/ext/cdf/cdf38_0-dist/Help.test new file mode 100644 index 0000000..7722028 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Help.test @@ -0,0 +1,5 @@ +`make test' is used to test the CDF library. The tests for the C interfaces +are always performed. The tests for the Fortran interfaces are only performed +if Fortran testing was requested during the `make all' step. The tests for +the interfaces to the shareable CDF library are only performed if the operating +system being used supports shareable libraries. diff --git a/ext/cdf/cdf38_0-dist/Makefile b/ext/cdf/cdf38_0-dist/Makefile new file mode 100644 index 0000000..1f63996 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Makefile @@ -0,0 +1,2236 @@ +#------------------------------------------------------------------------------ +# Copyright 1996-2016 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +#------------------------------------------------------------------------------ +# +# NSSDC/CDF Makefile for CDF distribution. +# +# Version 1.0, 2-Feb-05, SPDF/GSFC/NASA. +# +# Modification history: +# +# V1.0 02-Feb-05, M Liu Original version. +# V1.1 30-May-05, M Liu Changed the Fortran compiler to g95 (from f77), +# an open source, if possible. +# 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. +# V1.6 23-Aug-06, M Liu Added cdfirdump and cdfmerge. +# V1.7 12-Feb-07, D Berger Added -ff2c to the linux, gnu fortran compiler +# options. +# V1.8 04-May-07, D Berger Added UCOPTIONS and removed -ff2c. +# V1.9 28-Apr-09, M Liu Added linux/gnu64 combination. +# V1.10 16-Dec-10, M Liu Moodified to make it work for both Mac OS X +# 10.5 and 10.6. +# V1.11 21-Mar-11, M Liu No longer support for g77. Use gfortran or g95. +# V1.12 21-Jul-11, M Liu Modified to support 64-bit Solaris on Intel +# with Sunstudio and gnu compilers. +# V1.13 18-Jun-12, M Liu Modified to support shared library for +# Cygwin and Mingw. +# V2.0 20-Feb-16, M Liu Added version to dynamic library name for Mac. +# Mac OS to build both 32 and 64-bit universal +# binary for libraries and tools. +# V3.0 16-Mar-20, M Liu For Mac OS X, Xcode version 10 or newer +# will only build x86_64 application. Only +# older versions can make both 32 and 64-mode. +#------------------------------------------------------------------------------ +# +# Notes: +# +# `make' on DECstations complains (prints a error message) if an if-then-else +# construct evaluates to FALSE but there is no `false' part. To prevent this, +# the `NULL' command is executed as the `false' part. +# +#------------------------------------------------------------------------------ + +.SILENT: + +SHELL=/bin/bash +NULL=true +PART=all +TARGET= +SOURCE= +DESTINATION= +VERSION=3.8.0 + +#------------------------------------------------------------------------------ +# Directory locations. +#------------------------------------------------------------------------------ + +DEFSsrcDIR=src/definitions +INCsrcDIR=src/include +LIBsrcDIR=src/lib +TOOLSsrcDIR=src/tools +TESTSsrcDIR=src/tests +HELPsrcDIR=src/help +LIBsrcZlibDIR=src/lib/zlib + +#------------------------------------------------------------------------------ +# Macros specified on the `make' command line. +#------------------------------------------------------------------------------ + +FORTRAN=no +CURSES=yes +SHARED=yes +OS= +ENV= +INSTALLDIR=. +UCOPTIONS= + +#------------------------------------------------------------------------------ +# Other macros. +#------------------------------------------------------------------------------ + +MORE=$(shell uname -a | cut -f5 -d " ") +ifeq ("$(OS)","solaris") + ifeq ("$(ENV)","x86") + MAKE=gmake + else + ifeq ("$(ENV)","x64") + MAKE=gmake + else + MAKE=make + endif + endif +else + ifeq ("$(MORE)","i86pc") + MAKE=gmake + else + MAKE=make + endif +endif +RANLIB=ranlib + +WHICHOS=$(shell uname) +MACVERSION=0 +XCODEVERSION= +XCODEVERSION2=0 +ifeq ("$(WHICHOS)","Darwin") + MACVERSION=$(shell uname -r | cut -f1 -d.) + XCODEVERSION=$(shell /usr/bin/xcodebuild -version | sed '2d' | cut -f2 -d' ') + XCODEVERSION2=$(shell echo $(XCODEVERSION) | cut -f1 -d.) +endif + +#------------------------------------------------------------------------------ +# Macros for Solaris. +#------------------------------------------------------------------------------ + +SHARED_solaris=yes +FOPTIONS_solaris=-w +FOPTIONSld_solaris= +SHAREDEXT_solaris=so +AROPTIONS_solaris=rc +RANLIB_solaris=no +FC_solaris=f90 +EXEEXT_solaris= + +CURSES_solaris_sparc=yes +CC_solaris_sparc=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 -xO2 +COPTIONSZlib_solaris_sparc=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_sparc= +FOPTIONS_solaris_sparc=-ext_names=fsecond-underscore +FOPTIONSld_solaris_sparc= +CURSESLIB_solaris_sparc=-lcurses +SYSLIBSexe_solaris_sparc=-lm +SYSLIBSshr_solaris_sparc= + +CURSES_solaris_sparc64=yes +CC_solaris_sparc64=cc +LD_solaris_sparc64=ld +LDOPTIONS_solaris_sparc64=-G +PIC_solaris_sparc64=-Kpic +COPTIONS_solaris_sparc64=-m64 -xarch=sparcvis -DSOLARIS -DSOLARIS64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -xO2 +COPTIONSZlib_solaris_sparc64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_sparc64=-m64 -xarch=sparcvis +FOPTIONS_solaris_sparc64=-m64 -ext_names=fsecond-underscore +FOPTIONSld_solaris_sparc64=-m64 +CURSESLIB_solaris_sparc64=-lcurses +SYSLIBSexe_solaris_sparc64=-L/usr/local/lib/sparcv9 -lm +SYSLIBSshr_solaris_sparc64= + +CURSES_solaris_gnu=yes +CC_solaris_gnu=gcc +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 -O2 +COPTIONSZlib_solaris_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_gnu= +FOPTIONS_solaris_gnu=-ext_names=fsecond-underscore +FOPTIONSld_solaris_gnu= +CURSESLIB_solaris_gnu=-lcurses +SYSLIBSexe_solaris_gnu=-lm +SYSLIBSshr_solaris_gnu= + +CURSES_solaris_gnu64=yes +CC_solaris_gnu64=gcc +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 -O2 +COPTIONSZlib_solaris_gnu64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_gnu64=-m64 +FOPTIONS_solaris_gnu64=-m64 -ext_names=fsecond-underscore +FOPTIONSld_solaris_gnu64=-m64 +CURSESLIB_solaris_gnu64=-lcurses +SYSLIBSexe_solaris_gnu64=-L/usr/local/lib/sparcv9 -lm +SYSLIBSshr_solaris_gnu64= + +CURSES_solaris_gnu64i=yes +CC_solaris_gnu64i=gcc +LD_solaris_gnu64i=gcc +LDOPTIONS_solaris_gnu64i=-shared -m64 +PIC_solaris_gnu64i=-fpic +COPTIONS_solaris_gnu64i=-DSOLARIS -DSOLARIS64 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2 -DX64 +COPTIONSZlib_solaris_gnu64i=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_gnu64i=-m64 +FOPTIONS_solaris_gnu64i=-m64 +FOPTIONSld_solaris_gnu64i=-m64 +CURSESLIB_solaris_gnu64i=-lcurses +SYSLIBSexe_solaris_gnu64i=-lm +SYSLIBSshr_solaris_gnu64i= + +CURSES_solaris_x86=yes +CC_solaris_x86=cc +LD_solaris_x86=ld +LDOPTIONS_solaris_x86=-G +PIC_solaris_x86=-Kpic +COPTIONS_solaris_x86=-DSOLARIS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O +COPTIONSZlib_solaris_x86=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_x86= +FOPTIONS_solaris_x86= +FOPTIONSld_solaris_x86= +CURSESLIB_solaris_x86=-lcurses +SYSLIBSexe_solaris_x86=-lm +SYSLIBSshr_solaris_x86= + +CURSES_solaris_x64=yes +CC_solaris_x64=cc +LD_solaris_x64=ld -64 +LDOPTIONS_solaris_x64=-G +PIC_solaris_x64=-Kpic +COPTIONS_solaris_x64=-DSOLARIS -DSOLARIS64 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DX64 -O +COPTIONSZlib_solaris_x64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_solaris_x64=-m64 +FOPTIONS_solaris_x64=-m64 +FOPTIONSld_solaris_x64=-m64 +CURSESLIB_solaris_x64=-lcurses +SYSLIBSexe_solaris_x64=-lm +SYSLIBSshr_solaris_x64= + +#------------------------------------------------------------------------------ +# Macros for MacosX. +#------------------------------------------------------------------------------ + +SHARED_macosx=yes +FOPTIONS_macosx= +FOPTIONSld_macosx= +SHAREDEXT_macosx=dylib +AROPTIONS_macosx=rc +RANLIB_macosx=yes +FC_macosx=gfortran +EXEEXT_macosx= +MACOSxlink= +MACOSxFopt= +WHICHOS=$(shell uname) +ifeq ("$(WHICHOS)","Darwin") + KERNELVERSION=$(shell uname -r | cut -f1 -d.) + ifeq ("$(KERNELVERSION)","9") + MACOSxlink=-L/usr/lib/gcc/i686-apple-darwin9/4.2.1 -lm -lc -lgcc + else + MACOSxlink=-lc -lm + MACOSxFopt=-m64 + endif +endif + +CURSES_macosx_gnu32=yes +CC_macosx_gnu32=gcc +LD_macosx_gnu32=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -macosx_version_min 10.6 +LDOPTIONS_macosx_gnu32=-dynamic +PIC_macosx_gnu32= +COPTIONS_macosx_gnu32=-m32 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2 +COPTIONSZlib_macosx_gnu32=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_macosx_gnu32= +FOPTIONS_macosx_gnu32=-w -m32 +FOPTIONSld_macosx_gnu32=-m32 +CURSESLIB_macosx_gnu32=-lcurses +SYSLIBSexe_macosx_gnu32=$(MACOSxlink) -m32 +SYSLIBSshr_macosx_gnu32=$(MACOSxlink) -m32 + +CURSES_macosx_gnu=yes +CC_macosx_gnu=gcc +LD_macosx_gnu=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -macosx_version_min 10.6 +LDOPTIONS_macosx_gnu=-dynamic +PIC_macosx_gnu= +COPTIONS_macosx_gnu=-m64 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2 +COPTIONSZlib_macosx_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_macosx_gnu= +FOPTIONS_macosx_gnu=-w $(MACOSxFopt) +FOPTIONSld_macosx_gnu=$(MACOSxFopt) +CURSESLIB_macosx_gnu=-lcurses +SYSLIBSexe_macosx_gnu=$(MACOSxlink) +SYSLIBSshr_macosx_gnu=$(MACOSxlink) + +CURSES_macosx_ppc=yes +CC_macosx_ppc=gcc +LD_macosx_ppc=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -syslibroot /Developer/SDKs/MacOSX10.5.sdk -macosx_version_min 10.6 -arch_only ppc +LDOPTIONS_macosx_ppc=-dynamic +PIC_macosx_ppc= +COPTIONS_macosx_ppc=-isysroot/Developer/SDKs/MacOSX10.5.sdk -arch ppc -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2 +COPTIONSZlib_macosx_ppc=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_macosx_ppc=-arch ppc -isysroot/Developer/SDKs/MacOSX10.5.sdk +FOPTIONS_macosx_ppc=-w +FOPTIONSld_macosx_ppc= +CURSESLIB_macosx_ppc=-lcurses +SYSLIBSexe_macosx_ppc=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 -lm -lc -lgcc +SYSLIBSshr_macosx_ppc=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 -lm -lc -lgcc + +CURSES_macosx_ppc64=yes +CC_macosx_ppc64=gcc +LD_macosx_ppc64=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -syslibroot /Developer/SDKs/MacOSX10.5.sdk -macosx_version_min 10.6 -arch_only ppc64 +LDOPTIONS_macosx_ppc64=-dynamic +PIC_macosx_ppc64= +COPTIONS_macosx_ppc64=-isysroot/Developer/SDKs/MacOSX10.5.sdk -arch ppc64 -m64 -DMACOSX64 -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2 +COPTIONSZlib_macosx_ppc64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_macosx_ppc64=-arch ppc64 -isysroot/Developer/SDKs/MacOSX10.5.sdk +FOPTIONS_macosx_ppc64=-w +FOPTIONSld_macosx_ppc64= +CURSESLIB_macosx_ppc64=-lcurses +SYSLIBSexe_macosx_ppc64=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/ppc64 -lm -lc -lgcc +SYSLIBSshr_macosx_ppc64=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/ppc64 -lm -lc -lgcc + +COPTIONS_macosx=-mmacosx-version-min=10.6 -Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2 + +CURSES_macosx_i386=yes +CC_macosx_i386=clang +ifeq ($(shell test $(XCODEVERSION2) -lt 10; echo $$?),0) + COPTIONS_macosx_i386=-arch i386 -arch x86_64 $(COPTIONS_macosx) + COPTIONSld_macosx_i386=-arch i386 -arch x86_64 +endif +LD_macosx_i386=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -macosx_version_min 10.6 +LDOPTIONS_macosx_i386=-dynamic +PIC_macosx_i386= +COPTIONSZlib_macosx_i386=-DHAVE_STDARG_H -DHAVE_UNISTD_H +FOPTIONS_macosx_i386=-w -m32 +FOPTIONSld_macosx_i386=-m32 +CURSESLIB_macosx_i386=-lcurses +SYSLIBSexe_macosx_i386=-lc -lm +SYSLIBSshr_macosx_i386=-lc -lm + +CURSES_macosx_x86_64=yes +CC_macosx_x86_64=clang +ifeq ($(shell test $(XCODEVERSION2) -gt 9; echo $$?),0) + COPTIONS_macosx_x86_64=-arch x86_64 $(COPTIONS_macosx) + COPTIONSld_macosx_x86_64=-arch x86_64 +else + COPTIONS_macosx_x86_64=-arch i386 -arch x86_64 $(COPTIONS_macosx) + COPTIONSld_macosx_x86_64=-arch i386 -arch x86_64 +endif +LD_macosx_x86_64=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -macosx_version_min 10.6 +LDOPTIONS_macosx_x86_64=-dynamic +PIC_macosx_x86_64= +COPTIONSZlib_macosx_x86_64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +FOPTIONS_macosx_x86_64=-w -m64 +FOPTIONSld_macosx_x86_64=-m64 +CURSESLIB_macosx_x86_64=-lcurses +SYSLIBSexe_macosx_x86_64=-lc -lm +SYSLIBSshr_macosx_x86_64=-lc -lm + +#------------------------------------------------------------------------------ +# Macros for OSF (Digital UNIX). +#------------------------------------------------------------------------------ + +SHARED_osf=yes +FOPTIONS_osf=-warn declarations -warn nounused +FOPTIONSld_osf= +SHAREDEXT_osf=so +AROPTIONS_osf=rc +RANLIB_osf=yes +FC_osf=f77 +EXEEXT_osf= + +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 +COPTIONSZlib_osf_dec=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_osf_dec= +FOPTIONS_osf_dec= +FOPTIONSld_osf_dec= +CURSESLIB_osf_dec=-lcurses +SYSLIBSexe_osf_dec=-lm -lc +SYSLIBSshr_osf_dec= + +CURSES_osf_gnu=yes +CC_osf_gnu=gcc +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 -O2 +COPTIONSZlib_osf_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_osf_gnu= +FOPTIONS_osf_gnu= +FOPTIONSld_osf_gnu= +CURSESLIB_osf_gnu=-lcurses +SYSLIBSexe_osf_gnu=-lm -lc +SYSLIBSshr_osf_gnu= + +#------------------------------------------------------------------------------ +# Macros for IRIX 6.x. +#------------------------------------------------------------------------------ + +SHARED_irix6=yes +FOPTIONS_irix6=-u +FOPTIONSld_irix6= +SHAREDEXT_irix6=so +AROPTIONS_irix6=rc +RANLIB_irix6=no +FC_irix6=f77 + +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 +COPTIONSZlib_irix6_sgin32=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_irix6_sgin32=-n32 -L/usr/lib32 +FOPTIONS_irix6_sgin32=-n32 +FOPTIONSld_irix6_sgin32=-n32 -L/usr/lib32 +CURSESLIB_irix6_sgin32=-lcurses +SYSLIBSexe_irix6_sgin32=-lm -lc +SYSLIBSshr_irix6_sgin32=-lm -lc + +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 +COPTIONSZlib_irix6_sgin64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_irix6_sgi64=-64 -DIRIX64bit -L/usr/lib64 +FOPTIONS_irix6_sgi64=-64 +FOPTIONSld_irix6_sgi64=-64 -L/usr/lib64 +CURSESLIB_irix6_sgi64=-lcurses +SYSLIBSexe_irix6_sgi64=-lm -lc +SYSLIBSshr_irix6_sgi64=-lm -lc + +CURSES_irix6_gnu=yes +CC_irix6_gnu=gcc +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 -O2 +COPTIONSZlib_irix6_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_irix6_gnu= +FOPTIONS_irix6_gnu= +FOPTIONSld_irix6_gnu= +CURSESLIB_irix6_gnu=-lcurses +SYSLIBSexe_irix6_gnu=-lm -lc +SYSLIBSshr_irix6_gnu= + +#------------------------------------------------------------------------------ +# Macros for Linux. +#------------------------------------------------------------------------------ + +SHARED_linux=yes +FOPTIONS_linux=-w +FOPTIONSld_linux= +SHAREDEXT_linux=so +AROPTIONS_linux=rc +RANLIB_linux=yes +FC_linux=gfortran +EXEEXT_linux= + +CURSES_linux_gnu=yes +CC_linux_gnu=gcc +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 -O2 +COPTIONSZlib_linux_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_linux_gnu= +FOPTIONS_linux_gnu=-fsecond-underscore +FOPTIONSld_linux_gnu= +CURSESLIB_linux_gnu=-lcurses +SYSLIBSexe_linux_gnu=-lm -lc +SYSLIBSshr_linux_gnu=-lm -lc + +CURSES_linux_gnu32=yes +CC_linux_gnu32=gcc +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 -O2 +COPTIONSZlib_linux_gnu32=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_linux_gnu32=-m32 +FOPTIONS_linux_gnu32=-m32 -fsecond-underscore +FOPTIONSld_linux_gnu32=-m32 +CURSESLIB_linux_gnu32=-lcurses +SYSLIBSexe_linux_gnu32=-lm -lc +SYSLIBSshr_linux_gnu32=-lm -lc + +CURSES_linux_gnu64=yes +CC_linux_gnu64=gcc +LD_linux_gnu64=gcc +LDOPTIONS_linux_gnu64=-shared -m64 +PIC_linux_gnu64=-fPIC +COPTIONS_linux_gnu64=-m64 -I/usr/include/ncurses -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DMALLOC_CHECK_=0 -O2 +COPTIONSZlib_linux_gnu64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_linux_gnu64=-m64 +FOPTIONS_linux_gnu64=-m64 -fsecond-underscore +FOPTIONSld_linux_gnu64=-m64 +CURSESLIB_linux_gnu64=-lcurses +SYSLIBSexe_linux_gnu64=-lm -lc +SYSLIBSshr_linux_gnu64=-lm -lc + +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 +COPTIONSZlib_linux_intel=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_linux_intel= +FOPTIONS_linux_intel= +FOPTIONSld_linux_intel= +CURSESLIB_linux_intel=-lcurses +SYSLIBSexe_linux_intel=-lm -lc +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 +COPTIONSZlib_aix_ibm=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 +COPTIONSZlib_aix_ibm64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 -O2 +COPTIONSZlib_aix_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 -O2 +COPTIONSZlib_aix_gnu64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 +COPTIONSZlib_hpux_std=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 +COPTIONSZlib_hpux_opt=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 +COPTIONSZlib_hpux_opt64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 +COPTIONSZlib_hpux_posix=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 -O2 +COPTIONSZlib_hpux_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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 -O2 +COPTIONSZlib_hpux_gnu64=-DHAVE_STDARG_H -DHAVE_UNISTD_H +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=yes +FOPTIONS_cygwin=-w +FOPTIONSld_cygwin= +SHAREDEXT_cygwin=dll +AROPTIONS_cygwin=rc +RANLIB_cygwin=yes +FC_cygwin=gfortran +EXEEXT_cygwin=.exe + +CURSES_cygwin_gnu=yes +CC_cygwin_gnu=gcc +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 -O2 +COPTIONSZlib_cygwin_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_cygwin_gnu= +FOPTIONS_cygwin_gnu=-fsecond-underscore +FOPTIONSld_cygwin_gnu= +CURSESLIB_cygwin_gnu=-lncurses +SYSLIBSexe_cygwin_gnu=-lgcc +SYSLIBSshr_cygwin_gnu=-lgcc + +#------------------------------------------------------------------------------ +# Macros for MinGW. +#------------------------------------------------------------------------------ + +SHARED_mingw=yes +FOPTIONS_mingw=-w +FOPTIONSld_mingw= +SHAREDEXT_mingw=dll +AROPTIONS_mingw=rc +RANLIB_mingw=yes +FC_mingw=gfortran +EXEEXT_mingw=.exe + +CURSES_mingw_gnu=yes +CC_mingw_gnu=gcc +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 -O2 -posix +COPTIONSZlib_mingw_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_mingw_gnu= +FOPTIONS_mingw_gnu=-fsecond-underscore +FOPTIONSld_mingw_gnu= +CURSESLIB_mingw_gnu=-lpdcurses +SYSLIBSexe_mingw_gnu=-lgcc +SYSLIBSshr_mingw_gnu=-lgcc + +#------------------------------------------------------------------------------ +# Macros for FreeBSD. +#------------------------------------------------------------------------------ + +SHARED_freebsd=yes +FOPTIONS_freebsd=-w +FOPTIONSld_freebsd= +SHAREDEXT_freebsd=so +AROPTIONS_freebsd=rc +RANLIB_freebsd=yes +FC_freebsd=f77 + +CURSES_freebsd_gnu=yes +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 +COPTIONSZlib_freebsd_gnu=-DHAVE_STDARG_H -DHAVE_UNISTD_H +COPTIONSld_freebsd_gnu= +FOPTIONS_freebsd_gnu= +FOPTIONSld_freebsd_gnu= +CURSESLIB_freebsd_gnu=-lncurses +SYSLIBSexe_freebsd_gnu=-lm -lc +SYSLIBSshr_freebsd_gnu=-lm -lc + +#------------------------------------------------------------------------------ +# Miscellaneous Macros. +#------------------------------------------------------------------------------ + +AND.yes.yes=yes +AND.yes.no=no +AND.no.yes=no +AND.no.no=no + +SUPPORTED.yes=supported +SUPPORTED.no=not supported + +#------------------------------------------------------------------------------ +# Compile/link entire distribution. +#------------------------------------------------------------------------------ + +all.help: + @if `type -p more > /dev/null 2>&1` ; then \ + more Help.all ; \ + else \ + less Help.all ; \ + fi + +all: all.$(OS).$(ENV) + +all..: + echo "Missing OS and ENV variables." + +all.linux.gnu: all.build +all.linux.gnu32: all.build +all.linux.gnu64: all.build +all.linux.intel: note1.intel all.build +all.solaris.sparc: note1.noCC all.build +all.solaris.sparc64: note1.noCC all.build +all.solaris.gnu: all.build +all.solaris.gnu64: all.build +all.solaris.gnu64i: 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.macosx.gnu32: all.build +all.macosx.gnu: all.build +all.macosx.ppc: all.build +all.macosx.ppc64: all.build +all.macosx.i386: + @if [ ${XCODEVERSION2} -gt 9 ] ; then \ + $(MAKE) note1.macx.i386 ; \ + else \ + $(MAKE) all.build ; \ + fi +all.macosx.x86_64: all.build + +all.build: +# echo $(COPTIONS_macosx_x86_64) +# echo $(COPTIONSld_macosx_x86_64) + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_$(OS)_$(ENV))" \ +"CCx=$(CC_$(OS)_$(ENV))" \ +"MAKE=$(MAKE)" \ +"COPTIONS=$(UCOPTIONS) $(COPTIONS_$(OS)_$(ENV)) $(COPTIONSZlib_$(OS)_$(ENV))" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(AND.$(SHARED).$(SHARED_$(OS)))" \ +"PIC=$(PIC_$(OS)_$(ENV))" \ +"CCx=$(CC_$(OS)_$(ENV))" \ +"MAKE=$(MAKE)" \ +"LDx=$(LD_$(OS)_$(ENV))" \ +"COPTIONS=$(UCOPTIONS) $(COPTIONS_$(OS)_$(ENV))" \ +"SYSLIBS=$(SYSLIBSshr_$(OS)_$(ENV))" \ +"SHAREDEXT=$(SHAREDEXT_$(OS))" \ +"LDOPTIONS=$(LDOPTIONS_$(OS)_$(ENV))" \ +"AROPTIONS=$(AROPTIONS_$(OS))" \ +"RANLIB=$(RANLIB_$(OS))" \ +"VERSION=$(VERSION)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_$(OS)_$(ENV))" \ +"MAKE=$(MAKE)" \ +"COPTIONS=$(COPTIONS_$(OS)_$(ENV))" \ +"COPTIONSld=$(COPTIONSld_$(OS)_$(ENV))" \ +"SYSLIBS=$(SYSLIBSexe_$(OS)_$(ENV))" \ +"CURSESLIB=$(CURSESLIB_$(OS)_$(ENV))" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_$(OS))" \ +"MAKE=$(MAKE)" \ +"CCx=$(CC_$(OS)_$(ENV))" \ +"SHARED=$(AND.$(SHARED).$(SHARED_$(OS)))" \ +"FOPTIONS=$(FOPTIONS_$(OS)) $(FOPTIONS_$(OS)_$(ENV))" \ +"FOPTIONSld=$(FOPTIONSld_$(OS)) $(FOPTIONSld_$(OS)_$(ENV))" \ +"COPTIONS=$(COPTIONS_$(OS)_$(ENV))" \ +"COPTIONSld=$(COPTIONSld_$(OS)_$(ENV))" \ +"SYSLIBS=$(SYSLIBSexe_$(OS)_$(ENV))" \ +"SHAREDEXT=$(SHAREDEXT_$(OS))" \ +all + +#------------------------------------------------------------------------------ +# Test distribution. +#------------------------------------------------------------------------------ + +test.help: + @if `type -p more > /dev/null 2>&1` ; then \ + more Help.test ; \ + else \ + less Help.test ; \ + fi + +test: + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) test + +#------------------------------------------------------------------------------ +# Install files. +#------------------------------------------------------------------------------ + +install.help: + @if `type -p more > /dev/null 2>&1` ; then \ + more Help.install ; \ + else \ + less Help.install ; \ + fi + +install: install.$(PART) + +install.all: install.definitions install.include install.lib \ + install.tools install.help_ notify.user copy.leapseconds + +install.definitions: create.bin copy.definitions change.definitions +install.include: create.include copy.include +install.tools: create.bin copy.tools +install.help_: create.help copy.help + +install.lib: create.lib copy.lib.a + @if [ -f $(LIBsrcDIR)/libcdf.so ] ; then \ + $(MAKE) MAKE=$(MAKE) "INSTALLDIR=$(INSTALLDIR)" install.lib.so ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(LIBsrcDIR)/libcdf.sl ] ; then \ + $(MAKE) MAKE=$(MAKE) "INSTALLDIR=$(INSTALLDIR)" install.lib.sl ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(LIBsrcDIR)/libcdf.dylib ] ; then \ + $(MAKE) MAKE=$(MAKE) "INSTALLDIR=$(INSTALLDIR)" install.lib.dylib ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(LIBsrcDIR)/libcdf.o ] ; then \ + $(MAKE) MAKE=$(MAKE) "INSTALLDIR=$(INSTALLDIR)" install.lib.o ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(LIBsrcDIR)/libcdf.dll ] ; then \ + $(MAKE) MAKE=$(MAKE) "INSTALLDIR=$(INSTALLDIR)" install.lib.dll ; \ + else \ + $(NULL) ; \ + fi + +install.lib.so: create.lib copy.lib.so +install.lib.sl: create.lib copy.lib.sl +install.lib.dylib: create.lib copy.lib.dylib +install.lib.o: create.lib copy.lib.o +install.lib.dll: create.lib copy.lib.dll + +create.include: + @if [ ! -d $(INSTALLDIR)/include ] ; then \ + $(MAKE) MAKE=$(MAKE) "TARGET=$(INSTALLDIR)/include" create.dir ; \ + else \ + $(NULL) ; \ + fi + +create.bin: + @if [ ! -d $(INSTALLDIR)/bin ] ; then \ + $(MAKE) MAKE=$(MAKE) "TARGET=$(INSTALLDIR)/bin" create.dir ; \ + else \ + $(NULL) ; \ + fi + +create.lib: + @if [ ! -d $(INSTALLDIR)/lib ] ; then \ + $(MAKE) MAKE=$(MAKE) "TARGET=$(INSTALLDIR)/lib" create.dir ; \ + else \ + $(NULL) ; \ + fi + +create.help: + @if [ ! -d $(INSTALLDIR)/lib ] ; then \ + $(MAKE) MAKE=$(MAKE) "TARGET=$(INSTALLDIR)/lib" create.dir ; \ + else \ + $(NULL) ; \ + fi + @if [ ! -d $(INSTALLDIR)/lib/cdf ] ; then \ + $(MAKE) MAKE=$(MAKE) "TARGET=$(INSTALLDIR)/lib/cdf" create.dir ; \ + else \ + $(NULL) ; \ + fi + @if [ ! -d $(INSTALLDIR)/lib/cdf/help ] ; then \ + $(MAKE) MAKE=$(MAKE) "TARGET=$(INSTALLDIR)/lib/cdf/help" create.dir ; \ + else \ + $(NULL) ; \ + fi + +change.definitions: + @if [ $(INSTALLDIR) = "." ] ; then \ + $(SHELL) ./modify_definition_files.sh `pwd` ; \ + else \ + $(SHELL) ./modify_definition_files.sh $(INSTALLDIR) ; \ + fi + +copy.leapseconds: + @if [ $(INSTALLDIR) != "." ] ; then \ + cp ./CDFLeapSeconds.txt $(INSTALLDIR) ; \ + fi + +copy.definitions: + @echo cp $(DEFSsrcDIR)/definitions.C $(INSTALLDIR)/bin + cp $(DEFSsrcDIR)/definitions.C $(INSTALLDIR)/bin + @echo cp $(DEFSsrcDIR)/definitions.K $(INSTALLDIR)/bin + cp $(DEFSsrcDIR)/definitions.K $(INSTALLDIR)/bin + @echo cp $(DEFSsrcDIR)/definitions.B $(INSTALLDIR)/bin + cp $(DEFSsrcDIR)/definitions.B $(INSTALLDIR)/bin + +copy.include: + @echo cp $(INCsrcDIR)/cdf.h $(INSTALLDIR)/include + cp $(INCsrcDIR)/cdf.h $(INSTALLDIR)/include + @echo cp $(INCsrcDIR)/cdf.inc $(INSTALLDIR)/include + cp $(INCsrcDIR)/cdf.inc $(INSTALLDIR)/include + @echo cp $(INCsrcDIR)/cdflib.h $(INSTALLDIR)/include + cp $(INCsrcDIR)/cdflib.h $(INSTALLDIR)/include + @echo cp $(INCsrcDIR)/cdflib64.h $(INSTALLDIR)/include + cp $(INCsrcDIR)/cdflib64.h $(INSTALLDIR)/include + @echo cp $(INCsrcDIR)/cdfdist.h $(INSTALLDIR)/include + cp $(INCsrcDIR)/cdfdist.h $(INSTALLDIR)/include + @echo cp $(INCsrcDIR)/cdfconfig.h $(INSTALLDIR)/include + cp $(INCsrcDIR)/cdfconfig.h $(INSTALLDIR)/include + +copy.lib.so: + @echo cp $(LIBsrcDIR)/libcdf.so $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.so $(INSTALLDIR)/lib/libcdf.$(VERSION).so + rm -f $(INSTALLDIR)/lib/libcdf.so + cd $(INSTALLDIR)/lib && ln -s libcdf.$(VERSION).so libcdf.so + +copy.lib.sl: + @echo cp $(LIBsrcDIR)/libcdf.sl $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.sl $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.sl $(INSTALLDIR)/lib/libcdf.$(VERSION).sl + rm -f $(INSTALLDIR)/lib/libcdf.sl + cd $(INSTALLDIR)/lib && ln -s libcdf.$(VERSION).sl libcdf.sl + +copy.lib.dylib: + @echo cp $(LIBsrcDIR)/libcdf.dylib $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.dylib $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.dylib $(INSTALLDIR)/lib/libcdf.$(VERSION).dylib + rm -f $(INSTALLDIR)/lib/libcdf.dylib + cd $(INSTALLDIR)/lib && ln -s libcdf.$(VERSION).dylib libcdf.dylib + +copy.lib.o: + @echo cp $(LIBsrcDIR)/libcdf.o $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.o $(INSTALLDIR)/lib + +copy.lib.dll: + @echo cp $(LIBsrcDIR)/libcdf.dll $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.dll $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.dll $(INSTALLDIR)/lib/libcdf.$(VERSION).dll + rm -f $(INSTALLDIR)/lib/libcdf.dll + cd $(INSTALLDIR)/lib && ln -s libcdf.$(VERSION).dll libcdf.dll + +copy.lib.a: + @echo cp $(LIBsrcDIR)/libcdf.a $(INSTALLDIR)/lib + cp $(LIBsrcDIR)/libcdf.a $(INSTALLDIR)/lib + +copy.tools: + @if [ -f $(TOOLSsrcDIR)/cdfedit.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfedit.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfedit.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfedit ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfedit" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfedit" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfxp.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfxp.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfexport.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfxp ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfxp" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfexport" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfcvt.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfcvt.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfconvert.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfcvt ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfcvt" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfconvert" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/skt2cdf.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/skt2cdf.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/skeletoncdf.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/skt2cdf ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/skt2cdf" \ + "DESTINATION=$(INSTALLDIR)/bin/skeletoncdf" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdf2skt.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdf2skt.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/skeletontable.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdf2skt ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdf2skt" \ + "DESTINATION=$(INSTALLDIR)/bin/skeletontable" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfinq.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfinq.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfinquire.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfinq ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfinq" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfinquire" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfstats.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfstats.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfstats.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfstats ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfstats" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfstats" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfcmp.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfcmp.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfcompare.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfcmp ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfcmp" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfcompare" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfdump.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfdump.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfdump.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfdump ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfdump" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfdump" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfirsdump.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfirsdump.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfirsdump.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfirsdump ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfirsdump" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfirsdump" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfmerge.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfmerge.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfmerge.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfmerge ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfmerge" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfmerge" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfvalidate.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfvalidate.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfvalidate.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfvalidate ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfvalidate" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfvalidate" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @if [ -f $(TOOLSsrcDIR)/cdfleapsecondsinfo.exe ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfleapsecondsinfo.exe" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfleapsecondsinfo.exe" \ + copy.file ; \ + elif [ -f $(TOOLSsrcDIR)/cdfleapsecondsinfo ] ; then \ + $(MAKE) MAKE=$(MAKE) \ + "SOURCE=$(TOOLSsrcDIR)/cdfleapsecondsinfo" \ + "DESTINATION=$(INSTALLDIR)/bin/cdfleapsecondsinfo" \ + copy.file ; \ + else \ + $(NULL) ; \ + fi + @echo cp $(TOOLSsrcDIR)/cdfdir.unix $(INSTALLDIR)/bin/cdfdir + cp $(TOOLSsrcDIR)/cdfdir.unix $(INSTALLDIR)/bin/cdfdir + +copy.help: + @echo cp $(HELPsrcDIR)/cdfedit.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfedit.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfeditj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfeditj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfedit.ilh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfedit.ilh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfbrow.ilh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfbrow.ilh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfxp.ilh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfxp.ilh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfcvt.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfcvt.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfcvtj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfcvtj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfcmp.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfcmp.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfcmpj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfcmpj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdf2skt.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdf2skt.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdf2sktj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdf2sktj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/skt2cdf.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/skt2cdf.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/skt2cdfj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/skt2cdfj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfstats.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfstats.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfstatsj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfstatsj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfdump.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfdump.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfdumpj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfdumpj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfirsdump.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfirsdump.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfirsdumpj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfirsdumpj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfinq.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfinq.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfinqj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfinqj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfdirj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfdirj.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfmerge.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfmerge.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfmergej.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfmergej.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfvalidate.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfvalidate.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfvalidatej.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfvalidatej.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfleaptableinfo.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfleaptableinfo.olh $(INSTALLDIR)/lib/cdf/help + @echo cp $(HELPsrcDIR)/cdfleaptableinfoj.olh $(INSTALLDIR)/lib/cdf/help + cp $(HELPsrcDIR)/cdfleaptableinfoj.olh $(INSTALLDIR)/lib/cdf/help + +create.dir: + @echo mkdir -p $(TARGET) + mkdir -p $(TARGET) + +copy.file: + @echo cp $(SOURCE) $(DESTINATION) + cp $(SOURCE) $(DESTINATION) + chmod +x $(DESTINATION) + +notify.user: + @echo + @echo Installation completed! + @echo + @echo "**********" + @echo "* NOTE *" + @echo "**********" + @echo "If you want to use any of the CDF command-line utilitites (e.g. cdfedit, " + @echo "cdfexport, etc.), we strongly encourage you to set the CDF environment " + @echo "variables defined in the CDF definition files. Once the environment variables" + @echo "defined, you can invoke the CDF utility of interest just by typing the utility" + @echo "name. Otherwise, you'll have to specify the full path of the utility." + @echo + @echo If you use TCSH or CSH, run the following command: + @echo + @if [ $(INSTALLDIR) = "." ] ; then \ + echo " source `pwd`/bin/definitions.C" ; \ + else \ + echo " source $(INSTALLDIR)/bin/definitions.C" ; \ + fi + @echo + @echo + @echo If you use BASH or BSH, run the following command: + @echo + @if [ $(INSTALLDIR) = "." ] ; then \ + echo " . `pwd`/bin/definitions.B" ; \ + else \ + echo " . $(INSTALLDIR)/bin/definitions.B" ; \ + fi + @echo + @echo + @echo If you use KSH, run the following command: + @echo + @if [ $(INSTALLDIR) = "." ] ; then \ + echo " . `pwd`/bin/definitions.K" ; \ + else \ + echo " . $(INSTALLDIR)/bin/definitions.K" ; \ + fi + @echo + +ranlib.file: + @echo $(RANLIB) $(TARGET) + $(RANLIB) $(TARGET) + +#------------------------------------------------------------------------------ +# Clean/purge. +#------------------------------------------------------------------------------ + +clean: + @-rm -f core + @-rm -f samples/core + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) clean + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) clean + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) clean + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) clean + +purge: + @-rm -f *~ + @-rm -f *# + @-rm -f samples/*~ + @-rm -f samples/*# + @-rm -f $(HELPsrcDIR)/*~ + @-rm -f $(HELPsrcDIR)/*# + @-rm -f $(DEFSsrcDIR)/*~ + @-rm -f $(DEFSsrcDIR)/*# + @-rm -f $(INCsrcDIR)/*~ + @-rm -f $(INCsrcDIR)/*# + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) purge + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) purge + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) purge + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) purge + +#------------------------------------------------------------------------------ +# Ultrix. +#------------------------------------------------------------------------------ + +all.ultrix.risc: note1.all.ultrix.risc.build +all.ultrix.gnu: note1.1st all.ultrix.gnu.build + +all.ultrix.risc.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_ultrix_risc)" \ +"CCx=$(CC_ultrix_risc)" \ +"COPTIONS=$(COPTIONS_ultrix_risc)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_ultrix)" \ +"PIC=$(PIC_ultrix_risc)" \ +"CCx=$(CC_ultrix_risc)" \ +"LDx=$(LD_ultrix_risc)" \ +"COPTIONS=$(COPTIONS_ultrix_risc)" \ +"SYSLIBS=$(SYSLIBSshr_ultrix_risc)" \ +"SHAREDEXT=$(SHAREDEXT_ultrix)" \ +"LDOPTIONS=$(LDOPTIONS_ultrix_risc)" \ +"AROPTIONS=$(AROPTIONS_ultrix)" \ +"RANLIB=$(RANLIB_ultrix)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_ultrix_risc)" \ +"COPTIONS=$(COPTIONS_ultrix_risc)" \ +"COPTIONSld=$(COPTIONSld_ultrix_risc)" \ +"SYSLIBS=$(SYSLIBSexe_ultrix_risc)" \ +"CURSESLIB=$(CURSESLIB_ultrix_risc)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_ultrix)" \ +"CCx=$(CC_ultrix_risc)" \ +"SHARED=$(SHARED_ultrix)" \ +"FOPTIONS=$(FOPTIONS_ultrix)" \ +"FOPTIONSld=$(FOPTIONSld_ultrix)" \ +"COPTIONS=$(COPTIONS_ultrix_risc)" \ +"COPTIONSld=$(COPTIONSld_ultrix_risc)" \ +"SYSLIBS=$(SYSLIBSexe_ultrix_risc)" \ +"SHAREDEXT=$(SHAREDEXT_ultrix)" \ +all + +all.ultrix.gnu.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_ultrix_gnu)" \ +"CCx=$(CC_ultrix_gnu)" \ +"COPTIONS=$(COPTIONS_ultrix_gnu)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_ultrix)" \ +"PIC=$(PIC_ultrix_gnu)" \ +"CCx=$(CC_ultrix_gnu)" \ +"LDx=$(LD_ultrix_gnu)" \ +"COPTIONS=$(COPTIONS_ultrix_gnu)" \ +"SYSLIBS=$(SYSLIBSshr_ultrix_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_ultrix)" \ +"LDOPTIONS=$(LDOPTIONS_ultrix_gnu)" \ +"AROPTIONS=$(AROPTIONS_ultrix)" \ +"RANLIB=$(RANLIB_ultrix)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_ultrix_gnu)" \ +"COPTIONS=$(COPTIONS_ultrix_gnu)" \ +"COPTIONSld=$(COPTIONSld_ultrix_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_ultrix_gnu)" \ +"CURSESLIB=$(CURSESLIB_ultrix_gnu)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_ultrix)" \ +"CCx=$(CC_ultrix_gnu)" \ +"SHARED=$(SHARED_ultrix)" \ +"FOPTIONS=$(FOPTIONS_ultrix)" \ +"FOPTIONSld=$(FOPTIONSld_ultrix)" \ +"COPTIONS=$(COPTIONS_ultrix_gnu)" \ +"COPTIONSld=$(COPTIONSld_ultrix_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_ultrix_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_ultrix)" \ +all + +#------------------------------------------------------------------------------ +# HP-UX. +#------------------------------------------------------------------------------ + +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 $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_hpux_std)" \ +"CCx=$(CC_hpux_std)" \ +"COPTIONS=$(COPTIONS_hpux_std) $(COPTIONSZlib_hpux_std)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_hpux_std)" \ +"PIC=$(PIC_hpux_std)" \ +"CCx=$(CC_hpux_std)" \ +"LDx=$(LD_hpux_std)" \ +"COPTIONS=$(COPTIONS_hpux_std)" \ +"SYSLIBS=$(SYSLIBSshr_hpux_std)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_std)" \ +"AROPTIONS=$(AROPTIONS_hpux)" \ +"RANLIB=$(RANLIB_hpux)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_hpux_std)" \ +"COPTIONS=$(COPTIONS_hpux_std)" \ +"COPTIONSld=$(COPTIONSld_hpux_std)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_std)" \ +"CURSESLIB=$(CURSESLIB_hpux_std)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_hpux)" \ +"CCx=$(CC_hpux_std)" \ +"SHARED=$(SHARED_hpux_std)" \ +"FOPTIONS=$(FOPTIONS_hpux)" \ +"FOPTIONSld=$(FOPTIONSld_hpux)" \ +"COPTIONS=$(COPTIONS_hpux_std)" \ +"COPTIONSld=$(COPTIONSld_hpux_std)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_std)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +all + +all.hpux.opt.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_hpux_opt)" \ +"CCx=$(CC_hpux_opt)" \ +"COPTIONS=$(COPTIONS_hpux_opt) $(COPTIONSZlib_hpux_opt)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_hpux_opt)" \ +"CCx=$(CC_hpux_opt)" \ +"LDx=$(LD_hpux_opt)" \ +"COPTIONS=$(COPTIONS_hpux_opt)" \ +"SYSLIBS=$(SYSLIBSshr_hpux_opt)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_opt)" \ +"AROPTIONS=$(AROPTIONS_hpux)" \ +"RANLIB=$(RANLIB_hpux)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_hpux_opt)" \ +"COPTIONS=$(COPTIONS_hpux_opt)" \ +"COPTIONSld=$(COPTIONSld_hpux_opt)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_opt)" \ +"CURSESLIB=$(CURSESLIB_hpux_opt)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_hpux)" \ +"CCx=$(CC_hpux_opt)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_hpux)" \ +"FOPTIONSld=$(FOPTIONSld_hpux)" \ +"COPTIONS=$(COPTIONS_hpux_opt)" \ +"COPTIONSld=$(COPTIONSld_hpux_opt)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_opt)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +all + +all.hpux.opt64.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_hpux_opt64)" \ +"CCx=$(CC_hpux_opt64)" \ +"COPTIONS=$(COPTIONS_hpux_opt64) $(COPTIONSZlib_hpux_opt64)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(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) MAKE=$(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) MAKE=$(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 $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_hpux_posix)" \ +"CCx=$(CC_hpux_posix)" \ +"COPTIONS=$(COPTIONS_hpux_posix) $(COPTIONSZlib_hpux_posix)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_hpux_posix)" \ +"CCx=$(CC_hpux_posix)" \ +"LDx=$(LD_hpux_posix)" \ +"COPTIONS=$(COPTIONS_hpux_posix)" \ +"SYSLIBS=$(SYSLIBSshr_hpux_posix)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_posix)" \ +"AROPTIONS=$(AROPTIONS_hpux)" \ +"RANLIB=$(RANLIB_hpux)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_hpux_posix)" \ +"COPTIONS=$(COPTIONS_hpux_posix)" \ +"COPTIONSld=$(COPTIONSld_hpux_posix)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_posix)" \ +"CURSESLIB=$(CURSESLIB_hpux_posix)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_hpux)" \ +"CCx=$(CC_hpux_posix)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_hpux)" \ +"FOPTIONSld=$(FOPTIONSld_hpux)" \ +"COPTIONS=$(COPTIONS_hpux_posix)" \ +"COPTIONSld=$(COPTIONSld_hpux_posix)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_posix)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +all + +all.hpux.gnu.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_hpux_gnu)" \ +"CCx=$(CC_hpux_gnu)" \ +"COPTIONS=$(COPTIONS_hpux_gnu) $(COPTIONSZlib_hpux_gnu)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_hpux_gnu)" \ +"CCx=$(CC_hpux_gnu)" \ +"LDx=$(LD_hpux_gnu)" \ +"COPTIONS=$(COPTIONS_hpux_gnu)" \ +"SYSLIBS=$(SYSLIBSshr_hpux_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_gnu)" \ +"AROPTIONS=$(AROPTIONS_hpux)" \ +"RANLIB=$(RANLIB_hpux)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_hpux_gnu)" \ +"COPTIONS=$(COPTIONS_hpux_gnu)" \ +"COPTIONSld=$(COPTIONSld_hpux_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_gnu)" \ +"CURSESLIB=$(CURSESLIB_hpux_gnu)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_hpux)" \ +"CCx=$(CC_hpux_gnu)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_hpux)" \ +"FOPTIONSld=$(FOPTIONSld_hpux)" \ +"COPTIONS=$(COPTIONS_hpux_gnu)" \ +"COPTIONSld=$(COPTIONSld_hpux_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +all + +all.hpux.gnu64.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_hpux_gnu64)" \ +"CCx=$(CC_hpux_gnu64)" \ +"COPTIONS=$(COPTIONS_hpux_gnu64) $(COPTIONSZlib_hpux_gnu64)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(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) MAKE=$(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) MAKE=$(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. +#------------------------------------------------------------------------------ + +all.irix6.sgin32: all.irix6.sgin32.build +all.irix6.sgi64: all.irix6.sgi64.build +all.irix6.gnu: note1.1st all.irix6.gnu.build + +all.irix6.sgin32.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_irix6_sgin32)" \ +"CCx=$(CC_irix6_sgin32)" \ +"COPTIONS=$(COPTIONS_irix6_sgin32) $(COPTIONSZlib_irix6_sgin32)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_irix6_sgin32)" \ +"CCx=$(CC_irix6_sgin32)" \ +"LDx=$(LD_irix6_sgin32)" \ +"COPTIONS=$(COPTIONS_irix6_sgin32)" \ +"SYSLIBS=$(SYSLIBSshr_irix6_sgin32)" \ +"SHAREDEXT=$(SHAREDEXT_irix6)" \ +"LDOPTIONS=$(LDOPTIONS_irix6_sgin32) -n32" \ +"AROPTIONS=$(AROPTIONS_irix6)" \ +"RANLIB=$(RANLIB_irix6)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_irix6_sgin32)" \ +"COPTIONS=$(COPTIONS_irix6_sgin32)" \ +"COPTIONSld=$(COPTIONSld_irix6_sgin32)" \ +"SYSLIBS=$(SYSLIBSexe_irix6_sgin32)" \ +"CURSESLIB=$(CURSESLIB_irix6_sgin32)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_irix6)" \ +"CCx=$(CC_irix6_sgin32)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_irix6)" \ +"FOPTIONSld=$(FOPTIONSld_irix6)" \ +"COPTIONS=$(COPTIONS_irix6_sgin32)" \ +"COPTIONSld=$(COPTIONSld_irix6_sgin32)" \ +"SYSLIBS=$(SYSLIBSexe_irix6_sgin32)" \ +"SHAREDEXT=$(SHAREDEXT_irix6)" \ +all + +all.irix6.sgi64.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_irix6_sgi64)" \ +"CCx=$(CC_irix6_sgi64)" \ +"COPTIONS=$(COPTIONS_irix6_sgi64) $(COPTIONSZlib_irix6_sgi64)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_irix6_sgi64)" \ +"CCx=$(CC_irix6_sgi64)" \ +"LDx=$(LD_irix6_sgi64)" \ +"COPTIONS=$(COPTIONS_irix6_sgi64)" \ +"SYSLIBS=$(SYSLIBSshr_irix6_sgi64)" \ +"SHAREDEXT=$(SHAREDEXT_irix6)" \ +"LDOPTIONS=$(LDOPTIONS_irix6_sgin64) -64" \ +"AROPTIONS=$(AROPTIONS_irix6)" \ +"RANLIB=$(RANLIB_irix6)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_irix6_sgi64)" \ +"COPTIONS=$(COPTIONS_irix6_sgi64)" \ +"COPTIONSld=$(COPTIONSld_irix6_sgi64)" \ +"SYSLIBS=$(SYSLIBSexe_irix6_sgi64)" \ +"CURSESLIB=$(CURSESLIB_irix6_sgi64)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_irix6)" \ +"CCx=$(CC_irix6_sgi64)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_irix6)" \ +"FOPTIONSld=$(FOPTIONSld_irix6)" \ +"COPTIONS=$(COPTIONS_irix6_sgi64)" \ +"COPTIONSld=$(COPTIONSld_irix6_sgi64)" \ +"SYSLIBS=$(SYSLIBSexe_irix6_sgi64)" \ +"SHAREDEXT=$(SHAREDEXT_irix6)" \ +all + +all.irix6.gnu.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_irix6_gnu)" \ +"CCx=$(CC_irix6_gnu)" \ +"COPTIONS=$(COPTIONS_irix6_gnu) $(COPTIONSZlib_irix6_gnu)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_irix6_gnu)" \ +"CCx=$(CC_irix6_gnu)" \ +"LDx=$(LD_irix6_gnu)" \ +"COPTIONS=$(COPTIONS_irix6_gnu)" \ +"SYSLIBS=$(SYSLIBSshr_irix6_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_irix6)" \ +"LDOPTIONS=$(LDOPTIONS_irix6_gnu) -n32" \ +"AROPTIONS=$(AROPTIONS_irix6)" \ +"RANLIB=$(RANLIB_irix6)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_irix6_gnu)" \ +"COPTIONS=$(COPTIONS_irix6_gnu)" \ +"COPTIONSld=$(COPTIONSld_irix6_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_irix6_gnu)" \ +"CURSESLIB=$(CURSESLIB_irix6_gnu)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_irix6)" \ +"CCx=$(CC_irix6_gnu)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_irix6)" \ +"FOPTIONSld=$(FOPTIONSld_irix6)" \ +"COPTIONS=$(COPTIONS_irix6_gnu)" \ +"COPTIONSld=$(COPTIONSld_irix6_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_irix6_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_irix6)" \ +all + +#------------------------------------------------------------------------------ +# AIX. +#------------------------------------------------------------------------------ + +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 $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_aix_ibm)" \ +"CCx=$(CC_aix_ibm)" \ +"COPTIONS=$(COPTIONS_aix_ibm) $(COPTIONSZlib_aix_ibm)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_aix_ibm)" \ +"CCx=$(CC_aix_ibm)" \ +"LDx=$(LD_aix_ibm)" \ +"COPTIONS=$(COPTIONS_aix_ibm)" \ +"SYSLIBS=$(SYSLIBSshr_aix_ibm)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +"LDOPTIONS=$(LDOPTIONS_aix_ibm)" \ +"AROPTIONS=$(AROPTIONS_aix)" \ +"RANLIB=$(RANLIB_aix)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_aix_ibm)" \ +"COPTIONS=$(COPTIONS_aix_ibm)" \ +"COPTIONSld=$(COPTIONSld_aix_ibm)" \ +"SYSLIBS=$(SYSLIBSexe_aix_ibm)" \ +"CURSESLIB=$(CURSESLIB_aix_ibm)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_aix)" \ +"CCx=$(CC_aix_ibm)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_aix)" \ +"FOPTIONSld=$(FOPTIONSld_aix)" \ +"COPTIONS=$(COPTIONS_aix_ibm)" \ +"COPTIONSld=$(COPTIONSld_aix_ibm)" \ +"SYSLIBS=$(SYSLIBSexe_aix_ibm)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +all + +all.aix.gnu.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_aix_gnu)" \ +"CCx=$(CC_aix_gnu)" \ +"COPTIONS=$(COPTIONS_aix_gnu) $(COPTIONSZlib_aix_gnu)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_aix_gnu)" \ +"CCx=$(CC_aix_gnu)" \ +"LDx=$(LD_aix_gnu)" \ +"COPTIONS=$(COPTIONS_aix_gnu)" \ +"SYSLIBS=$(SYSLIBSshr_aix_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +"LDOPTIONS=$(LDOPTIONS_aix_gnu)" \ +"AROPTIONS=$(AROPTIONS_aix)" \ +"RANLIB=$(RANLIB_aix)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_aix_gnu)" \ +"COPTIONS=$(COPTIONS_aix_gnu)" \ +"COPTIONSld=$(COPTIONSld_aix_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_aix_gnu)" \ +"CURSESLIB=$(CURSESLIB_aix_gnu)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_aix)" \ +"CCx=$(CC_aix_gnu)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_aix)" \ +"FOPTIONSld=$(FOPTIONSld_aix)" \ +"COPTIONS=$(COPTIONS_aix_gnu)" \ +"COPTIONSld=$(COPTIONSld_aix_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_aix_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +all + +all.aix.ibm64.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_aix_ibm64)" \ +"CCx=$(CC_aix_ibm64)" \ +"COPTIONS=$(COPTIONS_aix_ibm64) $(COPTIONSZlib_aix_ibm64)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(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) MAKE=$(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) MAKE=$(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 $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_aix_gnu64)" \ +"CCx=$(CC_aix_gnu64)" \ +"COPTIONS=$(COPTIONS_aix_gnu64) $(COPTIONSZlib_aix_gnu64)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(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) MAKE=$(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) MAKE=$(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. +#------------------------------------------------------------------------------ + +all.mach.next: note1.1st all.mach.next.build +all.mach.macosx: all.mach.macosx.build +all.mach.gnu: note1.1st all.mach.gnu.build + +all.mach.next.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_mach_next)" \ +"CCx=$(CC_mach_next)" \ +"COPTIONS=$(COPTIONS_mach_next)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_mach)" \ +"PIC=$(PIC_mach_next)" \ +"CCx=$(CC_mach_next)" \ +"LDx=$(LD_mach_next)" \ +"COPTIONS=$(COPTIONS_mach_next)" \ +"SYSLIBS=$(SYSLIBSshr_mach_next)" \ +"SHAREDEXT=$(SHAREDEXT_mach)" \ +"LDOPTIONS=$(LDOPTIONS_mach_next)" \ +"AROPTIONS=$(AROPTIONS_mach)" \ +"RANLIB=$(RANLIB_mach)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(CURSES_mach_next)" \ +"CCx=$(CC_mach_next)" \ +"COPTIONS=$(COPTIONS_mach_next)" \ +"COPTIONSld=$(COPTIONSld_mach_next)" \ +"SYSLIBS=$(SYSLIBSexe_mach_next)" \ +"CURSESLIB=$(CURSESLIB_mach_next)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_mach)" \ +"CCx=$(CC_mach_next)" \ +"SHARED=$(SHARED_mach)" \ +"FOPTIONS=$(FOPTIONS_mach)" \ +"FOPTIONSld=$(FOPTIONSld_mach)" \ +"COPTIONS=$(COPTIONS_mach_next)" \ +"COPTIONSld=$(COPTIONSld_mach_next)" \ +"SYSLIBS=$(SYSLIBSexe_mach_next)" \ +"SHAREDEXT=$(SHAREDEXT_mach)" \ +all + +all.mach.macosx.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_mach_macosx)" \ +"CCx=$(CC_mach_macosx)" \ +"COPTIONS=$(COPTIONS_mach_macosx)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_mach)" \ +"PIC=$(PIC_mach_macosx)" \ +"CCx=$(CC_mach_macosx)" \ +"LDx=$(LD_mach_macosx)" \ +"COPTIONS=$(COPTIONS_mach_macosx)" \ +"SYSLIBS=$(SYSLIBSshr_mach_macosx)" \ +"SHAREDEXT=$(SHAREDEXT_mach)" \ +"LDOPTIONS=$(LDOPTIONS_mach_macosx)" \ +"AROPTIONS=$(AROPTIONS_mach)" \ +"RANLIB=$(RANLIB_mach)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(CURSES_mach_macosx)" \ +"CCx=$(CC_mach_macosx)" \ +"COPTIONS=$(COPTIONS_mach_macosx)" \ +"COPTIONSld=$(COPTIONSld_mach_macosx)" \ +"SYSLIBS=$(SYSLIBSexe_mach_macosx)" \ +"CURSESLIB=$(CURSESLIB_mach_macosx)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_mach)" \ +"CCx=$(CC_mach_macosx)" \ +"SHARED=$(SHARED_mach)" \ +"FOPTIONS=$(FOPTIONS_mach)" \ +"FOPTIONSld=$(FOPTIONSld_mach)" \ +"COPTIONS=$(COPTIONS_mach_macosx)" \ +"COPTIONSld=$(COPTIONSld_mach_macosx)" \ +"SYSLIBS=$(SYSLIBSexe_mach_macosx)" \ +"SHAREDEXT=$(SHAREDEXT_mach)" \ +all + +all.mach.gnu.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_mach_gnu)" \ +"CCx=$(CC_mach_gnu)" \ +"COPTIONS=$(COPTIONS_mach_gnu)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_mach)" \ +"PIC=$(PIC_mach_gnu)" \ +"CCx=$(CC_mach_gnu)" \ +"LDx=$(LD_mach_gnu)" \ +"COPTIONS=$(COPTIONS_mach_gnu)" \ +"SYSLIBS=$(SYSLIBSshr_mach_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_mach)" \ +"LDOPTIONS=$(LDOPTIONS_mach_gnu)" \ +"AROPTIONS=$(AROPTIONS_mach)" \ +"RANLIB=$(RANLIB_mach)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(CURSES_mach_gnu)" \ +"CCx=$(CC_mach_gnu)" \ +"COPTIONS=$(COPTIONS_mach_gnu)" \ +"COPTIONSld=$(COPTIONSld_mach_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_mach_gnu)" \ +"CURSESLIB=$(CURSESLIB_mach_gnu)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_mach)" \ +"CCx=$(CC_mach_gnu)" \ +"SHARED=$(SHARED_mach)" \ +"FOPTIONS=$(FOPTIONS_mach)" \ +"FOPTIONSld=$(FOPTIONSld_mach)" \ +"COPTIONS=$(COPTIONS_mach_gnu)" \ +"COPTIONSld=$(COPTIONSld_mach_gnu)" \ +"SYSLIBS=$(SYSLIBSexe_mach_gnu)" \ +"SHAREDEXT=$(SHAREDEXT_mach)" \ +all + +#------------------------------------------------------------------------------ +# QNX. +#------------------------------------------------------------------------------ + +all.qnx.ccwat: note1.1st all.qnx.ccwat.build + +all.qnx.ccwat.build: + @cd $(LIBsrcZlibDIR); $(MAKE) MAKE=$(MAKE) \ +"PIC=$(PIC_qnx_ccwat)" \ +"CCx=$(CC_qnx_ccwat)" \ +"COPTIONS=$(COPTIONS_qnx_ccwat)" \ +all + @cd $(LIBsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"SHARED=$(SHARED_qnx)" \ +"PIC=$(PIC_qnx_ccwat)" \ +"CCx=$(CC_qnx_ccwat)" \ +"LDx=$(LD_qnx_ccwat)" \ +"COPTIONS=$(COPTIONS_qnx_ccwat)" \ +"SYSLIBS=$(SYSLIBSshr_qnx_ccwat)" \ +"SHAREDEXT=$(SHAREDEXT_qnx)" \ +"LDOPTIONS=$(LDOPTIONS_qnx_ccwat)" \ +"AROPTIONS=$(AROPTIONS_qnx)" \ +"RANLIB=$(RANLIB_qnx)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"CURSES=$(CURSES_qnx_ccwat)" \ +"CCx=$(CC_qnx_ccwat)" \ +"COPTIONS=$(COPTIONS_qnx_ccwat)" \ +"COPTIONSld=$(COPTIONSld_qnx_ccwat)" \ +"SYSLIBS=$(SYSLIBSexe_qnx_ccwat)" \ +"CURSESLIB=$(CURSESLIB_qnx_ccwat)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) MAKE=$(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_qnx)" \ +"CCx=$(CC_qnx_ccwat)" \ +"SHARED=$(SHARED_qnx)" \ +"FOPTIONS=$(FOPTIONS_qnx)" \ +"FOPTIONSld=$(FOPTIONSld_qnx)" \ +"COPTIONS=$(COPTIONS_qnx_ccwat)" \ +"COPTIONSld=$(COPTIONSld_qnx_ccwat)" \ +"SYSLIBS=$(SYSLIBSexe_qnx_ccwat)" \ +"SHAREDEXT=$(SHAREDEXT_qnx)" \ +all + +#------------------------------------------------------------------------------ +# Show settings. +#------------------------------------------------------------------------------ + +show: show.$(OS).$(ENV) + +show.sunos.bsd: show.supported +show.sunos.bsd5: show.supported +show.sunos.sysV: show.supported +show.sunos.gnu: show.supported +show.sunos.gnu5: show.supported +show.solaris.bsd: show.supported +show.solaris.bsd5: show.supported +show.solaris.sparc: show.supported +show.solaris.sparc64: show.supported +show.solaris.sysV: show.supported +show.solaris.gnu: show.supported +show.solaris.gnu64: show.supported +show.solaris.gnu64i: show.supported +show.solaris.gnu5: show.supported +show.solaris.gnu5_64: show.supported +show.solaris.gnu-64: show.supported +show.ultrix.risc: show.supported +show.ultrix.gnu: show.supported +show.mach.next: show.supported +show.mach.macosx: show.supported +show.mach.gnu: show.supported +show.hpux.std: show.supported +show.hpux.opt: show.supported +show.hpux.posix: show.supported +show.hpux.gnu: show.supported +show.aix.ibm: show.supported +show.aix.gnu: show.supported +show.osf.dec: show.supported +show.osf.gnu: show.supported +show.osf.dec64: show.supported +show.osf.gnu64: show.supported +show.irix34.sgi: show.supported +show.irix34.gnu: show.supported +show.irix5.sgi: show.supported +show.irix5.gnu: show.supported +show.irix6.sgi32: show.supported +show.irix6.sgin32: show.supported +show.irix6.sgi64: show.supported +show.irix6.gnu: show.supported +show.qnx.gnu: show.notsupported +show.linux.gnu: show.supported +show.linux.gnu32: show.supported +show.linux.gnu64: show.supported +show.linux.intel: show.supported +show.breebsd.gnu: show.supported +show.cygwin.gnu: show.supported +show.mingw.gnu: show.supported +show.freebsd.gnu: show.supported +show.posix.vax: show.supported +show.posix.alphaD: show.supported +show.posix.alphaG: show.supported +show.posix.alphaI: show.supported + +show.supported: + @echo SHARED is $(SUPPORTED.$(SHARED_$(OS))) + @echo CURSES is $(SUPPORTED.$(CURSES_$(OS)_$(ENV))) + @echo FOPTIONS=$(FOPTIONS_$(OS)) + @echo FOPTIONSld=$(FOPTIONSld_$(OS)) + @echo SHAREDEXT=$(SHAREDEXT_$(OS)) + @echo LDOPTIONSlibcdf=$(LDOPTIONS_$(OS)_$(ENV)) + @echo RANLIB=$(RANLIB_$(OS)) + @echo FCx=$(FC_$(OS)) + @echo CCx=$(CC_$(OS)_$(ENV)) + @echo PIC=$(PIC_$(OS)_$(ENV)) + @echo COPTIONS=$(COPTIONS_$(OS)_$(ENV)) + @echo COPTIONSld=$(COPTIONSld_$(OS)_$(ENV)) + @echo CURSESLIB=$(CURSESLIB_$(OS)_$(ENV)) + @echo SYSLIBSexe=$(SYSLIBSexe_$(OS)_$(ENV)) + @echo SYSLIBSshr=$(SYSLIBSshr_$(OS)_$(ENV)) + +show.notsupported: + @echo Sorry, \`make show\' is not available on this machine. + +#------------------------------------------------------------------------------ +# Warning messages. +#------------------------------------------------------------------------------ + +note1.1st: + @cat Note.1st + +note1.noCC: + @cat Note.noCC + +note1.solaris: + @cat Note.solaris + +note1.intel: + @cat Note.intel + +note1.macx.no: + @cat Note.MacX + +note1.macx.yes: + @$(NOOP) + +note1.macx.i386: + @echo + @echo Xcode version: $(XCODEVERSION) no longer supports i386 build... + @echo diff --git a/ext/cdf/cdf38_0-dist/Note.1st b/ext/cdf/cdf38_0-dist/Note.1st new file mode 100644 index 0000000..efb96f9 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.1st @@ -0,0 +1,16 @@ + + * Warning * + +The OS/ENV combination you have selected has not been tested. The +options which will be used are based on previous experiences with the +operating system being used. If an error occurs, don't panic, simply +contact us [GSFC-cdf-support@lists.nasa.gov]. The reason that your +OS/ENV combination is not tested is probably because we no longer have +a guest account on a machine having that particular OS/ENV combination. +If you would like to offer us a guest account for testing purposes we +would be very happy to hear from you. In fact, we would even build/test +the CDF distribution on your machine for you. + +If this `make' completes without any warnings or errors, please let us +know so we can remove this warning. Anyway, here we go... + diff --git a/ext/cdf/cdf38_0-dist/Note.gcc b/ext/cdf/cdf38_0-dist/Note.gcc new file mode 100644 index 0000000..ae9f091 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.gcc @@ -0,0 +1,6 @@ + +If you are using GCC's gfortran to build, Use the newer version, e.g., GCC +V4.4.2. (Use "gfortran -v" to show the compiler version.) Using an older +version, e.g., V4.1.2, may have problems in building/testing the test +Fortran programs. + diff --git a/ext/cdf/cdf38_0-dist/Note.intel b/ext/cdf/cdf38_0-dist/Note.intel new file mode 100644 index 0000000..7e499ea --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.intel @@ -0,0 +1,5 @@ + +If you are also using Intel's Fortran compiler, use this +make OS=linux ENV=intel FORTRAN=yes FC_linux=ifort all +for the make. + diff --git a/ext/cdf/cdf38_0-dist/Note.linux b/ext/cdf/cdf38_0-dist/Note.linux new file mode 100644 index 0000000..79b796d --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.linux @@ -0,0 +1,6 @@ +Recommended/tested gcc: + Version 4.4.2 or later + +Recommended/tested gfortran: + Version 4.4.2 or later + diff --git a/ext/cdf/cdf38_0-dist/Note.macosx b/ext/cdf/cdf38_0-dist/Note.macosx new file mode 100644 index 0000000..e5a0ab2 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.macosx @@ -0,0 +1,4 @@ +# To compile and link on Mac OS X 10.6, make the following changes to Makefile: +# 1) Replace MacOSX10.5.sdk with MacOSX10.6.sdk +# 2) Replace /usr/lib/gcc/powerpc-apple-darwin9 with +# /usr/lib/gcc/powerpc-apple-darwin10 diff --git a/ext/cdf/cdf38_0-dist/Note.noCC b/ext/cdf/cdf38_0-dist/Note.noCC new file mode 100644 index 0000000..0810624 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.noCC @@ -0,0 +1,5 @@ + +If an error occurs because the C compiler could not be found, enter +`make all.help' again and read the subsection "C compiler not found" +in the section named `Possible Problems'. + diff --git a/ext/cdf/cdf38_0-dist/Note.solaris b/ext/cdf/cdf38_0-dist/Note.solaris new file mode 100644 index 0000000..c3e0046 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Note.solaris @@ -0,0 +1,4 @@ + +If you are running Solaris 2.3 (or earlier), make sure that the +`SOLARISbsdDIRUTILSbug' macro setting in `cdfconfig.h' is correct. + diff --git a/ext/cdf/cdf38_0-dist/README.after_install b/ext/cdf/cdf38_0-dist/README.after_install new file mode 100644 index 0000000..0e47c07 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/README.after_install @@ -0,0 +1,52 @@ +This is the CDF V3.7.0 online software distribution directory for Unix +systems. This directory contains the following files: + +Welcome.txt The welcome information for the current version. + +CDF_copyright.txt This file contains the CDF copyright. + +CHANGES.txt The software change log for the current CDF version. + +HOWTO.run-Java-tools The file contains the instructions of how to run + the Java-based CDF tools. + +HOWTO.run_previous_version The file contains the instructions to set it up + to use the libraries and tools from a previously + installed version. + +Makefile Make file for various Unix platforms. + Type "make" for installation instructions for + the supported Unix platforms. + + This makefile builds the CDF library and the + command line version of the CDF tools. + +README.after_install This is the file you are browsing. + +README.install CDF library installation instructions. + +README.install_java_APIs Instructions on how to build and use the Java + Native Interface (JNI) to CDF library. + +README_cdf_tools.txt This file contains a description of the CDF tools + that allow users to manipulate CDF files (e.g. + CDFEdit, CDFExport, etc.) + +Release.notes CDF 3.7.0 release notes. + +cdfjava This directory contains the CDF Java APIs, the JNI + code, and example programs that demonstrate how to + create a CDF file and read data from it. It also + contains the CDF XML utilities. + + NOTE: + This directory will only exist if the CDF Java + APIs are installed. + +samples This directory contains sample CDF files and + programs written in C and Fortran. + +src This directory contains the CDF source code and + some test programs that can be used to check + whether the CDF library is properly installed. + diff --git a/ext/cdf/cdf38_0-dist/README.install b/ext/cdf/cdf38_0-dist/README.install new file mode 100644 index 0000000..bde8771 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/README.install @@ -0,0 +1,167 @@ + CDF Version 3.7.0, UNIX/POSIX Systems + +Common Data Format (CDF) is a conceptual data abstraction for storing +multi-dimensional data sets. The basic component of CDF is a software +programming interface that is a device independent view of the CDF data +model. The application developer is insulated from the actual physical +file format for reasons of conceptual simplicity, device independence, +and future expandability. CDF files created on any given platform can be +transported to any other platform on to which CDF is ported and used with +any CDF tools or layered applications. A more detailed introduction to +CDF can be found in the CDF User's Guide. + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! You must have a C compiler in order to build the CDF distribution. !! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +The CDF library and toolkit programs are written in C. A C compiler is +necessary to build the CDF distribution. The CDF distribution also contains +several Fortran source files which support the Fortran interface. If a +Fortran compiler is not available, the distribution can be built without +Fortran support. + +The CDF distribution package now contains CDF Java APIs as well as Java +version of the CDF tools (e.g., CDFEdit, CDFExport, SkeletonTable, SkeletonCDF, +etc.). The Java APIs, built on top of the CDF library written in C, allow +users to develop platform-independent CDF applications, and by default, they +are not installed as part of standard installation. The APIs can be +installed by following the installation instructions described in the +README.install_java_APIs file. + +Documentation for CDF consists of the CDF User's Guide, the CDF C Reference +Manual, and the CDF Fortran Reference Manual. + +Requests for assistance or documentation should be sent to: + + gsfc-cdf-support@lists.nasa.gov + +If you get the distribution, please send CDFSUPPORT a message so we can put +you on our mailing list. That way you will be notified of new releases. + + +UNIX/POSIX Installation Instructions +------------------------------------ + +CDF V3.7.0 is distributed for UNIX and POSIX systems as a gzipped compressed +'tar' file . + +To uncompress cdf37_0-dist-all.tar.gz, cdf37_0-dist-cdf.tar.gz, +cdf37_0-dist-java.tar.gz, use the `gzip' command as follows... + + gunzip + +The resulting file will be named cdf37_0-dist-all.tar, cdf37_0-dist-cdf.tar, +or cdf37_0-dist-java.tar. + +Then use the `tar' command to extract the CDF source files. `tar' will create +a directory named `cdf37_0-dist' containing several subdirectories. The source +files for the distribution will be placed into these directories. + +The syntax for the `tar' command is different on some flavors of UNIX. For +most UNIX systems (and the POSIX shell) use... + + tar -xvf cdf37_0-dist-all.tar + +For the IBM-RS6000/AIX use... + + tar -x -v -f cdf37_0-dist-all.tar + + +CDF distribution has a makefile that automatically builds the CDF library and +tools. The following steps should be taken to build and install CDF. + + 1. Set your current directory (cd) to the top level CDF directory + (the directory named `cdf37_0-dist' created by `tar'). + + 2. If desired, modify the include file named `cdfconfig.h' in the + `src/include' directory to the desired default parameters for + your distribution. These default parameters affect a number + of actions taken by the CDF library and toolkit programs in + various situations (the comments in `cdfconfig.h' describe these + default parameters). + + 3. Compile/link the distribution. First enter... + + make all.help + + to determine the required/optional `make' variables to be used. + Then enter... + + make `make variables...' all + + Some informational/warning messages from the compilers may be + displayed. These can be ignored and should have no effect on + the operation of the CDF library or toolkit programs. + + Examples: + To build the distribution on a Solaris system using the + System V C compiler enter... + + make OS=solaris ENV=sparc all + + To build the distribution on Linux system using the GNU C + compiler enter... + + make OS=linux ENV=gnu all + + The `OS' and `ENV' variables are described in the `make all.help' + part of this step. + + 4. Test that the distribution was built correctly by entering... + + make test + + The name of each test executed will be displayed. No other + messages will be displayed unless an error occurs. Entering... + + make test.help + + will display additional information about the testing of the + CDF distribution. + + 5. Install the definitions files, libraries, include files, toolkit + programs, and help files. First enter... + + make install.help + + to determine the required/optional `make' variables to be used. + Then enter... + + make `make variables...' install + + The appropriate files will be copied to the `include', `lib', + `bin', and `lib/cdf/help' directories (from the `src/...' + directories). + + Examples: + 1) The following command will install the CDF distribution under + the current working directory (i.e CDF base directory). + + make install + + 2) If you want to install the CDF distribution in the + user-specified directory called '/user/local/cdf', enter ... + + make INSTALLDIR=/usr/local/cdf install + + 6. Delete the library(s), object files, and executables in the + `src/...' directories by entering... + + make clean + + You may also delete the entire `src/...' directory tree if you + have no need for the source code. + + 7. If you have Fortran applications which include `CDF.INC' instead + of `cdf.inc', you may want to add a soft logical link in the + `include' directory which will point `CDF.INC' to `cdf.inc'. To + do so set your current directory to the `include' directory and + use the command `ln -s cdf.inc CDF.INC'. (Note that this logical + link existed automatically in previous CDF distributions after + the `make install' step was performed.) + + 8. (Optional) JAVA Support + Please read the file README.install_java_APIs in the top level of + CDF directory for instructions on how to build and install the Java + Native Interface (JNI) and Java-CDF APIs. + diff --git a/ext/cdf/cdf38_0-dist/README.install_java_APIs b/ext/cdf/cdf38_0-dist/README.install_java_APIs new file mode 100644 index 0000000..79e71b2 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/README.install_java_APIs @@ -0,0 +1,231 @@ + CDF Version 3.7.0, UNIX/POSIX Systems + +The CDF distribution package now contains the CDF Java APIs, in addition to +the existing C and Fortran APIs, to allow users to develop platform-independent +CDF applications. By default, the Java APIs are not installed as part of +standard installation, and the APIs can be installed by following the +installation instructions listed below. + +Documentation for the CDF Java APIs is available at + http://cdf.gsfc.nasa.gov/CDF_docs.html + + +*************************************************************************** +* Please make sure that you have done the following before proceeding * +* with the CDF Java APIs installation: * +* * +* - installed the JDK 1.5 or later. * +* - untarred the CDF distribution package * +* - installed the CDF distribution package using the 'make' command. * +* - executed the definitions.C|B|K file located under the * +* /bin directory (e.g. `source definitions.C' for C shell).* +* This file defines the environment variables (e.g. CDF_BASE, * +* CDF_LIB, etc.) that are used by the installation instructions * +* described below. * +*************************************************************************** + +Installation instructions of the CDF Java APIs +---------------------------------------------- +1. Set your current directory (cd) to the top level directory where + + cd $CDF_BASE + +2. If you downloaded a tar file that contains both the CDF library and the + CDF Java APIs (i.e. cdf37_0-dist-all.tar), go to step 3. + + Untar the CDF Java APIs, cdf37_0-dist-java.tar, as follows: + tar xvf cdf37_0-dist-java.tar + +3. Set your current directory (cd) to the cdfjava/jni directory. + +4. Compile the JNI code, cdfNativeLibrary.c, as follows: + + cc -c cdfNativeLibrary.c + -I${CDF_BASE}/include + -I + -I + -o cdfNativeLibrary.o + + NOTE: During compilation, you may get the following warning message or + something similar on some platforms. Don't be alarmed about the + message and proceed to the next step. + + "cdfNativeLibrary.c: In function `getJavaField': + cdfNativeLibrary.c:398: warning: assignment discards + qualifiers from pointer target type" + + Examples: + The examples below assume that the appropriate environmental variables + have been properly defined. The CDF_BASE and CDF_LIB variables are + defined in the definitions. file located under the + ${CDF_BASE}/bin directory. The JAVA_HOME environment variable + refers to the name of the root/base directory where the Java virtual + machine is installed. + + If you have Linux, the following command will compile the JNI + code: + + gcc -I${CDF_BASE}/include \ + -I${JAVA_HOME}/include \ + -I${JAVA_HOME}/include/linux \ + -fPIC \ + -c cdfNativeLibrary.c + + For a Sun OS or Solaris sparc, the following command + will compile the JNI code into 32-bit mode (using Sun's compiler): + + cc -DSOLARIS -DHAVE_CONFIG_H -Kpic \ + -I${CDF_BASE}/include \ + -I${JAVA_HOME}/include \ + -I${JAVA_HOME}/include/solaris \ + -c cdfNativeLibrary.c + + For a Solaris sparc (8/9/10), the following command + will compile the JNI code into 64-bit mode (using Sun's compiler): + + cc -DSOLARIS -DSOLARIS64 -DHAVE_CONFIG_H -xarch=v9a -Kpic \ + -I${CDF_BASE}/include \ + -I${JAVA_HOME}/include \ + -I${JAVA_HOME}/include/solaris \ + -c cdfNativeLibrary.c + + For a Solaris sparc (8/9/10), the following command + will compile the JNI code into 64-bit mode (using Gnu's gcc compiler): + + gcc -DSOLARIS -DSOLARIS64 -m64 -fpic \ + -I${CDF_BASE}/include \ + -I${JAVA_HOME}/include \ + -I${JAVA_HOME}/include/solaris \ + -c cdfNativeLibrary.c + + If you have OSF1 on a DEC Alpha, the following command will compile the + JNI code: + + gcc -I${CDF_BASE}/include \ + -I${JAVA_HOME}/include/java \ + -I${JAVA_HOME}/include/java/alpha \ + -c cdfNativeLibrary.c + (You may need to include "-pthread" option if you use DEC's C + compiler.) + + If you are using the IBM JDK under Linux, the following command + will compile the JNI code: + + cc -I${CDF_BASE}/include \ + -I${JAVA_HOME}/include \ + -I${JAVA_HOME}/include/linux \ + -c cdfNativeLibrary.c + + If you are using Mac OS X, the following command will compile the + JNI code as well as create a shared library. It covers both this + step and the next step (go to step 6 after successful execution): + + (Refer Apple's "Mac OS X GM Release Notes: Java" for more information.) + + Power PC + -------- + gcc -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 + -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 (32-bit) + ------------------ + gcc -L/Developer/SDKs/MacOSX10.5.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 + + Intel Mac (64-bit) + ------------------ + gcc -L/Developer/SDKs/MacOSX10.5.sdk -arch x86_64 -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: Mac OS X 10.5 is binary-compatible with 10.6 and vice versa. + So /Developer/SDKs/MacOSX10.5u.sdk can be replaced with + /Developer/SDKs/MacOSX10.6u.sdk + + + NOTE: The include path is slightly different depending upon which + JDK version and operating system you use. + + +5. Create a shared library for the JNI code just compiled as follows: + + If you are using OSF1, Linux, Irix5|6, or AIX, use the following + command: + + ld -shared cdfNativeLibrary.o \ + -o ../lib/libcdfNativeLibrary.so -L${CDF_LIB} -lc -lm -lcdf + + If you are using a Solaris or Sun OS, use the following + command to make a 32-bit mode library: + + ld -G cdfNativeLibrary.o \ + -o ../lib/libcdfNativeLibrary.so -L${CDF_LIB} -lc -lm -lcdf + + If you are using a Solaris sparc (8|9), use the following command for + Sun's linker to make a 64-bit mode library: + + ld -G cdfNativeLibrary.o -64 -L/usr/lib/sparcv9 \ + -o ../lib/libcdfNativeLibrary.so -L${CDF_LIB} -lc -lm -lcdf + + Note: assume that 64-bit library is at /usr/lib/sparcv9. + + If you are using a Solaris sparc (8|9), use the following command for + Gnu's gcc linker to make a 64-bit mode library: + + gcc -G cdfNativeLibrary.o -m64 -L/usr/local/gcc-3.2/lib/sparcv9 \ + -o ../lib/libcdfNativeLibrary.so -L${CDF_LIB} -lc -lm -lcdf + + Note: assume that Gnu's 64-bit library is at /usr/local/gcc-3.2/lib/sparcv9. + + If you are using HP-UX, use the following command: + + ld -b cdfNativeLibrary.o \ + -o ../lib/libcdfNativeLibrary.sl -L${CDF_LIB} -lc -lm -lcdf + +6. Set the CLASSPATH and LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac OS X) + environment variables. + + 1) CLASSPATH should point to the following file(s): + + - the location (full path name) of the cdfjava.jar file that is + located in the cdfjava/classes directory. + + Example: + setenv CLASSPATH ${CLASSPATH}:.: ${CDF_JAVA}/classes/cdfjava.jar + + Optionally, if the Java-based CDF tools will be used, then also include + CDFToolsDriver.jar and cdfml.jar in the CLASSPATH. These jar files reside + in the ${CDF_JAVA}/cdftools and ${CDF_JAVA}/cdfml directroires, + respectively. + + 2) LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac OS X) should point to the + following files: + + - the location (full path name) of the libcdfNativeLibrary.[so|sl|jnilib] + created in step 5 (it should be under cdfjava/lib) + + - the location (full path name) of the CDF library (libcdf.[so|sl|jnilib] + that is defined by the environment variable CDF_LIB that is defined when + the CDF library is installed. + + Example: + setenv LD_LIBRARY_PATH .:${CDF_LIB}:${CDF_JAVA}/lib (Unix/Linux) + setenv DYLD_LIBRARY_PATH .:${CDF_LIB}:${CDF_JAVA}/lib (Mac OS X) + diff --git a/ext/cdf/cdf38_0-dist/README_cdf_tools.txt b/ext/cdf/cdf38_0-dist/README_cdf_tools.txt new file mode 100644 index 0000000..b850f34 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/README_cdf_tools.txt @@ -0,0 +1,173 @@ +CDF Utilities +============= +Below is a list of the CDF tools that are included as part of the standard CDF +distribution package and their descriptions. + +There are two different types of the CDF tools are distributed in the CDF +package: command line-based and GUI-based. + +GUI CDF Tools +------------- + 1) CDFToolsDriver.jar - contains the GUI version (Java) of the CDF tools + + This file contains a complete suite of the CDF tools. + + See HOWTO.run-Java-tools.txt in the directory on + how to run/invoke the GUI tools. + + 2) CDFso.exe (Windows only) + + This program contains MS Foundation Class-based CDFstats, CDFconvert, + CDFcompare, CDFinquire, CDFdump, SkeletonCDF, and + SkeletonTable + + Double-click the program and select the program you want to invoke + from the 'File' menu item. + + 3) CDFfsi.exe (Windows only) + + This program contains MS Foundation Class-based CDFedit and CDFexport + + Double-click the program and select the program you want to invoke + from the 'File' menu item. + + +Command-line CDF Tools +---------------------- +The following programs can be found under the /bin directory: + + 1) cdfcompare + 2) cdfconvert + 3) cdfdump + 4) cdfedit + 5) cdfexport + 6) cdfinquire + 7) cdfirsdump + 8) cdfleapsecondsinfo + 9) cdfmerge + 10) cdfstats + 11) cdfvalidate + 12) skeletoncdf + 13) skeletontable + +Enterring the program name alone will display the help message. + + +Description of CDF Utilities +============================ +CDFcompare + This utility is used to display a directory listing of a CDF's files. + The .cdf file is displayed first followed by the rVariable files and + then the zVariable files (if either exist in a multi-file CDF) in + numerical order. + +CDFconvert + This program is used to convert various properties of a CDF. In all + cases new CDFs are created (existing CDFs are not modified.) Any + combination of the following properties may be changed when converting + a CDF. + + - A CDF created with an earlier release of the CDF library (e.g., CDF + V2.5) may be converted to the current library release. + - The format of the CDF may be changed. + - The data encoding of the CDF may be changed. + - The variable majority of the CDF may be changed. + +CDFdump + This program dumps the data contents from a CDF file, including data + and metadata as well as variable information (e.g. data type, + dimensionality, number of written records, blocking factor, etc.). + +CDFedit + This program allows the display and/or modification of practically all + of the contents of a CDF by way of a full-screen interface. It is also + possible to run CDFedit in a browse-only mode if that's desired. + +CDFexport + This program allows the entire contents or a portion of a CDF file to be + exported to the terminal screen, a text file, or another CDF. The + variables to be exported can be selected along with a filter range for + each variable which allows a subset of the CDF to be generated. + When exporting to another CDF, a new compression and sparseness can be + specified for each variable. When exporting to the terminal screen or + a text file, the format of the output can be tailored as necessary. + +CDFinquire + This program displays the version of the CDF distribution being used and + the default toolkit qualifiers. + +CDFirsdump + This program dumps the Inernal Records (IRs) in a CDF file. + +CDFleapsecondsinfo + This program shows how the leap seconds is referenced by the CDF library + and optioanlly displays the table contents. + +CDFmerge + This program merges multiple CDFs into a single one. + +CDFstats + This program produces a statistical report on a CDF's variable data. + Both rVariables and zVariables are analyzed. For each variable it + determines the actual minimum and maximum values (in all of the variable + records), the minimum and maximum values within the valid range (if the + VALIDMIN and VALIDMAX vAttributes and corresponding entries are present + in the CDF), and the monotonicity. An option exists to allow fill + values (specified by the FILLVAL vAttribute) to be ignored when + collecting statistics. + +CDFvalidate + This program validates if a given file is a valid CDF file. If it's a valid + CDF file, it check's the integrity of CDF internal data structures. + +SkeletonTable + This program is used to create an ASCII text file called a skeleton table + containing information about a given CDF (SkeletonTable can also be + instructed to output the skeleton table to the terminal screen.) It reads + a CDF file and writes into the skeleton table the following information. + + 1. Format (single or multi file), data encoding, variable majority. + 2. Number of dimensions and dimension sizes for the rVariables. + 3. gAttribute definitions (and gEntry values). + 4. rVariable and zVariable definitions and vAttribute definitions + (with rEntry/zEntry values). + 5. Data values for all or a subset of the CDF's variables. + Traditionally, only NRV variable values are written to a skeleton + table. RV variable values may now also be written. The above + information is written in a format that can be "understood" by the + SkeletonCDF program. SkeletonCDF reads a skeleton table and creates + a new CDF (called a skeleton CDF). + +SkeletonCDF + This program is used to make a fully structured CDF, called a skeleton + CDF, by reading a text file called a skeleton table. The skeleton table + contains the information necessary to create a CDF that is complete in + all respects except for record-variant (RV) var iable values. (RV + variables vary from record to record.) RV values are then written to the + CDF by the execution of an application program. The SkeletonCDF program + allows a CDF to be created with the following. + + 1. The necessary header information - the number of dimensions and + dimension sizes for the rVariables, format, data encoding, and + variable majority. + 2. The gAttribute definitions and any number of gEntries for each. + 3. The rVariable and zVariable definitions. + 4. The vAttribute definitions and the entries corresponding to each + variable. + 5. The data values for those variables that are non-record-variant + (NRV). NRV variables do not vary from record to record. + +CDF2CDFML + This program extracts the contents of a CDF file into a XML file that + conforms to the CDF DTD or schema (a.k.a CDF Markup Language). + +CDFML2CDF: + This program creates a CDF file from a XML/CDFML file that conforms to + the CDF DTD or schema. + + The XML parser, SAX, is required to run this program. Note that Sun's + JDK 1.4 or a later version includes a XML parser so you don't need to + download a XML parser. Java Virtual Machines (JVMs) from some vendors + don't include a XML parser. If that's the case, please download a XML + parser of your choice. + diff --git a/ext/cdf/cdf38_0-dist/Release.notes b/ext/cdf/cdf38_0-dist/Release.notes new file mode 100644 index 0000000..264710a --- /dev/null +++ b/ext/cdf/cdf38_0-dist/Release.notes @@ -0,0 +1,144 @@ +/-----------------------------------/ +/ CDF V3.8.0.0 Release Notes / +/-----------------------------------/ + +1. Compatibility with all CDF 3.*, 2.7.6 and earlier versions + +CDF V3.7.1 is backward compatible with the previous versions of CDF, and it +can read CDF files that were created with earlier versions. + +If a file was created with CDF 2.7 and read and modified by CDF 3.*, the +resultant file will be saved in the CDF 2.7 format, not CDF 3.*. The same +principle applies to files that were created with CDF 2.5 and 2.6. CDF +files that are created from scratch with CDF V3.7.1 are compatible in file +structure with all CDF 3.*, but not compatible (due to a 64-bit file offsets +used since CDF 3.0 versions) with CDF 2.7.2 or earlier, and an attempt to +read CDF 3.* files from CDF 2.7.2 or earlier will produce an error. Since a +couple of new data types were added in V3.4, applications based on V3.3.* +and earlier will not be able access the V3.4 and later files if the files +have the data of those new types. However, if the files of V3.4 and later do +not contain data of the new data types, V3.*-based applications should have no +problems accessing them. + +Users of CDF 3.0 or later versions will be able to create CDF files that +can be read by CDF 2.7.2 or earlier by using the CDFsetFileBackward function +(in C) or CDF_set_FileBackward subroutine (in Fortran), or using the +CDF_FILEBACKWARD environment variable on Unix/Linux (including Mac OS X) or +PC, or CDF$FILEBACKWARD on OpenVMS. See Section 4.18 of the CDF C +Reference Manual and the CDF Fortran Reference Manual for details on how to +create CDF 2.7-compatible files. Note: There are a few new data types that are +only available in Version 3.1 and later, which can not be used in Version 2.*. + +All features added to the previous releases are included. Refer to the release +notes from the previous versions to view the specific features pertaining +to that release. + +2. Changes + +The following changes have been made/added in V3.8.0.* and prior versions: + + * Added a new option "-advformat" to tool program skeletontable to manage + how FORMAT attribute is used to encode the data and metadata. This option + will show data with more precision in the skeleton table. + * Modified code to use FILLVAL to fill the missing data if it exists, instead + of the pad value. + * String typed variable's pad value will only hold a single space and then + followed by NULs, instead of all spaces (for the number of elements). + * Modified skeletoncdf program to handle skeleton table with hidden character + carriage-return (\r) made from Windows. + * Added a few features to cdfconvert tool program. + * Added a few features to cdfconvert tool program. + * Modified skt2cdf to allow processing a skeleton table made in Windows + * to be used on non-Windows systems. + * Upgrade the zlib package to V2.1.11, which has code improvements and bug + * fixed. + * Added a set of time conversion functions between CDF_EPOCH, CDF_EPOCH16 + and CDF_TIME_TT2000 time and unix time. + * Added a new, general set of epoch encoding (toEncodexxxx) and parsing + toParsexxxx functions (where xxxx is EPOCH, EPOCH16 or TT2000) for each + of the CDF epoch data type. + * Expanded the CDF XML schema and allowed special characters used in + name. + * Encoded CDF epoch data in ISO8601 format, except skeleton table. + * Added ARM port. + * Added IA64 OpenVMS. + * Allowed Nul-terminting string data for attribute and variable data. + * Allowed multi-strings for variable attribute entries. + * Skip checksum verification if the data validation is turned off. + * Added cdfj.jar, the pure Java APIs that can read/write CDFs without + needing the CDF library and JNI. + * Revised the CDF schema to support new features. + * For Unix-based systems, "mkstemp" function is used to create the + temporary file in the template form of "mycdftmp.XXXXXX". + * For Unix-based systems, if CDF_TEMP is not defined, the temporary files + are created on the current directory (pwd), if it is writable. Otherwise, + environment variable: TMPDIR is used if it is defined. Otherwise, /tmp + directory is used. + * If adding data to a master file to create a new CDF, the leap second last + updated header field is updated with the information from the leap second + table if the data is of TT2000 data type. + * Added a new leap second for 1/1/2017. + * Added a new set of CDFread functions that will allocate the needed + space for the user. It is user's responsiblility to free the space after + use. + * New features were added in the cdfconvert, cdfdump tool programs. + * Modified library to space(s) filled string data that has a shorter + length than the defined (number of elements) while reading/writing. + * Modified Makefile and installation for Mac OS X El Captain (10.11). + * Used the preserved system temporary folder, e.g., /tmp for Linux/Unix/MacOSX, + to hold the temporary file(s). + * Set temporary file name using the random number generator with process id + and current time as the seed. + * Added support for computing TT2000 from UTC if the passed day is DOY + (day of the year from January 1st). + * Added a few options to cdfconvert tool program. + * Added a new leap second for 2015-07-01 to the leap second table. + * Added a new field "leapsecondlastupdated" in a CDF's GDR. This records + the leap second table a CDF is based upon. A set of read/write/validate + functions for the field is added to the library. + * Added a new record delete option in the library, which will rearrange + remaining records for sparse record variables. + * Skipped checking the given CDF file name for ASCII for reading. Only + enforce the file name to be ASCII, but not the directory portion, if + provided, for creating a CDF. + * Tool cdfconvert has a new option to sort the keyed variable, e.g., Epoch, + for the output file. + * Tool cdfconvert has a new option to validate a CDF, including the + variable data. + * A few bugs were fixed. + * Rename all CDF distributed MATLAB modules, prefixing each with "spdf", to + differentiate them with the ones come from MATLAB. + +Please refer to CHANGES.txt for the detailed code changes in various versions. + +3. How to Obtain the Latest Software + + Go to the CDF home page (http://cdf.gsfc.nasa.gov) and click the + Download CDF Software link. + + +4. Documentation + +The CDF documentation set consists of the following: + + cdf363ug.pdf (CDF User's Guide) + cdf363crm.pdf (CDF C Reference Manual) + cdf363frm.pdf (CDF Fortran Reference Manual) + cdf363prm.pdf (CDF Perl Reference Manual) + cdf363jrm.pdf (CDF Java Reference Manual) + cdf363csrm.pdf (CDF C# Reference Manual) + cdf363vbrm.pdf (CDF Visual Basic Reference Manual) + cdf36ifd.pdf (CDF Internal Format Description) + +These documents are available from the CDF home page (http://cdf.gsfc.nasa.gov). + +We have a user support office for CDF that you can contact when you need an +assistance. For requests, please send emails to: + + Internet -- gsfc-cdf-support@lists.nasa.gov + +Please let us know (via an email to CDFSUPPORT) if you get the distribution. +We would like to know who has the distribution so we know who to contact +when updates are available. + +CDFsupport diff --git a/ext/cdf/cdf35_0-dist/Welcome.txt b/ext/cdf/cdf38_0-dist/Welcome.txt similarity index 81% rename from ext/cdf/cdf35_0-dist/Welcome.txt rename to ext/cdf/cdf38_0-dist/Welcome.txt index c5da710..2a9ef7b 100644 --- a/ext/cdf/cdf35_0-dist/Welcome.txt +++ b/ext/cdf/cdf38_0-dist/Welcome.txt @@ -1,4 +1,4 @@ -This is the latest CDF V3.5.0 distribution package that contains everything +This is the latest CDF V3.8.0 distribution package that contains everything CDF offers except for the CDF Perl and C# APIs, and it contains the following items: diff --git a/ext/cdf/cdf38_0-dist/cdfjava/JavaAPIs.txt b/ext/cdf/cdf38_0-dist/cdfjava/JavaAPIs.txt new file mode 100644 index 0000000..f18cfb1 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/JavaAPIs.txt @@ -0,0 +1,2 @@ +Documentation for the CDF Java APIs can be found at +https://cdf.gsfc.nasa.gov/cdfjava_doc/index.html diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfj/cdfj.jar b/ext/cdf/cdf38_0-dist/cdfjava/cdfj/cdfj.jar new file mode 100644 index 0000000..9743c91 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/cdfj/cdfj.jar differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/AAREADME.1ST b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/AAREADME.1ST new file mode 100644 index 0000000..c9b7766 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/AAREADME.1ST @@ -0,0 +1,25 @@ +Files in the cdfml.tar archive... +----------------------------------------------------------- + +1. cdfml.jar: The Java archive file that contains CDF2CDFML and + CDFML2CDF Java tool programs. + +2. test.cdf: A test CDF file. + +3. testdtd.xml: A validated test XML file that conforms to CDF XML DTD. It + is created from CDF2CDFML program. + +4. testxsd.xml: A validated test XML file that conforms to CDF XML Schema. + +5. cdf.dtd: The CDF XML Document Type Definition (DTD). + +6. cdf.xsd: The CDF XML Schema. + +7. AAREADME.1ST: This file file that you are browsing. + +8. Readme.txt: This file contains the information on how to install and + run the Java-based CDF2CDFML and CDFML2CDF programs. + +9. about.cdfVarData: This file presents some examples of CDFML in + different forms. They are all valid and + comforming to cdf.dtd and cdf.xsd. diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/Readme.txt b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/Readme.txt new file mode 100644 index 0000000..44fe389 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/Readme.txt @@ -0,0 +1,84 @@ +*************************************************************************** +* Please make sure that you have done the following before proceeding * +* with the CDF Markup Language (CDFML) utilities: * +* * +* - installed JDK 1.5. Programs may fail running under an earleir JVM.* +* - installed/built the CDF distribution package. * +* - executed the definitions.* file located under the bin directory * +* of CDF installation (e.g. `source definitions.C' for C shell) to * +* define the environment variables (e.g. CDF_BASE, CDF_LIB, etc). * +* - installed the CDF Java APIs and built the CDF-Java JNI. * +* (Download the latest CDF Java APIs if you already have the * +* CDF-Java JNI.) * +* - optionally, install Sun's Multi-Schema XML Validator. * +*************************************************************************** + +Instructions for using the CDF's CDFML programs +----------------------------------------------- + +1. Download and un-tar the cdfml.tar archive file from the directory that + contains cdf35_0-dist. + +2. Set the CLASSPATH and LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac OSX) + environment variables. + + 1) CLASSPATH should point to the following information: + - the location (full path name) of the cdfml.jar file that was + extracted in step 1. + - the location (full path name) of the cdfjava.jar file. + + Examples: + + - using Sun's V1.5 + + setenv CLASSPATH ${CLASSPATH}:.: \ + /home/cdf/cdf35_0-dist/cdfjava/classes/cdfjava.jar: \ + /home/cdf/cdf35_0-dist/cdfjava/cdfml/cdfml.jar + + Note: + Absolute/full path name (not relative path) MUST be used when adding + the location of a program to the CLASSPATH environment variable. + + + 2) LD_LIBRARY_PATH should point to the following information: + - the location (full path name) of the CDF-Java JNI + libcdfNativeLibrary.[so|sl|jnilib] (it should be under cdfjava/lib + from the distribution) + + - the location (full path name) of the CDF shared library that is + defined by the environment variable CDF_LIB. This variable is + defined when the CDF library is installed. + + Example: + setenv LD_LIBRARY_PATH .:/home/cdf/cdf35_0-dist/cdfjava/lib:${CDF_LIB} + + OR for Mac OSX, + setenv DYLD_LIBRARY_PATH .:/home/cdf/cdf35_0-dist/cdfjava/lib:${CDF_LIB} + + +3. Use CDF2CDFML Java program to create a CDFML document from a CDF file. + To get the instructions and valid arguments/options, enter: + + java CDF2CDFML + +4. Use CDFML2CDF Java program to convert a CDFML document to a CDF file. To + get the instructions and valid arguments/options, enter: + + java CDFML2CDF + +5. Use Sun's Multi-Schema Validator, a Java tool, to validate a CDFML document + conforming to cdf.dtd or cdf.xsd, if needed. + + Run: java -jar msv.jar cdf.dtd test.xml or + java -jar msv.jar cdf.xsd testxsd.xml + + +Note: + If one creates a CDFML file from an existing CDF file and creates a new + CDF file from that CDFML file, the contents of the new file is the same + as the original CDF file. But the ordering of some of the variable + attributes in the new file could be different from the original file + that should be transparent to the users. + + Please direct any comments or questions to: + gsfc-cdf-support@lists.nasa.gov diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/about.cdfVarData b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/about.cdfVarData new file mode 100644 index 0000000..010ce5e --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/about.cdfVarData @@ -0,0 +1,70 @@ +Information here represents some valid but different forms for the cdfVarData +element. Data values specified within the 'record' tag constitutes a record. + + Example 1: + + 10 20 30 + 40 50 60 + + + Example 2: + + 10 20 + 30 + + + 40 + 50 + 60 + + + + Example 3: + + + @~First string@~ + @~second string@~ + + + + Example 4: + + + First string + Second string + + + + Example 5 (sparse elements): + + + 10 + 123 + + + + Example 6: + + + 10 0 0 0 0 123 0 0 0 0 + + + + +NOTE: + The first example is identical to the second example. The optional + recNum attribute specifies the record number. If it is not + present, it would be record number 0 or the next record from + the previous record number (either specified or not). + The third example is identical to the fourth example. The CDF_CHAR + or CDF_UCHAR data type variable needs delimiter (default or + user specified) to delimit elements' multi-values data for + a record. + The fifth example is similar to the sixth example. It + allows to provide data values only for those elements + that have real data. Other elements will have default + values. This is a sampled 1D variable with 10 integer + elements. If the CDF distribution is built to have 0 + as the default value for an integer, these two examples + will create two identical CDF files by CDFML2CDF. + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/arow.cdf b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/arow.cdf new file mode 100644 index 0000000..125f645 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/arow.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.dtd b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.dtd new file mode 100644 index 0000000..1cbff9e --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.dtd @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.xsd b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.xsd new file mode 100644 index 0000000..0725f10 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.xsd @@ -0,0 +1,306 @@ + + + + + Schema for CDF Markup Language (CDFML) + Version: 1.2 (October 21, 2011) + History: + Date Version Comments + ==== ======= ======== + May 2002 1.0 Original + Oct 11, 2007 1.1 Made the default namespace the same as the + targetNamespace. + Added the CDF_EPOCH16 data type. + Oct 21, 2011 1.2 Added CDF_INT8 and CDF_TIME_TT2000 data types. + May 21, 2018 1.2 Added data types for choice elements. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.xsd-orig b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.xsd-orig new file mode 100644 index 0000000..59b1ad5 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdf.xsd-orig @@ -0,0 +1,257 @@ + + + + + Schema for CDF Markup Language (CDFML) + Version: 1.2 (October 21, 2011) + History: + Date Version Comments + ==== ======= ======== + May 2002 1.0 Original + Oct 11, 2007 1.1 Made the default namespace the same as the + targetNamespace. + Added the CDF_EPOCH16 data type. + Oct 21, 2011 1.2 Added CDF_INT8 and CDF_TIME_TT2000 data types. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdfml.jar b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdfml.jar new file mode 100644 index 0000000..b4e9d99 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/cdfml.jar differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/test.cdf b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/test.cdf new file mode 100644 index 0000000..2d3a7f8 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/test.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/test.xml b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/test.xml new file mode 100644 index 0000000..ce09a03 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/test.xml @@ -0,0 +1,369 @@ + + + + + + + + + + + + 5.3432 + 5.5 + 5.5 10.2 + 1 + 1 2 3 + -32768 + 1 2 + 3 + 4 5 + + 4294967295 + 4294967295 2147483648 + 65535 + 65535 65534 + 255 + 255 254 + + + 25-Apr-2002 00:00:00.000 + 2008-02-04T06:08:10.012014016 + + + 13-May-2004 15:08:11.022.033.044.055 + + + + + + + + 20 + + + 90 + + + + 1 2 3 + + + + + + 254 254 5 + 15 25 35 + 100 128 255 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -32767 -32767 -32767 + 10 20 30 + 40 32767 -32768 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + 11 22 33 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + + + + + + 101 201 301 + 21 65534 31 + 51 65534 61 + 32767 65534 65535 + 65534 65534 65534 + 333 444 555 + + + + + + 110 210 310 410 510 610 + 10 20 40 50 7 8 + 90 95 96 97 32767 -32768 + + + + + + 10 20 40 50 7 8 9 10 90 95 96 97 98 99 80 85 + + + + + + 100 200 300 400 500 600 + 4294967294 4294967294 4294967294 4294967294 4294967294 4294967294 + 4294967294 4294967294 4294967294 4294967294 4294967294 4294967294 + 10 20 40 50 70 80 + 90 95 96 97 2147483648 4294967295 + + + + + + 100 128 255 + + + + + + + + + + + + + 55.5 -1.0E30 66.6 + 666.66 777.77 888.88 + 96.5 97.5 98.5 + 100.5 110.6 120.7 + 200.5 210.6 220.7 + + + + + + 5.5 -0.0 6.6 + 9.5 -0.0 8.5 + 10.5 10.6 10.7 + 20.5 20.6 20.7 + -1.0E30 -1.0E30 -1.0E30 + 333.3 444.4 555.5 + + + + + + 55.55 + 66.66 + -1.0E30 + -1.0E30 + -1.0E30 + 999.99 + + + + + + 9.5 -0.0 8.5 + + + + + + 77.77 + + + + + + -1.0E30 -1.0E30 -1.0E30 + 18888.8 -1.0E30 19999.9 + -1.0E30 -1.0E30 -1.0E30 + -1.0E30 -1.0E30 -1.0E30 + -1.0E30 -1.0E30 -1.0E30 + 333.333 444.444 555.555 + 10.5 10.6 10.7 + 20.5 20.6 20.7 + + + + + + + 13-May-2002 00:00:00.000 + + + + 05-Mar-1999 05:06:07.100 + 02-Jan-1998 03:04:05.666 + + + + + + + 13-May-2002 15:08:01.002.003.004.005 + + + + 29-Nov-2004 15:55:23.030.411.522.634 + 29-Dec-2004 16:56:24.031.411.522.634 + 29-Dec-2005 16:56:24.031.444.555.777 + + + + + + 88888 99999 + 1 -1 + 10 -10 + 9223372036854775807 -9223372036854775808 + + + + + + + 2010-05-13T10:20:30.040050060 + + + + 2008-12-31T23:59:58.123456789 + 2008-12-31T23:59:59.123456789 + 2008-12-31T23:59:60.123456789 + 2009-01-01T00:00:00.123456789 + 2009-01-01T00:00:01.123456789 + 2009-01-01T00:00:02.223456789 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -32767 -32767 -32767 + 10 20 30 + 40 32767 -32768 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + 11 22 33 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + 100 200 300 + -32767 -32767 -32767 + 10 20 30 + 40 32767 -32768 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + 11 22 33 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -32767 -32767 -32767 + 10 20 30 + 40 32767 -32768 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + 11 22 33 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + -32767 -32767 -32767 + + + + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testdtd.xml b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testdtd.xml new file mode 100644 index 0000000..bacdd0a --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testdtd.xml @@ -0,0 +1,374 @@ + + + + + + + + + + + + 5.3432 + 5.5 + 5.5 10.2 + 1 + 1 2 3 + -32768 + 1 2 + 3 + 4 5 + + 4294967295 + 4294967295 2147483648 + 65535 + 65535 65534 + 255 + 255 254 + + + 25-Apr-2002 00:00:00.000 + + + 13-May-2004 15:08:11.022.033.044.055 + + + + + + + + 20 + + + 90 + + + + 1 2 3 + + + + + + 0 0 5 + 15 25 35 + 100 128 255 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + + + + + + 101 201 301 + 21 0 31 + 51 0 61 + 32767 0 65535 + 0 0 0 + 333 444 555 + + + + + + 110 210 310 410 510 610 + 10 20 40 50 7 8 + 90 95 96 97 32767 -32768 + + + + + + 10 20 40 50 7 8 9 10 90 95 96 97 98 99 80 85 + + + + + + 100 200 300 400 500 600 + 0 0 0 0 0 0 + 0 0 0 0 0 0 + 10 20 40 50 70 80 + 90 95 96 97 2147483648 4294967295 + + + + + + 100 128 255 + + + + + + + + + + + + + 55.5 0.0 66.6 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 666.66 777.77 888.88 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 96.5 97.5 98.5 + 100.5 110.6 120.7 + 200.5 210.6 220.7 + + + + + + 5.5 -0.0 6.6 + 9.5 -0.0 8.5 + 10.5 10.6 10.7 + 20.5 20.6 20.7 + 0.0 0.0 0.0 + 333.3 444.4 555.5 + + + + + + 55.55 + 66.66 + 0.0 + 0.0 + 0.0 + 999.99 + + + + + + 9.5 -0.0 8.5 + + + + + + 77.77 + + + + + + 0.0 0.0 0.0 + 18888.8 0.0 19999.9 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 333.333 444.444 555.555 + 10.5 10.6 10.7 + 20.5 20.6 20.7 + + + + + + + 13-May-2002 00:00:00.000 + + + + 05-Mar-1999 05:06:07.100 + 02-Jan-1998 03:04:05.666 + + + + + + + 13-May-2002 15:08:01.002.003.004.005 + + + + 29-Nov-2004 15:55:23.030.411.522.634 + 29-Dec-2004 16:56:24.031.411.522.634 + 29-Dec-2005 16:56:24.031.444.555.777 + + + + + + 88888 99999 + 1 -1 + 10 -10 + 9223372036854775807 -9223372036854775808 + + + + + + 2008-12-31T23:59:58.123456789 + 2008-12-31T23:59:59.123456789 + 2008-12-31T23:59:60.123456789 + 2009-01-01T00:00:00.123456789 + 2009-01-01T00:00:01.123456789 + 2009-01-01T00:00:02.123456789 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + + + + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testnew.cdf b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testnew.cdf new file mode 100644 index 0000000..d1f212c Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testnew.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testxsd.xml b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testxsd.xml new file mode 100644 index 0000000..1955d62 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/cdfml/testxsd.xml @@ -0,0 +1,343 @@ + + + + + + + + + + + + 5.3432 + 5.5 + 5.5 10.2 + 1 + 1 2 3 + -32768 + 1 2 + 3 + 4 5 + + 4294967295 + 4294967295 2147483648 + 65535 + 65535 65534 + 255 + 255 254 + + + 25-Apr-2002 00:00:00.000 + + + 13-May-2004 15:08:11.022.033.044.055 + + + + + + + + 20 + + + 90 + + + + 1 2 3 + + + + + + 0 0 5 + 15 25 35 + 100 128 255 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + + + + + + 101 201 301 + 21 0 31 + 51 0 61 + 32767 0 65535 + 0 0 0 + 333 444 555 + + + + + + 110 210 310 410 510 610 + 10 20 40 50 7 8 + 90 95 96 97 32767 -32768 + + + + + + 10 20 40 50 7 8 9 10 90 95 96 97 98 99 80 85 + + + + + + 100 200 300 400 500 600 + 0 0 0 0 0 0 + 0 0 0 0 0 0 + 10 20 40 50 70 80 + 90 95 96 97 2147483648 4294967295 + + + + + + 100 128 255 + + + + + + + + + + + + + 55.5 0.0 66.6 + 666.66 777.77 888.88 + 96.5 97.5 98.5 + 100.5 110.6 120.7 + 200.5 210.6 220.7 + + + + + + 5.5 -0.0 6.6 + 9.5 -0.0 8.5 + 10.5 10.6 10.7 + 20.5 20.6 20.7 + 0.0 0.0 0.0 + 333.3 444.4 555.5 + + + + + + 55.55 + 66.66 + 0.0 + 0.0 + 0.0 + 999.99 + + + + + + 9.5 -0.0 8.5 + + + + + + 77.77 + + + + + + 0.0 0.0 0.0 + 18888.8 0.0 19999.9 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 0.0 0.0 0.0 + 333.333 444.444 555.555 + 10.5 10.6 10.7 + 20.5 20.6 20.7 + + + + + + + 13-May-2002 00:00:00.000 + + + + 05-Mar-1999 05:00:00.000 02-Jan-1998 03:00:00.000 + + + + + + + 13-May-2002 15:08:01.002.003.004.005 + + + + 29-Nov-2004 15:55:23.030.411.522.634 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + + + + + + + + + + 180 + + + + + + + + + + + + + 100 200 300 + -99 -99 -99 + 10 20 30 + 40 32767 -32768 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + 11 22 33 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + -99 -99 -99 + + + + diff --git a/ext/cdf/cdf38_0-dist/cdfjava/cdftools/CDFToolsDriver.jar b/ext/cdf/cdf38_0-dist/cdfjava/cdftools/CDFToolsDriver.jar new file mode 100644 index 0000000..3c56c99 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/cdftools/CDFToolsDriver.jar differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/classes/cdfjava.jar b/ext/cdf/cdf38_0-dist/cdfjava/classes/cdfjava.jar new file mode 100644 index 0000000..9c18985 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/classes/cdfjava.jar differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/CreateCDF.class b/ext/cdf/cdf38_0-dist/cdfjava/examples/CreateCDF.class new file mode 100644 index 0000000..b66eece Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/CreateCDF.class differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/CreateCDF.java b/ext/cdf/cdf38_0-dist/cdfjava/examples/CreateCDF.java new file mode 100644 index 0000000..50415cc --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/examples/CreateCDF.java @@ -0,0 +1,879 @@ +/****************************************************************************** +* Copyright 1996-2013 United States Government as represented by the +* Administrator of the National Aeronautics and Space Administration. +* All Rights Reserved. +******************************************************************************/ + +import java.io.*; +import java.text.*; +import java.util.*; +import gsfc.nssdc.cdf.*; +import gsfc.nssdc.cdf.util.*; + +/** + * This test program demonstrates how to create a single-file CDF + * called test.cdf. It also copies a variable along with data out of + * test.cdf and creates a new single-file CDF called test1.cdf. + * + * Thie program demonstrates the following techniques: + * + * - how to create a variable + * - how to create a global attribute + * - how to create a variable attribute + * - how to create a global variable attribute entry + * - how to create a variable attribute entry + * - how to add data to a variable + * - how to delete a variable attribute + * - how to rename a variable + * - how to rename a variable attribute + * - how to copy a variable with or without data + * - how to delete data (records) out of a variable + * - how to set options that are available with a CDF file and a variable + */ + +public class CreateCDF implements CDFConstants{ + + public static void main(String[] args) { + CDF cdf = null, + cdf1 = null; + + try { + + /******************************************************************/ + /* If the file to be created is a multifile (not a single file), */ + /* the following restrictions apply: */ + /* */ + /* - CDF file extension is not allowed (i.e. .cdf) */ + /* - Compression and sparse records are not allowed */ + /* - Deleting a variable is not allowed */ + /******************************************************************/ + File cdfFile = new File("test.cdf"); + if (cdfFile.exists()) cdfFile.delete(); + + cdfFile = new File("test1.cdf"); + if (cdfFile.exists()) cdfFile.delete(); + + //CDF.setFileBackward(BACKWARDFILEoff); + cdf = CDF.create("test"); + cdf1 = CDF.create("test1"); + + // cdf.setFormat(SINGLE_FILE); // Set to signle-file CDF + cdf.setChecksum(MD5_CHECKSUM); + + /*************************************************/ + /* Set the information/warning message flag */ + /* - By default, this flag is turned off */ + /* - setInfoWarningOn() turns on the flag */ + /* - setInfoWarningOff() turns off the flag */ + /*************************************************/ + // cdf.setInfoWarningOn(); + + /*******************************************/ + /* Create global and variable attributes */ + /*******************************************/ + Attribute + project = Attribute.create(cdf, "Project", GLOBAL_SCOPE), + pi = Attribute.create(cdf, "PI", GLOBAL_SCOPE), + test = Attribute.create(cdf, "Test", GLOBAL_SCOPE), + testDate = Attribute.create(cdf, "TestDate", GLOBAL_SCOPE), + ep16TestDate = Attribute.create(cdf, "epTestDate", GLOBAL_SCOPE), + + validMin = Attribute.create(cdf, "VALIDMIN", VARIABLE_SCOPE), + validMax = Attribute.create(cdf, "VALIDMAX", VARIABLE_SCOPE), + snafu = Attribute.create(cdf, "snafu", VARIABLE_SCOPE), + dummy = Attribute.create(cdf, "dummy", VARIABLE_SCOPE), + myAttr = Attribute.create(cdf, "myAttr", VARIABLE_SCOPE); + + System.out.println("Created attributes."); + + /**********************/ + /* Create variables */ + /**********************/ + long numElements = 1, + numDims = 1, + dimVary[] = {VARY}, + noDimVary[] = {NOVARY}, + dimVariance1[] = {VARY, VARY}, + dimVariance2[] = {VARY, NOVARY}; + + Variable + latitude = Variable.create(cdf, "Latitude", + CDF_INT1, + 1, 1, new long [] {3}, + NOVARY, /* recVary */ + new long [] {VARY}), + + latitude1 = Variable.create(cdf, "Latitude1", + CDF_UINT1, + 1, 1, new long [] {3}, + VARY, + new long [] {VARY}), + + longitude = Variable.create(cdf, "Longitude", + CDF_INT2, + numElements, numDims, + new long [] {3}, /* dimSizes */ + VARY, /* recVary */ + new long [] {VARY}), + + longitude1 = Variable.create(cdf, "Longitude1", + CDF_UINT2, + numElements, numDims, + new long [] {3}, /* dimSizes */ + VARY, /* recVary */ + dimVary), /* dimVary */ + + delta = Variable.create(cdf, "Delta", + CDF_INT4, + 1, 2, new long [] {3,2}, + VARY, dimVariance1), + + volume = Variable.create(cdf, "volume", + CDF_INT4, + 1, 3, new long [] {2,4,2}, + VARY, new long [] {VARY, VARY, VARY}), + + time = Variable.create(cdf, "Time", + CDF_UINT4, + 1, 2, new long [] {3,2}, + VARY, dimVariance1), + + dvar = Variable.create(cdf, "dvar", CDF_INT2, + 1, 1, new long [] {3}, + NOVARY, + new long [] {NOVARY}), + + name = Variable.create(cdf, "Name", + CDF_CHAR, + 10, 1, new long [] {2}, + VARY, + new long [] {VARY}), + + temp = Variable.create(cdf, "Temp", CDF_FLOAT, + 1, 1, new long [] {3}, + VARY, + new long [] {VARY}), + + temp1 = Variable.create(cdf, "Temp1", CDF_REAL4, + 1, 1, new long [] {3}, + VARY, + new long [] {VARY}), + + temp2 = Variable.create(cdf, "Temperature", CDF_FLOAT, + 1, 0, new long [] {1}, + VARY, + new long [] {NOVARY}), + + temp3 = Variable.create(cdf, "Temperature1", CDF_FLOAT, + 1, 1, new long [] {3}, + NOVARY, + new long [] {VARY}), + + temp4 = Variable.create(cdf, "Temperature2", CDF_FLOAT, + 1, 0, new long [] {1}, + NOVARY, + new long [] {NOVARY}), + + dp = Variable.create(cdf, "dp", CDF_DOUBLE, + 1, 1, new long [] {3}, + VARY, + new long [] {VARY}), + + ep = Variable.create(cdf, "ep", CDF_EPOCH, + 1, 0, new long [] {0}, + VARY, + new long [] {NOVARY}), + + ep16 = Variable.create(cdf, "ep16", CDF_EPOCH16, + 1, 0, new long [] {0}, + VARY, + new long [] {NOVARY}), + + newI8 = Variable.create(cdf, "newI8", CDF_INT8, + 1, 1, new long [] {2}, + VARY, + new long [] {VARY}), + + tt2000 = Variable.create(cdf, "tt2000", CDF_TIME_TT2000, + 1, 0, new long [] {0}, + VARY, + new long [] {NOVARY}), + + dummyVar = Variable.create(cdf, "DummyVar", + CDF_EPOCH, + 1, 0, new long [] {0}, + VARY, + new long [] {NOVARY}); + + System.out.println("Created variables."); + + /*********************************/ + /* Set miscelleneous settings. */ + /*********************************/ + // cdf.setCompression(RLE_COMPRESSION, new long[] {0}); + cdf.setMajority(ROW_MAJOR); /* Default is ROW_MAJOR */ + // cdf.setEncoding(SUN_ENCODING); + + cdf.selectNegtoPosfp0(NEGtoPOSfp0off); + cdf.selectCDFCacheSize(400L); + cdf.selectCompressCacheSize(500L); + cdf.selectStageCacheSize(600L); + + System.out.println("Mode: "+ + cdf.confirmzMode()); + System.out.println("Neg -0.0 to 0.0: "+ + cdf.confirmNegtoPosfp0()); + System.out.println("CDF Cache size: "+ + cdf.confirmCDFCacheSize()); + System.out.println("Compression Cache Size: "+ + cdf.confirmCompressCacheSize()); + System.out.println("Stage Cache Size: "+ + cdf.confirmStageCacheSize()); + System.out.println("\nDefined CDF file options..."); + + dvar.setDimVariances (new long [] {VARY}); + + longitude.selectCacheSize(700L); + longitude.setCompression(GZIP_COMPRESSION, new long[] {9}); +// longitude.setPadValue(new Short((short) -99)); + longitude.setBlockingFactor(130L); + longitude.setInitialRecords(20L); +System.out.println("pad value="+longitude.getPadValue()+" status="+cdf.getStatus()+" confirm="+longitude.confirmPadValue()); + + // Only applicable to compressed z variables + longitude.selectReservePercent(15L); + + System.out.println("Cache Size (longitude): "+ + longitude.confirmCacheSize()); + System.out.println("Reserver Percentage (longitude): "+ + longitude.confirmReservePercent()); + + temp.setSparseRecords(PAD_SPARSERECORDS); + time.setBlockingFactor(60); +// ep.setSparseRecords(PREV_SPARSERECORDS); + + // Only applicable to uncompressed Z vars in a single-file CDF. + ep.allocateRecords(3L); + + long firstRec = 9, lastRec = 20; + time.allocateBlock(firstRec, lastRec); + + System.out.println ("time.getAllocatedFrom(4L): "+ + time.getAllocatedFrom(4L)); + System.out.println ("time.getAllocatedTo(13L): "+ + time.getAllocatedFrom(13L)); + + /*******************************************/ + /* Add entries to global attributes */ + /* */ + /* NOTE: entry value must be a Java object */ + /*******************************************/ + Double entryValue = new Double(5.3432); + + System.out.println("Adding global attribute entries..."); + + Entry.create(project, 0, CDF_CHAR, "Using the CDFJava API"); + Entry.create(pi, 3, CDF_CHAR, "Ernie Els"); + System.out.println("\tchars completed."); + + Entry.create(test, 0, CDF_DOUBLE, entryValue); + Entry.create(test, 1, CDF_DOUBLE, new double []{5.3, 2.3}); + System.out.println("\tdoubles completed."); + + Entry.create(test, 2, CDF_FLOAT, new Float(5.5)); + Entry.create(test, 3, CDF_FLOAT, + new float [] {(float)5.5,(float)10.2}); + System.out.println("\tfloats completed."); + + Entry.create(test, 4, CDF_INT1, new Byte((byte)1)); + Entry.create(test, 5, CDF_INT1, + new byte [] {(byte) 1, (byte)2, (byte)3}); + System.out.println("\tbytes completed."); + + Entry.create(test,6,CDF_INT2,new Short((short)-32768)); + Entry.create(test, 7, CDF_INT2, + new short [] {(short)1,(short)2}); + System.out.println("\tshorts completed."); + + Entry.create(test, 8, CDF_INT4, new Integer(3)); + Entry.create(test, 9, CDF_INT4, new int [] {4,5}); + System.out.println("\tintegers completed."); + + Entry.create(test, 10, CDF_CHAR, "This is a string"); + System.out.println("\tString completed."); + + Entry.create(test,11,CDF_UINT4, new Long(4294967295L)); + Entry.create(test,12,CDF_UINT4, + new long[] {4294967295L,2147483648L}); + System.out.println("\tUINT4 completed."); + + Entry.create(test,13,CDF_UINT2,new Integer(65535)); + Entry.create(test,14,CDF_UINT2,new int[]{65535,65534}); + System.out.println("\tUINT2 completed."); + + Entry.create(test,15,CDF_UINT1, new Short((short)255)); + Entry.create(test,16,CDF_UINT1, new short[] {255,254}); + System.out.println("\tUINT1 completed."); + + double testDateData = Epoch.compute(2002, 4, 25, 0, 0, 0, 0); + Entry.create(testDate, 1, CDF_EPOCH, new Double(testDateData)); + System.out.println("\tEPOCH completed."); + + double[] ep16Data = new double[2]; + double ep_status = Epoch16.compute(2004, 5, 13, 15, 8, + 11, 22, 33, 44, 55, ep16Data); + Entry.create(ep16TestDate, 0, CDF_EPOCH16, ep16Data); + System.out.println("\tEPOCH16 completed."); + + long testTT2000 = CDFTT2000.compute(2008, 2, 4, 6, 8, 10, 12, 14, 16); + Entry.create(testDate, 2, CDF_TIME_TT2000, + new Long(testTT2000)); + System.out.println("\tEPOCH completed."); + + /************************************/ + /* Add variable attribute entries */ + /************************************/ + System.out.println("Adding variable attribute entries..."); + + // Entry.create(validMin, longitude.getID(), CDF_INT2, + // new Short((short)10)); + Entry.create(validMin, longitude.getID(), CDF_INT2, + new Short((short)-10)); + latitude.putEntry(validMin, CDF_INT2, new Short((short)20)); + System.out.println("\tAdded VALIDMIN entries."); + + longitude.putEntry(validMax, CDF_INT2, new Short((short)180)); + latitude.putEntry(validMax, CDF_INT2, new Short((short)90)); + System.out.println("\tAdded VALIDMAX entries."); + + longitude.putEntry(snafu, CDF_CHAR, "test1"); + System.out.println("\tAdded snafu for Longitude."); + + double testDateData1 = Epoch.compute(2002, 5, 13, 0, 0, 0, 0); + ep.putEntry(dummy, CDF_EPOCH, new Double(testDateData1)); + System.out.println("\tAdded dummy for ep."); + + ep_status = Epoch16.compute(2002L, 5L, 13L, 15L, 8L, + 1L, 2L, 3L, 4L, 5L, ep16Data); + ep16.putEntry(dummy, CDF_EPOCH16, ep16Data); + System.out.println("\tAdded dummy for ep16."); + + longitude.putEntry(dummy, CDF_CHAR, "test2"); + System.out.println("\tAdded dummy for Longitude."); + + long testDateData2 = CDFTT2000.compute(2010, 5, 13, 10, 20, 30, 40, + 50, 60); + tt2000.putEntry(dummy, CDF_TIME_TT2000, new Long(testDateData2)); + System.out.println("\tAdded dummy for tt2000."); + + char ch = 'a'; + String myStr = String.valueOf(ch); + longitude.putEntry(myAttr, CDF_CHAR, myStr); + System.out.println("\tAdded myAttr for Longitude."); + + /*************************/ + /* Delete an attribute */ + /*************************/ +// dummy.delete(); + + /***********************/ + /* Add variable data */ + /***********************/ + long recNum = 0, + recCount = 2, + recInterval = 1, + indicies[] = {0}, + dimIndicies[] = {0}, + dimCounts[] = {3}, + dimIntervals[] = {1}; + + System.out.println("Adding variable data..."); + + /***************************/ + /* Add data to longitude */ + /***************************/ + long status; + short [][] longitudeData = {{10, 20, 30}, + {40, 32767, -32768}}; + + longitude.putSingleData(recNum, indicies, new Short((short)100)); + status = cdf.getStatus(); + if (status != CDF_OK) { + String statusText = CDF.getStatusText(status); + System.out.println (statusText); + } + + longitude.putSingleData(0L, new long[] {1}, new Short((short)200)); + longitude.putSingleData(0L, new long[] {2}, new Short((short)300)); + System.out.println("\tAdded a single longitude variable data."); + + recNum = 2; + longitude.putHyperData(recNum, recCount, recInterval, + dimIndicies, dimCounts, dimIntervals, + longitudeData); + System.out.println("\tAdded a hyperput longitude variable data."); + + recNum = 10; + longitude.putRecord (recNum, new short[] {11, 22, 33}); + System.out.println("\tAdded a single longitude variable data."); + + /****************************/ + /* Add data to longitude1 */ + /****************************/ + int [][] longitude1Data = {{21, 31}, + {51, 61}, + {32767, 65535}}; + + longitude1.putSingleData(0L, indicies, new Integer((int)101)); + longitude1.putSingleData(0L, new long[] {1}, new Integer((int)201)); + longitude1.putSingleData(0L, new long[] {2}, new Integer((int)301)); + System.out.println("\tAdded a single longitude1 variable data."); + + recNum = 1; + dimIntervals[0] = 2; + longitude1.putHyperData(recNum, 3, recInterval, + dimIndicies, new long[] {2}, + dimIntervals, + longitude1Data); + System.out.println("\tAdded a hyperput longitude1 variable data."); + + /**************************/ + /* Add data to latitude */ + /**************************/ + byte [][] latitudeData = { {15, 25, 35}, + {45, 127, -128} }; + + latitude.putSingleData(0L, indicies, new Byte((byte)1)); + latitude.putSingleData(0L, new long[] {1}, new Byte((byte)2)); + latitude.putSingleData(0L, new long[] {2}, new Byte((byte)3)); + System.out.println("\tAdded a single latitude variable data."); + + /***************************/ + /* Add data to latitude1 */ + /***************************/ + short [][] latitude1Data = { {15, 25, 35}, + {100, 128, 255} }; + + latitude1.putSingleData(0L, new long[] {2}, new Short((short)5)); + System.out.println("\tAdded a single latitude1 variable data."); + + // This record will overwrite the first record + + recNum = 1; + recCount = 2; + latitude1.putHyperData(recNum, recCount, recInterval, + new long[] {0}, new long[] {3}, + new long[] {1}, latitude1Data); + System.out.println("\tAdded a hyperput latitude1 variable data."); + + /***********************/ + /* Add data to Delta */ + /***********************/ + int [][][] deltaData = { {{10,20}, {40,50}, {7, 8}}, + {{90,95},{96,97}, {32767, -32768}} + }; + delta.putSingleData(0L, new long[] {0,0}, new Integer((int)110)); + delta.putSingleData(0L, new long[] {0,1}, new Integer((int)210)); + delta.putSingleData(0L, new long[] {1,0}, new Integer((int)310)); + delta.putSingleData(0L, new long[] {1,1}, new Integer((int)410)); + delta.putSingleData(0L, new long[] {2,0}, new Integer((int)510)); + delta.putSingleData(0L, new long[] {2,1}, new Integer((int)610)); + + delta.putHyperData(1L, 2L, 1L, new long[] {0,0}, new long[] {3,2}, + new long[] {1,1}, deltaData); + + System.out.println("\tAdded delta data."); + + /************************/ + /* Add data to Volume */ + /************************/ + int [][][] volumeData = { {{10,20}, {40,50}, {7, 8}, {9,10}}, + {{90,95}, {96,97}, {98, 99}, {80,85}} + }; + volume.putHyperData(0L, 1L, 1L, + new long[] {0,0,0}, // dimension indicies + new long[] {2,4,2}, // dimension sizes + new long[] {1,1,1}, // dimension interval + volumeData); + + System.out.println("\tAdded volume data."); + + /**********************/ + /* Add data to Time */ + /**********************/ + long [][][] timeData = {{{10,20},{40,50},{70, 80}}, + {{90,95},{96,97},{2147483648L,4294967295L}} + }; + time.putSingleData(0L, new long[] {0,0}, new Long((long)100)); + time.putSingleData(0L, new long[] {0,1}, new Long((long)200)); + time.putSingleData(0L, new long[] {1,0}, new Long((long)300)); + time.putSingleData(0L, new long[] {1,1}, new Long((long)400)); + time.putSingleData(0L, new long[] {2,0}, new Long((long)500)); + time.putSingleData(0L, new long[] {2,1}, new Long((long)600)); + + time.putHyperData(5L, 2L, 1L, new long[] {0,0}, new long[] {3,2}, + new long[] {1,1}, timeData); + + System.out.println("\tAdded time data."); + + /**********************/ + /* Add data to dvar */ + /**********************/ + short [][] dvarData = {{15, 25, 35}, + {100, 128, 255} }; + + dvar.putSingleData(0L, new long[] {0}, new Short((short)5)); + dvar.putSingleData(1L, new long[] {1}, new Short((short)6)); + System.out.println("\tAdded a single dvar variable data."); + + recNum = 1; + recCount = 2; + dimIntervals[0] = 1; + dvar.putHyperData(recNum, recCount, recInterval, + dimIndicies, dimCounts, dimIntervals, + dvarData); + System.out.println("\tAdded a hyperput latitude1 variable data."); + + /*********************/ + /* Add String data */ + /*********************/ + name.setPadValue(new String("abc")); + String [] ndata = new String[2]; + ndata[0] = "abcd"; + ndata[1] = "bcdefghij"; + name.putSingleData(0L, new long[] {0}, new String("123456789")); + name.putSingleData(0L, new long[] {1}, new String("13579")); + + System.out.println("\tAdded a single string data."); + + name.putHyperData(1L, 1L, 1L, + new long[] {0}, new long[] {2}, new long[] {1}, + ndata); + + System.out.println("\tAdded hyperput name data."); + + /*******************/ + /* Add Temp data */ + /*******************/ + float [][] tempData = {{(float)96.5, (float)97.5, (float)98.5}, + {(float)100.5, (float)110.6, (float)120.7}, + {(float)200.5, (float)210.6, (float)220.7}}; + + temp.putSingleData(0L, new long[] {0}, new Float("55.5")); + temp.putSingleData(0L, new long[] {2}, new Float("66.6")); + + System.out.println("\tAdded a single temp data."); + + temp.putHyperData(10L, 3L, 1L, + new long[] {0}, new long[] {3}, new long[] {1}, + tempData); + + System.out.println("\tAdded hyperput temp data."); + + /********************/ + /* Add Temp1 data */ + /********************/ + float [][] temp1Data = {{(float)10.5, (float)10.6, (float)10.7}, + {(float)20.5, (float)20.6, (float)20.7}}; + + temp1.putSingleData(0L, new long[] {0}, new Float(5.5)); + temp1.putSingleData(0L, new long[] {1}, new Float(-0.0)); + temp1.putSingleData(0L, new long[] {2}, new Float(6.6)); + + System.out.println("\tAdded a single temp1 data."); + + float temp1Rec[] = {(float)9.5, (float)-0.0, (float)8.5}; + temp1.putRecord(1L, temp1Rec); + + temp1.putHyperData(2L, 2L, 1L, + new long[] {0}, new long[] {3}, new long[] {1}, + temp1Data); + + System.out.println("\tAdded hyperput temp1 data."); + + /********************************************/ + /* Add Temp2 data - scalar Record Varying */ + /********************************************/ + temp2.putScalarData(0L, new Float("55.55")); + temp2.putScalarData(1L, new Float("66.66")); + + System.out.println("\tAdded a scalar temp2 data."); + + /********************/ + /* Add Temp3 data */ + /********************/ + temp3.putRecord(temp1Rec); + + System.out.println("\tAdded a non-scalar temp3 data."); + + /************************************************/ + /* Add Temp4 data - scalar Non-Record Varying */ + /************************************************/ + temp4.putScalarData(new Float("77.77")); + + System.out.println("\tAdded a scalar temp4 data."); + + /*****************/ + /* Add dp data */ + /*****************/ + double [][] dpData = {{(double)9.5, (double)7.5, (double)8.5}, + {(double)10.5, (double)10.6, (double)10.7}, + {(double)20.5, (double)20.6, (double)20.7}}; + + dp.putSingleData(1L, new long[] {0}, new Double("18888.8")); + dp.putSingleData(1L, new long[] {2}, new Double("19999.9")); + + System.out.println("\tAdded a single dp data."); + + dp.putHyperData(5L, 3L, 1L, + new long[] {0}, new long[] {3}, new long[] {1}, + dpData); + + System.out.println("\tAdded hyperput dp data."); + + /*****************/ + /* Add ep data */ + /*****************/ + double epData = Epoch.compute(1999, 3, 5, 5, 6, 7, 100), + epData1 = Epoch.compute(1998, 1, 2, 3, 4, 5, 666); + String e0 = Epoch.encode(epData1); + double p0 = Epoch.toParse(e0); + + ep.putSingleData(0L, new long[] {0}, new Double(epData)); + ep.putSingleData(1L, new long[] {0}, new Double(p0)); + + System.out.println("\tAdded putSingleData ep data."); + + /*******************/ + /* Add ep16 data */ + /*******************/ + ep_status = Epoch16.compute(2004, 11, 29, /* yyyy-mm-dd */ + 15, 55, 23, /* hh-mm-ss */ + 30, /* millisecond */ + 411, /* microsecond */ + 522, /* nanosecond */ + 634, /* picosecond */ + ep16Data); /* CDF_EPOCH16 data */ + ep16.putSingleData(0L, new long[] {0}, ep16Data); + + ep_status = Epoch16.compute(2004, 12, 29, /* yyyy-mm-dd */ + 16, 56, 24, /* hh-mm-ss */ + 31, /* millisecond */ + 411, /* microsecond */ + 522, /* nanosecond */ + 634, /* picosecond */ + ep16Data); /* CDF_EPOCH16 data */ + ep16.putSingleData(1L, new long[] {0}, ep16Data); + + ep_status = Epoch16.compute(2005, 12, 29, /* yyyy-mm-dd */ + 16, 56, 24, /* hh-mm-ss */ + 31, /* millisecond */ + 444, /* microsecond */ + 555, /* nanosecond */ + 777, /* picosecond */ + ep16Data); /* CDF_EPOCH16 data */ + ep16.putSingleData(2L, new long[] {0}, ep16Data); + + System.out.println("\tAdded putSingleData ep16 data."); + + /********************/ + /* Add newI8 data */ + /********************/ + + long [][] i8Data = {{1L, -1L}, + {10L, -10L}, + {Long.MAX_VALUE, Long.MIN_VALUE}}; + + newI8.putSingleData(0L, new long[] {0}, new Long(88888L)); + newI8.putSingleData(0L, new long[] {1}, new Long(99999L)); + + System.out.println("\tAdded a single newI8 data."); + + newI8.putHyperData(1L, 3L, 1L, + new long[] {0}, new long[] {2}, new long[] {1}, + i8Data); + + System.out.println("\tAdded hyperput newI8 data."); + + /*********************/ + /* Add tt2000 data */ + /*********************/ + + String dateTime = new String("2015-06-30T23:59:58.123456789"); + long [] nanosecs = new long[5]; + long nansecSinceJ2000; + try { + nansecSinceJ2000 = CDFTT2000.toParse(dateTime); + } catch (CDFException ex) { + nansecSinceJ2000 = 0; + } + int ix; + for (ix = 0; ix < 5; ++ix) { + nanosecs[ix] = nansecSinceJ2000 + (ix + 1) * 1000000000L; + } + + tt2000.putSingleData(0L, new long[] {0}, new Long(nansecSinceJ2000)); + + System.out.println("\tAdded a single tt2000 data."); + + tt2000.putHyperData(1L, 5L, 1L, + new long[] {0}, new long[] {1}, new long[] {1}, + nanosecs); + + System.out.println("\tAdded hyperput tt2000 data."); + + /************************************************************/ + /* Initiate a record write for a group of CDF variables. */ + /* Six (6) variables are involved in this data put function */ + /* and the 6th record for each variable is written. */ + /* Note: All data elements in each variable's record object */ + /* should be fully provided. Otherwise, expect to have*/ + /* bad data at the missing element(s) in the record. */ + /************************************************************/ + + String[] strVars = {"Longitude1", // variable names in CDF + "Temp1", + "dp", + "Temp", + "Temperature"}; + // long[] numVars = { 3, 9, 13, 15, 8, 10}; // variable IDs + + /* Prepare the record objects, every object holds full */ + /* element data for each individual variable. */ + /* Longitude1 -- data type: CDF_UINT2 dimensionality: 1:[3] */ + int[] longitude1_data = {333, 444, 555}; + + /* Temp1 -- data type: CDF_REAL4 dimensionality: 1:[3] */ + float[] temp1_data = {(float)333.3, (float)444.4, (float)555.5}; + + /* dp -- data type: CDF_DOUBLE dimensionality: 1:[3] */ + double[] dp_data = {333.333, 444.444, 555.555}; + + /* Temp -- data type: CDF_FLOAT dimensionality: 1:[3] */ + float[] temp_data = {(float)666.66, (float)777.77, (float)888.88}; + + /* Temperature -- data type: CDF_FLOAT dimensionality: 0:[] */ + Float temperature_data = new Float((float)999.99); + + /* record, the Vector holding the record objects */ + /* for writing to the CDF. */ + + Vector record = new Vector(); + record.add(longitude1_data); + record.add(temp1_data); + record.add(dp_data); + record.add(temp_data); + record.add(temperature_data); + + cdf.putRecord(5L, strVars, record); // Write a record to record #6 + + System.out.println("\tAdded a record data (Logitude1, Temp1, "+ + "dp, Temp, Temperature)."); + + /****************************************/ + /* Rename a variable and an attribute */ + /****************************************/ + dvar.rename("foo"); + System.out.println("Renamed a variable."); + + validMin.rename("validmin"); + System.out.println("Renamed an attribute."); + + /**************************************/ + /* Get the attribute name and scope */ + /**************************************/ + String scope; + if (project.getScope() == GLOBAL_SCOPE) + scope = "global"; + else + scope = "variable"; + System.out.println ("Attribute 'project': \n"+ + "\tname: "+project.getName()+ + "\n\tscope: "+scope); + + /************************************************/ + /* Copy a variable - this only copies metadata */ + /************************************************/ + + // The current CDF file MUST be saved first (by calling the save() + // method) before 'copying/duplicating data records' operation is + // performed. Otherwise the program will either fail or produce + // undesired results. + cdf.save(); + + longitude.copy("longitude_copy"); + System.out.println("Copied a variable."); + + // Get the variable just copied and set its record variance. + Variable long_copy; + long_copy = cdf.getVariable("longitude_copy"); + // long_copy.setRecVariance(NOVARY); + + // Copy the 'longitude' variable to 'longitude_copy' and put + // 'longitude_copy" into test1.cdf. + + longitude.copy(cdf1,"longitude_copy"); + System.out.println("Copied a variable into another CDF."); + + longitude.copyDataRecords(long_copy); + longitude.concatenateDataRecords(long_copy); + + /***************************************************************/ + /* Duplicate a variable */ + /* - copies everything including metadata, data, and */ + /* other settings such as blocking factor, compression, */ + /* sparseness, and pad value */ + /***************************************************************/ + cdf.save(); + + longitude.duplicate("longitude_dup"); + longitude.duplicate(cdf1, "longitude_dup"); + + /***********************/ + /* Delete a variable */ + /***********************/ + dummyVar.delete(); + System.out.println("Deleted a variable."); + + /****************************************/ + /* Delete a variable and global entry */ + /****************************************/ + // validMin.deleteEntry(latitude); + System.out.println("Deleted a variable entry."); + + long entryID = 1; + test.deleteEntry(entryID); + System.out.println("Deleted a global entry."); + + /**********************************************************/ + /* For variables with sparse and/or compressed records, */ + /* the CDF file must be saved first before records can */ + /* be properly deleted. */ + /* */ + /* NOTE: It's always safe to save a CDF file, before */ + /* deleting any variable records. */ + /**********************************************************/ + cdf.save(); + + /**********************/ + /* Delete record(s) */ + /**********************/ + firstRec = 1; + lastRec = 2; + time.deleteRecords(firstRec, lastRec); + + /************************************/ + /* This should throw an exception */ + /************************************/ + // Attribute badAttribute; + // badAttribute = Attribute.create(cdf, "Project", GLOBAL_SCOPE); + cdf.close(); + cdf1.close(); + System.out.println("** Tested successfully **"); + + } catch (Exception e) { + System.out.println("A bad thing happened on the way to the CDF."); + e.printStackTrace(); + } + } +} diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/ReadCDF.class b/ext/cdf/cdf38_0-dist/cdfjava/examples/ReadCDF.class new file mode 100644 index 0000000..637cedb Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/ReadCDF.class differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/ReadCDF.java b/ext/cdf/cdf38_0-dist/cdfjava/examples/ReadCDF.java new file mode 100644 index 0000000..7e13f6d --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/examples/ReadCDF.java @@ -0,0 +1,685 @@ +/****************************************************************************** +* Copyright 1996-2013 United States Government as represented by the +* Administrator of the National Aeronautics and Space Administration. +* All Rights Reserved. +******************************************************************************/ + +import java.io.*; +import java.text.*; +import java.util.*; +import java.lang.reflect.*; +import gsfc.nssdc.cdf.*; +import gsfc.nssdc.cdf.util.*; + +/** + * This program demonstrates how to read the contents of test.cdf created + * by CreateCDF.java in this directory. + */ + +public class ReadCDF implements CDFConstants{ + + public static void main(String[] args) { + String fileName = "test"; + int maxVarNameLength = 22; + int ii, jj; + CDF cdf; + + jj = args.length; + if (jj == 0) jj = 1; +/* + try { + CDF.setValidate (VALIDATEFILEoff); + } catch (CDFException vax) { + System.out.println("*** Error at setting the validation..."+vax); + System.exit(1); + } +*/ + for (ii = 0; ii < jj; ++ii) { + if (args.length != 0) fileName = args[ii]; + if (ii > 0) + System.out.println(""); + System.out.println("Reading " + fileName + "...:\n"); + try { + cdf = null; + cdf = CDF.open(fileName, READONLYon); + if (cdf.getStatus() != CDF_OK) + { + if (cdf.getStatus() == CHECKSUM_ERROR) + System.out.println("*** Checksum failed... the cdf file is corrupted...\n"); + if (cdf != null) cdf.close(); + } else { + + /************************************************************/ + /* If a decoding method is not specified when a CDF file is */ + /* opened, the CDF libaray knows what encoding method was */ + /* used to create the CDF file. */ + /* */ + /* Decoding method should be specified only if one needs */ + /* to translate data from one platform to another. */ + /************************************************************/ + // cdf.selectDecoding(NETWORK_DECODING); + + /**********************************/ + /* Print out the file information */ + /**********************************/ + System.out.println("File Info\n"+ + "========================================="); + + if (cdf.confirmReadOnlyMode() == READONLYon) + System.out.println("CDF File: "+cdf+" (READONLYon)"); + else { + System.out.println("CDF File: "+cdf+" (READONLYoff)"); + } + + System.out.println("Version: "+cdf.getVersion()); + String cp = cdf.getCopyright(); + System.out.println("Copyright: "+cp); + System.out.println("Format: "+CDFUtils.getStringFormat(cdf)); + System.out.println("Encoding: "+ + CDFUtils.getStringEncoding(cdf)); + System.out.println("Decoding: "+ + CDFUtils.getStringDecoding(cdf)); + System.out.println("Majority: "+ + CDFUtils.getStringMajority(cdf)); + if (cdf.getMajority() == COLUMN_MAJOR) + System.out.println("(******** Data dumps from multi-dimensional "+ + "variables are shown row-based.)"); + System.out.println("Checksum: "+ + CDFUtils.getStringChecksum(cdf)); + System.out.println("numRvars: "+cdf.getNumRvars()); + System.out.println("numZvars: "+cdf.getNumZvars()); + System.out.println("numAttrs: "+cdf.getNumAttrs()+ + " ("+cdf.getNumGattrs()+" global, "+ + cdf.getNumVattrs()+" variable)"); + System.out.println("Compression: "+cdf.getCompression()); + if (cdf.getCompressionType() != 0) + System.out.println("cPct: "+cdf.getCompressionPct()); + if (new Integer(cdf.getVersion().substring(0,1)).intValue() > 3) { + long lsLastUpdated = cdf.getLeapSecondLastUpdated(); + if (lsLastUpdated > 0) + System.out.println("LeapSecondLastUpdated: "+lsLastUpdated); + } + System.out.println("Cache Size: "+cdf.confirmCDFCacheSize()); + + /**********************************************/ + /* Print out the Global Attribute information */ + /**********************************************/ + Attribute a; + String attrName = null; + int i; + long n = cdf.getNumGattrs(); + Vector ga = cdf.getGlobalAttributes(); + + System.out.println("\nGlobal Attributes ("+n+" attributes)\n"+ + "========================================="); + i = 0; + for (Enumeration e = ga.elements() ; e.hasMoreElements() ;) { + a = (Attribute) e.nextElement(); + n = a.getNumEntries(); + if (i == 0) { + attrName = a.getName(); + if (n <= 1) + System.out.println (attrName+" ("+n+" entry):"); + else + System.out.println (attrName+" ("+n+" entries):"); + } + else { + String currAttrName = a.getName();; + if (currAttrName != attrName) { + if (n <= 1) + System.out.println (currAttrName+" ("+n+" entry):"); + else + System.out.println (currAttrName+" ("+n+" entries):"); + } + } + i++; + Vector ent = a.getEntries(); + for (Enumeration e1 =ent.elements() ; e1.hasMoreElements() ;) { + Entry entry = (Entry) e1.nextElement(); + if (entry != null) { + long eDataType = entry.getDataType(); + System.out.print ("\t"+entry.getID()+" ("+ + CDFUtils.getStringDataType(eDataType)+ + "/"+entry.getNumElements()+ + "): \t"); + Object data = entry.getData(); + if (eDataType == CDF_EPOCH) { + CDFUtils.printData ( + Epoch.toEncode(((Double) data).doubleValue())); + } else if (eDataType == CDF_EPOCH16) { + CDFUtils.printData (Epoch16.toEncode((double[])data)); + } else if (eDataType == CDF_TIME_TT2000) { + CDFUtils.printData ( + CDFTT2000.toEncode(((Long)data).longValue())); + } else { + if (CDFUtils.isStringDataType(eDataType)) + System.out.print("\""); + CDFUtils.printData (data); + if (CDFUtils.isStringDataType(eDataType)) + System.out.print("\""); + } + System.out.println (" "); + } + } + System.out.println (" "); + } + + /************************************************/ + /* Print out the Variable Attribute information */ + /************************************************/ + attrName = null; + n = cdf.getNumVattrs(); + Vector va = cdf.getVariableAttributes(); + + System.out.println("\nVariable Attributes ("+n+" attributes)\n"+ + "========================================="); + i = 0; + for (Enumeration e = va.elements() ; e.hasMoreElements() ;) { + a = (Attribute) e.nextElement(); + if (i == 0) { + attrName = a.getName(); + System.out.println (attrName+":"); + } + else { + String currAttrName = a.getName();; + if (currAttrName != attrName) + System.out.println (currAttrName+":"); + } + i++; + Vector ent = a.getEntries(); + for (Enumeration e1 =ent.elements() ; e1.hasMoreElements() ;) { + Entry entry = (Entry) e1.nextElement(); + if (entry != null) { + long eDataType = entry.getDataType(); + Variable v = cdf.getVariable(entry.getID()); + System.out.print ("\t"+v.getName()+" ("+ + CDFUtils.getStringDataType(eDataType)+ + "/"+entry.getNumElements()+"): "); + Object data = entry.getData(); + if (eDataType == CDF_EPOCH) { + CDFUtils.printData ( + Epoch.toEncode(((Double) data).doubleValue())); + } else if (eDataType == CDF_EPOCH16) { + CDFUtils.printData (Epoch16.toEncode((double[])data)); + } else if (eDataType == CDF_TIME_TT2000) { + CDFUtils.printData ( + CDFTT2000.toEncode(((Long) data).longValue())); + } else { + if (entry.getScope() == VARIABLE_SCOPE) { + if (CDFUtils.isStringDataType(eDataType)) { + if (data instanceof String[]) { + long ix = ((String[])data).length; + System.out.println("\t("+ix+" string"+(ix>1?"s":"")+") "); + int iy; + for (iy=0; iy 0) System.out.print (","); + System.out.print (dimSizes[i]); + } + System.out.print ("] "); + // if (numDims == 1) System.out.print ("\t"); + + System.out.print((v.getRecVariance() ? "T" : "F")+"/"); + long[] dimVariances = v.getDimVariances(); + for (i=0; i < v.getNumDims(); i++) + System.out.print( + ((dimVariances[i] == CDFConstants.VARY) ? "T" : "F")); + + String sparseRecord = CDFUtils.getStringSparseRecord(v); + if (!sparseRecord.equals("None")) + System.out.print (" sparseRecord=\""+sparseRecord+"\""); + + // Print the user-define pad value if one exists. + // if (v.checkPadValueExistence()) { +/* + padValue = v.getPadValue(); + if (dt == CDF_EPOCH) + padValue = Epoch.toEncode(((Double) padValue).doubleValue()); + else if (dt == CDF_EPOCH16) + padValue = Epoch16.toEncode((double[]) padValue); + else if (dt == CDF_TIME_TT2000) + padValue = CDFTT2000.toEncode(((Long) padValue).longValue()); + else if (dt != CDF_REAL4 && dt != CDF_FLOAT && + dt != CDF_REAL8 && dt != CDF_DOUBLE) + System.out.print (" PadValue="+((CDFUtils.isStringDataType(dt)|| + CDFUtils.isEpochDataType(dt))? + "\"":"")+padValue+ + ((CDFUtils.isStringDataType(dt)|| + CDFUtils.isEpochDataType(dt))?"\"":"")); + else { + String format; + try { + Attribute attr = cdf.getAttribute("FORMAT"); + format = (String) attr.getEntry (v.getID()).getData(); + } catch (CDFException ee) { + format = null; + } + System.out.print (" PadValue="); + CDFUtils.printDataWithFormat (padValue,format); + } +*/ + // } + + blockingFactor = v.getBlockingFactor(); + if (blockingFactor > 0) + System.out.print (" blockingFactor=\""+blockingFactor+"\""); + + System.out.println (" "); + } + + /**********************************************************/ + /* Print out the Variable data (all variables in the CDF) */ + /**********************************************************/ + System.out.println("\n\nVariable Data ("+n+" variables)\n"+ + "========================================="); + CDFData data = null; + long numRecs, maxRec; + long[] dimIndices = {0L}; + long[] dimIntervals = {1L}; + long[] dimSizes = {1L}; + + for (Enumeration e = vars.elements() ; e.hasMoreElements() ;) { + Variable v = (Variable) e.nextElement(); + + if (v.getNumDims() > 0) { + dimSizes = v.getDimSizes(); + dimIntervals = new long[dimSizes.length]; + dimIndices = new long[dimSizes.length]; + for (i=0; i < dimSizes.length; i++) { + dimIntervals[i] = 1; + dimIndices[i] = 0; + } + } + maxRec = v.getMaxWrittenRecord(); + numRecs = v.getNumWrittenRecords(); + varName = v.getName(); + System.out.println (varName); + String format; + try { + Attribute attr = cdf.getAttribute("FORMAT"); + format = (String) attr.getEntry (v.getID()).getData(); + } catch (CDFException ee) { + format = null; + } + + for (i=0; i < varName.length(); i++) + System.out.print ("-"); + System.out.println (" "); + + if (v.getCompressionType() == NO_COMPRESSION) + System.out.println ("Compression: None"); + else + System.out.println ("Compression: "+ + v.getCompression()+" ("+ + v.getCompressionPct()+"%)"); + if (v.checkPadValueExistence()) { + long myDT = v.getDataType(); + Object pv = v.getPadValue(); + if (pv != null) { + if (myDT == CDF_EPOCH) + System.out.println ("Pad value: "+ + Epoch.toEncode(((Double)pv).doubleValue())); + else if (myDT == CDF_EPOCH16) + System.out.println ("Pad value: "+ + Epoch16.toEncode((double[])pv)); + else if (myDT == CDF_TIME_TT2000) + System.out.println ("Pad value: "+ + CDFTT2000.toUTCstring(((Long)pv).longValue())); + else if (CDFUtils.isStringDataType(myDT)) + System.out.println ("Pad value: \""+ pv+"\""); + else { + System.out.print ("Pad value: "); + CDFUtils.printDataWithFormat (pv, format); + System.out.println(""); + } + } + } + System.out.println ("Records: "+ + numRecs+"n/"+maxRec+"x"); + System.out.println ("Allocated: "+ + v.getNumAllocatedRecords()+"n/"+ + v.getMaxAllocatedRecord()+"x"); + System.out.println ("Blocking Factor: "+ + v.getBlockingFactor()); + System.out.println ("Sparseness: "+ + CDFUtils.getStringSparseRecord(v)); + System.out.println (" "); + + /********************************************************/ + /* maxRec represents the last record number for this */ + /* variable, not the number of records. */ + /* */ + /* NOTE: maxRec starts at 0, so if the value of maxRec */ + /* is 2, the actual number of records is 3. */ + /* If there are no records exists, the value of */ + /* maxRec is -1. */ + /********************************************************/ + long status; + for (i=0; i <= maxRec; i++) { + data = v.getHyperDataObject(i, 1, 1, + dimIndices, + dimSizes, + dimIntervals); + status = cdf.getStatus(); + if (status == CDF_OK || status != VIRTUAL_RECORD_DATA) { + System.out.println ("Record # "+i+":"); + data.dumpDataWithFormat(format); + } + } + System.out.println(""); + } + + /**************************************************/ + /* Print out a few individual variable data and */ + /* attribute entries. */ + /**************************************************/ + if (fileName.equals("test")) { + System.out.println("\n\nIndividual Variable Data\n"+ + "================================="); + + Variable longitude = cdf.getVariable("Longitude"), /* T/T */ + latitude = cdf.getVariable("Latitude"), /* F/T */ + latitude1 = cdf.getVariable("Latitude1"), /* T/F */ + time = cdf.getVariable("Time"), /* T/T */ + foo = cdf.getVariable("foo"), /* F/F */ + v = cdf.getVariable("longitude_dup"); + + System.out.println ("longDup.dumpData():"); + System.out.println ("------------------"); + if (v.getNumDims() > 0) { + dimSizes = v.getDimSizes(); + dimIntervals = new long[dimSizes.length]; + dimIndices = new long[dimSizes.length]; + for (i=0; i < dimSizes.length; i++) { + dimIntervals[i] = 1; + dimIndices[i] = 0; + } + } + maxRec = v.getMaxWrittenRecord(); + for (i=0; i <= maxRec; i++) { + System.out.println ("Record # "+i+":"); + data = v.getHyperDataObject(i, 1, 1, + dimIndices, + dimSizes, + dimIntervals); + data.dumpData(); + System.out.println(" "); + } + + + System.out.print ("Record #0 for latitude: "); + CDFUtils.printData (latitude.getRecord (0)); + System.out.println (""); + + System.out.print ("Record #1 for longitude: "); + CDFUtils.printData (longitude.getRecord (1)); + System.out.println (""); + + System.out.print ("Record #2 for latitude1: "); + CDFUtils.printData (latitude1.getRecord (2)); + System.out.println (""); + + System.out.print ("Record #0 for foo: "); + CDFUtils.printData (foo.getRecord (0)); + System.out.println ("\n"); + + System.out.print ("1st element of record #0 for latitude: "); + CDFUtils.printData (latitude.getSingleData(0, new long [] {0})); + System.out.println (""); + + System.out.print ("2nd element of record #1 for longitude: "); + CDFUtils.printData (longitude.getSingleData(1, new long [] {1})); + System.out.println (""); + + System.out.print ("3rd element of record #2 for longitude: "); + CDFUtils.printData (latitude1.getSingleData(2, new long [] {2})); + System.out.println (""); + + System.out.print ("1st element of record #0 for foo: "); + CDFUtils.printData (foo.getSingleData (0, new long [] {0})); + System.out.println ("\n"); + + CDFData dataRecord; + System.out.print ("(1,0)th element of record #0 for Time: "); + dataRecord = time.getSingleDataObject(0, new long[] {1,0}); + dataRecord.dumpData(); + + System.out.print ("(1,1)th element of record #0 for Time: "); + Long tValue = (Long) time.getSingleData(0, new long[] {1,1}); + System.out.println (tValue); + + System.out.println ("Record #0 for Time: "); + dataRecord = time.getRecordObject(0L); + dataRecord.dumpData(); + System.out.println ("\n"); + + System.out.println ("Record #0 for Time: "); + long[][] yy = (long [][]) time.getRecord(0L); + for (int x=0;x<3; x++) + for (int j=0;j<2;j++) + System.out.println("["+x+","+j+"] = "+yy[x][j]); + + System.out.println ("\n"); + + Variable var; + var = cdf.getVariable("Temperature2"); + System.out.print ("getScalarData for Temperature2: "); + CDFUtils.printData (var.getScalarData()); + System.out.println ("\n"); + + System.out.print ("getScalarDataObject for Temperature2: "); + dataRecord = var.getScalarDataObject(); + dataRecord.dumpData(); + System.out.println (""); + + var = cdf.getVariable("Temperature"); + System.out.print ("Record #0 for Temperature: "); + CDFUtils.printData (var.getScalarData(0L)); + System.out.println (""); + System.out.print ("Record #1 for Temperature: "); + dataRecord = var.getScalarDataObject(1L); + dataRecord.dumpData(); + System.out.println ("\n"); + + var = cdf.getVariable("Delta"); + System.out.println ("HyperGet for Delta: "); + + /***************************************************/ + /* Read 3 records, starting from record number 0. */ + /* Each record is an 3x2 array. */ + /***************************************************/ + int[][][] xxx = (int [][][]) var.getHyperData (0L, 3L, 1L, + new long[] {0, 0}, + new long[] {3, 2}, + new long[] {1, 1}); + for (int x=0;x<3; x++) { + System.out.println ("\nRecord #"+x+":"); + for (int j=0;j<3;j++) { + for (int k=0;k<2;k++) + System.out.println("["+j+","+k+"] = "+xxx[x][j][k]); + } + } + + /******************************************************/ + /* Read the 2nd and 3rd row of the 3x2 array in the */ + /* 1st and the 3rd record. */ + /******************************************************/ + int[][][] xx = (int [][][]) var.getHyperData (0L, 3L, 2L, + new long[] {1, 0}, + new long[] {2, 2}, + new long[] {1, 1}); + for (int x=0;x<2; x++) { + int recNo = x; + if (x == 1) recNo = x+1; + System.out.println ("\nRecord #"+recNo+ + " (2nd and 3rd row of the 3x2 array):"); + for (int j=0;j<2;j++) { + for (int k=0;k<2;k++) + System.out.println("["+(j+1)+","+k+"] = "+xx[x][j][k]); + } + } + + /******************************************************/ + /* Read the 1st column of the 3x2 array in the */ + /* 1st and the 2nd record. */ + /******************************************************/ + int[][] xx1 = (int [][]) var.getHyperData (0L, 2L, 1L, + new long[] {0, 0}, + new long[] {3, 1}, + new long[] {1, 1}); + for (int x=0; x < 2; x++) { + int recNo = x; + if (x == 1) recNo = 1; + System.out.println ("\nRecord #"+recNo+ + " (1st column of the 3x2 array):"); + for (int j=0; j < 3; j++) + System.out.println("["+j+",0] = "+xx1[x][j]); + } + System.out.println ("\n"); + + /*************************************************************/ + /* Initiate a record read for a group of CDF variables. */ + /* Five (5) variables are involved in this data get function */ + /* and the 6th record for each variable is acquired. */ + /*************************************************************/ + + /* record, the Vector holding the retrieved record objects */ + Vector record; + + String[] strVars = {"Longitude1", // variable names in CDF + "Temp1", + "dp", + "Temp", + "Temperature"}; + + long[] status = new long[6]; + record = cdf.getRecord(5L, strVars, status); + /* record = cdf.getRecord(5L, varIDs, status); */ + + System.out.println ("\nDump of the 6th record from \"Longitude1, "+ + "Temp1, dp, Temp, Temperature\":"); + + /* var: Longitude1 -- CDF_UINT2, dimensionality: 1:[3] */ + System.out.print (" Longitude1 -- "); + for (i = 0; i < 3; i++) + System.out.print (((int[])record.elementAt(0))[i]+" "); + System.out.println (""); + + /* var: Temp1 -- data type: CDF_REAL4 dimensionality: 1:[3] */ + System.out.print (" Temp1 -- "); + for (i = 0; i < 3; i++) + System.out.print (((float[])record.elementAt(1))[i]+" "); + System.out.println (""); + + /* var: dp -- data type: CDF_DOUBLE dimensionality: 1:[3] */ + System.out.print (" dp -- "); + for (i = 0; i < 3; i++) + System.out.print (((double[])record.elementAt(2))[i]+" "); + System.out.println (""); + + /* var: Temp -- data type: CDF_FLOAT dimensionality: 1:[3] */ + System.out.print (" Temp -- "); + for (i = 0; i < 3; i++) + System.out.print (((float[])record.elementAt(3))[i]+" "); + System.out.println (""); + + /* var: Temperature -- CDF_FLOAT, dimensionality: 0:[] */ + System.out.print (" Temperature -- "); + System.out.print (record.elementAt(4)+" "); + System.out.println (""); + + System.out.println("\n\nVariable/Global Attribute Entries"+ + "\n===================================="); + + Attribute test = cdf.getAttribute("Test"), /* global */ + validMin = cdf.getAttribute("validmin"); /* var */ + + Entry tEntry = test.getEntry(15), + vEntry = validMin.getEntry(longitude); + + long attrNum = test.getID(); + Attribute test1 = cdf.getAttribute(attrNum); + + System.out.print (test1.getName()+": \n\t"); + CDFUtils.printData (tEntry.getData()); + System.out.println (""); + + System.out.print ("\nVALIDMIN: \n\tLongitude: "); + CDFUtils.printData (vEntry.getData()); + System.out.println (""); + + System.out.print ("\nVALIDMAX: \n\tLatitude: "); + var = cdf.getVariable("Latitude"); + CDFUtils.printData (var.getEntryData("VALIDMAX")); + System.out.println (""); + + } + + cdf.close(); + } + } catch (Exception e) { + System.out.println (e); + } + } + } +} diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/test.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/test.cdf new file mode 100644 index 0000000..beba89a Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/test.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/test0.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/test0.cdf new file mode 100644 index 0000000..3c2251a Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/test0.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/test1.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/test1.cdf new file mode 100644 index 0000000..485db25 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/test1.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/testCdfColMajor.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/testCdfColMajor.cdf new file mode 100644 index 0000000..97a0ec3 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/testCdfColMajor.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/testCdfRowMajor.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/testCdfRowMajor.cdf new file mode 100644 index 0000000..1b84b3b Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/testCdfRowMajor.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/testjson.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/testjson.cdf new file mode 100644 index 0000000..aa458ac Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/testjson.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/examples/testo.cdf b/ext/cdf/cdf38_0-dist/cdfjava/examples/testo.cdf new file mode 100644 index 0000000..f7fc98f Binary files /dev/null and b/ext/cdf/cdf38_0-dist/cdfjava/examples/testo.cdf differ diff --git a/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfNativeLibrary.c b/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfNativeLibrary.c new file mode 100644 index 0000000..068c408 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfNativeLibrary.c @@ -0,0 +1,3079 @@ +/* + * $Id: cdfNativeLibrary.c,v 1.1.1.1 2019/10/16 16:22:18 mhliu Exp $ + */ +/****************************************************************************** +* Copyright 1996-2014 United States Government as represented by the +* Administrator of the National Aeronautics and Space Administration. +* All Rights Reserved. +******************************************************************************/ +/* + * cdfjava.c + * + * This file contains all the JNI C wrappers for the CDF, Attribute, etc + * classes and their children and instances. + * + * C Functions: + * ErrorHandler - Handles all errors and throws appropriate CDFExceptions + * cdfObjectType - Determines the CDF Object's class + * getFuncOrItem - Gets a java/lang/Long out of the command vector and + * returns the CDF function or item. + * getJavaField - Gets the value out of the intance var that the argument + * describes and places it in arg.ptr + * setJavaField - Sets the instance var to the value pointed to by arg.ptr + * argAlloc - Allocated space to arg.ptr to hold the value + * cleanArgument - Cleans up the memory and UTF strings + * ErrHandle - Cleans up the memory and UTF strings before returning an + * error status after a CDFlib call + * cleanGlobalRefs - Cleans the global references + * getItem - Retrieves the elements in a vector that is passed in + * addCDFid - Adds a CDF id to the list of maintained CDF ids + * getCDFid - Returns the CDF id that corresponds to the jid + * removeCDFid - Mark the CDF id as closed + * cleanGlobalRefs - Clear the CDFid link list and free the global + * references if there is none open CDF + * JAVAcdflib - The main method for parsing and executing the command + * vector + * + * JNI methods: + * Java_gsfc_nssdc_cdf_CDFNativeLibrary_cdfNativeLib + * - Main wrapper for the native implementation of the CDF Java APIs + * + * Java_gsfc_nssdc_cdf_util_Epoch_compute + * Java_gsfc_nssdc_cdf_util_Epoch_breakdown + * Java_gsfc_nssdc_cdf_util_Epoch_encode + * Java_gsfc_nssdc_cdf_util_Epoch_encode1 + * Java_gsfc_nssdc_cdf_util_Epoch_encode2 + * Java_gsfc_nssdc_cdf_util_Epoch_encode3 + * Java_gsfc_nssdc_cdf_util_Epoch_encode4 + * Java_gsfc_nssdc_cdf_util_Epoch_encodex + * + * @version 2.0 03/18/05 Removed the code for selection of current CDF, attribute, + * variable or entry when just passed an "NULL_" item. + * It caused a problem under multi-thread environment as the + * selection might not be followed immediately by the intended + * operation of the same thread, thus unexpected results would + * happen. Selections are done as part of operations passed + * to JNI. JNI call is synchronized so only one process is + * allowed in a JVM. + * @version 2.1 06/18/09 Added call ROWtoCOL when hyper-put and COLtoROW + * when hyper-get for multi-dimensional variables + * in a COLUMN-major CDF as the data passed from/to + * Java is ROW-based. + * @version 2.2 05/28/13 Added ErrHandle to free up space(s) before an error + * status is returnedi to avoid memory leak(s). + * + * Author: Mike Liu, RSTX + * Phil Williams. QSS/NASA/GSFC + * + */ + +#include "cdfjava.h" + +#if defined(sun) && !defined(SOLARIS) && !defined(__GCC_NEW_VARARGS__) +# define VARARGS +#else +# define STDARG +#endif + +#if defined(hpux) +# define VA_START(ap) { \ +va_list _apT_; \ +va_start (_apT_); \ +ap = _apT_; \ +} +#else +# define VA_START(ap) va_start(ap) +#endif + +/********************************************* + ** ** + ** Global References ** + ** ** + *********************************************/ + +static char msg[2048]; /* Debug message buffer */ +int mydebug = 0; /* 0 = off, non-zero = on */ +jlong jmax = (jlong) 1 << 32; +jlong jsignmax = ((jlong) 1 << 31) - 1; +jint imax = (jint) 1 << 16; +jint isignmax = (jint) ( 1 << 15) - 1; +jshort smax = (jshort) 1 << 8; +jshort ssignmax = (jshort) (1 << 7) -1; + +static jclass cdfClass = 0, varClass, entryClass, attrClass, dataClass, + excClass; +static jclass byteClass, shortClass, intClass, longClass, floatClass, + doubleClass, strClass, objClass, vecClass; +static jmethodID BvalID, SvalID, IvalID, LvalID, FvalID, DvalID; +static jfieldID cdfStatusID, infoWarnID; +/*static jfieldID backwardEnvVarID; */ +static long envVar; +static long lib_ver; +static char *leapTable; + +/* + A list of currently available CDFs. This list allows multiple cdfs to be + opened at one time. The cdfIDs are maintained in this list and the only + information that is passed back to Java objects is the position in the + list of the current CDF +*/ +cdfIDList *listOfCDFs = NULL; + +/********************************************* + ** ** + ** C Utility Functions ** + ** ** + *********************************************/ + +/* Function: ErrorHandler + * + * Purpose: Throw exceptions back to Java to handle CDF errors + * Depending on the status returned a CDFException will be thrown + * + * Params: + * in: where - string describing where error occured in calling routine. + * in: status - CDF status code. + * in: env - JNI runtime environment + * Returns: + * 1 if no fatal errors had occured + * 0 if a fatal error occured + */ +int ErrorHandler (char *where, long status, JNIEnv *env, jobject myCDF, + int flag) { + + jmethodID cdfExceptionInit; + jthrowable cdfException; + char text[CDF_STATUSTEXT_LEN+128]; + + if (flag == 1) (*env)->SetLongField(env, myCDF, cdfStatusID, (jlong)status); + if (status == CDF_OK) return(1); /* ignore OK */ + + /* Get the message and throw appropriate exception */ + CDFlib (SELECT_, CDF_STATUS_, status, + GET_, STATUS_TEXT_, text, + NULL_); + + if ((status > CDF_OK) || (status == CHECKSUM_ERROR) || + (CDF_OK > status && status >= CDF_WARN)) { + jlong infowarn; + infowarn = (long) (*env)->GetLongField(env, myCDF, infoWarnID); + /* Print warnings or information to the stdout */ + strcat(text, "\n "); + strcat(text, where); + MYDEBUG("ErrorHandler", text); + if (infowarn == 1) printf("%s\n", text); + return(1); + } else { /* Throw the rest */ + strcpy(msg, where); + strcat(msg, " exception occured: "); + strcat(msg, text); + MYDEBUG("ErrorHandler", msg); + + /* if excClass not found then simply return. + This should never happen. */ + if (excClass == 0) return(0); + /* Get the method ID for the constructor CDFException(long) */ + cdfExceptionInit = (*env)->GetMethodID(env, excClass, + "", + "(JLjava/lang/String;)V"); + + /* Build a new cdfException object */ + cdfException = (*env)->NewObject(env, excClass, cdfExceptionInit, + (jlong)status, + (*env)->NewStringUTF(env, where)); + + MYDEBUG("ErrorHandler", "cdfException object created"); + + /* Throw the newly created exception */ + (*env)->Throw(env, cdfException); + + MYDEBUG("ErrorHandler", "cdfException thrown"); + + return(0); + } +} /* end ErrorHandler */ + + +/* Function: cdfObjectType + * + * Purpose: Determine the CDFObject's class and return the + * appropriate flag + * + * Parameters: + * in: env - the Java runtime environment + * in: obj - the Object whose type will be determined + * Returns: + * A "long" integer representing the object type (see cdfjava.h for + * definitions. + */ +long cdfObjectType(JNIEnv *env, jobject obj) { + + if (obj == NULL) { + (*env)->ThrowNew(env, excClass, "cdfObject is null"); + return -1L; + } + + if ((*env)->IsInstanceOf(env, obj, cdfClass)) + return CDF_CLASS; + + else if ((*env)->IsInstanceOf(env, obj, varClass)) + return VAR_CLASS; + + else if ((*env)->IsInstanceOf(env, obj, dataClass)) + return DATA_CLASS; + + else if ((*env)->IsInstanceOf(env, obj, entryClass)) + return ENTRY_CLASS; + + else if ((*env)->IsInstanceOf(env, obj, attrClass)) + return ATTR_CLASS; + + else + return -1L; /* Unknown class */ +} + +/* Function: getFuncOrItem + * + * Purpose: parse the next element in the command vector and return + * the CDF function or item at that location. + * Parameters: + * in: env - the Java runtime environment + * in: obj - a Long object whose value should correspond to a CDF function + * or CDF item + * out: funcOrItem - the CDF function or item that the object represents + * Returns: + * CDFstatus + */ +CDFstatus getFuncOrItem(JNIEnv *env, jobject obj, long *funcOrItem) { + + if ((*env)->IsInstanceOf(env, obj, longClass) == JNI_FALSE){ + return(BAD_FNC_OR_ITEM); + } + + *funcOrItem = (long)((*env)->CallLongMethod(env, obj, LvalID)); + + return(CDF_OK); +} + +/* Function: getJavaField + * + * Purpose: Move the value from the Java's instance variable + * to arg.ptr for use in C + * Parameters: + * env - Java VM pointer + * arg - A pointer to an argument structure + * Returns: + * none (should be CDFstatus) + */ +void getJavaField(JNIEnv *env, argument *arg) { + + jthrowable exc; + jobject tempObject; + jarray arrayObject; + jbyte *bbody; + jshort *sbody; + jint *ibody; + jlong *jbody; + jfloat *fbody; + jdouble *dbody; + char dummySig[50]; + char dummyCSig[50]; + + if (arg->isEntryorVariableData) { + if (arg->isArray) { + strcpy(dummySig, arg->datasig+1); /* Skip "[" */ + strcpy(dummyCSig, arg->Csig+1); + } else { + strcpy(dummySig, arg->datasig); + strcpy(dummyCSig, arg->Csig); + } + + } else { + if (arg->isArray) + strcpy(dummySig, arg->sig+1); /* Skip "[" */ + else + strcpy(dummySig, arg->sig); + } + sprintf(msg,"dummySig = %s", dummySig); + MYDEBUG("getJavaField", msg); + + switch (dummySig[0]) { + case 'Z': /* boolean */ + break; + + case 'B': /* byte */ + if (arg->isArray) { + arrayObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + bbody = (*env)->GetByteArrayElements(env, (jarray)arrayObject, 0); + memcpy (arg->ptr, bbody, sizeof(char)*arg->length); + (*env)->ReleaseByteArrayElements(env, + (jarray)arrayObject, bbody, 0); + } else { + *(char *)arg->ptr + = (*env)->GetByteField(env, arg->myObject, arg->id); + } + break; + + case 'C': /* char */ + break; + + case 'S': /* short */ + if (arg->isArray) { + arrayObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + sbody = (*env)->GetShortArrayElements(env, (jarray)arrayObject, 0); + if (strncmp((char *)dummyCSig, "S", 1) == 0) + memcpy (arg->ptr, sbody, sizeof(short)*arg->length); + else { /* Data type is CDF_UINT1 */ + int i; + for (i=0; i< arg->length; i++) + if (sbody[i] <= ssignmax) + *((jbyte *) arg->ptr + i) = (jbyte) sbody[i]; + else + *((jbyte *) arg->ptr + i) = (jbyte) (sbody[i] - smax); + } + (*env)->ReleaseShortArrayElements(env, + (jarray)arrayObject, sbody, 0); + } else { + if (strncmp((char *)dummyCSig, "S", 1) == 0) + *(short *)arg->ptr + = (*env)->GetShortField(env, arg->myObject, arg->id); + else + *(jbyte *)arg->ptr + = (jbyte) (*env)->GetShortField(env, arg->myObject, arg->id); + } + break; + + case 'I': /* integer */ + if (arg->isArray) { + arrayObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + ibody = (*env)->GetIntArrayElements(env, (jarray)arrayObject, 0); + if (strncmp((char *)dummyCSig, "I", 1) == 0) + memcpy (arg->ptr, ibody, sizeof(jint)*arg->length); + else { /* Data type is CDF_UINT2 */ + int i; + for (i=0; i< arg->length; i++) + if (ibody[i] <= isignmax) + *((jshort *) arg->ptr + i) = (jshort) ibody[i]; + else + *((jshort *) arg->ptr + i) = (jshort) (ibody[i] - imax); + } + (*env)->ReleaseIntArrayElements(env, + (jarray)arrayObject, ibody, 0); + } else { + if (strncmp((char *)dummyCSig, "I", 1) == 0) + *(jint *)arg->ptr + = (*env)->GetIntField(env, arg->myObject, arg->id); + else /* Data type is CDF_UINT2 */ + *(jshort *)arg->ptr + = (jshort) (*env)->GetIntField(env, arg->myObject, arg->id); + } + break; + + case 'J': /* long */ + if (arg->isArray) { + int i; + arrayObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + jbody = (*env)->GetLongArrayElements(env, (jarray)arrayObject, 0); + if (!arg->isEntryorVariableData) { + for (i=0; i< arg->length; i++) + *((long *) arg->ptr + i) = (long) jbody[i]; + } else { + if (strncmp((char *)dummyCSig, "J", 1) == 0) { /* CDF_INT8 */ + memcpy (arg->ptr, jbody, sizeof(jlong)*arg->length);; + } else { /* Data type is CDF_UINT4 */ + for (i=0; i< arg->length; i++) + if (jbody[i] <= jsignmax) + *((jint *) arg->ptr + i) = (jint) jbody[i]; + else + *((jint *) arg->ptr + i) = (jint) (jbody[i] - jmax); + } + } + (*env)->ReleaseLongArrayElements(env, + (jarray)arrayObject, jbody, 0); + } else { + if (!arg->isEntryorVariableData) + *(long *)arg->ptr + = (long) (*env)->GetLongField(env, arg->myObject, arg->id); + else { + if (strncmp((char *)dummyCSig, "J", 1) == 0) + *(jlong *)arg->ptr + = (jlong) (*env)->GetLongField(env, arg->myObject, arg->id); + else + *(jint *)arg->ptr + = (jint) (*env)->GetLongField(env, arg->myObject, arg->id); + } + } + sprintf (msg, "field = %s value(long) = %ld ", + arg->name,*(long *)arg->ptr); + MYDEBUG("getJavaField", msg); + break; + + case 'F': /* float */ + if (arg->isArray) { + arrayObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + fbody = (*env)->GetFloatArrayElements(env, (jarray)arrayObject, 0); + memcpy (arg->ptr, fbody, sizeof(float)*arg->length); + (*env)->ReleaseFloatArrayElements(env, + (jarray)arrayObject, fbody, 0); + } else { + *(float *)arg->ptr + = (*env)->GetFloatField(env, arg->myObject, arg->id); + } + break; + + case 'D': /* double */ + if (arg->isArray) { + arrayObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + dbody = (*env)->GetDoubleArrayElements(env, (jarray)arrayObject, 0); + memcpy (arg->ptr, dbody, sizeof(double)*arg->length); + (*env)->ReleaseDoubleArrayElements(env, + (jarray)arrayObject, dbody, 0); + } else { + *(double *)arg->ptr + = (*env)->GetDoubleField(env, arg->myObject, arg->id); + } + break; + + case 'L': /* object */ + if (strcmp(dummySig,"Ljava/lang/String;") == 0) { + if (arg->isArray) { /* N/A */ + } else { + arg->tempString = + (*env)->GetObjectField(env, arg->myObject, arg->id); + if (arg->ptr != NULL) free (arg->ptr); + arg->ptr = (void *) + (*env)->GetStringUTFChars(env, arg->tempString, 0); +/* Have to comment out the following line as it causes problems if the combined + string is bigger than 2048, the size of msg buffer. */ +/* sprintf(msg, "field = %s value(String) = %s", + arg->name,(char *)arg->ptr); */ + MYDEBUG("getJavaField", msg); + } + + } else if (strcmp(dummySig, "Ljava/lang/Byte;") == 0) { + tempObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + *(char *)arg->ptr + = (*env)->CallByteMethod(env, tempObject, BvalID); + + } else if (strcmp(dummySig, "Ljava/lang/Short;") == 0) { + tempObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + if (strncmp((char *)dummyCSig, "S", 1) == 0) /* CDF_INT2 */ + *(short *)arg->ptr + = (*env)->CallShortMethod(env, tempObject, SvalID); + else /* CDF_UINT1 */ + *(char *)arg->ptr + = (jbyte) (*env)->CallShortMethod(env, tempObject, SvalID); + + } else if (strcmp(dummySig, "Ljava/lang/Integer;") == 0) { + tempObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + if (strncmp((char *)dummyCSig, "I", 1) == 0) /* CDF_INT4 */ + *(jint *)arg->ptr + = (jint) (*env)->CallIntMethod(env, tempObject, IvalID); + else /* CDF_UINT2 */ + *(short *)arg->ptr + = (short) (*env)->CallIntMethod(env, tempObject, IvalID); + + } else if (strcmp(dummySig, "Ljava/lang/Long;") == 0) { + tempObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + if (!arg->isEntryorVariableData) + *(long *)arg->ptr + = (long) (*env)->CallLongMethod(env, tempObject, LvalID); + else { + if (strncmp((char *)dummyCSig, "J", 1) == 0) /* CDF_INT8 */ + *(jlong *)arg->ptr + = (jlong) (*env)->CallLongMethod(env, tempObject, LvalID); + else /* CDF_UINT4 */ + *(jint *)arg->ptr + = (jint) (*env)->CallLongMethod(env, tempObject, LvalID); + } + } else if (strcmp(dummySig, "Ljava/lang/Float;") == 0) { + tempObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + *(float *)arg->ptr + = (*env)->CallFloatMethod(env, tempObject, FvalID); + + } else if (strcmp(dummySig, "Ljava/lang/Double;") == 0) { + tempObject = (*env)->GetObjectField(env, arg->myObject, arg->id); + *(double *)arg->ptr + = (*env)->CallDoubleMethod(env, tempObject, DvalID); + } + break; + + case '[': /* array */ + break; + + default: + MYDEBUG("getJavaField","unknown type"); + } + + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in getJavaField\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } +} /* getJavaField */ + +/* Function: setJavaField + * + * Purpose: Move the value out of the arg.ptr to the + * Java's instance variable. + * + * Parameters: + * env - Java VM pointer + * arg - An argument structure + * Returns: + * none (Should be CDFStatus) + * + */ +void setJavaField(JNIEnv *env, argument arg) { + + jthrowable exc; + jobject tempObject; + jmethodID tempMethod; + jlong *jbody; + jint *ibody; + jshort *sbody; + jbyte *bbody; + jfloat *fbody; + jdouble *dbody; + + int i; + char dummySig[50]; + char dummyCSig[50]; + + if (arg.isArray) MYDEBUG("setJavaField", "it is an array"); + if (arg.isEntryorVariableData) MYDEBUG("setJavaField", "it is an entry/variable data"); + + if (arg.isArray) + if (arg.isEntryorVariableData) { + strcpy(dummySig, arg.datasig+1); /* Skip "[" */ + strcpy(dummyCSig, arg.Csig+1); + } else + strcpy(dummySig, arg.sig+1); /* Skip "[" */ + else + if (arg.isEntryorVariableData) { + strcpy(dummySig, arg.datasig); + strcpy(dummyCSig, arg.Csig); + } else + strcpy(dummySig, arg.sig); + + sprintf(msg, "dummySig = %s", dummySig); + MYDEBUG("setJavaField", msg); + switch (dummySig[0]) { + case 'Z': /* boolean */ + break; + + case 'B': /* byte */ + if (arg.isArray) { + sprintf(msg,"setting byte array"); + tempObject = (*env)->GetObjectField(env, arg.myObject, arg.id); + bbody = + (*env)->GetByteArrayElements(env, (jbyteArray)tempObject, 0); + memcpy (bbody, (jbyte *) arg.ptr, arg.length); + (*env)->ReleaseByteArrayElements(env, tempObject, bbody, 0); + } else { + sprintf(msg,"setting byte var"); + (*env)->SetByteField(env, arg.myObject, arg.id, *(char *) arg.ptr); + } + break; + + case 'C': /* char */ + break; + + case 'S': /* short */ + if (arg.isArray) { + sprintf(msg,"setting short array"); + tempObject = (*env)->GetObjectField(env, arg.myObject, arg.id); + sbody = (*env)->GetShortArrayElements( + env, (jshortArray)tempObject, 0); + if (strncmp((char *)dummyCSig, "S", 1) == 0) { + memcpy (sbody, (jbyte *)arg.ptr, sizeof(short)*arg.length); + } else { + for (i=0; i< arg.length; i++) { + if (*((jbyte *) arg.ptr + i) >= 0) + sbody[i] = (jshort) *((jbyte *) arg.ptr + i); + else + sbody[i] = smax + (jshort) *((jbyte *) arg.ptr + i); + } + } + (*env)->ReleaseShortArrayElements(env, tempObject, sbody, 0); + } else { + sprintf(msg,"setting short var"); + if (strncmp((char *)dummyCSig, "S", 1) == 0) + (*env)->SetShortField (env, arg.myObject, arg.id, + *(short *)arg.ptr); + else { + jshort ss; + if (*(jbyte *) arg.ptr >= 0) + ss = (jshort) *(jbyte *) arg.ptr; + else + ss = smax + (jshort) *(jbyte *) arg.ptr; + (*env)->SetShortField (env, arg.myObject, arg.id, ss); + } + } + break; + + case 'I': /* integer */ + if (arg.isArray) { + sprintf(msg,"setting int array"); + tempObject = (*env)->GetObjectField(env, arg.myObject, arg.id); + ibody = (*env)->GetIntArrayElements(env, (jintArray)tempObject, 0); + if (strncmp((char *)dummyCSig, "I", 1) == 0) { + for (i=0; i< arg.length; i++) + ibody[i] = *((jint *) arg.ptr + i); + } else { + for (i=0; i< arg.length; i++) { + if (*((jshort *) arg.ptr + i) >= 0) + ibody[i] = (jint) *((jshort *) arg.ptr + i); + else + ibody[i] = imax + (jint) *((jshort *) arg.ptr + i); + } + } + (*env)->ReleaseIntArrayElements(env, tempObject, ibody, 0); + } else { + if (strncmp((char *)dummyCSig, "I", 1) == 0) + (*env)->SetIntField (env, arg.myObject, arg.id, + *(jint *) arg.ptr); + else { + jint ii = 0; + if (*(jshort *) arg.ptr >= 0) + ii = (jint) *(jshort *) arg.ptr; + else + ii = imax + (jint) *(jshort *) arg.ptr; + (*env)->SetIntField (env, arg.myObject, arg.id, ii); + } + } + break; + + case 'J': /* long */ + if (arg.isArray) { + tempObject = (*env)->GetObjectField(env, arg.myObject, arg.id); + jbody = (*env)->GetLongArrayElements(env, (jlongArray)tempObject, 0); + if (!arg.isEntryorVariableData) { + for (i=0; i= 0) + jbody[i] = (jlong) *((jint *) arg.ptr + i); + else + jbody[i] = jmax + (jlong) *((jint *) arg.ptr + i); + } + } + } + (*env)->ReleaseLongArrayElements(env, tempObject, jbody, 0); + } else { + sprintf(msg,"name = %s; sig = %s; val = %ld", + arg.name, arg.sig, *(long *) arg.ptr); + if (!arg.isEntryorVariableData) { + (*env)->SetLongField (env, arg.myObject, arg.id, + (jlong) (*(long *) arg.ptr)); + } else { + if (strncmp((char *)dummyCSig, "J", 1) == 0) + (*env)->SetLongField (env, arg.myObject, arg.id, + (jlong) (*(jlong *) arg.ptr)); + else { + jlong jj = 0; + if (*(jint *) arg.ptr >= 0) + jj = (jlong) *(jint *) arg.ptr; + else + jj = jmax + (jlong) *(jint *) arg.ptr; + (*env)->SetLongField (env, arg.myObject, arg.id, jj); + } + } + } + break; + + case 'F': /* float */ + if (arg.isArray) { + sprintf(msg,"setting float array"); + tempObject = (*env)->GetObjectField(env, arg.myObject, arg.id); + fbody = (*env)->GetFloatArrayElements (env, + (jfloatArray)tempObject, 0); + for (i=0; iReleaseFloatArrayElements(env, tempObject, fbody, 0); + } else { + sprintf(msg,"setting float var"); + (*env)->SetFloatField (env, arg.myObject, arg.id, + (jfloat) *(float *) arg.ptr); + } + break; + + case 'D': /* double */ + if (arg.isArray) { + sprintf(msg,"setting double array"); + tempObject = (*env)->GetObjectField(env, arg.myObject, arg.id); + dbody = (*env)->GetDoubleArrayElements(env, + (jdoubleArray)tempObject, 0); + for (i=0; iReleaseDoubleArrayElements(env, tempObject, dbody, 0); + } else { + sprintf(msg,"setting double var"); + (*env)->SetDoubleField (env, arg.myObject, arg.id, + (jdouble) *(double *) arg.ptr); + } + break; + + case 'L': /* object */ + if (strcmp(dummySig,"Ljava/lang/String;") == 0) { + if (arg.ptr != NULL) { + ((char *)arg.ptr)[arg.length - 1] = '\0'; +/* Have to comment out the following line as it causes problems if the combined + string is bigger than 2048, the size of msg buffer. */ +/* sprintf(msg,"name = %s; sig = %s val = %s\n", + arg.name, arg.sig, ((char *) arg.ptr)); */ + (*env)->SetObjectField(env, arg.myObject, arg.id, + (*env)->NewStringUTF(env, (char *) arg.ptr)); + } + } else if (strcmp(dummySig, "Ljava/lang/Byte;") == 0) { + sprintf(msg,"building byte object"); + tempMethod = (*env)->GetMethodID(env, byteClass, "", "(B)V"); + tempObject = (*env)->NewObject(env, byteClass, tempMethod, + (jbyte) *(char *) arg.ptr); + (*env)->SetObjectField(env, arg.myObject, arg.id, tempObject); + + } else if (strcmp(dummySig, "Ljava/lang/Short;") == 0) { + sprintf(msg,"building short object"); + tempMethod = (*env)->GetMethodID(env, shortClass, "", "(S)V"); + if (!arg.isEntryorVariableData || + strncmp((char *)dummyCSig, "S", 1) == 0) { + tempObject = (*env)->NewObject(env, shortClass, tempMethod, + *(short *) arg.ptr); + } else { + jshort ss = 0; + if (*(jbyte *)arg.ptr >= 0) + ss = (jshort) *(jbyte *) arg.ptr; + else + ss = smax + (jshort) *(jbyte *) arg.ptr; + tempObject = (*env)->NewObject(env, shortClass, tempMethod, ss); + } + (*env)->SetObjectField(env, arg.myObject, arg.id, tempObject); + + } else if (strcmp(dummySig, "Ljava/lang/Integer;") == 0) { + sprintf(msg,"building int object"); + tempMethod = (*env)->GetMethodID(env, intClass, "", "(I)V"); + if (!arg.isEntryorVariableData || + strncmp((char *)dummyCSig, "I", 1) == 0) { + tempObject = (*env)->NewObject (env, intClass, tempMethod, + *(jint *) arg.ptr); + } else { + jint ii = 0; + if (*(jshort *) arg.ptr >= 0) + ii = (jint) *(jshort *) arg.ptr; + else + ii = imax + (jint) *(jshort *) arg.ptr; + tempObject = (*env)->NewObject (env, intClass, tempMethod, ii); + } + (*env)->SetObjectField(env, arg.myObject, arg.id, tempObject); + + } else if (strcmp(dummySig, "Ljava/lang/Long;") == 0) { + sprintf(msg,"building long object"); + tempMethod = (*env)->GetMethodID(env, longClass, "", "(J)V"); + if (!arg.isEntryorVariableData || + strncmp((char *)dummyCSig, "J", 1) == 0) { + tempObject = (*env)->NewObject (env, longClass, tempMethod, + (jlong) (*(jlong *) arg.ptr)); + } else { + jlong jj; + if (*(jint*)arg.ptr >= 0) + jj = (jlong) *(jint*)arg.ptr; + else { + jj = jmax + (jlong) *(jint*)arg.ptr; + } + tempObject = (*env)->NewObject (env, longClass, tempMethod, jj); + } + (*env)->SetObjectField(env, arg.myObject, arg.id, tempObject); + + } else if (strcmp(dummySig, "Ljava/lang/Float;") == 0) { + sprintf(msg,"building float object"); + tempMethod = (*env)->GetMethodID(env, floatClass, "", "(F)V"); + tempObject = (*env)->NewObject(env, floatClass, tempMethod, + (jfloat) *(float *) arg.ptr); + (*env)->SetObjectField(env, arg.myObject, arg.id, tempObject); + + } else if (strcmp(dummySig, "Ljava/lang/Double;") == 0) { + sprintf(msg,"building double object"); + tempMethod = (*env)->GetMethodID(env, doubleClass, "", "(D)V"); + tempObject = (*env)->NewObject(env, doubleClass, tempMethod, + (jdouble) *(double *) arg.ptr); + (*env)->SetObjectField(env, arg.myObject, arg.id, tempObject); + } + break; + + case '[': /* array */ + break; + + default: + sprintf(msg, "Unknown type; sig = %s",arg.sig); + } + MYDEBUG("setJavaField",msg); + + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in setJavaField\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } +} /* setJavaField */ + + +/* Function: argAlloc + * + * Purpose: determines the size needed for the pointer and mallocs + * the appropriate space. + * + * Parameters: + * arg - the argument to malloc space for the variable + * Returns: + * CDFStatus - success or failure + */ +CDFstatus argAlloc(JNIEnv *env, const char *signature, argument *arg) { + + int i; + CDFstatus status = CDF_OK; + + if (arg->length == -1) arg->length = 1; + + switch (signature[0]) { + case 'Z': /* boolean */ + break; + + case 'B': /* byte */ + sprintf(msg,"allocated space for %d byte variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (char *) malloc (sizeof(char) * arg->length); + for (i=0;ilength;i++) + *((char *)arg->ptr + i) = 0; + break; + + case 'C': /* char */ + sprintf(msg,"allocated space for %d char variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (char *) malloc (sizeof(char) * arg->length); + break; + + case 'S': /* short */ + sprintf(msg,"allocated space for %d short variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (short *) malloc (sizeof(short) * arg->length); + for (i=0; i < arg->length; i++) + *((short *)arg->ptr + i) = (short)0; + break; + + case 'I': /* integer */ + sprintf(msg,"allocated space for %d int variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (jint *) malloc (sizeof(jint) * arg->length); + for (i=0; i < arg->length; i++) + *((jint *)arg->ptr + i) = (jint) 0; + break; + + case 'J': /* long */ + sprintf(msg,"allocated space for %d long variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + if (!arg->isEntryorVariableData) { + arg->ptr = (long *) malloc (sizeof(long) * arg->length); + for (i=0; i < arg->length; i++) + *((long *)arg->ptr + i) = (long) 0; + } else { + arg->ptr = (jlong *) malloc (sizeof(jlong) * arg->length); + for (i=0; i < arg->length; i++) + *((jlong *)arg->ptr + i) = (jlong) 0; + } + break; + + case 'F': /* float */ + sprintf(msg,"allocated space for %d float variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (float *) malloc (sizeof(float) * arg->length); + for (i=0; i < arg->length; i++) + *((float *)arg->ptr + i) = 0.0; + break; + + case 'D': /* double */ + sprintf(msg,"allocated space for %d double variable(s)", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (double *) malloc (sizeof(double) * arg->length); + for (i=0; i < arg->length; i++) + *((double *)arg->ptr + i) = 0; + break; + + case 'L': /* object */ + if (strcmp(signature,"Ljava/lang/String;") == 0) { + sprintf(msg,"allocated space for a %d long string", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (void *) malloc (sizeof(char) * (arg->length)); + + } else if (strcmp(signature,"Ljava/lang/Byte;") == 0) { + sprintf(msg,"allocated space for %d byte object", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (char *) malloc (sizeof(char) * arg->length); + for (i=0; i < arg->length; i++) + *((char *)arg->ptr + i) = 0; + + } else if (strcmp(signature,"Ljava/lang/Short;") == 0) { + sprintf(msg,"allocated space for %d short object", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (short *) malloc (sizeof(short) * arg->length); + for (i=0; i < arg->length; i++) + *((short *)arg->ptr + i) = 0; + + } else if (strcmp(signature,"Ljava/lang/Integer;") == 0) { + sprintf(msg,"allocated space for %d int object", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (jint *) malloc (sizeof(jint) * arg->length); + for (i=0; i < arg->length; i++) + *((jint *)arg->ptr + i) = 0; + + } else if (strcmp(signature,"Ljava/lang/Long;") == 0) { + sprintf(msg,"allocated space for %d long object", (int) arg->length); + MYDEBUG("argAlloc",msg); + if (!arg->isEntryorVariableData) { + arg->ptr = (long *) malloc (sizeof(long) * arg->length); + for (i=0; i < arg->length; i++) + *((long *)arg->ptr + i) = (long) 0; + } else { + arg->ptr = (jlong *) malloc (sizeof(jlong) * arg->length); + for (i=0; i < arg->length; i++) + *((jlong *)arg->ptr + i) = (jlong) 0; + } + + } else if (strcmp(signature,"Ljava/lang/Float;") == 0) { + sprintf(msg,"allocated space for %d float object", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (float *) malloc (sizeof(float) * arg->length); + for (i=0; i < arg->length; i++) + *((float *)arg->ptr + i) = 0.0; + + } else if (strcmp(signature,"Ljava/lang/Double;") == 0) { + sprintf(msg,"allocated space for %d double object", (int) arg->length); + MYDEBUG("argAlloc",msg); + arg->ptr = (double *) malloc (sizeof(double) * arg->length); + for (i=0; i < arg->length; i++) + *((double *)arg->ptr + i) = 0; + } + break; + + case '[': /* array */ + arg->isArray = JNI_TRUE; + arg->length = (*env)->GetArrayLength(env, + (jarray)(*env)->GetObjectField(env, + arg->myObject, + arg->id)); + MYDEBUG("argAlloc", "calling self"); + status = argAlloc(env, signature+1, arg); /* Recursive call */ + break; + + default: + MYDEBUG("argAlloc","unknown type"); + } + + if (arg->ptr == NULL) { + MYDEBUG("argAlloc","malloc failed"); + return(BAD_MALLOC); + } + + return(status); +} + +/* Function: cleanArgument + * + * Purpose: clean up the memory and UTF strings used by the argument + * + * Parameters: + * env - The Java runtime environment + * arg - The argument to clean + * Returns: + * none + */ +void cleanArgument(JNIEnv *env, argument *arg) { + /* + * tempString is only used for certain String arguments. If it was used + * free it. + */ + + if ((!strcmp(arg->sig,"Ljava/lang/String;")) && arg->tempString != NULL) + /* a Java string variable like name or path */ + (*env)->ReleaseStringUTFChars(env, arg->tempString, (char *)arg->ptr); + else if (arg->datasig != NULL && + ((!strcmp(arg->datasig,"Ljava/lang/String;")) && arg->tempString != NULL)) + /* a Java data which contains a string value */ + (*env)->ReleaseStringUTFChars(env, arg->tempString, (char *)arg->ptr); + else /* other data type: a non-string Java variable or a non-string data object */ + free (arg->ptr); + + /* Free the name */ + (*env)->ReleaseStringUTFChars(env, arg->nameObject, arg->name); + (*env)->ReleaseStringUTFChars(env, arg->sigObject, arg->sig); + if (arg->isEntryorVariableData) + (*env)->ReleaseStringUTFChars(env, arg->dsObject, arg->datasig); + /* reinitialize to allow reuse */ + arg->ptr = NULL; + arg->isArray = JNI_FALSE; + arg->isEntryorVariableData = JNI_FALSE; + arg->length = -1; + arg->tempString = NULL; + +} +/* Function: ErrHandle + * + * Purpose: clean up the memory used by the argument(s) when + * an error that forces the function to return + * + * Parameters: + * status - The return status + * env - The Java runtime environment + * arg - The variable list of argument(s) to clean + * NULL - The end of variable argument list + * Returns: + * status + */ +#if defined(STDARG) +static CDFstatus ErrHandle (CDFstatus status, JNIEnv *env, ...) +#else +static CDFstatus ErrHandle (CDFstatus status, JNIEnv *env, va_alist) +va_dcl +#endif +{ + va_list ap; +#if defined(STDARG) + va_start (ap, env); +#else + VA_START (ap); +#endif + for (;;) { + argument *arg = va_arg (ap, argument *); + if (arg == NULL) { + va_end (ap); + return status; + } else + cleanArgument(env, arg); + } +} + + +/* Function: getItem + * + * Purpose: Setup the argument structure for the obj + * + * Parameters: + * env - the JNI runtime environment + * obj - the object for which the argument is setup. + * parent - the parent of the obj + * arg - a pointer to a blank argument structure + * + * Returns: + * CDFstatus - success or failure + */ +CDFstatus getItem(JNIEnv *env, jobject theCDF, jobject itemObj, jobject parent, argument *arg) { + + jobject temp1, temp2, temp3; + jclass parentClass = (*env)->GetObjectClass(env, parent); + jmethodID + vElemID = (*env)->GetMethodID(env, vecClass, "elementAt", + "(I)Ljava/lang/Object;"); + jthrowable exc; + CDFstatus status; + long dataType; + + /********************/ + /* Initialize */ + /********************/ + arg->isArray = JNI_FALSE; + arg->tempString = NULL; + arg->myObject = parent; + arg->datasig = NULL; + + MYDEBUG("getItem", "completed initialization."); + + /*******************************************/ + /* Make sure that the argument is a Vector */ + /*******************************************/ + if (((*env)->IsInstanceOf(env, itemObj, vecClass)) == JNI_FALSE) { + MYDEBUG("getItem","itemObj not a vector"); + return(BAD_FNC_OR_ITEM); + } + /**********************************************************/ + /* Get the name of the instance var out of the arg object */ + /**********************************************************/ + temp1 = (*env)->CallObjectMethod(env, itemObj, vElemID, 0); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in getItem\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + return(BAD_FNC_OR_ITEM); + } + arg->nameObject = temp1; + arg->name = (*env)->GetStringUTFChars(env, arg->nameObject, 0); + /*******************************************/ + /* Get the signature out of the arg object */ + /*******************************************/ + temp2 = (*env)->CallObjectMethod(env, itemObj, vElemID, 1); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in getItem2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + return(BAD_FNC_OR_ITEM); + } + arg->sigObject = temp2; + arg->sig = (*env)->GetStringUTFChars(env, arg->sigObject, 0); + sprintf(msg,"(1) name = %s sig = %s", arg->name, arg->sig); + MYDEBUG("getItem", msg); + + /*********************************************/ + /* Get the field id of the instance variable */ + /*********************************************/ + arg->id = (*env)->GetFieldID(env, parentClass, arg->name, arg->sig); + CHECKNULL("field ID", arg->id); + MYDEBUG("getItem", "got Field ID"); + + arg->isEntryorVariableData = + (((*env)->IsAssignableFrom(env, dataClass, parentClass) && + (strcmp(arg->name, "_data") == 0)) || + ((*env)->IsAssignableFrom(env, entryClass, parentClass) && + (strcmp(arg->name, "data") == 0)) || + ((*env)->IsAssignableFrom(env, entryClass, parentClass) && + (strcmp(arg->name, "_data") == 0)) || + ((*env)->IsAssignableFrom(env, varClass, parentClass) && + (strcmp(arg->name, "padValue") == 0))); + if (arg->isEntryorVariableData) { + MYDEBUG("getItem", "got entry/variable data/pad value"); + temp3 = + (*env)->GetObjectField(env, parent, + (*env)->GetFieldID(env, parentClass, + "dataSignature", + "Ljava/lang/String;")); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in getItem 3\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + return(BAD_FNC_OR_ITEM); + } + arg->dsObject = temp3; + arg->datasig = (*env)->GetStringUTFChars(env, arg->dsObject, 0); + sprintf(msg,"datasig = %s", arg->datasig); + dataType = (long) (*env)->GetLongField(env, parent, + (*env)->GetFieldID(env, + parentClass, + "dataType", + "J")); + if (dataType == CDF_CHAR || dataType == CDF_UCHAR) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[B"); + else + strcpy(arg->Csig, "Ljava/lang/String;"); + + else if (dataType == CDF_BYTE || dataType == CDF_INT1 || + dataType == CDF_UINT1) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[B"); + else + strcpy(arg->Csig, "B"); + + else if (dataType == CDF_INT2 || dataType == CDF_UINT2) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[S"); + else + strcpy(arg->Csig, "S"); + + else if (dataType == CDF_INT4 || dataType == CDF_UINT4) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[I"); + else + strcpy(arg->Csig, "I"); + + else if (dataType == CDF_INT8 || dataType == CDF_TIME_TT2000) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[J"); + else + strcpy(arg->Csig, "J"); + + else if (dataType == CDF_REAL4 || dataType == CDF_FLOAT) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[F"); + else + strcpy(arg->Csig, "F"); + + else if (dataType == CDF_REAL8 || dataType == CDF_DOUBLE || + dataType == CDF_EPOCH) + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[D"); + else + strcpy(arg->Csig, "D"); + + else if (dataType == CDF_EPOCH16) { + if (strncmp(arg->datasig, "[", 1) == 0) + strcpy(arg->Csig, "[D"); + else { + strcpy(arg->Csig, "D"); + arg->length = 2; + } + } + + MYDEBUG("getItem", msg); + if (strcmp(arg->datasig, "Ljava/lang/String;") == 0) + arg->length = + (jsize)(*env)->GetLongField(env, parent, + (*env)->GetFieldID(env, + parentClass, + "numElements", + "J")) + + 1; + status = argAlloc(env, arg->Csig, arg); + + if (!CheckStatus("getItem", 0)) return(status); + (*env)->ReleaseStringUTFChars(env, (jstring) temp3, 0); + return (CDF_OK); + } + + /**************************************************************/ + /* Allocate the appropriate amount of space for the variable */ + /**************************************************************/ + + if (strcmp(arg->name, "name") == 0 || strcmp(arg->name, "path") == 0) { + if (arg->length == -1) { /* Have to use the length of the passed string */ + if (strcmp(arg->name, "name") == 0) + temp3 = + (*env)->GetObjectField(env, parent, + (*env)->GetFieldID(env, parentClass, + "name", + "Ljava/lang/String;")); + else + temp3 = + (*env)->GetObjectField(env, parent, + (*env)->GetFieldID(env, parentClass, + "path", + "Ljava/lang/String;")); + arg->length = + (jsize)(*env)->GetStringUTFLength(env, (jstring) temp3); + + (*env)->ReleaseStringUTFChars(env, (jstring) temp3, 0); + } + } + status = argAlloc(env, arg->sig, arg); + if (!CheckStatus("getItem", 0)) return(status); + + return (CDF_OK); +} /* getItem */ + + +/* Function: addCDFid + * + * Purpose: addCDFid adds a CDF id to the list of maintained CDF ids. + * + * Parameters: + * id - the C CDFid to add to the list + * Returns: + * jid - the position in the CDF list where the id was added + * + * Note that items from the list may not be removed since they may cause the id of the + * CDF object to become out of sync with the native list. + * + * If this is done, then all the CDF objects will have to be synced, which may be + * difficult. + * + * Note that they may also be needed by the finalize method. + */ +jlong addCDFid(CDFid id) { + + cdfIDList *myListOfCDFs; + jlong i = 0; + + myListOfCDFs = listOfCDFs; + + if (listOfCDFs == NULL) { /* It's the first one */ + myListOfCDFs = (cdfIDList *) malloc (sizeof(cdfIDList)); + listOfCDFs = myListOfCDFs; + + } else { /* Find the end of the list and then add it */ + while (myListOfCDFs->next != NULL) { + i++; + myListOfCDFs = myListOfCDFs->next; + } + i++; + myListOfCDFs->next = (cdfIDList *) malloc (sizeof(cdfIDList)); + myListOfCDFs = myListOfCDFs->next; + } + myListOfCDFs->jid = i; + myListOfCDFs->nCDFs = (int)i+1; + myListOfCDFs->id = id; + myListOfCDFs->open = TRUE; + myListOfCDFs->next = NULL; + + return i; +} /* addCDFid */ + +/* Function: getCDFid + * + * Purpose: Get the jid-th CDFid out of the list + * + * Parameters: + * jid - position id of the CDF link list + * + * Returns: + * id - the C CDFid + */ +CDFid getCDFid (jlong jid) { + + cdfIDList *myListOfCDFs; + int i = 0; + + myListOfCDFs = listOfCDFs; + for (i=0; i < (int)jid; i++) + myListOfCDFs = myListOfCDFs->next; + return myListOfCDFs->id; /* Acutal CDF id, not jid */ +} /* getCDFid */ + +/* Function: removeCDFid + * + * Purpose: Mark the jid-th CDFid on the list as closed when the CDF is closed + * + * Parameters: + * jid - position id of the CDF link list + * + */ +void removeCDFid (jlong jid) { + + cdfIDList *myListOfCDFs; + int i; + + myListOfCDFs = listOfCDFs; + for (i=0; i < (int)jid; i++) + myListOfCDFs = myListOfCDFs->next; + + myListOfCDFs->open = FALSE; /* Mark it as closed */ +} /* removeCDFid */ + +/* Function: flipDataElements + * + * Purpose: Shuffle data elements in records from row to column or column + * to row for a multi-dimensional variable in a column-major CDF. + * + * Parameters: + * buffer - buffer pointer for record data + * direction - indicator, 1 for column-to-row, 2 for row-to-column + * + */ +CDFstatus flipDataElements (char * buffer, jint direction) { + + long majority, numdims, dimSizes[CDF_MAX_DIMS], reccount; + long dimVarys[CDF_MAX_DIMS]; + long dimcounts[CDF_MAX_DIMS]; + int ix; + int toflip; + CDFstatus statuz; + long numdimsx; + statuz = CDFlib (GET_, CDF_MAJORITY_, &majority, + zVAR_NUMDIMS_, &numdims, + zVAR_DIMSIZES_, dimSizes, + zVAR_DIMVARYS_, dimVarys, + CONFIRM_, zVAR_RECCOUNT_, &reccount, + zVAR_DIMCOUNTS_, dimcounts, + NULL_); + if (statuz != CDF_OK) return(statuz); + numdimsx = 0; + for (ix = 0; ix < (int) numdims; ix++) { + if (dimVarys[ix]) { + dimSizes[numdimsx] = dimSizes[ix]; + ++numdimsx; + } + } + toflip = 1; + if (majority == ROW_MAJOR) toflip = 0; + else if (numdimsx < 2) toflip = 0; + else if (reccount < 1) toflip = 0; + else { + for (ix = 0; ix < (int) numdimsx; ix++) { + if (dimSizes[ix] != dimcounts[ix]) { + toflip = 0; + break; + } + } + } + if (toflip == 1) { + long NvalueBytes, numelems, datatype; + long nValuesPerRecord = 1L, nBytesPerRecord; + char *tmpbuf; + statuz = CDFlib (GET_, zVAR_DATATYPE_, &datatype, + zVAR_NUMELEMS_, &numelems, + NULL_); + if (statuz != CDF_OK) return(statuz); + + for (ix = 0; ix < (int) numdims; ix++) { + if (dimVarys[ix] && dimcounts[ix] > 0) + nValuesPerRecord *= dimcounts[ix]; + } + NvalueBytes = numelems * CDFelemSize(datatype); + nBytesPerRecord = nValuesPerRecord * NvalueBytes; + tmpbuf = (char *) malloc ((size_t) nBytesPerRecord * + reccount); + for (ix = 0; ix < (int) reccount; ix++) { + size_t offset = (size_t) (ix * nBytesPerRecord); + if (direction == 1) + COLtoROW (buffer + offset, tmpbuf + offset, + numdimsx, dimcounts, NvalueBytes); + else + ROWtoCOL (buffer + offset, tmpbuf + offset, + numdimsx, dimcounts, NvalueBytes); + + } + memmove (buffer, tmpbuf, + (size_t) reccount * nBytesPerRecord); + free (tmpbuf); + } + return (CDF_OK); +} /* flipDataElements */ + +/* Function: cleanGlobalRefs + * + * Purpose: Clear the global references if no CDFs are still open. In this + * case, the CDFid link list are also cleared. + * + * Parameters: + * env - the Java runtime environment + * + */ +void cleanGlobalRefs (JNIEnv *env) { + + cdfIDList *myListOfCDFs; + + if (listOfCDFs == NULL) return; + /* Check if there is still at least one open CDF. If so, then return. */ + if (listOfCDFs->open) return; + myListOfCDFs = listOfCDFs; + while (myListOfCDFs->next != NULL) { + myListOfCDFs = myListOfCDFs->next; + if (myListOfCDFs->open) return; + } + + /* All CDFs on the link list are closed. So */ + /* clear the link list and global references */ + + while (listOfCDFs->next != NULL) { + myListOfCDFs = listOfCDFs->next; + free (listOfCDFs); + listOfCDFs = myListOfCDFs; + } + free (listOfCDFs); + listOfCDFs = NULL; + (*env)->DeleteGlobalRef(env, cdfClass); + (*env)->DeleteGlobalRef(env, varClass); + (*env)->DeleteGlobalRef(env, entryClass); + (*env)->DeleteGlobalRef(env, attrClass); + (*env)->DeleteGlobalRef(env, dataClass); + (*env)->DeleteGlobalRef(env, excClass); + + (*env)->DeleteGlobalRef(env, byteClass); + (*env)->DeleteGlobalRef(env, shortClass); + (*env)->DeleteGlobalRef(env, intClass); + (*env)->DeleteGlobalRef(env, longClass); + (*env)->DeleteGlobalRef(env, floatClass); + (*env)->DeleteGlobalRef(env, doubleClass); + (*env)->DeleteGlobalRef(env, strClass); + (*env)->DeleteGlobalRef(env, objClass); + (*env)->DeleteGlobalRef(env, vecClass); + + cdfClass = 0; + MYDEBUG("cleanGlobalRefs", "Global Refs deleted."); + return; +} /* cleanGlobalRefs */ + +/* Function: JAVAcdflib + * Purpose: JAVAcdflib is the main wrapper to CDFlib calls + * + * Parameters: + * env - the JNI runtime environment + * obj - the CDFObject on which the command is to be executed. + * cmdVector - the CDF cmd wrapped in a java.long.Vector + * jid - the java CDF id which contains the CDFObject + * Returns: + * status - the return status of the CDFlib call + */ +CDFstatus JAVAcdflib (JNIEnv *env, + jobject theCDF, + jobject obj, + jobject cmdVector, /* Command vector to process */ + long jid, /* CDF id in the link list */ + long function) { /* Function to be processed */ + + jclass + objClass = (*env)->GetObjectClass(env, obj); + jmethodID + vSizeID = (*env)->GetMethodID(env, vecClass, "size", "()I"), + vElemID = (*env)->GetMethodID(env, vecClass, "elementAt", "(I)Ljava/lang/Object;"); + + jobject nextItem; + jthrowable exc; + CDFid id; /* Only need for the close method. */ + CDFid oid; + CDFstatus status, status2; + + int i; + char *CDFname; + argument arg, arg2, arg3, arg4, arg5, arg6, arg7, arg8; + long item, /* Item (e.g. CDF_, ATTR_, etc.) */ + func; /* Function (e.g. CREATE_, OPEN_, etc. */ + jlong newID; /* Position id in the link list */ + + /****************************************/ + /* Get the value of the passed function */ + /****************************************/ + func = function; + + MYDEBUG("cdflib",">>>>>>>>>>>>>>>>>>>>>>"); + strcpy(msg, "vecClass is"); + if (vecClass == NULL) + strcat(msg, " null!?!"); + else + strcat(msg, " ok!"); + MYDEBUG("cdflib", msg); + + /**********************************************************************/ + /* Since the first item is processed by the calling routine, skip the */ + /* command and start processing item and its arguments */ + /**********************************************************************/ + i = 1; + + /***********************************************************************/ + /* Process until there are no more items to process in the cmdVector */ + /***********************************************************************/ + + arg.length = -1; + + while (func != NULL_) { + switch (func) { + + case OPEN_: /* Open CDF */ + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + + status = getFuncOrItem(env, nextItem, &item); + if (!CheckStatus("Java getFuncOrItem", 0)) return(status); + sprintf(msg,"func = %ld item = %ld status = %ld",func,item,status); + MYDEBUG("cdflib",msg); + + /************************/ + /* Get the CDF filename */ + /************************/ + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + arg.length = -1; /* Actual path length is determined in getItem */ + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("Java getItem", 0)) return(status); + getJavaField (env, &arg); + sprintf(msg,"filename = %s", ((char *) arg.ptr)); + MYDEBUG("cdflib", msg); + + /**************/ + /* Get the id */ + /**************/ + arg2.length = 1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("Java getItem", 0)) return(status); + + /**************************************************/ + /* Perform the OPEN_ and place the CDF in zMODE/2 */ + /**************************************************/ + status = CDFlib(OPEN_, item, (char *)arg.ptr, &oid, + NULL_); + if (!CheckStatus("cdflib (OPEN_, CDF_)", 1)) + return (ErrHandle(status, env, &arg, &arg2, NULL)); + + /********************************************************/ + /* Set the CDF id returned by CDFlib (i.e. oid) and add */ + /* the position id of the link list (i.e. newID). */ + /********************************************************/ + newID = addCDFid(oid); + (*env)->SetLongField(env, obj, arg2.id, newID); + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end OPEN_ */ + + case CLOSE_: /* Special case: only close CDFs */ + MYDEBUG("cdflib","closing the file"); + /********************************************/ + /* NEW Get the jid-th CDFid out of the list */ + /********************************************/ + id = getCDFid(jid); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + + status = CDFlib(SELECT_, CDF_, id, + CLOSE_, CDF_, + NULL_); + + if (!CheckStatus("cdflib (CLOSE_, CDF_)", 1)) return(status); + + removeCDFid(jid); + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + cleanGlobalRefs(env); + break; /* end CLOSE_ */ + + case CONFIRM_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + + while (item < NULL_) { + sprintf (msg,"func = %ld item = %ld status = %ld", + func,item,status2); + MYDEBUG("cdflib",msg); + + switch(item) { + + case CDF_READONLY_MODE_: + case CDF_DECODING_: + case CDF_CACHESIZE_: + case CDF_NEGtoPOSfp0_MODE_: + case CDF_zMODE_: + case COMPRESS_CACHESIZE_: + case STAGE_CACHESIZE_: + case gENTRY_: + case zENTRY_: + case ATTR_: + case zVAR_RECNUMBER_: + case zVAR_RECCOUNT_: + case zVAR_RECINTERVAL_: + case zVAR_CACHESIZE_: + case zVAR_RESERVEPERCENT_: + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (CONFIRM_ 1)", 0)) return(status); + + getJavaField(env, &arg); + + sprintf (msg,"confirming item %ld, id = %ld", + item,*(long *)arg.ptr); + MYDEBUG("cdflib",msg); + + status = CDFlib(CONFIRM_, item, (long *)arg.ptr, + NULL_); + if (!CheckStatus("cdflib (CONFIRM_ 2)", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + setJavaField(env, arg); + cleanArgument(env, &arg); + break; + + case zENTRY_EXISTENCE_: + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (CONFIRM_)", 0)) return(status); + + getJavaField(env, &arg); + + sprintf (msg,"confirming item %ld, id = %ld", + item,*(long *)arg.ptr); + MYDEBUG("cdflib",msg); + + status = CDFlib(CONFIRM_, item, *(long *)arg.ptr, + NULL_); + if (!CheckStatus("cdflib (CONFIRM_)", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + setJavaField(env, arg); + cleanArgument(env, &arg); + break; + + case ATTR_EXISTENCE_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (CONFIRM_)", 0)) return(status); + + getJavaField(env, &arg); /* Attribute name */ + + sprintf (msg,"confirming item %ld, id = %ld", + item,*(long *)arg.ptr); + MYDEBUG("cdflib",msg); + status = CDFlib(CONFIRM_, item, (char *)arg.ptr, + NULL_); + if (!CheckStatus("cdflib (CONFIRM_)", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + setJavaField(env, arg); + cleanArgument(env, &arg); + break; + + case zVAR_PADVALUE_: + case CDF_CHECKSUM_: + + status = CDFlib(CONFIRM_, item, + NULL_); + + if (!CheckStatus("cdflib (CONFIRM_)", 1)) return(status); + break; + + default: + MYDEBUG("cdflib","Can't deal with it yet"); + break; + } /* switch(item) */ + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end CONFIRM_ */ + + case CREATE_: + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + while (item < NULL_) { + sprintf (msg,"func = %ld item = %ld status = %ld", + func,item,status2); + MYDEBUG("cdflib",msg); + + switch(item) { + + case ATTR_: + arg.length = -1; /* Actual name length is determined in getItem */ + arg2.length = arg3.length = -1; + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (CREATE_,ATTR_) 1", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (CREATE_,ATTR_) 2", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg3); + if (!CheckStatus("cdflib (CREATE_,ATTR_) 3", 0)) return(status); + + getJavaField(env, &arg); /* Attr name */ + getJavaField(env, &arg2); /* Attr scope */ + + status = CDFlib (CREATE_, ATTR_, (char *)arg.ptr, + *(long *)arg2.ptr, + arg3.ptr, + NULL_); + if (!CheckStatus("cdflib (CREATE_,ATTR_) 4", 1)) + return (ErrHandle(1, env, &arg, &arg2, &arg3, NULL)); + + setJavaField (env,arg3); /* Set the value of attrNum */ + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + cleanArgument(env, &arg3); + break; + + case CDF_: + arg.length = -1; /* Actual path length is determined in getItem */ + arg2.length = arg3.length = arg4.length = -1; + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (CREATE_,CDF_) 1", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (CREATE_,CDF_) 2", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg3); + if (!CheckStatus("cdflib (CREATE_,CDF_) 3", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg4); + if (!CheckStatus("cdflib (CREATE_,CDF_) 4", 0)) return(status); + getJavaField(env, &arg); /* char *CDFname */ + getJavaField(env, &arg2); /* long numDims */ + getJavaField(env, &arg3); /* long dimSizes[] */ + + /**************************************************** + * When creating CDF files, the name should not have + * the ".cdf" or ".CDF" extension at the end. Check + * the name (in arg.ptr) to see if ".cdf" or ".CDF" + * is present and remove it if it is. + ***************************************************/ + + if (strcmp((char *)arg.ptr+arg.length-4,".cdf") == 0 || + strcmp((char *)arg.ptr+arg.length-4,".CDF") == 0) { + CDFname = malloc(arg.length - 4 + 1); + if (CDFname == NULL) return(BAD_MALLOC); + memmove(CDFname, arg.ptr, arg.length-4); + CDFname[arg.length-4] = NUL; + } else { + CDFname = malloc(arg.length+1); + if (CDFname == NULL) return(BAD_MALLOC); + strcpy(CDFname, arg.ptr); + } + + status = CDFlib(CREATE_, CDF_, CDFname, + *(long *)arg2.ptr, + arg3.ptr, + &oid, /* out-CDFid */ + NULL_); + free(CDFname); + if (!CheckStatus("cdflib (CREATE_,CDF_) 5", 1)) + return (ErrHandle(status, env, &arg, &arg2, &arg3, + &arg4, NULL)); + + /****************************************************/ + /* Add the oid (CDF id) returned by the CDFlib call */ + /* to the link list. */ + /****************************************************/ + newID = addCDFid(oid); + + /********************************/ + /* Set the CDF id field in Java */ + /********************************/ + *(long *)arg4.ptr = (long) newID; + + setJavaField(env,arg4); + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + cleanArgument(env, &arg3); + cleanArgument(env, &arg4); + break; + + case zVAR_: + arg.length = -1; /* Actual name length is determined in getItem */ + arg2.length = arg3.length = arg4.length = arg5.length = + arg6.length = arg7.length = arg8.length = -1; + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (CREATE_,VAR_) 1", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (CREATE_,VAR_) 2", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg3); + if (!CheckStatus("cdflib (CREATE_,VAR_) 3", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg4); + if (!CheckStatus("cdflib (CREATE_,VAR_) 4", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg5); + if (!CheckStatus("cdflib (CREATE_,VAR_) 5", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg6); + if (!CheckStatus("cdflib (CREATE_,VAR_) 6", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg7); + if (!CheckStatus("cdflib (CREATE_,VAR_) 7", 0)) return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg8); + if (!CheckStatus("cdflib (CREATE_,VAR_) 8", 0)) return(status); + + getJavaField(env, &arg); /* char *varName */ + getJavaField(env, &arg2); /* jlong dataType */ + getJavaField(env, &arg3); /* jlong numElements */ + getJavaField(env, &arg4); /* jlong numDims */ + getJavaField(env, &arg5); /* jlong dimSizes[] */ + getJavaField(env, &arg6); /* jlong recVary */ + getJavaField(env, &arg7); /* jlong dimVary[] */ + status = CDFlib(CREATE_, zVAR_, (char *)arg.ptr, + *(long *)arg2.ptr, + *(long *)arg3.ptr, + *(long *)arg4.ptr, + (long *) arg5.ptr, + *(long *)arg6.ptr, + (long *) arg7.ptr, + arg8.ptr, /* varNum */ + NULL_); + if (!CheckStatus("cdflib (CREATE_,VAR_) 9", 1)) + return (ErrHandle(1, env, &arg, &arg2, &arg3, + &arg4, &arg5, &arg6, &arg7, &arg8, + NULL)); + + setJavaField(env,arg8); /* Set the variable number */ + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + cleanArgument(env, &arg3); + cleanArgument(env, &arg4); + cleanArgument(env, &arg5); + cleanArgument(env, &arg6); + cleanArgument(env, &arg7); + cleanArgument(env, &arg8); + break; + + default: + (*env)->ThrowNew(env, excClass, "Bad function or item"); + break; + } /* switch(item) */ + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end CREATE_ */ + + case DELETE_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + + while (item < NULL_) { + sprintf(msg,"func = %ld item = %ld status = %ld",func,item, + status2); + MYDEBUG("cdflib",msg); + + switch(item) { + + case ATTR_: + case CDF_: + case gENTRY_: + case zENTRY_: + case zVAR_: + status = CDFlib(DELETE_, item, NULL_); + if (!CheckStatus("cdflib (DELETE_) 1", 1)) return(status); + if (item == CDF_) removeCDFid(jid); + break; + + case zVAR_RECORDS_: + case zVAR_RECORDS_RENUMBER_: + arg.length = arg2.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (DELETE_, VAR_RECORDS_) 1", 0)) + return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (DELETE_,VAR_RECORDS_) 2", 0)) + return(status); + + getJavaField(env, &arg); /* first record number */ + getJavaField(env, &arg2); /* last record number */ + + status = CDFlib(DELETE_, item, *(long *)arg.ptr, + *(long *)arg2.ptr, + NULL_); + if (!CheckStatus("cdflib (DELETE_, VAR_RECORDS_) 3", 1)) + return(ErrHandle(status, env, &arg, &arg2, NULL)); + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + break; + default: + (*env)->ThrowNew(env, excClass, "Function not implemented yet. Contact the CDFJava API developer for requests/questions"); + break; + } /* switch(item) */ + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end DELETE_ */ + + case SAVE_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + + while (item < NULL_) { + sprintf(msg,"func = %ld item = %ld status = %ld",func,item, + status2); + MYDEBUG("cdflib",msg); + + switch(item) { + + case CDF_: + status = CDFlib(SAVE_, item, NULL_); + if (!CheckStatus("cdflib (SAVE_) 1", 1)) return(status); + break; + default: + (*env)->ThrowNew(env, excClass, "Function not implemented yet. Contact the CDFJava API developer for requests/questions"); + break; + } /* switch(item) */ + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end SAVE_ */ + + case GET_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + + while (item < NULL_) { + + sprintf(msg,"func = %ld item = %ld status = %ld",func,item, + status2); + MYDEBUG("cdflib",msg); + + switch(item) { + + case ATTR_NAME_: + case ATTR_SCOPE_: + case ATTR_MAXgENTRY_: + case ATTR_MAXzENTRY_: + case ATTR_NUMgENTRIES_: + case ATTR_NUMzENTRIES_: + case CDF_COPYRIGHT_: + case CDF_ENCODING_: + case CDF_FORMAT_: + case CDF_INCREMENT_: + case CDF_MAJORITY_: + case CDF_NUMATTRS_: + case CDF_NUMgATTRS_: + case CDF_NUMvATTRS_: + case CDF_NUMrVARS_: + case CDF_NUMzVARS_: + case CDF_VERSION_: + case CDF_RELEASE_: + case CDF_CHECKSUM_: + case CDF_LEAPSECONDLASTUPDATED_: + case gENTRY_DATATYPE_: + case gENTRY_NUMELEMS_: + case zENTRY_DATATYPE_: + case zENTRY_NUMELEMS_: + case zENTRY_NUMSTRINGS_: + case zVAR_NAME_: + case zVAR_NUMELEMS_: + case zVAR_DATATYPE_: + case zVAR_NUMDIMS_: + case zVAR_RECVARY_: + case zVAR_DIMVARYS_: + case zVAR_DIMSIZES_: + case zVAR_MAXREC_: + case zVAR_BLOCKINGFACTOR_: + case zVAR_MAXallocREC_: + case zVAR_NUMallocRECS_: + case zVAR_NUMRECS_: + case zVAR_SPARSERECORDS_: + case zVARs_MAXREC_: + case LIB_COPYRIGHT_: + case LIB_INCREMENT_: + case LIB_RELEASE_: + case LIB_VERSION_: + case LIB_subINCREMENT_: + if (item == CDF_COPYRIGHT_ || item == LIB_COPYRIGHT_) + arg.length = CDF_COPYRIGHT_LEN + 1; + if (item == ATTR_NAME_) { + if (lib_ver == 2 || CDFgetFileBackward()) + arg.length = CDF_ATTR_NAME_LEN + 1; + else + arg.length = CDF_ATTR_NAME_LEN256 + 1; + } + if (item == zVAR_NAME_) { + if (lib_ver == 2 || CDFgetFileBackward()) + arg.length = CDF_VAR_NAME_LEN + 1; + else + arg.length = CDF_VAR_NAME_LEN256 + 1; + } + if (item == LIB_subINCREMENT_) + arg.length = 2; + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (GET_) 1", 0)) return(status); + + status = CDFlib(GET_, item, arg.ptr, NULL_); + if (!CheckStatus("cdflib (GET_) 2", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + setJavaField(env,arg); + cleanArgument(env, &arg); + + break; + + case ATTR_NUMBER_: + if (lib_ver == 2 || CDFgetFileBackward()) + arg.length = CDF_ATTR_NAME_LEN256+1; + else + arg.length = CDF_ATTR_NAME_LEN+1; + arg2.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (GET_, ATTR_NUMBER_) 1", 0)) + return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (GET_,ATTR_NUMBER_) 2", 0)) + return(status); + + getJavaField(env, &arg); /* Attribute name */ + + status = CDFlib(GET_, ATTR_NUMBER_, (char *)arg.ptr, + arg2.ptr, + NULL_); + if (!CheckStatus("cdflib (GET_, ATTR_NUMBER_) 3", 1)) + return(ErrHandle(status, env, &arg, &arg2, NULL)); + + setJavaField(env,arg2); /* Set the attribute number */ + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + break; + + case zVAR_ALLOCATEDFROM_: + case zVAR_ALLOCATEDTO_: + arg.length = arg2.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (GET_, ALLOCATEDFROM_/TO_) 1", 0)) + return(status); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (GET_,ALLOCATEDFROM_/TO_) 2", 0)) + return(status); + + getJavaField(env, &arg); /* start record number */ + + status = CDFlib(GET_, item, *(long *)arg.ptr, + arg2.ptr, + NULL_); + if (!CheckStatus("cdflib (GET_, ALLOCATEDFROM_/TO_) 3", 1)) + return(ErrHandle(status, env, &arg, &arg2, NULL)); + + setJavaField(env,arg2); /* Set the last record number */ + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + break; + + case gENTRY_DATA_: + case zENTRY_DATA_: + case zVAR_DATA_: + case zVAR_HYPERDATA_: + case zVAR_PADVALUE_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (GET_, ENTRY/VARIABLE_DATA_) 1", 0)) + return(status); + + status = CDFlib (GET_, item, (void *) arg.ptr, + NULL_); + + if (!CheckStatus("cdflib (GET_,ENTRY/VARIABLE_DATA_) 2", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + if (item == zVAR_HYPERDATA_) { + status2 = flipDataElements((char *) arg.ptr, 1); + } + setJavaField(env,arg); /* Set the attribute entry data */ + cleanArgument(env, &arg); + break; + + case CDF_COMPRESSION_: + case rVAR_COMPRESSION_: + case zVAR_COMPRESSION_: + arg.length = arg2.length = arg3.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (GET_, COMPRESSION_) 1", 0)) + return(status); + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (GET_, COMPRESSION_) 2", 0)) + return(status); + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg3); + if (!CheckStatus("cdflib (GET_, COMPRESSION_) 3", 0)) + return(status); + + status = CDFlib(GET_, item, arg.ptr, + arg2.ptr, + arg3.ptr, + NULL_); + if (!CheckStatus("cdflib (GET_, COMPRESSION_) 4", 1)) + return (ErrHandle(status, env, &arg, &arg2, &arg3, + NULL)); + + setJavaField(env,arg); /* long *cType */ + setJavaField(env,arg2); /* long cParms[CDF_MAX_PARMS] */ + setJavaField(env,arg3); /* long *cPct */ + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + cleanArgument(env, &arg3); + break; + + default: + MYDEBUG("cdflib","Can't deal with it yet"); + break; + } /* switch(item) */ + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end GET_ */ + + case PUT_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + + while (item < NULL_) { + sprintf (msg,"func = %ld item = %ld status = %ld", + func,item,status2); + MYDEBUG("cdflib",msg); + switch(item) { + + case ATTR_NAME_: + case zVAR_NAME_: /* for 1 pointer variable input */ + arg.length = -1; /* Actual name length is determined in getItemm */ + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (PUT_) 1", 0)) return(status); + + getJavaField(env, &arg); + + status = CDFlib(PUT_, item, (char *)arg.ptr, NULL_); + if (!CheckStatus("cdflib (PUT_) 2", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + cleanArgument(env, &arg); + break; + + case ATTR_SCOPE_: + case CDF_ENCODING_: + case CDF_MAJORITY_: + case CDF_FORMAT_: + case CDF_CHECKSUM_: + case CDF_LEAPSECONDLASTUPDATED_: + case zVAR_ALLOCATERECS_: + case zVAR_BLOCKINGFACTOR_: + case zVAR_RECVARY_: + case zVAR_SPARSERECORDS_: + case zVAR_INITIALRECS_: /* for 1 long variable as input */ + + arg.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (PUT_,CDF_ENC/MAJ_/FOR_/zVAR_ALLOC_/BLOCK_/INIT_/SPARSE_/RECVARY_) 1", 0)) + return(status); + getJavaField(env, &arg); + status = CDFlib(PUT_, item, *(long *)arg.ptr, + NULL_); + if (!CheckStatus("cdflib (PUT_,CDF_ENC/MAJ_/FOR_/zVAR_ALLOC_/BLOCK_/INIT_/SPARSE_/RECVARY_) 2", 1)) + return (ErrHandle(status, env, &arg, NULL)); + + cleanArgument(env, &arg); + break; + + case zENTRY_DATA_: + case gENTRY_DATA_: /* for 2 long and 1 pointer variables input */ + arg.length = arg2.length = arg3.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (PUT_,ENTRY_DATA_) 1", 0)) + return(status); + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (PUT_,ENTRY_DATA_) 2", 0)) + return(status); + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + + status = getItem(env, theCDF, nextItem, obj, &arg3); + if (!CheckStatus("cdflib (PUT_,ENTRY_DATA_) 3", 0)) + return(status); + + getJavaField(env, &arg); /* long dataType */ + + getJavaField(env, &arg2); /* long numElements */ + + getJavaField(env, &arg3); /* void *data */ + + status = CDFlib(PUT_, item, *(long *)arg.ptr, + *(long *)arg2.ptr, + arg3.ptr, + NULL_); + if (!CheckStatus("cdflib (PUT_,ENTRY_DATA_) 4", 1)) + return (ErrHandle(status, env, &arg, &arg2, &arg3, + NULL)); + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + cleanArgument(env, &arg3); + break; + + case gENTRY_DATASPEC_: + case zENTRY_DATASPEC_: + case zVAR_DATASPEC_: + case zVAR_ALLOCATEBLOCK_: /* for 2 long variables input */ + arg.length = arg2.length = -1; + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + + if (!CheckStatus("cdflib (PUT_,g/zENTRY_DATASPEC_|zVAR_DATASPEC_|zVAR_ALLOCATEBLOCK_) 1", 0)) + return(status); + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (PUT_,g/zENTRY_DATASPEC_|zVAR_DATASPEC_|zVAR_ALLOCATEBLOCK_) 2", 0)) + return(status); + + getJavaField(env, &arg); /* long firstRecord */ + getJavaField(env, &arg2); /* long lastRecord */ + + status = CDFlib(PUT_, item, *(long *)arg.ptr, + *(long *)arg2.ptr, + NULL_); + if (!CheckStatus("cdflib (PUT_,g/zENTRY_DATASPEC_|zVAR_DATASPEC_|zVAR_ALLOCATEBLOCK_) 3", 1)) + return (ErrHandle(status, env, &arg, &arg2, NULL)); + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + break; + + case zVAR_PADVALUE_: + case zVAR_DATA_: + case zVAR_HYPERDATA_: /* for 1 pointer variable for input */ + + arg.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (PUT_,zVAR_PADVALUE_/_DATA_/_HYPERDATA_) 1", 0)) + return(status); + + getJavaField(env, &arg); + + if (item == zVAR_HYPERDATA_) { + status2 = flipDataElements((char *) arg.ptr, 2); + } + + status = CDFlib(PUT_, item, (void *)arg.ptr, + NULL_); + if (!CheckStatus("cdflib (PUT_,zVAR_PADVALUE_/_DATA_/_HYPERDATA_) 2", 1)) + return (ErrHandle(status, env, &arg, NULL)); + + cleanArgument(env, &arg); + break; + + case CDF_COMPRESSION_: + case zVAR_COMPRESSION_: /* for 1 long and 1 pointer variables input */ + + arg.length = arg2.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (PUT_,CDF_/zVAR_COMPRESSION_) 1", 0)) + return(status); + + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg2); + if (!CheckStatus("cdflib (PUT_,CDF_/zVAR_COMPRESSION_) 2", 0)) + return(status); + + getJavaField(env, &arg); + + getJavaField(env, &arg2); + + status = CDFlib(PUT_, item, *(long *)arg.ptr, arg2.ptr, + NULL_); + if (!CheckStatus("cdflib (PUT_,CDF_/zVAR_COMPRESSION_) 3", 1)) + return (ErrHandle(status, env, &arg, &arg2, NULL)); + + cleanArgument(env, &arg); + cleanArgument(env, &arg2); + break; + + case zVAR_DIMVARYS_: /* for 1 pointer variable input */ + + arg.length = -1; + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + if (!CheckStatus("cdflib (PUT_,zVAR_DIMVARYS_) 1", 0)) + return(status); + + getJavaField(env, &arg); + + status = CDFlib(PUT_, item, arg.ptr, + NULL_); + if (!CheckStatus("cdflib (PUT_,zVAR_DIMVARYS_) 2", 1)) + return (ErrHandle(status, env, &arg, NULL)); + + cleanArgument(env, &arg); + break; + + default: + (*env)->ThrowNew(env, excClass, "Bad function or item"); + break; + } /* switch(item) */ + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end PUT_ */ + + /******************************************************************/ + /* SELECT_ */ + /******************************************************************/ + case SELECT_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + if (isItem(nextItem)) { + status2 = getFuncOrItem(env, nextItem, &item); + + while (item < NULL_) { + sprintf (msg,"func = %ld item = %ld status = %ld", + func,item,status2); + MYDEBUG("cdflib",msg); + + switch(item) { + + case CDF_READONLY_MODE_: + case CDF_DECODING_: + case CDF_CACHESIZE_: + case CDF_NEGtoPOSfp0_MODE_: + case CDF_zMODE_: + case COMPRESS_CACHESIZE_: + case STAGE_CACHESIZE_: + case gENTRY_: + case zENTRY_: + case ATTR_: + case zVAR_RECNUMBER_: + case zVAR_RECCOUNT_: + case zVAR_RECINTERVAL_: + case zVAR_CACHESIZE_: + case zVAR_RESERVEPERCENT_: + case CDF_: + case zVAR_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + getJavaField(env, &arg); + if (!CheckStatus("cdflib (SELECT_)", 0)) + return(status); + + if (item == CDF_) { + id = getCDFid(jid); + status = CDFlib(SELECT_, CDF_, id, NULL_); + } else { + status = CDFlib(SELECT_, item, *(long *)arg.ptr, + NULL_); + } + if (!CheckStatus("cdflib (SELECT_)", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + cleanArgument(env, &arg); + break; + + case zVAR_DIMINDICES_: + case zVAR_DIMCOUNTS_: + case zVAR_DIMINTERVALS_: + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + status = getItem(env, theCDF, nextItem, obj, &arg); + getJavaField(env, &arg); + if (!CheckStatus("cdflib (SELECT_)", 0)) + return(status); + + status = CDFlib(SELECT_, item, (long *)arg.ptr, + NULL_); + if (!CheckStatus("cdflib (SELECT_)", 1)) + return(ErrHandle(status, env, &arg, NULL)); + + cleanArgument(env, &arg); + break; + + default: + MYDEBUG("cdflib","Can't deal with it yet"); + break; + } /* switch(item) */ + + MYDEBUG("cdflib", "Getting nextItem"); + nextItem = (*env)->CallObjectMethod(env, cmdVector, vElemID, i++); + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib2\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + CHECKNULL("nextItem",nextItem); + status2 = getFuncOrItem(env, nextItem, &item); + } + } else { + (*env)->ThrowNew(env, excClass, "Bad function or item"); + } + break; /* end SELECT_ */ + + default: + (*env)->ThrowNew(env, excClass, "Bad function or item"); + break; + } /* switch(func) */ + func = item; + sprintf(msg, "The next func = %ld",func); + MYDEBUG("cdflib", msg); + + exc = (*env)->ExceptionOccurred(env); + if (exc) { + printf("Exception in cdflib3\n"); + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + return(BAD_FNC_OR_ITEM); + } + + } /* while(func!=NULL_) */ + MYDEBUG("cdflib","<<<<<<<<<<<<<<<<<<<<"); + return(status); + +} /* end JAVAcdflib */ + +/********************************************* + ** ** + ** JNI Methods ** + ** ** + *********************************************/ + +/* Function: cdfNativeLib + * Class: CDFNativeLibrary + * Package: gsfc.nssdc.cdf + * + * Purpose: This is the main wrapper for the native implementation of the + * CDFJava API + * + * Parameters: + * in: env - The Java environment pointer + * in: nativeLibraryObject - The instance of CDFNativeLibrary making + * the call + * in: theCDF - The CDF to which the object belongs + * in: obj - The instance of a CDFObject on which the cmds should be + * executed + * in: cmdVector - A java.util.Vector that contains the CDF command + * to perform + * Returns: + * void + */ +JNIEXPORT void JNICALL +Java_gsfc_nssdc_cdf_CDFNativeLibrary_cdfNativeLib(JNIEnv *env, + jobject nativeLibraryObject, + jobject theCDF, + jobject obj, + jobject cmdVector) { + + jclass + myobjClass = (*env)->GetObjectClass(env, obj), + cmdClass = (*env)->GetObjectClass(env, cmdVector); + + jfieldID cdfidID, idID; + jmethodID vElemID; + jobject firstCmd, firstArg; + + long cdfid, /* CDF id assigned by the CDFlib routine */ + objType, /* CDF object type */ + func, /* CDF function (e.g. CREATE_, GET_, etc) */ + newArg; /* Argument after function */ + + + /* Needed for save operation without closing a CDF file */ + struct CDFstruct *cdfstruct; + CDFid id0; + CDFstatus status; + + /* For the first call to here, set up all global references */ + if (cdfClass == 0) { + + jclass cdfClass1, varClass1, entryClass1, attrClass1, dataClass1, + excClass1; + jclass byteClass1, shortClass1, intClass1, longClass1, floatClass1, + doubleClass1, strClass1, vecClass1, objClass1; + + cdfClass1 = (*env)->FindClass(env, "gsfc/nssdc/cdf/CDF"), + varClass1 = (*env)->FindClass(env, "gsfc/nssdc/cdf/Variable"), + entryClass1 = (*env)->FindClass(env, "gsfc/nssdc/cdf/Entry"), + attrClass1 = (*env)->FindClass(env, "gsfc/nssdc/cdf/Attribute"), + dataClass1 = (*env)->FindClass(env, "gsfc/nssdc/cdf/CDFData"), + excClass1 = (*env)->FindClass(env, "gsfc/nssdc/cdf/CDFException"), + + vecClass1 = (*env)->FindClass(env, "java/util/Vector"), + byteClass1 = (*env)->FindClass(env, "java/lang/Byte"), + shortClass1 = (*env)->FindClass(env, "java/lang/Short"), + intClass1 = (*env)->FindClass(env, "java/lang/Integer"), + longClass1 = (*env)->FindClass(env, "java/lang/Long"), + floatClass1 = (*env)->FindClass(env, "java/lang/Float"), + doubleClass1 = (*env)->FindClass(env, "java/lang/Double"), + strClass1 = (*env)->FindClass(env, "java/lang/String"), + objClass1 = (*env)->FindClass(env, "java/lang/Object"); + + cdfClass = (*env)->NewGlobalRef(env, cdfClass1); + varClass = (*env)->NewGlobalRef(env, varClass1); + entryClass = (*env)->NewGlobalRef(env, entryClass1); + attrClass = (*env)->NewGlobalRef(env, attrClass1); + dataClass = (*env)->NewGlobalRef(env, dataClass1); + excClass = (*env)->NewGlobalRef(env, excClass1); + + vecClass = (*env)->NewGlobalRef(env, vecClass1); + byteClass = (*env)->NewGlobalRef(env, byteClass1); + shortClass = (*env)->NewGlobalRef(env, shortClass1); + intClass = (*env)->NewGlobalRef(env, intClass1); + longClass = (*env)->NewGlobalRef(env, longClass1); + floatClass = (*env)->NewGlobalRef(env, floatClass1); + doubleClass = (*env)->NewGlobalRef(env, doubleClass1); + strClass = (*env)->NewGlobalRef(env, strClass1); + objClass = (*env)->NewGlobalRef(env, objClass1); + + BvalID = (*env)->GetMethodID(env, byteClass, "byteValue", "()B"); + SvalID = (*env)->GetMethodID(env, shortClass, "shortValue", "()S"); + IvalID = (*env)->GetMethodID(env, intClass, "intValue", "()I"); + LvalID = (*env)->GetMethodID(env, longClass, "longValue", "()J"); + FvalID = (*env)->GetMethodID(env, floatClass, "floatValue", "()F"); + DvalID = (*env)->GetMethodID(env, doubleClass, "doubleValue", "()D"); + + cdfStatusID = (*env)->GetFieldID(env, cdfClass, "cdfStatus", "J"); + infoWarnID = (*env)->GetFieldID(env, cdfClass, "infoWarning", "J"); + + status = CDFlib(GET_, LIB_VERSION_, &lib_ver, + NULL_); + + } + + if (cdfClass == NULL) MYDEBUG("cdfNativeLib", "cdfClass is null"); + if (objClass == NULL) MYDEBUG("cdfNativeLib", "objClass is null"); + if (cmdClass == NULL) MYDEBUG("cdfNativeLib", "cmdClass is null"); + if (vecClass == NULL) MYDEBUG("cdfNativeLib", "vecClass is null???"); + + cdfidID = (*env)->GetFieldID(env, cdfClass, "id", "J"); + MYDEBUG("cdfNativeLib","got cdfidID"); + + idID = (*env)->GetFieldID(env, myobjClass, "id", "J"); + MYDEBUG("cdfNativeLib","got idID"); + + vElemID=(*env)->GetMethodID(env, cmdClass, "elementAt", + "(I)Ljava/lang/Object;"); + MYDEBUG("cdfNativeLib","got jmethodIDs"); + /******************************************************/ + /* Get the real CDF id assigned by the CDFlib routine */ + /******************************************************/ + cdfid = (long)(*env)->GetLongField(env, theCDF, cdfidID); + MYDEBUG("cdfNativeLib","got fields"); + MYDEBUG("cdfNativeLib","getting first command"); + + /***************************************************/ + /* Get the first command and make sure that is one */ + /***************************************************/ + firstCmd = (*env)->CallObjectMethod(env, cmdVector, vElemID, 0); + status = getFuncOrItem(env, firstCmd, &func); + if (!CheckStatus("Java getFuncOrItem", 0)) return; + sprintf(msg,"1st function = %ld", func); + MYDEBUG("cdfNativeLib", msg); + if (func < NULL_) { + (*env)->ThrowNew(env, excClass, "Illegal function detected."); + return; + } + /*****************************************************/ + /* ok to continue. Determine what type of CDFObject */ + /*****************************************************/ + + objType = cdfObjectType(env, obj); + switch (objType) { + + case CDF_CLASS: + if (func == SAVE_) { /* Should SAVE_ be added to the main CDFlib?? */ + id0 = getCDFid(cdfid); + cdfstruct = (struct CDFstruct *)id0; + if (cdfstruct->largeFile) { + /* UpdateDotCDF returns 0 for success nonzero indicates failure */ + if (UpdateDotCDF64(cdfstruct) != 0) + (*env)->ThrowNew(env, excClass, "Save Failed 1."); + /* V_flush returns 0 for success nonzero indicates failure */ + if (V_flush64(cdfstruct->fp) != 0) + (*env)->ThrowNew(env, excClass, "Save Failed 2."); + } else { + /* UpdateDotCDF returns 0 for success nonzero indicates failure */ + if (UpdateDotCDF(cdfstruct) != 0) + (*env)->ThrowNew(env, excClass, "Save Failed 1."); + if (V_flush(cdfstruct->fp) != 0) + (*env)->ThrowNew(env, excClass, "Save Failed 2."); + } + } else if (func == BACKWARD_) { +/* if (func == BACKWARD_) { */ + firstArg = (*env)->CallObjectMethod(env, cmdVector, vElemID, 1); + status = getFuncOrItem(env, firstArg, &newArg); + if (!CheckStatus("Java getFuncOrItem", 0)) return; + CDFsetFileBackward((int)newArg); + } else if (func == CHECKSUM_) { + firstArg = (*env)->CallObjectMethod(env, cmdVector, vElemID, 1); + status = getFuncOrItem(env, firstArg, &newArg); + if (!CheckStatus("Java getFuncOrItem", 0)) return; + CDFsetChecksumMode(newArg); + } else if (func == VALIDATE_) { + firstArg = (*env)->CallObjectMethod(env, cmdVector, vElemID, 1); + status = getFuncOrItem(env, firstArg, &newArg); + if (!CheckStatus("Java getFuncOrItem", 0)) return; + CDFsetValidate(newArg); + } else if (func == GETCDFFILEBACKWARD_ || func == GETCDFCHECKSUM_ || + func == GETCDFVALIDATE_) { + argument arg; + arg.length = -1; + if (func == GETCDFFILEBACKWARD_) + envVar = (long) CDFgetFileBackwardEnvVar(); + else if (func == GETCDFCHECKSUM_) + envVar = (long) CDFgetChecksumEnvVar(); + else + envVar = (long) CDFgetValidate(); + firstArg = (*env)->CallObjectMethod(env, cmdVector, vElemID, 1); + status = getItem(env, theCDF, firstArg, obj, &arg); + *(long *)arg.ptr = envVar; + setJavaField(env, arg); + cleanArgument(env, &arg); + } else if (func == GETLEAPSECONDSENVVAR_) { + argument arg; + char *envvar; + arg.length = CDF_PATHNAME_LEN + 1; + firstArg = (*env)->CallObjectMethod(env, cmdVector, vElemID, 1); + status = getItem(env, theCDF, firstArg, obj, &arg); + envvar = (char *) CDFgetLeapSecondsTableEnvVar(); + if (envvar != NULL) + strncpy (arg.ptr, envvar, CDF_PATHNAME_LEN); + else + arg.ptr = NULL; + setJavaField(env, arg); + cleanArgument(env, &arg); + } else if (func == NULL_) { /* just to select this CDF */ + id0 = getCDFid(cdfid); + status = CDFlib(SELECT_, CDF_, id0, + NULL_); + if (!CheckStatus("cdflib (CDF)", 1)) return; + if (func == NULL_) return; /* If func == SELECT, return */ + } else { + status = JAVAcdflib (env, theCDF, obj, cmdVector, cdfid, func); + if (status != CDF_OK) return; + } + if (func == CLOSE_ || func == DELETE_) cleanGlobalRefs(env); + break; + + case VAR_CLASS: +/* id0 = getCDFid(cdfid); */ +/* if (func == CREATE_) { */ +/* status = CDFlib(SELECT_, CDF_, id0, */ +/* NULL_); */ +/* } else { */ + /* Get the id of the calling var */ +/* id = (long) (*env)->GetLongField(env, obj, idID); */ +/* */ +/* sprintf(msg,"Selecting variable #%ld",id); */ +/* MYDEBUG("cdflib (variable)",msg); */ +/* */ +/* status = CDFlib(SELECT_, CDF_, id0, */ +/* zVAR_, id, */ +/* NULL_); */ +/* } */ +/* if (!CheckStatus("cdflib (Variable)")) return; */ +/* if (func == NULL_) return; */ /* If func = SELECT, return */ + + status = JAVAcdflib(env, theCDF, obj, cmdVector, cdfid, func); + if (status != CDF_OK) return; + break; + + case ENTRY_CLASS: +/* if (func == NULL_) return; */ + /* Get the id of the calling entry */ +/* id = (long) (*env)->GetLongField(env, obj, idID); */ +/* id0 = getCDFid(cdfid); */ +/* entryScopeID = (*env)->GetFieldID(env, entryClass, "scope", "J"); */ +/* scope = (long)(*env)->GetLongField(env, obj, entryScopeID); */ +/* if (scope == GLOBAL_SCOPE) */ +/* status = CDFlib(SELECT_, CDF_, id0, gENTRY_, id, */ +/* NULL_); */ +/* else */ +/* status = CDFlib(SELECT_, CDF_, id0, */ +/* zENTRY_, id, */ +/* NULL_); */ +/* */ +/* if (!CheckStatus("cdflib (Entry)")) return; */ +/* if (func == NULL_) return; */ /* If func = SELECT, return */ + + status = JAVAcdflib(env, theCDF, obj, cmdVector, cdfid, func); + if (status != CDF_OK) return; + break; + + case DATA_CLASS: +/* id0 = getCDFid(cdfid); */ +/* status = CDFlib(SELECT_, CDF_, id0, */ +/* NULL_); */ +/* if (!CheckStatus("cdflib (DATA_CLASS)")) return; */ + status = JAVAcdflib(env, theCDF, obj, cmdVector, cdfid, func); + if (status != CDF_OK) return; + break; + + case ATTR_CLASS: +/* id0 = getCDFid(cdfid); */ +/* if (func == CREATE_) { */ +/* MYDEBUG("_Attribute_ 2", "CREATE_, ATTR_"); */ +/* status = CDFlib(SELECT_, CDF_, id0, */ +/* NULL_); */ +/* } else { */ + /* Get the id of the calling attr */ +/* id = (long) (*env)->GetLongField(env, obj, idID); */ +/* sprintf(msg,"Selecting attr #%ld",id); */ +/* MYDEBUG("_Attribute_ 2",msg); */ +/* status = CDFlib(SELECT_, CDF_, id0, */ +/* ATTR_, id, */ +/* NULL_); */ +/* } */ +/* if (!CheckStatus("cdflib (Attribute)")) return; */ +/* if (func == NULL_) return; */ /* If func = SELECT, return */ + + status = JAVAcdflib(env, theCDF, obj, cmdVector, cdfid, func); + if (status != CDF_OK) return; + break; + + default: /* bad class. Throw an error */ + (*env)->ThrowNew(env, excClass, "Bad CDFObject passed to cdflib\n"); + break; + } /* switch(objtype) */ +/* cleanGlobalRefs(env); */ + + +} /* Java_gsfc_nssdc_cdf_CDFNativeLibrary_cdfNativeLib */ + +/********************************************* + ** ** + ** Epoch Utility Wrappers ** + ** ** + ** Note: These wrappers are now ** + ** obsolete and are present for ** + ** testing and comparison ** + ** ** + *********************************************/ + +JNIEXPORT jdouble JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_compute(JNIEnv *env, + jobject obj, + jlong year, + jlong month, + jlong day, + jlong hour, + jlong minute, + jlong second, + jlong msec) { + + double epoch = computeEPOCH((long)year, (long)month, (long)day, (long)hour, + (long)minute, (long)second, (long)msec); + + return((jdouble)epoch); +} + +JNIEXPORT jlongArray JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_breakdown(JNIEnv *env, jobject obj, + jdouble epoch) { + + long year, month, day, hour, minute, second, msec; + jlongArray jarray; + jlong *jbody; + + jarray = (*env)->NewLongArray(env, 7); + EPOCHbreakdown(epoch, &year, &month, &day, &hour, &minute, &second, &msec); + jbody = (*env)->GetLongArrayElements(env, jarray, 0); + jbody[0] = (jlong)year; + jbody[1] = (jlong)month; + jbody[2] = (jlong)day; + jbody[3] = (jlong)hour; + jbody[4] = (jlong)minute; + jbody[5] = (jlong)second; + jbody[6] = (jlong)msec; + + (*env)->ReleaseLongArrayElements(env, jarray, jbody, 0); + + return (jarray); +} + +JNIEXPORT jstring JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_encode(JNIEnv *env, + jobject obj, + jdouble epoch) { + + char epString[EPOCH_STRING_LEN+1]; + + encodeEPOCH(epoch, epString); + return (*env)->NewStringUTF(env, epString); +} + +JNIEXPORT jstring JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_encode1(JNIEnv *env, + jobject obj, + jdouble epoch) { + + char epString[EPOCH1_STRING_LEN+1]; + + encodeEPOCH1(epoch, epString); + return (*env)->NewStringUTF(env, epString); +} + +JNIEXPORT jstring JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_encode2(JNIEnv *env, + jobject obj, + jdouble epoch) { + + char epString[EPOCH2_STRING_LEN+1]; + + encodeEPOCH2(epoch, epString); + return (*env)->NewStringUTF(env, epString); +} + +JNIEXPORT jstring JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_encode3(JNIEnv *env, + jobject obj, + jdouble epoch) { + + char epString[EPOCH3_STRING_LEN+1]; + + encodeEPOCH3(epoch, epString); + return (*env)->NewStringUTF(env, epString); +} + +JNIEXPORT jstring JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_encode4(JNIEnv *env, + jobject obj, + jdouble epoch) { + + char epString[EPOCH4_STRING_LEN+1]; + + encodeEPOCH4(epoch, epString); + return (*env)->NewStringUTF(env, epString); +} + +JNIEXPORT jstring JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_encodex(JNIEnv *env, + jobject obj, + jdouble epoch, + jstring format) { + + char epString[EPOCH3_STRING_LEN+1]; + const char *formatString = (*env)->GetStringUTFChars(env, format, 0); + + encodeEPOCHx (epoch, (char *)formatString, epString); + (*env)->ReleaseStringUTFChars(env, format, formatString); + return (*env)->NewStringUTF(env, epString); +} + +JNIEXPORT jdouble JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_parse(JNIEnv *env, + jclass obj, + jstring sEpoch) { + + jdouble millis; + const char *epochString = (*env)->GetStringUTFChars(env, sEpoch, 0); + millis = parseEPOCH((char *)epochString); + (*env)->ReleaseStringUTFChars(env, sEpoch, epochString); + + return millis; +} + +JNIEXPORT jdouble JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_parse1(JNIEnv *env, + jclass obj, + jstring sEpoch) { + + jdouble millis; + const char *epochString = (*env)->GetStringUTFChars(env, sEpoch, 0); + millis = parseEPOCH1((char *)epochString); + (*env)->ReleaseStringUTFChars(env, sEpoch, epochString); + + return millis; +} + +JNIEXPORT jdouble JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_parse2(JNIEnv *env, + jclass obj, + jstring sEpoch) { + + jdouble millis; + const char *epochString = (*env)->GetStringUTFChars(env, sEpoch, 0); + millis = parseEPOCH2((char *)epochString); + (*env)->ReleaseStringUTFChars(env, sEpoch, epochString); + + return millis; +} + +JNIEXPORT jdouble JNICALL +Java_gsfc_nssdc_cdf_util_EpochNative_parse3(JNIEnv *env, + jclass obj, + jstring sEpoch) { + + jdouble millis; + const char *epochString = (*env)->GetStringUTFChars(env, sEpoch, 0); + millis = parseEPOCH3((char *)epochString); + (*env)->ReleaseStringUTFChars(env, sEpoch, epochString); + + return millis; +} diff --git a/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfNativeLibrary.h b/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfNativeLibrary.h new file mode 100644 index 0000000..835def3 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfNativeLibrary.h @@ -0,0 +1,134 @@ +/****************************************************************************** +* Copyright 1996-2014 United States Government as represented by the +* Administrator of the National Aeronautics and Space Administration. +* All Rights Reserved. +******************************************************************************/ +/* DO NOT EDIT THIS FILE - it is machine generated */ +/* --- Epoch routine names need to be consistent with the C and Fortran APIs */ +#include +/* Header for class gsfc_nssdc_cdf_CDFNativeLibrary */ + +#ifndef _Included_gsfc_nssdc_cdf_CDFNativeLibrary +#define _Included_gsfc_nssdc_cdf_CDFNativeLibrary +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: gsfc_nssdc_cdf_CDFNativeLibrary + * Method: cdfNativeLib + * Signature: (Lgsfc/nssdc/cdf/CDF;Lgsfc/nssdc/cdf/CDFObject;Ljava/util/Vector;)V + */ +JNIEXPORT void JNICALL Java_gsfc_nssdc_cdf_CDFNativeLibrary_cdfNativeLib + (JNIEnv *, jobject, jobject, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class gsfc_nssdc_cdf_util_EpochNative */ + +#ifndef _Included_gsfc_nssdc_cdf_util_EpochNative +#define _Included_gsfc_nssdc_cdf_util_EpochNative +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: compute + * Signature: (JJJJJJJ)D + */ +JNIEXPORT jdouble JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_compute + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: breakdown + * Signature: (D)[J + */ +JNIEXPORT jlongArray JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_breakdown + (JNIEnv *, jclass, jdouble); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: encode + * Signature: (D)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_encode + (JNIEnv *, jclass, jdouble); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: encode1 + * Signature: (D)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_encode1 + (JNIEnv *, jclass, jdouble); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: encode2 + * Signature: (D)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_encode2 + (JNIEnv *, jclass, jdouble); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: encode3 + * Signature: (D)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_encode3 + (JNIEnv *, jclass, jdouble); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: encode4 + * Signature: (D)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_encode4 + (JNIEnv *, jclass, jdouble); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: encodex + * Signature: (DLjava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_encodex + (JNIEnv *, jclass, jdouble, jstring); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: parse + * Signature: (Ljava/lang/String;)D + */ +JNIEXPORT jdouble JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_parse + (JNIEnv *, jclass, jstring); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: parse1 + * Signature: (Ljava/lang/String;)D + */ +JNIEXPORT jdouble JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_parse1 + (JNIEnv *, jclass, jstring); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: parse2 + * Signature: (Ljava/lang/String;)D + */ +JNIEXPORT jdouble JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_parse2 + (JNIEnv *, jclass, jstring); + +/* + * Class: gsfc_nssdc_cdf_util_EpochNative + * Method: parse3 + * Signature: (Ljava/lang/String;)D + */ +JNIEXPORT jdouble JNICALL Java_gsfc_nssdc_cdf_util_EpochNative_parse3 + (JNIEnv *, jclass, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfjava.h b/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfjava.h new file mode 100644 index 0000000..8d5ccc5 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/cdfjava/jni/cdfjava.h @@ -0,0 +1,112 @@ +/* $Id: cdfjava.h,v 1.1.1.1 2019/10/16 16:22:18 mhliu Exp $ + * + */ +/****************************************************************************** +* Copyright 1996-2014 United States Government as represented by the +* Administrator of the National Aeronautics and Space Administration. +* All Rights Reserved. +******************************************************************************/ + +#include +#include +#include "cdfNativeLibrary.h" + +/****************************************/ +/* Max # of elements CmdVector can hold */ +/****************************************/ +#define MAX_VECTOR_SIZE 100 + +/****************************************** + * CDFObject Types + ******************************************/ +#define CDFOBJECT_CLASS 0L +#define CDF_CLASS 1L +#define FILE_CLASS 2L +#define VAR_CLASS 3L +#define ENTRY_CLASS 4L +#define DATA_CLASS 5L +#define ATTR_CLASS 6L + +/****************************************** + * Should this be added to cdf.h? + ******************************************/ +/* #define SAVE_ 1009 */ +/* #define BACKWARD_ 1010 */ +/* #define GETCDFFILEBACKWARD_ 1011 */ + +/*********************************************** + * Offset for big/little-endian. + * If NETWORKbyteORDERcpu is defined in + * cdflib.h, then it is a big-endian machine. + ***********************************************/ + +#if defined(NETWORKbyteORDERcpu) +#define LONGOFFSET 4 +#define INTOFFSET 2 +#define SHORTOFFSET 1 +#else +#define LONGOFFSET 0 +#define INTOFFSET 0 +#define SHORTOFFSET 0 +#endif + + +/* + * Macro definitions: + */ +#define CheckStatus(msg,flag) ErrorHandler(msg, status, env, theCDF, flag) + +#define isItem(obj) ((*env)->IsInstanceOf(env, obj, \ + (*env)->FindClass(env, "java/util/Vector"))) == JNI_FALSE + +#define CHECKNULL(a,v) \ + if ( v == NULL ) { \ + char message[1024]; \ + sprintf( message, "%s is NULL!", a ); \ + (*env)->ThrowNew( env, (*env)->FindClass( env, "java/lang/NullPointerException" ), \ + message );\ + return (BAD_FNC_OR_ITEM); \ + } + +#define MYDEBUG(f,m) \ + if (mydebug) { printf("%-15s: %s\n", f, m); } + +/******************************************************************* + * Structure that is used to hold information about argument + * (e.g. id, name, etc.) + ******************************************************************/ +typedef struct argStruct { + jobject myObject; /* The object that the instance var is a member of */ + jfieldID id; /* The field ID of the instance var */ + jobject nameObject; /* The name string object. Needed for memory management */ + const char *name; /* The name of the argument as a C string */ + jobject sigObject; /* The sig string object. Needed for memory management */ + const char *sig; /* The signature of the arg as a C string */ + void *ptr; /* A pointer to the arg in C */ + jstring tempString; /* Temp string object needed to handle memory for instance + vars that are Strings */ + jboolean isArray; /* JNI_FALSE = not an array, JNI_TRUE = is an array */ + jboolean isEntryorVariableData; /* Is arg an Entry/Variable data */ + jobject dsObject; /* If entryData then this is the actual data signature + Since in the "data" instance var is a generic + java/lang/Object we need 2 signatures. The actual signature + "Ljava/lang/Object;" to get the data and this one to build + and get the data out. */ + const char *datasig; /* The signature of the entry "data" as a C string */ + jsize length; /* = numElements */ + jsize numDims; + long dimSizes[CDF_MAX_DIMS]; + char Csig[25]; +} argument; + +/************************************************************************ + * Structure that is used to hold information about the CDF file. + * (e.g. id, name, etc.) + ************************************************************************/ +typedef struct cdfIDStruct { + CDFid id; /* The CDFid from open or create function */ + jlong jid; /* Where it is in the link list structure */ + int nCDFs; /* Reseved for future use */ + jboolean open; /* flag indicating whether CDF is still open */ + struct cdfIDStruct *next; /* A pointer to the next item in the list */ +} cdfIDList; diff --git a/ext/cdf/cdf38_0-dist/cdfjava/lib/.empty b/ext/cdf/cdf38_0-dist/cdfjava/lib/.empty new file mode 100644 index 0000000..e69de29 diff --git a/ext/cdf/cdf38_0-dist/checkleapseconds.sh b/ext/cdf/cdf38_0-dist/checkleapseconds.sh new file mode 100644 index 0000000..f26dab3 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/checkleapseconds.sh @@ -0,0 +1,72 @@ +#! /bin/sh +echo +echo Checking for the leap second table... +local_url=`printenv CDF_LEAPSECONDSTABLE` +if [ -z "$local_url" ]; then + echo CDF_LEAPSECONDSTABLE environment variable is not defined... + echo Internal hard-coded leap second table may be used... + if [ -n "$CDF_BASE" ]; then + result=`$CDF_BASE/bin/cdfleapsecondsinfo -nodump` + local_leap=`echo $result | cut -d " " -f31` + ls_folder= + else + echo "Enter the latest, installed CDF directory: "; + read ls_folder + if [ -f "$ls_folder/CDFLeapSeconds.txt" ]; then + local_leap=`tail -1 $ls_folder/CDFLeapSeconds.txt | awk '{ print $1"-"$2"-"$3 }'` + else + echo "Error... CDF installation not found in $ls_folder." + exit 0; + fi + fi +else + local_leap=`tail -1 ${local_url}| awk '{ print $1"-"$2"-"$3 }'`; + ls_folder=`dirname $local_url` +fi +remote_url="https://cdf.gsfc.nasa.gov/html/CDFLeapSeconds.txt" +isCurlAvail=`which curl` +if [ `echo "$isCurlAvail" | grep -c "no "` -eq 1 ]; then + `wget -q -O /tmp/CDFLeapSeconds.txt ${remote_url}` + if [ $? -ne 0 ]; then + echo "Error... ${remote_url} not found."; + exit 0; + fi +else + `curl -s -o /tmp/CDFLeapSeconds.txt ${remote_url}` + if [ $? -ne 0 ]; then + echo "Error... ${remote_url} not found."; + exit 0; + fi +fi +remote_leap=`tail -1 /tmp/CDFLeapSeconds.txt | awk '{ print $1"-"$2"-"$3 }'` +lyear=`echo $local_leap | cut -d- -f1` +lmonth=`echo $local_leap | cut -d- -f2` +lday=`echo $local_leap | cut -d- -f3` +ryear=`echo $remote_leap | cut -d- -f1` +rmonth=`echo $remote_leap | cut -d- -f2` +rday=`echo $remote_leap | cut -d- -f3` +localdate=`expr $lyear*10000+$lmonth*100+$lday | bc` +remotedate=`expr $ryear*10000+$rmonth*100+$rday | bc` +if [ $localdate -lt $remotedate ]; then + echo "" + echo "You are using the leap second table at $local_url" + echo "But, newer leap second(s) had been added to CDFLeapSeconds.txt at the CDF" + echo "home page. Please update your CDF installation that includes the" + echo "latest CDFLeapSeconds.txt from https://cdf.gsfc.nasa.gov." + echo "" +else + if [ $localdate -eq $remotedate ]; then + echo "" + if [ -z "$ls_folder" ]; then + echo "Hard-coded CDFLeapSeconds.txt is up-to-date." + else + echo "Local CDFLeapSeconds.txt in $ls_folder is up-to-date." + fi + echo "" + else + echo "" + echo "Local CDFLeapSeconds.txt in $ls_folder has a newer leap second(s)" + echo "than the one at the CDF home page." + echo "" + fi +fi diff --git a/ext/cdf/cdf38_0-dist/modify_definition_files.sh b/ext/cdf/cdf38_0-dist/modify_definition_files.sh new file mode 100644 index 0000000..f017216 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/modify_definition_files.sh @@ -0,0 +1,80 @@ +#! /bin/bash +search="" +replace=$1 # Current working directory +whichos=`uname` +case "$whichos" in + CYGWIN*) topath=1;; + MINGW*) topath=1;; + Darwin*) topath=2;; + * ) topath=0;; +esac + +for file in `ls $replace/bin/definitions.*` +do + extension="${file:${#file}-1}" + if [ $topath -eq 1 ]; then + if [ $extension == "B" ] || [ $extension == "K" ]; then + echo "export PATH=\"$CDF_BASE/lib:\$PATH\"" >> $file + else + echo "setenv PATH \"$CDF_BASE/lib:\$PATH\"" >> $file + fi + elif [ $topath -eq 2 ]; then + if [ $extension == "B" ] || [ $extension == "K" ]; then + echo "if [ -z \$DYLD_LIBRARY_PATH ]; then" >> $file + echo " export DYLD_LIBRARY_PATH=\$CDF_BASE/lib" >> $file + echo "else" >> $file + echo " LDY=\`printenv DYLD_LIBRARY_PATH\`" >> $file + echo " if ! [[ \$LDY =~ \"\$CDF_BASE/lib\" ]]; then" >> $file + echo " export DYLD_LIBRARY_PATH=\$CDF_BASE/lib:\$DYLD_LIBRARY_PATH" >> $file + echo " fi" >> $file + echo "fi" >> $file + else + echo "if \$?DYLD_LIBRARY_PATH then" >> $file + echo " set LDY=\`printenv DYLD_LIBRARY_PATH\`" >> $file + echo " if ( \$LDY !~ \*\${CDF_BASE}/lib\* ) then" >> $file + echo " setenv DYLD_LIBRARY_PATH \$CDF_BASE/lib:\$DYLD_LIBRARY_PATH" >> $file + echo " endif" >> $file + echo "else" >> $file + echo " setenv DYLD_LIBRARY_PATH \$CDF_BASE/lib" >> $file + echo "endif" >> $file + fi + else + if [ $extension == "B" ] || [ $extension == "K" ]; then + echo "if [ -z \$LD_LIBRARY_PATH ]; then" >> $file + echo " export LD_LIBRARY_PATH=\$CDF_BASE/lib" >> $file + echo "else" >> $file + echo " LDY=\`printenv LD_LIBRARY_PATH\`" >> $file + echo " if ! [[ \$LDY =~ \"\$CDF_BASE/lib\" ]]; then" >> $file + echo " export LD_LIBRARY_PATH=\$CDF_BASE/lib:\$LD_LIBRARY_PATH" >> $file + echo " fi" >> $file + echo "fi" >> $file + else + echo "if \$?LD_LIBRARY_PATH then" >> $file + echo " set LDY=\`printenv LD_LIBRARY_PATH\`" >> $file + echo " if ( \$LDY !~ \*\$CDF_BASE/lib\* ) then" >> $file + echo " setenv LD_LIBRARY_PATH \$CDF_BASE/lib:\$LD_LIBRARY_PATH" >> $file + echo " endif" >> $file + echo "else" >> $file + echo " setenv LD_LIBRARY_PATH \$CDF_BASE/lib" >> $file + echo "endif" >> $file + fi + fi + + echo "Modifying the definition file $file .." + if `type ed > /dev/null 2>&1` + then + ed - $file << editend + 1,\$s:$search:$replace:g + w + q +editend + elif `type sed > /dev/null 2>&1` + then + sed -e "s,$search,$replace,g" < $file > $file.new + mv $file.new $file + else + echo Not modified... as both "ed" and "sed" line editor not installed. + echo Use any available text editor to manually modify "$search" to "$replace". + fi +done + diff --git a/ext/cdf/cdf38_0-dist/samples/OperateAttributes.c b/ext/cdf/cdf38_0-dist/samples/OperateAttributes.c new file mode 100644 index 0000000..eb2ca38 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/OperateAttributes.c @@ -0,0 +1,375 @@ +/****************************************************************************** +* +* SPDF/CDF Sample program for operating attributes/entries in a CDF. +* +* Version 1.0, 09-Dec-05 +* +* Modification history: +* +* V1.0 09-Dec-05, M Liu Original version (for CDF V3.1). +* A simple program to add and delete +* attributes/entries to and from a CDF. +* The global attributes apply to the CDF as a +* whole, variable attributes +* apply to variables, zVariables in this sample +* program. It also shows how to respecify and +* verify the specifications of the entries. +******************************************************************************/ + +#include +#include +#include + +#include "cdf.h" + +#define EXIT_SUCCESS_ 0 +#define EXIT_FAILURE_ 1 + +/****************************************************************************** +* Macros/prototypes. +******************************************************************************/ + +void QuitCDF PROTOARGs((char *where, CDFstatus status)); + +/****************************************************************************** +* Main. +******************************************************************************/ + +int main () { +CDFid id; +CDFstatus status; +static long dimSizes[1] = { 2 }; +static long dimSizes1[2] = { 2, 3 }; +static long dimSizes2[1] = { 5 }; +static long var1DataType = { CDF_INT2 }; +static long var2DataType = { CDF_CHAR }; +static long var1NumElements = { 1 }; +static long var2NumElements = { 8 }; +long var1Num_out, var2Num_out; +static long var1RecVariance = { VARY }; +static long var2RecVariance = { VARY }; +static long var1DimVariances[2] = { VARY, VARY }; +static long var2DimVariances[1] = { VARY }; +static char var1Name[] = "VAR1a"; +static char var2Name[] = "zVARa1"; +long attrNum_out; +static long entryNum = { 2 }; +long maxEntry_out; +static long attrScope = { GLOBAL_SCOPE }; +static long attrScope2 = { VARIABLE_SCOPE }; +static long attrScope3 = { VARIABLE_SCOPE }; +long attrScope_out; +static long entryDataType = { CDF_INT2 }; +static long entryDataTypeNew = { CDF_UINT2 }; +long entryDataType_out; +static long entryNumElems = { 1 }; +long entryNumElems_out; +static short entryValue = { 1 }; +short entryValue_out; +long numAttrs_out; +int i; +static char attrName[] = "ATTR1"; +static char attrName2[] = "ATTR2"; +static char attrName3[] = "ATTR3"; +static char new_attrName[] = "ATTR1a"; +char attrName_out[CDF_ATTR_NAME_LEN256]; +static char zEntryValue1 = { 4 }; +char zEntryValueOut1; +static double zEntryValue2 = { 4.0 }; +double zEntryValueOut2; +long maxGentry, numGentries, + maxZentry, numZentries, numGattrs, numVattrs; +long entryNumOut1, entryNumOut2, entryNumOut3; + +/****************************************************************************** +* Create CDF. +******************************************************************************/ +/* CDFsetFileBackwardFlag(BACKWARDFILEon); */ +status = CDFlib (CREATE_, CDF_, "TEST", 0L, dimSizes, &id, + NULL_); + +if (status < CDF_OK) { + if (status == CDF_EXISTS) { + status = CDFlib (OPEN_, CDF_, "TEST", &id, + NULL_); + if (status < CDF_OK) QuitCDF ("1.0", status); + + status = CDFlib (DELETE_, CDF_, + NULL_); + if (status < CDF_OK) QuitCDF ("1.1", status); + + status = CDFlib (CREATE_, CDF_, "TEST", 0L, dimSizes, &id, + NULL_); + if (status < CDF_OK) QuitCDF ("1.2", status); + } + else + QuitCDF ("1.3", status); +} + +/****************************************************************************** +* Create variables. +******************************************************************************/ + +status = CDFlib (CREATE_, zVAR_, var1Name, var1DataType, var1NumElements, + 2L, dimSizes1, + var1RecVariance, var1DimVariances, + &var1Num_out, + NULL_); +if (status < CDF_OK) QuitCDF ("2.0", status); + +status = CDFlib (CREATE_, zVAR_, var2Name, var2DataType, var2NumElements, + 1L, dimSizes2, + var2RecVariance, var2DimVariances, + &var2Num_out, + NULL_); +if (status < CDF_OK) QuitCDF ("2.1", status); + +/****************************************************************************** +* Create attributes. +******************************************************************************/ + +status = CDFlib (CREATE_, ATTR_, attrName, attrScope, &attrNum_out, + ATTR_, attrName2, attrScope2, &attrNum_out, + ATTR_, attrName3, attrScope3, &attrNum_out, + NULL_); +if (status < CDF_OK) QuitCDF ("3.0", status); + +/****************************************************************************** +* Write to attributes. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + gENTRY_, entryNum, + PUT_, gENTRY_DATA_, entryDataType, entryNumElems, + &entryValue, + SELECT_, ATTR_, 1L, + zENTRY_NAME_, var1Name, + PUT_, zENTRY_DATA_, CDF_BYTE, 1L, &zEntryValue1, + SELECT_, ATTR_, 2L, + zENTRY_NAME_, var2Name, + PUT_, zENTRY_DATA_, CDF_REAL8, 1L, &zEntryValue2, + NULL_); +if (status < CDF_OK) QuitCDF ("4.0", status); + +/****************************************************************************** +* Confirm entry numbers. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + CONFIRM_, gENTRY_, &entryNumOut1, + SELECT_, ATTR_, 1L, + CONFIRM_, zENTRY_, &entryNumOut2, + SELECT_, ATTR_, 2L, + CONFIRM_, zENTRY_, &entryNumOut3, + NULL_); +if (status < CDF_OK) QuitCDF ("5.0", status); + +if (entryNumOut1 != 2) QuitCDF ("5.1", status); +if (entryNumOut2 != 1) QuitCDF ("5.2", status); +if (entryNumOut3 != 1) QuitCDF ("5.3", status); + +/****************************************************************************** +* Read from attributes. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + gENTRY_, entryNum, + CONFIRM_, CURgENTRY_EXISTENCE_, + GET_, gENTRY_DATA_, &entryValue_out, + SELECT_, ATTR_, 1L, + zENTRY_, 0L, + CONFIRM_, CURzENTRY_EXISTENCE_, + GET_, zENTRY_DATA_, &zEntryValueOut1, + SELECT_, ATTR_, 2L, + zENTRY_, 1L, + CONFIRM_, CURzENTRY_EXISTENCE_, + GET_, zENTRY_DATA_, &zEntryValueOut2, + NULL_); +if (status < CDF_OK) QuitCDF ("6.0", status); + +if (entryValue_out != entryValue) QuitCDF ("6.1", status); +if (zEntryValue1 != zEntryValueOut1) QuitCDF ("6.2", status); +if (zEntryValue2 != zEntryValueOut2) QuitCDF ("6.3", status); + +/****************************************************************************** +* Confirm existence of attributes/entries. +******************************************************************************/ + +status = CDFlib (CONFIRM_, ATTR_EXISTENCE_, attrName3, + NULL_); +if (status < CDF_OK) QuitCDF ("7.0", status); + +status = CDFlib (SELECT_, ATTR_, 0L, + CONFIRM_, gENTRY_EXISTENCE_, entryNum, + SELECT_, ATTR_, 1L, + CONFIRM_, zENTRY_EXISTENCE_, 0L, + SELECT_, ATTR_, 2L, + CONFIRM_, zENTRY_EXISTENCE_, 1L, + NULL_); +if (status < CDF_OK) QuitCDF ("7.1", status); + +/****************************************************************************** +* Inquire CDF. +******************************************************************************/ + +status = CDFlib (GET_, CDF_NUMATTRS_, &numAttrs_out, + NULL_); +if (status < CDF_OK) QuitCDF ("8.0", status); + +if (numAttrs_out != 3) QuitCDF ("8.1", status); + +/****************************************************************************** +* Rename attribute. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_NAME_, attrName, + PUT_, ATTR_NAME_, new_attrName, + NULL_); +if (status < CDF_OK) QuitCDF ("9.0", status); + +/****************************************************************************** +* Inquire attribute. +******************************************************************************/ + +status = CDFlib (GET_, ATTR_NAME_, attrName_out, + ATTR_SCOPE_, &attrScope_out, + ATTR_MAXgENTRY_, &maxEntry_out, + CONFIRM_, ATTR_, &attrNum_out, + NULL_); +if (status < CDF_OK) QuitCDF ("10.0", status); + +if (strcmp(attrName_out,new_attrName) != 0) QuitCDF ("10.1", status); +if (attrScope_out != attrScope) QuitCDF ("10.2", status); +if (maxEntry_out != entryNum) QuitCDF ("10.3", status); +if (attrNum_out != 0L) QuitCDF ("10.4", status); + +/****************************************************************************** +* Inquire attribute entries. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + gENTRY_, entryNum, + GET_, gENTRY_DATATYPE_, &entryDataType_out, + gENTRY_NUMELEMS_, &entryNumElems_out, + NULL_); +if (status < CDF_OK) QuitCDF ("11.0", status); + +if (entryDataType_out != entryDataType) QuitCDF ("11.1", status); +if (entryNumElems_out != entryNumElems) QuitCDF ("11.2", status); + +status = CDFlib (SELECT_, ATTR_, 1L, + zENTRY_, 0L, + GET_, zENTRY_DATATYPE_, &entryDataType_out, + zENTRY_NUMELEMS_, &entryNumElems_out, + NULL_); +if (status < CDF_OK) QuitCDF ("11.3", status); + +if (entryDataType_out != CDF_BYTE) QuitCDF ("11.4", status); +if (entryNumElems_out != 1L) QuitCDF ("11.5", status); + +status = CDFlib (SELECT_, ATTR_, 2L, + zENTRY_, 1L, + GET_, zENTRY_DATATYPE_, &entryDataType_out, + zENTRY_NUMELEMS_, &entryNumElems_out, + NULL_); +if (status < CDF_OK) QuitCDF ("11.6", status); + +if (entryDataType_out != CDF_REAL8) QuitCDF ("11.7", status); +if (entryNumElems_out != 1L) QuitCDF ("11.8", status); + +/****************************************************************************** +* Inquire CDF. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + GET_, CDF_NUMgATTRS_, &numGattrs, + CDF_NUMvATTRS_, &numVattrs, + ATTR_MAXgENTRY_, &maxGentry, + ATTR_NUMgENTRIES_, &numGentries, + SELECT_, ATTR_, 1L, + GET_, ATTR_MAXzENTRY_, &maxZentry, + ATTR_NUMzENTRIES_, &numZentries, + NULL_); +if (status < CDF_OK) QuitCDF ("12.0", status); + +if (numGattrs != 1) QuitCDF ("12.1", status); +if (numVattrs != 2) QuitCDF ("12.2", status); +if (maxGentry != entryNum) QuitCDF ("12.3", status); +if (numGentries != 1) QuitCDF ("12.4", status); +if (maxZentry != 0) QuitCDF ("12.5", status); +if (numZentries != 1) QuitCDF ("12.6", status); + +/****************************************************************************** +* Modify entries/attribute. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + gENTRY_, entryNum, + PUT_, gENTRY_DATASPEC_, entryDataTypeNew, entryNumElems, + SELECT_, ATTR_, 1L, + zENTRY_, 0L, + PUT_, zENTRY_DATASPEC_, CDF_UINT1, 1L, + SELECT_, ATTR_, 2L, + zENTRY_, 1L, + PUT_, zENTRY_DATASPEC_, CDF_EPOCH, 1L, + SELECT_, ATTR_, 0L, + PUT_, ATTR_SCOPE_, VARIABLE_SCOPE, + ATTR_SCOPE_, GLOBAL_SCOPE, + NULL_); +if (status < CDF_OK) QuitCDF ("13.0", status); + +/****************************************************************************** +* Delete entries/attribute/variables. +******************************************************************************/ + +status = CDFlib (SELECT_, ATTR_, 0L, + gENTRY_, entryNum, + DELETE_, gENTRY_, + SELECT_, ATTR_, 1L, + zENTRY_, 0L, + DELETE_, zENTRY_, + SELECT_, ATTR_, 2L, + zENTRY_, 1L, + DELETE_, zENTRY_, + SELECT_, ATTR_, 0L, + DELETE_, ATTR_, + NULL_); +if (status < CDF_OK) QuitCDF ("14.0", status); + +/****************************************************************************** +* Close CDF. +******************************************************************************/ + +status = CDFlib (CLOSE_, CDF_, + NULL_); +if (status < CDF_OK) QuitCDF ("15.0", status); + +/****************************************************************************** +* Successful completion. +******************************************************************************/ + +return EXIT_SUCCESS_; +} + + +/****************************************************************************** +* QuitCDF. +******************************************************************************/ + +void QuitCDF (where, status) +char *where; +CDFstatus status; +{ + 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\n", text); + } + CDFlib (CLOSE_, CDF_, + NULL_); + printf ("...test aborted.\n"); + exit (EXIT_FAILURE_); +} diff --git a/ext/cdf/cdf38_0-dist/samples/OperateCDF.c b/ext/cdf/cdf38_0-dist/samples/OperateCDF.c new file mode 100644 index 0000000..32d4285 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/OperateCDF.c @@ -0,0 +1,163 @@ +/****************************************************************************** +* +* SPDF/CDF Sample program for operating a CDF. +* +* Version 1.0, 09-Dec-05 +* +* Modification history: +* +* V1.0 09-Dec-05, M Liu Original version (for CDF V3.1). +* A simple program to create/delete a CDF and +* modify the CDF specification from the +* defaults. The CDF is created expecting +* zVariable(s), the preferred variable, to be +* added. It also shows how to acquire the +* information from the library being operated +* upon. +* +******************************************************************************/ + +#include +#include +#include + +#include "cdf.h" + +#define EXIT_SUCCESS_ 0 +#define EXIT_FAILURE_ 1 + +/****************************************************************************** +* Macros/prototypes. +******************************************************************************/ + +void QuitCDF PROTOARGs((char *where, CDFstatus status)); + +/****************************************************************************** +* Main. +******************************************************************************/ + +int main () { +CDFid id; +CDFstatus status; +static long encoding = NETWORK_ENCODING; +static long majority = ROW_MAJOR; +static long dimSizes[1] = { 0 }; +static long cType = GZIP_COMPRESSION; +static long cParms[1] = { 5 }; +long version_out; +long release_out; +long increment_out; +char subincrement_out; +long formatOut; +long encoding_out; +long majority_out; +char CopyRightText[CDF_COPYRIGHT_LEN+1]; +static long actual_encoding = NETWORK_ENCODING; + +/****************************************************************************** + * Get library information. + ******************************************************************************/ + +status = CDFlib (GET_, LIB_VERSION_, &version_out, + LIB_RELEASE_, &release_out, + LIB_INCREMENT_, &increment_out, + LIB_subINCREMENT_, &subincrement_out, + LIB_COPYRIGHT_, CopyRightText, + NULL_); +if (status < CDF_OK) QuitCDF ("1.0", status); + +/****************************************************************************** +* Create CDF. +******************************************************************************/ +/* CDFsetFileBackwardFlag(BACKWARDFILEon); */ +status = CDFlib (CREATE_, CDF_, "TEST", 0L, dimSizes, &id, + NULL_); + +if (status < CDF_OK) { + if (status == CDF_EXISTS) { + status = CDFlib (OPEN_, CDF_, "TEST", &id, + NULL_); + if (status < CDF_OK) QuitCDF ("2.0", status); + + status = CDFlib (DELETE_, CDF_, + NULL_); + if (status < CDF_OK) QuitCDF ("2.1", status); + + status = CDFlib (CREATE_, CDF_, "TEST", 0L, dimSizes, &id, + NULL_); + if (status < CDF_OK) QuitCDF ("2.2", status); + } + else + QuitCDF ("1.3", status); +} + +/****************************************************************************** +* Respecify the encoding and majority for the CDF (from its default). +******************************************************************************/ + +status = CDFlib (PUT_, CDF_ENCODING_, encoding, + CDF_MAJORITY_, majority, + NULL_); + +if (status < CDF_OK) QuitCDF ("3.0", status); + +/****************************************************************************** +* Inquire CDF. +******************************************************************************/ + +status = CDFlib (GET_, CDF_FORMAT_, &formatOut, + CDF_ENCODING_, &encoding_out, + CDF_MAJORITY_, &majority_out, + NULL_); +if (status < CDF_OK) QuitCDF ("4.0", status); + +if (formatOut != SINGLE_FILE) QuitCDF ("4.1", status); +if (encoding_out != actual_encoding) QuitCDF ("4.2", status); +if (majority_out != majority) QuitCDF ("4.3", status); + +/****************************************************************************** +* Specify the compression for the CDF. +******************************************************************************/ + +status = CDFlib (PUT_, CDF_COMPRESSION_, cType, cParms, + NULL_); + +if (status < CDF_OK) QuitCDF ("5.0", status); + +/****************************************************************************** +* Close CDF. +******************************************************************************/ + +status = CDFlib (CLOSE_, CDF_, + NULL_); +if (status < CDF_OK) QuitCDF ("6.0", status); + +/****************************************************************************** +* Successful completion. +******************************************************************************/ + +return EXIT_SUCCESS_; +} + + +/****************************************************************************** +* QuitCDF. +******************************************************************************/ + +void QuitCDF (where, status) +char *where; +CDFstatus status; +{ + 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\n", text); + } + CDFlib (CLOSE_, CDF_, + NULL_); + printf ("...test aborted.\n"); + exit (EXIT_FAILURE_); +} diff --git a/ext/cdf/cdf38_0-dist/samples/OperateVariables.c b/ext/cdf/cdf38_0-dist/samples/OperateVariables.c new file mode 100644 index 0000000..24f6fb6 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/OperateVariables.c @@ -0,0 +1,549 @@ +/****************************************************************************** +* +* SPDF/CDF Test program for operating variables in a CDF. +* +* Version 1.0, 09-Dec-05 +* +* Modification history: +* +* V1.0 09-Dec-05, M Liu Original version (for CDF V3.1). +* A simple program to create zVariables, the +* preferred variables, to a CDF. It also +* shows how to respecify and verify the +* variable's specification. Data values are +* written to and read from the variables in +* differenet ways. +******************************************************************************/ + +#include +#include +#include + +#include "cdf.h" + +#define EXIT_SUCCESS_ 0 +#define EXIT_FAILURE_ 1 + +/****************************************************************************** +* Macros/prototypes. +******************************************************************************/ + +#define N_DIMS1 2 +#define DIM_0_SIZE1 2 +#define DIM_1_SIZE1 3 + +#define N_DIMS2 1 +#define DIM_0_SIZE2 5 +#define NUM_ELEMS2 8 + +void QuitCDF PROTOARGs((char *where, CDFstatus status)); + +/****************************************************************************** +* Main. +******************************************************************************/ + +int main () { +CDFid id; +CDFstatus status; +int dim_n; +static long numDims1 = N_DIMS1; +static long numDims2 = N_DIMS2; +static long dimSizes[1] = { 0 }; +static long dimSizes1[N_DIMS1] = { DIM_0_SIZE1, DIM_1_SIZE1 }; +static long dimSizes2[N_DIMS2] = { DIM_0_SIZE2 }; +static long var1DataType = { CDF_INT2 }; +static long var1DataTypeNew = { CDF_UINT2 }; +static long var2DataType = { CDF_CHAR }; +static long var2DataTypeNew = { CDF_UCHAR }; +long var1DataType_out, var2DataType_out; +static long var1NumElements = { 1 }; +static long var1NumElementsNew = { 1 }; +static long var2NumElements = { NUM_ELEMS2 }; +static long var2NumElementsNew = { NUM_ELEMS2 }; +long var1NumElements_out, var2NumElements_out; +long var1Num_out, var2Num_out, varNum_out1, varNum_out2; +static short var1Values[DIM_0_SIZE1][DIM_1_SIZE1] = {{1,2,3},{4,5,6}}; +static char var2Values[DIM_0_SIZE2][NUM_ELEMS2] = { + {'1','1','1','1','1','1','1','1'}, + {'2','2','2','2','2','2','2','2'}, + {'3','3','3','3','3','3','3','3'}, + {'4','4','4','4','4','4','4','4'}, + {'5','5','5','5','5','5','5','5'} +}; +short var1Value_out; +static char var2Value_out[NUM_ELEMS2]; +static long recNum = { 0 }; +static long recStart = { 0 }; +static long recCount = { 1 }; +static long recInterval = { 1 }; +long indices[N_DIMS1]; +static long counts[N_DIMS1] = { DIM_0_SIZE1, DIM_1_SIZE1 }; +static long intervals[N_DIMS1] = { 1, 1 }; +static long zRecNum = { 0 }; +static long zRecStart = { 0 }; +static long zRecCount = { 1 }; +static long zRecInterval = { 1 }; +long zIndicesA[N_DIMS2]; +static long zCounts[N_DIMS2] = { DIM_0_SIZE2 }; +static long zIntervals[N_DIMS2] = { 1 }; +short var1Buffer_out[DIM_0_SIZE1][DIM_1_SIZE1]; +char var2Buffer_out[DIM_0_SIZE2][NUM_ELEMS2]; +long numDims1_out; +long dimSizes1_out[N_DIMS1]; +long numDims2_out; +long dimSizes2_out[N_DIMS2]; +long maxRec_out; +long numAttrs_out; +int i, x0, x1, x; +static long var1RecVariance = { VARY }; +static long var1RecVarianceNew = { NOVARY }; +static long var2RecVariance = { VARY }; +static long var2RecVarianceNew = { NOVARY }; +long var1RecVariance_out, var2RecVariance_out; +static long var1DimVariances[N_DIMS1] = { VARY, VARY }; +static long var1DimVariancesNew[N_DIMS1] = { NOVARY, NOVARY }; +static long var2DimVariances[N_DIMS2] = { VARY }; +static long var2DimVariancesNew[N_DIMS2] = { NOVARY }; +long var1DimVariances_out[N_DIMS1], + var2DimVariances_out[N_DIMS2]; +static char var1Name[] = "VAR1a"; +static char var2Name[] = "zVARa1"; +static char new_var1Name[] = "VAR1b"; +static char new_var2Name[] = "zVARa2"; +char var1Name_out[CDF_VAR_NAME_LEN256+1], + var2Name_out[CDF_VAR_NAME_LEN256+1]; +char CopyRightText[CDF_COPYRIGHT_LEN+1]; +char errorText[CDF_STATUSTEXT_LEN+1]; +long numRvars, numZvars; +static short pad1 = { -999 }; +static char pad2[NUM_ELEMS2+1] = { "********" }; +short pad1out; +static char pad2out[NUM_ELEMS2+1] = { " " }; +static long blockingfactor1 = 3; +static long blockingfactor2 = 4; +long blockingfactorOut1, blockingfactorOut2; +long recStartOut, recCountOut, recIntervalOut, recNumOut; +long indicesOut[CDF_MAX_DIMS], + countsOut[CDF_MAX_DIMS], + intervalsOut[CDF_MAX_DIMS]; +int dimN; +long formatOut; +long maxAllocOut1, maxAllocOut2; +long maxRecOut1, maxRecOut2, maxRecOut; +long nIndexRecsOut1, nIndexRecsOut2; +long nIndexEntriesOut1, nIndexEntriesOut2; +static long allocRecs1 = { 10 }; +static long allocRecs2 = { 8 }; +static long nZvars1 = { 1 }; +static long zVarNs1[2] = { 0 }; +static char zVarsRecBuffer1[DIM_0_SIZE1][DIM_1_SIZE1][6] = { + {{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0}}, + {{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0}} +}; +static char zVarsRecBufferOut1[DIM_0_SIZE1][DIM_1_SIZE1][6]; +static long nZvars2 = { 1 }; +static long zVarNs2[1] = { 1 }; +static char zVarsRecBuffer2[DIM_0_SIZE2][NUM_ELEMS2] = { + {'%','%','%','%','%','%','%','%'}, + {'%','%','%','%','%','%','%','%'}, + {'%','%','%','%','%','%','%','%'}, + {'%','%','%','%','%','%','%','%'}, + {'%','%','%','%','%','%','%','%'} +}; +static char zVarsRecBufferOut2[DIM_0_SIZE2][NUM_ELEMS2]; + +/****************************************************************************** +* Create CDF. +******************************************************************************/ +/* CDFsetFileBackwardFlag(BACKWARDFILEon); */ +status = CDFlib (CREATE_, CDF_, "TEST", 0L, dimSizes, &id, + NULL_); + +if (status < CDF_OK) { + if (status == CDF_EXISTS) { + status = CDFlib (OPEN_, CDF_, "TEST", &id, + NULL_); + if (status < CDF_OK) QuitCDF ("1.0", status); + + status = CDFlib (DELETE_, CDF_, + NULL_); + if (status < CDF_OK) QuitCDF ("1.1", status); + + status = CDFlib (CREATE_, CDF_, "TEST", 0L, dimSizes, &id, + NULL_); + if (status < CDF_OK) QuitCDF ("1.2", status); + } + else + QuitCDF ("1.3", status); +} + +/****************************************************************************** +* Create variables. +******************************************************************************/ + +status = CDFlib (CREATE_, zVAR_, var1Name, var1DataType, var1NumElements, + numDims1, dimSizes1, + var1RecVariance, var1DimVariances, + &var1Num_out, + NULL_); +if (status < CDF_OK) QuitCDF ("2.0", status); + +status = CDFlib (CREATE_, zVAR_, var2Name, var2DataType, var2NumElements, + numDims2, dimSizes2, + var2RecVariance, var2DimVariances, + &var2Num_out, + PUT_, zVAR_ALLOCATERECS_, allocRecs2, + zVAR_BLOCKINGFACTOR_, blockingfactor2, + NULL_); +if (status < CDF_OK) QuitCDF ("2.1", status); + +/****************************************************************************** +* Set/confirm pad values. +******************************************************************************/ + +status = CDFlib (SELECT_, CDF_, id, + zVAR_, var1Num_out, + PUT_, zVAR_PADVALUE_, &pad1, + SELECT_, zVAR_, var2Num_out, + PUT_, zVAR_PADVALUE_, &pad2, + NULL_); +if (status < CDF_OK) QuitCDF ("3.0", status); + +status = CDFlib (SELECT_, zVAR_, var1Num_out, + GET_, zVAR_PADVALUE_, &pad1out, + SELECT_, zVAR_, var2Num_out, + GET_, zVAR_PADVALUE_, &pad2out, + NULL_); +if (status < CDF_OK) QuitCDF ("3.1", status); + +if (pad1out != pad1) QuitCDF ("3.2", status); +if (strcmp(pad2out,pad2)) QuitCDF ("3.3", status); + +/****************************************************************************** +* Write to variables - one value at a time. +******************************************************************************/ + +status = CDFlib (SELECT_, zVAR_, var1Num_out, + zVAR_RECNUMBER_, recNum, + NULL_); +if (status < CDF_OK) QuitCDF ("4.0", status); + +for (x0 = 0; x0 < DIM_0_SIZE1; x0++) + for (x1 = 0; x1 < DIM_1_SIZE1; x1++) { + indices[0] = x0; + indices[1] = x1; + status = CDFlib (SELECT_, zVAR_DIMINDICES_, indices, + PUT_, zVAR_DATA_, &var1Values[x0][x1], + NULL_); + if (status < CDF_OK) QuitCDF ("4.1", status); +} + +status = CDFlib (SELECT_, zVAR_, var2Num_out, + zVAR_RECNUMBER_, zRecNum, + NULL_); +if (status < CDF_OK) QuitCDF ("4.2", status); + +for (x0 = 0; x0 < DIM_0_SIZE2; x0++) { + zIndicesA[0] = x0; + status = CDFlib (SELECT_, zVAR_DIMINDICES_, zIndicesA, + PUT_, zVAR_DATA_, var2Values[x0], + NULL_); + if (status < CDF_OK) QuitCDF ("4.3", status); +} + +/****************************************************************************** +* Read/verify for the variables - one value at a time. +******************************************************************************/ + +status = CDFlib (SELECT_, zVAR_, var1Num_out, + zVAR_RECNUMBER_, recNum, + NULL_); +if (status < CDF_OK) QuitCDF ("5.0", status); + +for (x0 = 0; x0 < DIM_0_SIZE1; x0++) + for (x1 = 0; x1 < DIM_1_SIZE1; x1++) { + indices[0] = x0; + indices[1] = x1; + status = CDFlib (SELECT_, zVAR_DIMINDICES_, indices, + GET_, zVAR_DATA_, &var1Value_out, + NULL_); + if (status < CDF_OK) QuitCDF ("5.1", status); + + if (var1Value_out != var1Values[x0][x1]) QuitCDF ("5.2", status); + } + +status = CDFlib (SELECT_, zVAR_, var2Num_out, + zVAR_RECNUMBER_, zRecNum, + NULL_); +if (status < CDF_OK) QuitCDF ("5.3", status); + +for (x0 = 0; x0 < DIM_0_SIZE2; x0++) { + zIndicesA[0] = x0; + status = CDFlib (SELECT_, zVAR_DIMINDICES_, zIndicesA, + GET_, zVAR_DATA_, var2Value_out, + NULL_); + if (status < CDF_OK) QuitCDF ("5.4", status); + + for (i = 0; i < NUM_ELEMS2; i++) { + if (var2Value_out[i] != var2Values[x0][i]) QuitCDF ("5.5", status); + } +} + +/****************************************************************************** +* HyperPUT to the variables - one full record at a time. +******************************************************************************/ + +for (x0 = 0; x0 < DIM_0_SIZE1; x0++) + for (x1 = 0; x1 < DIM_1_SIZE1; x1++) { + var1Values[x0][x1] = -var1Values[x0][x1]; + } + +indices[0] = 0; +indices[1] = 0; + +status = CDFlib (SELECT_, zVAR_, var1Num_out, + zVAR_RECNUMBER_, recStart, + zVAR_RECCOUNT_, recCount, + zVAR_RECINTERVAL_, recInterval, + zVAR_DIMINDICES_, indices, + zVAR_DIMCOUNTS_, counts, + zVAR_DIMINTERVALS_, intervals, + zVAR_, var1Num_out, + PUT_, zVAR_HYPERDATA_, var1Values, + NULL_); +if (status < CDF_OK) QuitCDF ("6.0", status); + +for (x0 = 0; x0 < DIM_0_SIZE2; x0++) + for (i = 0; i < NUM_ELEMS2; i++) { + var2Values[x0][i]++; + } + +zIndicesA[0] = 0; + +status = CDFlib (SELECT_, zVAR_, var2Num_out, + zVAR_RECNUMBER_, zRecStart, + zVAR_RECCOUNT_, zRecCount, + zVAR_RECINTERVAL_, zRecInterval, + zVAR_DIMINDICES_, zIndicesA, + zVAR_DIMCOUNTS_, zCounts, + zVAR_DIMINTERVALS_, zIntervals, + PUT_, zVAR_HYPERDATA_, var2Values, + NULL_); +if (status < CDF_OK) QuitCDF ("6.1", status); + +/****************************************************************************** +* HyperGET/verify for variables - one record at a time. +******************************************************************************/ + +status = CDFlib (SELECT_, zVAR_, var1Num_out, + zVAR_RECNUMBER_, recStart, + zVAR_RECCOUNT_, recCount, + zVAR_RECINTERVAL_, recInterval, + zVAR_DIMINDICES_, indices, + zVAR_DIMCOUNTS_, counts, + zVAR_DIMINTERVALS_, intervals, + zVAR_, var1Num_out, + GET_, zVAR_HYPERDATA_, var1Buffer_out, + NULL_); +if (status < CDF_OK) QuitCDF ("7.0", status); + +for (x0 = 0; x0 < DIM_0_SIZE1; x0++) + for (x1 = 0; x1 < DIM_1_SIZE1; x1++) { + if (var1Buffer_out[x0][x1] != var1Values[x0][x1]) + QuitCDF ("7.1", status); + } + +status = CDFlib (SELECT_, zVAR_, var2Num_out, + zVAR_RECNUMBER_, zRecStart, + zVAR_RECCOUNT_, zRecCount, + zVAR_RECINTERVAL_, zRecInterval, + zVAR_DIMINDICES_, zIndicesA, + zVAR_DIMCOUNTS_, zCounts, + zVAR_DIMINTERVALS_, zIntervals, + GET_, zVAR_HYPERDATA_, var2Buffer_out, + NULL_); +if (status < CDF_OK) QuitCDF ("7.2", status); + +for (x0 = 0; x0 < DIM_0_SIZE2; x0++) + for (i = 0; i < NUM_ELEMS2; i++) { + if (var2Buffer_out[x0][i] != var2Values[x0][i]) + QuitCDF ("7.3", status); + } + +/****************************************************************************** +* Confirm hyper parameters for a zVariable. +******************************************************************************/ + +status = CDFlib (CONFIRM_, zVAR_RECNUMBER_, &recStartOut, + zVAR_RECCOUNT_, &recCountOut, + zVAR_RECINTERVAL_, &recIntervalOut, + zVAR_DIMINDICES_, indicesOut, + zVAR_DIMCOUNTS_, countsOut, + zVAR_DIMINTERVALS_, intervalsOut, + NULL_); +if (status < CDF_OK) QuitCDF ("8.0", status); + +if (recStartOut != zRecStart) QuitCDF ("8.1", status); +if (recCountOut != zRecCount) QuitCDF ("8.2", status); +if (recIntervalOut != zRecInterval) QuitCDF ("8.3", status); +for (dimN = 0; dimN < N_DIMS2; dimN++) { + if (indicesOut[dimN] != zIndicesA[dimN]) QuitCDF ("8.4", status); + if (countsOut[dimN] != zCounts[dimN]) QuitCDF ("8.5", status); + if (intervalsOut[dimN] != zIntervals[dimN]) QuitCDF ("8.6", status); +} + +/****************************************************************************** +* Set/confirm sequential access position for a zVariable (and read/write a +* value). +******************************************************************************/ + +status = CDFlib (SELECT_, zVAR_SEQPOS_, zRecStart, zIndicesA, + GET_, zVAR_SEQDATA_, var2Value_out, + PUT_, zVAR_SEQDATA_, var2Value_out, + CONFIRM_, zVAR_SEQPOS_, &recNumOut, indicesOut, + NULL_); +if (status < CDF_OK) QuitCDF ("9.0", status); + +if (recNumOut != zRecStart) QuitCDF ("9.1", status); +if (indicesOut[0] != zIndicesA[0] + 2) QuitCDF ("9.2", status); + + +/****************************************************************************** +* Confirm existence of variables. +******************************************************************************/ + +status = CDFlib (CONFIRM_, zVAR_EXISTENCE_, var1Name, + zVAR_EXISTENCE_, var2Name, + NULL_); +if (status < CDF_OK) QuitCDF ("10.0", status); + +/****************************************************************************** +* Inquire variable numbers. +******************************************************************************/ + +status = CDFlib (GET_, zVAR_NUMBER_, var1Name, &varNum_out1, + zVAR_NUMBER_, var2Name, &varNum_out2, + NULL_); +if (status < CDF_OK) QuitCDF ("11.0", status); + +if (varNum_out1 != 0) QuitCDF ("11.2", status); +if (varNum_out2 != 1) QuitCDF ("11.3", status); + +/****************************************************************************** +* Rename variables. +******************************************************************************/ + +status = CDFlib (SELECT_, zVAR_NAME_, var1Name, + PUT_, zVAR_NAME_, new_var1Name, + NULL_); +if (status < CDF_OK) QuitCDF ("12.0", status); + +status = CDFlib (SELECT_, zVAR_NAME_, var2Name, + PUT_, zVAR_NAME_, new_var2Name, + NULL_); +if (status < CDF_OK) QuitCDF ("12.1", status); + +/****************************************************************************** +* Read/write multiple variable data - one record for each variable involved. +******************************************************************************/ + +status = CDFlib (SELECT_, zVARs_RECNUMBER_, 2L, + PUT_, zVARs_RECDATA_, nZvars1, zVarNs1, zVarsRecBuffer1, + SELECT_, zVARs_RECNUMBER_, 2L, + PUT_, zVARs_RECDATA_, nZvars2, zVarNs2, zVarsRecBuffer2, + NULL_); +if (status < CDF_OK) QuitCDF ("13.0", status); + +status = CDFlib (GET_, zVARs_RECDATA_, nZvars1, zVarNs1, zVarsRecBufferOut1, + GET_, zVARs_RECDATA_, nZvars2, zVarNs2, zVarsRecBufferOut2, + NULL_); +if (status < CDF_OK) QuitCDF ("13.1", status); + +if (memcmp(zVarsRecBufferOut1,zVarsRecBuffer1, + sizeof(zVarsRecBuffer1))) QuitCDF ("13.3", status); +if (memcmp(zVarsRecBufferOut2,zVarsRecBuffer2, + sizeof(zVarsRecBuffer2))) QuitCDF ("13.4", status); + +/****************************************************************************** +* Inquire variables. +******************************************************************************/ + +status = CDFlib (SELECT_, zVAR_, var1Num_out, + GET_, zVAR_NAME_, var1Name_out, + zVAR_DATATYPE_, &var1DataType_out, + zVAR_NUMELEMS_, &var1NumElements_out, + zVAR_BLOCKINGFACTOR_, &blockingfactorOut1, + zVAR_MAXallocREC_, &maxAllocOut1, + zVAR_MAXREC_, &maxRecOut1, + zVAR_nINDEXRECORDS_, &nIndexRecsOut1, + zVAR_nINDEXENTRIES_, &nIndexEntriesOut1, + CONFIRM_, zVAR_, &var1Num_out, + NULL_); +if (status < CDF_OK) QuitCDF ("14.0", status); + +if (strcmp(var1Name_out,new_var1Name) != 0) QuitCDF ("14.1", status); +if (var1DataType_out != var1DataType) QuitCDF ("14.2", status); +if (var1NumElements_out != var1NumElements) QuitCDF ("14.3", status); +if (var1Num_out != 0L) QuitCDF ("14.4", status); +if (blockingfactorOut1 != blockingfactor1) QuitCDF ("14.5", status); +if (maxAllocOut1 + 1 != allocRecs1) QuitCDF ("14.6", status); +if (maxRecOut1 != 2L) QuitCDF ("14.7", status); + +status = CDFlib (SELECT_, zVAR_, var2Num_out, + GET_, zVAR_NAME_, var2Name_out, + zVAR_DATATYPE_, &var2DataType_out, + zVAR_NUMELEMS_, &var2NumElements_out, + zVAR_BLOCKINGFACTOR_, &blockingfactorOut2, + zVAR_MAXallocREC_, &maxAllocOut2, + zVAR_MAXREC_, &maxRecOut2, + zVAR_nINDEXRECORDS_, &nIndexRecsOut2, + zVAR_nINDEXENTRIES_, &nIndexEntriesOut2, + CONFIRM_, zVAR_, &var2Num_out, + NULL_); +if (status < CDF_OK) QuitCDF ("14.8", status); + +if (strcmp(var2Name_out,new_var2Name) != 0) QuitCDF ("14.9", status); +if (var2DataType_out != var2DataType) QuitCDF ("14.10", status); +if (var2NumElements_out != var2NumElements) QuitCDF ("14.11", status); +if (var2Num_out != 1L) QuitCDF ("14.12", status); +if (blockingfactorOut2 != blockingfactor2) QuitCDF ("14.13", status); +if (maxAllocOut2 + 1 != allocRecs2) QuitCDF ("14.14", status); +if (maxRecOut2 != 2L) QuitCDF ("14.15", status); + +/****************************************************************************** +* Close CDF. +******************************************************************************/ + +status = CDFlib (CLOSE_, CDF_, + NULL_); +if (status < CDF_OK) QuitCDF ("15.0", status); + +/****************************************************************************** +* Successful completion. +******************************************************************************/ + +return EXIT_SUCCESS_; +} + + +/****************************************************************************** +* QuitCDF. +******************************************************************************/ + +void QuitCDF (where, status) +char *where; +CDFstatus status; +{ + 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\n", text); + } + CDFlib (CLOSE_, CDF_, + NULL_); + printf ("...test aborted.\n"); + exit (EXIT_FAILURE_); +} diff --git a/ext/cdf/cdf38_0-dist/samples/cacsst2.cdf b/ext/cdf/cdf38_0-dist/samples/cacsst2.cdf new file mode 100644 index 0000000..e959b5e Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/cacsst2.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/cacsst2.skt b/ext/cdf/cdf38_0-dist/samples/cacsst2.skt new file mode 100644 index 0000000..b3eb37e --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/cacsst2.skt @@ -0,0 +1,405 @@ +! Skeleton table for the "cacsst2" CDF. +! Generated: Wednesday, 3-Apr-1996 10:18:44 +! CDF created/modified by CDF V2.5.19 +! Skeleton table created by CDF V2.6.0 + +#header + + CDF NAME: cacsst2 + DATA ENCODING: NETWORK + MAJORITY: COLUMN + FORMAT: SINGLE + +! Variables G.Attributes V.Attributes Records Dims Sizes +! --------- ------------ ------------ ------- ---- ------ + 4/0 1 8 1/z 2 180 91 + + +#GLOBALattributes + +! Attribute Entry Data +! Name Number Type Value +! --------- ------ ---- ----- + + "TITLE" 1: CDF_CHAR { "Climate Analysis Center " - + "SST blended analysis " } . + + +#VARIABLEattributes + + "FIELDNAM" + "VALIDMIN" + "VALIDMAX" + "SCALEMIN" + "SCALEMAX" + "UNITS" + "FORMAT" + "FILLVAL" + + +#variables + +! Variable Data Number Record Dimension +! Name Type Elements Variance Variances +! -------- ---- -------- -------- --------- + + "LATITUDE" CDF_INT2 1 F F T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Latitude " } + "VALIDMIN" CDF_INT2 { -90 } + "VALIDMAX" CDF_INT2 { 90 } + "SCALEMIN" CDF_INT2 { -90 } + "SCALEMAX" CDF_INT2 { 90 } + "UNITS" CDF_CHAR { "deg " } + "FORMAT" CDF_CHAR { "I5 " } . + + ! NRV values follow... + + [1,1] = -90 + [1,2] = -88 + [1,3] = -86 + [1,4] = -84 + [1,5] = -82 + [1,6] = -80 + [1,7] = -78 + [1,8] = -76 + [1,9] = -74 + [1,10] = -72 + [1,11] = -70 + [1,12] = -68 + [1,13] = -66 + [1,14] = -64 + [1,15] = -62 + [1,16] = -60 + [1,17] = -58 + [1,18] = -56 + [1,19] = -54 + [1,20] = -52 + [1,21] = -50 + [1,22] = -48 + [1,23] = -46 + [1,24] = -44 + [1,25] = -42 + [1,26] = -40 + [1,27] = -38 + [1,28] = -36 + [1,29] = -34 + [1,30] = -32 + [1,31] = -30 + [1,32] = -28 + [1,33] = -26 + [1,34] = -24 + [1,35] = -22 + [1,36] = -20 + [1,37] = -18 + [1,38] = -16 + [1,39] = -14 + [1,40] = -12 + [1,41] = -10 + [1,42] = -8 + [1,43] = -6 + [1,44] = -4 + [1,45] = -2 + [1,46] = 0 + [1,47] = 2 + [1,48] = 4 + [1,49] = 6 + [1,50] = 8 + [1,51] = 10 + [1,52] = 12 + [1,53] = 14 + [1,54] = 16 + [1,55] = 18 + [1,56] = 20 + [1,57] = 22 + [1,58] = 24 + [1,59] = 26 + [1,60] = 28 + [1,61] = 30 + [1,62] = 32 + [1,63] = 34 + [1,64] = 36 + [1,65] = 38 + [1,66] = 40 + [1,67] = 42 + [1,68] = 44 + [1,69] = 46 + [1,70] = 48 + [1,71] = 50 + [1,72] = 52 + [1,73] = 54 + [1,74] = 56 + [1,75] = 58 + [1,76] = 60 + [1,77] = 62 + [1,78] = 64 + [1,79] = 66 + [1,80] = 68 + [1,81] = 70 + [1,82] = 72 + [1,83] = 74 + [1,84] = 76 + [1,85] = 78 + [1,86] = 80 + [1,87] = 82 + [1,88] = 84 + [1,89] = 86 + [1,90] = 88 + [1,91] = 90 + + +! Variable Data Number Record Dimension +! Name Type Elements Variance Variances +! -------- ---- -------- -------- --------- + + "LONGITUD" CDF_INT2 1 F T F + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Longitude " } + "VALIDMIN" CDF_INT2 { -180 } + "VALIDMAX" CDF_INT2 { 180 } + "SCALEMIN" CDF_INT2 { -180 } + "SCALEMAX" CDF_INT2 { 180 } + "UNITS" CDF_CHAR { "deg " } + "FORMAT" CDF_CHAR { "I5 " } . + + ! NRV values follow... + + [1,1] = -178 + [2,1] = -176 + [3,1] = -174 + [4,1] = -172 + [5,1] = -170 + [6,1] = -168 + [7,1] = -166 + [8,1] = -164 + [9,1] = -162 + [10,1] = -160 + [11,1] = -158 + [12,1] = -156 + [13,1] = -154 + [14,1] = -152 + [15,1] = -150 + [16,1] = -148 + [17,1] = -146 + [18,1] = -144 + [19,1] = -142 + [20,1] = -140 + [21,1] = -138 + [22,1] = -136 + [23,1] = -134 + [24,1] = -132 + [25,1] = -130 + [26,1] = -128 + [27,1] = -126 + [28,1] = -124 + [29,1] = -122 + [30,1] = -120 + [31,1] = -118 + [32,1] = -116 + [33,1] = -114 + [34,1] = -112 + [35,1] = -110 + [36,1] = -108 + [37,1] = -106 + [38,1] = -104 + [39,1] = -102 + [40,1] = -100 + [41,1] = -98 + [42,1] = -96 + [43,1] = -94 + [44,1] = -92 + [45,1] = -90 + [46,1] = -88 + [47,1] = -86 + [48,1] = -84 + [49,1] = -82 + [50,1] = -80 + [51,1] = -78 + [52,1] = -76 + [53,1] = -74 + [54,1] = -72 + [55,1] = -70 + [56,1] = -68 + [57,1] = -66 + [58,1] = -64 + [59,1] = -62 + [60,1] = -60 + [61,1] = -58 + [62,1] = -56 + [63,1] = -54 + [64,1] = -52 + [65,1] = -50 + [66,1] = -48 + [67,1] = -46 + [68,1] = -44 + [69,1] = -42 + [70,1] = -40 + [71,1] = -38 + [72,1] = -36 + [73,1] = -34 + [74,1] = -32 + [75,1] = -30 + [76,1] = -28 + [77,1] = -26 + [78,1] = -24 + [79,1] = -22 + [80,1] = -20 + [81,1] = -18 + [82,1] = -16 + [83,1] = -14 + [84,1] = -12 + [85,1] = -10 + [86,1] = -8 + [87,1] = -6 + [88,1] = -4 + [89,1] = -2 + [90,1] = 0 + [91,1] = 2 + [92,1] = 4 + [93,1] = 6 + [94,1] = 8 + [95,1] = 10 + [96,1] = 12 + [97,1] = 14 + [98,1] = 16 + [99,1] = 18 + [100,1] = 20 + [101,1] = 22 + [102,1] = 24 + [103,1] = 26 + [104,1] = 28 + [105,1] = 30 + [106,1] = 32 + [107,1] = 34 + [108,1] = 36 + [109,1] = 38 + [110,1] = 40 + [111,1] = 42 + [112,1] = 44 + [113,1] = 46 + [114,1] = 48 + [115,1] = 50 + [116,1] = 52 + [117,1] = 54 + [118,1] = 56 + [119,1] = 58 + [120,1] = 60 + [121,1] = 62 + [122,1] = 64 + [123,1] = 66 + [124,1] = 68 + [125,1] = 70 + [126,1] = 72 + [127,1] = 74 + [128,1] = 76 + [129,1] = 78 + [130,1] = 80 + [131,1] = 82 + [132,1] = 84 + [133,1] = 86 + [134,1] = 88 + [135,1] = 90 + [136,1] = 92 + [137,1] = 94 + [138,1] = 96 + [139,1] = 98 + [140,1] = 100 + [141,1] = 102 + [142,1] = 104 + [143,1] = 106 + [144,1] = 108 + [145,1] = 110 + [146,1] = 112 + [147,1] = 114 + [148,1] = 116 + [149,1] = 118 + [150,1] = 120 + [151,1] = 122 + [152,1] = 124 + [153,1] = 126 + [154,1] = 128 + [155,1] = 130 + [156,1] = 132 + [157,1] = 134 + [158,1] = 136 + [159,1] = 138 + [160,1] = 140 + [161,1] = 142 + [162,1] = 144 + [163,1] = 146 + [164,1] = 148 + [165,1] = 150 + [166,1] = 152 + [167,1] = 154 + [168,1] = 156 + [169,1] = 158 + [170,1] = 160 + [171,1] = 162 + [172,1] = 164 + [173,1] = 166 + [174,1] = 168 + [175,1] = 170 + [176,1] = 172 + [177,1] = 174 + [178,1] = 176 + [179,1] = 178 + [180,1] = 180 + + +! Variable Data Number Record Dimension +! Name Type Elements Variance Variances +! -------- ---- -------- -------- --------- + + "SST " CDF_REAL4 1 T T T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Monthly Mean SST " } + "VALIDMIN" CDF_REAL4 { -5.0 } + "VALIDMAX" CDF_REAL4 { 40.0 } + "SCALEMIN" CDF_REAL4 { 0.0 } + "SCALEMAX" CDF_REAL4 { 35.0 } + "UNITS" CDF_CHAR { "deg C " } + "FORMAT" CDF_CHAR { "F5.2 " } + "FILLVAL" CDF_REAL4 { -1.0e+09 } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Variance Variances +! -------- ---- -------- -------- --------- + + "EPOCH " CDF_EPOCH 1 T F F + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Time Line " } + "VALIDMIN" CDF_EPOCH { 01-Jan-1982 00:00:00.000 } + "VALIDMAX" CDF_EPOCH { 01-Dec-1992 00:00:00.000 } + "SCALEMIN" CDF_EPOCH { 01-Jan-1982 00:00:00.000 } + "SCALEMAX" CDF_EPOCH { 01-Dec-1992 00:00:00.000 } + "UNITS" CDF_CHAR { "ms " } + "FORMAT" CDF_CHAR { "E14.8 " } . + + ! RV values were not requested. + + +#zVariables + +! No zVariables. + + +#end diff --git a/ext/cdf/cdf35_0-dist/src/include/cdf.inc b/ext/cdf/cdf38_0-dist/samples/cdf.inc similarity index 97% rename from ext/cdf/cdf35_0-dist/src/include/cdf.inc rename to ext/cdf/cdf38_0-dist/samples/cdf.inc index 719250e..f48a740 100644 --- a/ext/cdf/cdf35_0-dist/src/include/cdf.inc +++ b/ext/cdf/cdf38_0-dist/samples/cdf.inc @@ -1,5 +1,5 @@ C----------------------------------------------------------------------- -C Copyright 1996-2013 United States Government as represented by the +C Copyright 1996-2014 United States Government as represented by the C Administrator of the National Aeronautics and Space Administration. C All Rights Reserved. C----------------------------------------------------------------------- @@ -472,6 +472,9 @@ C !--------------------------------------------------------------- INTEGER*4 PRECEEDING_RECORDS_ALLOCATED PARAMETER (PRECEEDING_RECORDS_ALLOCATED = 1009) + INTEGER*4 TT2000_CDF_MAYNEEDUPDATE + PARAMETER (TT2000_CDF_MAYNEEDUPDATE = 1010) + C !--------------------------------------------------------------- C ! OK code. C !--------------------------------------------------------------- @@ -854,6 +857,21 @@ C -2105 unused. INTEGER*4 UNABLE_TO_PROCESS_CDF PARAMETER (UNABLE_TO_PROCESS_CDF = -2230) + INTEGER*4 ZLIB_COMPRESS_ERROR + PARAMETER (ZLIB_COMPRESS_ERROR = -2231) + + INTEGER*4 ZLIB_UNCOMPRESS_ERROR + PARAMETER (ZLIB_UNCOMPRESS_ERROR = -2232) + + INTEGER*4 CANNOT_INSERT_RECORDS + PARAMETER (CANNOT_INSERT_RECORDS = -2233) + + INTEGER*4 TT2000_USED_OUTDATED_TABLE + PARAMETER (TT2000_USED_OUTDATED_TABLE = -2234) + + INTEGER*4 BADDATE_LEAPSECOND_UPDATED + PARAMETER (BADDATE_LEAPSECOND_UPDATED = -2235) + REAL*8 ILLEGAL_EPOCH_VALUE PARAMETER (ILLEGAL_EPOCH_VALUE = -1.0) @@ -1389,6 +1407,15 @@ C----------------------------------------------------------------------- INTEGER*4 CDF_CHECKSUM_ PARAMETER (CDF_CHECKSUM_ = 156) + INTEGER*4 rVAR_RECORDS_RENUMBER_ + PARAMETER (rVAR_RECORDS_RENUMBER_ = 157) + + INTEGER*4 zVAR_RECORDS_RENUMBER_ + PARAMETER (zVAR_RECORDS_RENUMBER_ = 158) + + INTEGER*4 CDF_LEAPSECONDLASTUPDATED_ + PARAMETER (CDF_LEAPSECONDLASTUPDATED_ = 159) + C----------------------------------------------------------------------- C Declarations for functions. These may cause compiler warnings on some C machines if the functions are not used. If that is a problem, remove diff --git a/ext/cdf/cdf38_0-dist/samples/d103a2x.cdf b/ext/cdf/cdf38_0-dist/samples/d103a2x.cdf new file mode 100644 index 0000000..627c176 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/d103a2x.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/example.dat b/ext/cdf/cdf38_0-dist/samples/example.dat new file mode 100644 index 0000000..aac0c0b --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/example.dat @@ -0,0 +1,96 @@ +0000 -165. +40. 20.0 +0000 -165. +30. 21.7 +0000 -150. +40. 19.2 +0000 -150. +30. 20.7 +0100 -165. +40. 18.2 +0100 -165. +30. 19.3 +0100 -150. +40. 22.0 +0100 -150. +30. 19.2 +0200 -165. +40. 19.9 +0200 -165. +30. 19.3 +0200 -150. +40. 19.6 +0200 -150. +30. 19.0 +0300 -165. +40. 19.9 +0300 -165. +30. 19.3 +0300 -150. +40. 12.6 +0300 -150. +30. 19.0 +0400 -165. +40. 19.7 +0400 -165. +30. 13.3 +0400 -150. +40. 19.6 +0400 -150. +30. 19.0 +0500 -165. +40. 17.9 +0500 -165. +30. 19.3 +0500 -150. +40. 19.6 +0500 -150. +30. 19.6 +0600 -165. +40. 19.9 +0600 -165. +30. 20.3 +0600 -150. +40. 19.6 +0600 -150. +30. 12.0 +0700 -165. +40. 15.9 +0700 -165. +30. 19.3 +0700 -150. +40. 19.6 +0700 -150. +30. 19.0 +0800 -165. +40. 19.9 +0800 -165. +30. 19.3 +0800 -150. +40. 13.6 +0800 -150. +30. 19.0 +0900 -165. +40. 19.9 +0900 -165. +30. 19.3 +0900 -150. +40. 19.8 +0900 -150. +30. 29.0 +1000 -165. +40. 19.9 +1000 -165. +30. 19.3 +1000 -150. +40. 13.6 +1000 -150. +30. 19.0 +1100 -165. +40. 19.9 +1100 -165. +30. 19.3 +1100 -150. +40. 19.6 +1100 -150. +30. 19.0 +1200 -165. +40. 16.9 +1200 -165. +30. 19.9 +1200 -150. +40. 19.6 +1200 -150. +30. 19.0 +1300 -165. +40. 19.9 +1300 -165. +30. 12.3 +1300 -150. +40. 19.6 +1300 -150. +30. 19.0 +1400 -165. +40. 19.9 +1400 -165. +30. 11.3 +1400 -150. +40. 19.6 +1400 -150. +30. 19.0 +1500 -165. +40. 19.9 +1500 -165. +30. 18.3 +1500 -150. +40. 19.6 +1500 -150. +30. 19.0 +1600 -165. +40. 16.9 +1600 -165. +30. 19.3 +1600 -150. +40. 19.6 +1600 -150. +30. 19.0 +1700 -165. +40. 18.9 +1700 -165. +30. 19.3 +1700 -150. +40. 19.6 +1700 -150. +30. 19.0 +1800 -165. +40. 17.9 +1800 -165. +30. 19.3 +1800 -150. +40. 19.6 +1800 -150. +30. 17.0 +1900 -165. +40. 17.9 +1900 -165. +30. 17.3 +1900 -150. +40. 19.6 +1900 -150. +30. 19.0 +2000 -165. +40. 12.9 +2000 -165. +30. 19.3 +2000 -150. +40. 19.6 +2000 -150. +30. 10.0 +2100 -165. +40. 19.9 +2100 -165. +30. 19.3 +2100 -150. +40. 19.5 +2100 -150. +30. 19.0 +2200 -165. +40. 19.9 +2200 -165. +30. 19.3 +2200 -150. +40. 19.6 +2200 -150. +30. 19.5 +2300 -165. +40. 21.0 +2300 -165. +30. 19.5 +2300 -150. +40. 18.4 +2300 -150. +30. 22.0 diff --git a/ext/cdf/cdf38_0-dist/samples/example1.c b/ext/cdf/cdf38_0-dist/samples/example1.c new file mode 100644 index 0000000..b701a42 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/example1.c @@ -0,0 +1,231 @@ +/****************************************************************************** +* +* NSSDC/CDF Create an example CDF using the New Standard Interface +* that was introduced in CDF 3.1. +* +* History: +* +* V1.0 10-Jan-2006, D. Han Original version +* +******************************************************************************/ + +/****************************************************************************** +* +* Note(s): +* +* This program would have to be modified to run on a DEC Alpha because the +* C language `long' data type is 8 bytes rather than 4 (the CDF data type of +* CDF_INT4 is always 4 bytes). +* +******************************************************************************/ + +/****************************************************************************** +* Necessary include files. +******************************************************************************/ + +#include +#include +#include +#include + +#include "cdf.h" + +/****************************************************************************** +* Function prototypes. +******************************************************************************/ + +void StatusHandler (); + +/****************************************************************************** +* MAIN. +******************************************************************************/ +int main () { + +CDFid id; /* CDF identifier. */ +CDFstatus status; /* CDF completion status. */ + +FILE *fp; /* File pointer - used to read input data file. */ + +char *title[] = {"CDF title", "Author: CDF"}; +short lat[181]; +int time, i, *image; +long TimeVarNum, LatVarNum, ImageVarNum, attrNum, recNum, titleAttrNum, + dimIndices[2], dimCounts[2], dimInterval[2], dimSizes[2], dimVarys[2]; +long cType, /* Compression type */ + cParms[CDF_MAX_PARMS]; /* Compression parameters */ + +assert(sizeof(short) == 2); /* Test if short matches with CDF_INT2 */ +assert(sizeof(int) == 4); /* Test if int matches with CDF_INT4 */ + +/****************************************************************************** +* Create the CDF. +******************************************************************************/ +status = CDFcreateCDF ("example1", &id); +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Create zVariables. +******************************************************************************/ +status = CDFcreatezVar (id, + "Time", /* Variable name - case sensitive */ + CDF_INT4, /* Data type */ + 1L, /* Number of elements */ + 0L, /* Dimentionality */ + dimSizes, /* Dummy dimension sizes since dim = 0 */ + VARY, /* Record variance */ + VARY, /* Dimension variance */ + &TimeVarNum); +if (status != CDF_OK) StatusHandler (status); + +dimSizes[0] = 181; +dimVarys[0] = VARY; +dimVarys[1] = VARY; +status = CDFcreatezVar (id, "Latitude", CDF_INT2, 1L, 1L, dimSizes, + VARY, dimVarys, &LatVarNum); +if (status != CDF_OK) StatusHandler (status); + +dimSizes[0] = 10; +dimSizes[1] = 20; +dimVarys[0] = VARY; +dimVarys[1] = VARY; +status = CDFcreatezVar (id, "Image", CDF_INT4, 1L, 2L, dimSizes, + VARY, dimVarys, &ImageVarNum); +if (status != CDF_OK) StatusHandler (status); + +/* Define compression for the 'Image' variable. */ +cType = GZIP_COMPRESSION; +cParms[0] = 5; /* GZIP compression level */ +status = CDFsetzVarCompression (id, ImageVarNum, cType, cParms); +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Create global and variable attributes. +******************************************************************************/ +status = CDFcreateAttr (id, "TITLE", GLOBAL_SCOPE, &titleAttrNum); +if (status != CDF_OK) StatusHandler (status); + +status = CDFcreateAttr (id, "FIELDNAM", VARIABLE_SCOPE, &attrNum); +if (status != CDF_OK) StatusHandler (status); + +status = CDFcreateAttr (id, "UNITS", VARIABLE_SCOPE, &attrNum); +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Write TITLE gAttribute gEntry. +******************************************************************************/ +status = CDFputAttrgEntry (id, titleAttrNum, + 0L, /* Attribute entry number */ + CDF_CHAR, strlen(title[0]), title[0]); +if (status != CDF_OK) StatusHandler (status); + +status = CDFputAttrgEntry (id, titleAttrNum, + 1L, /* Attribute entry number */ + CDF_CHAR, strlen(title[1]), title[1]); +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Write vAttribute zEntries for 'Time' zVariable. +******************************************************************************/ +status = CDFputAttrzEntry (id, CDFgetAttrNum(id,"FIELDNAM"), + CDFvarNum(id,"Time"), CDF_CHAR, 19L, + "Time of observation"); +if (status != CDF_OK) StatusHandler (status); + +status = CDFputAttrzEntry (id, CDFgetAttrNum(id,"UNITS"), + CDFvarNum(id,"Time"), CDF_CHAR, 11L, + "Hour/Minute"); + +/****************************************************************************** +* Write data for 'Time' zVariable. +******************************************************************************/ +recNum = 0L; +time = 23; +status = CDFputzVarRecordData (id, TimeVarNum, recNum, &time); +if (status != CDF_OK) StatusHandler (status); +recNum = 1L; +time = 24; +status = CDFputzVarRecordData (id, TimeVarNum, recNum, &time); +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Write data for 'Latitude' zVariable. +******************************************************************************/ +dimIndices[0] = 0; +dimCounts[0] = 181; +dimInterval[0] = 1; +for (i=-90; i <= 90; i++) + lat[i+90] = i; + +status = CDFhyperPutzVarData (id, LatVarNum, + 0L, /* record start */ + 1L, /* # of records to write */ + 1L, /* record interval */ + dimIndices, /* dimension dimIndices */ + dimCounts, /* dimension counts */ + dimInterval, /* dimension interval */ + lat); + +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Write data for 'Image' zVariable. +******************************************************************************/ +dimIndices[0] = 0; +dimIndices[1] = 0; +dimCounts[0] = 10; +dimCounts[1] = 20; +dimInterval[0] = 1; +dimInterval[1] = 1; + +image = (int *) malloc (sizeof(int) * 600); +for (i=0; i < 600; i++) /* Load 3 records of data */ + *(image+i) = i; + +status = CDFhyperPutzVarData (id, ImageVarNum, + 0L, /* record start */ + 3L, /* # of records to write */ + 1L, /* record interval */ + dimIndices, /* dimension dimIndices */ + dimCounts, /* dimension counts */ + dimInterval, /* dimension interval */ + image); + +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Close CDF. +******************************************************************************/ +status = CDFcloseCDF (id); +if (status != CDF_OK) StatusHandler (status); + +return 0; +} + +/****************************************************************************** +* Status handler. +******************************************************************************/ +void StatusHandler (status) +CDFstatus status; +{ +char message[CDF_ERRTEXT_LEN+1]; + +if (status < CDF_WARN) { + printf ("An error has occurred, halting...\n"); + CDFgetStatusText (status, message); + printf ("%s\n", message); + exit (1); +} +else + if (status < CDF_OK) { + printf ("Warning, function may not have completed as expected...\n"); + CDFgetStatusText (status, message); + printf ("%s\n", message); + } + else + if (status > CDF_OK) { + printf ("Function completed successfully, but be advised that...\n"); + CDFgetStatusText (status, message); + printf ("%s\n", message); + } +return; +} diff --git a/ext/cdf/cdf38_0-dist/samples/example1.cdf b/ext/cdf/cdf38_0-dist/samples/example1.cdf new file mode 100644 index 0000000..c8b928f Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/example1.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/example2.cdf b/ext/cdf/cdf38_0-dist/samples/example2.cdf new file mode 100644 index 0000000..550bbfd Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/example2.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/example2.f b/ext/cdf/cdf38_0-dist/samples/example2.f new file mode 100644 index 0000000..c5d513c --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/example2.f @@ -0,0 +1,147 @@ +C---------------------------------------------------------------------- +C +C NSSDC/CDF Create an example CDF (using skeleton +C table). +C +C Version 1.0, 13-Nov-91, Hughes STX +C +C Modification history: +C +C V1.0 13-Nov-91, J Love Original version +C 1.1 12-Jan-06, M Liu Used the new Standard Interface +C routines +C +C--------------------------------------------------------------------- + + INCLUDE '../include/cdf.inc' + + INTEGER*4 id ! CDF identifier. + INTEGER*4 status ! CDF completion status. + + INTEGER*4 lun ! Logical unit number for input data + ! file. + + INTEGER*4 indices(2) ! Dimension indices. + INTEGER*4 rec_num ! Record number. + + INTEGER*4 time_var_num ! 'Time' zVariable number. + INTEGER*4 tmp_var_num ! 'Temperature' zVariable number. + + INTEGER*4 time ! 'Time' zVariable value. + REAL*4 lat ! 'Latitude' zVariable value. + REAL*4 lon ! 'Longitude' zVariable value. + REAL*4 tmp ! 'Temperature' zVariable value. + + INTEGER*4 x1, x2 ! Indices + + DATA lun/1/ + +C---------------------------------------------------------------------- +C Open the CDF. +C---------------------------------------------------------------------- + + CALL CDF_open_cdf ('example2', id, status) + IF (status .NE. CDF_OK) CALL StatusHandler (status) + +C---------------------------------------------------------------------- +C Determine zVariable numbers. +C---------------------------------------------------------------------- + + time_var_num = CDF_get_var_num (id, 'Time') + IF (time_var_num .LT. CDF_OK) CALL StatusHandler (status) + + tmp_var_num = CDF_get_var_num (id, 'Temperature') + IF (tmp_var_num .LT. CDF_OK) CALL StatusHandler (status) + +C---------------------------------------------------------------------- +C Read input values for zVariables and write them to the CDF. Not +C every value must be written to the CDF - many of the values are +C redundant. The 'Time' value only has to be written once per CDF +C record (every 4 input records). The 'Longitude' and 'Latitude' +C values are not written at all because they had been specified in the +C skeleton table. Each 'Temperature' value read is written to the CDF. +C---------------------------------------------------------------------- + + OPEN (UNIT=lun, FILE='example.dat', STATUS='OLD', ERR=99) + + DO rec_num = 1, 24 + DO x1 = 1, 2 + DO x2 = 1, 2 + indices(1) = x1 + indices(2) = x2 + + READ (lun, *, ERR=99) time, lon, lat, tmp + IF (indices(1) .EQ. 1 .AND. indices(2) .EQ. 1) THEN + CALL CDF_put_zvar_data (id, time_var_num, rec_num, + . indices, time, status) + IF (status .NE. CDF_OK) CALL StatusHandler (status) + END IF + CALL CDF_put_zvar_data (id, tmp_var_num, rec_num, + . indices, tmp, status) + IF (status .NE. CDF_OK) CALL StatusHandler (status) + END DO + END DO + END DO + + CLOSE (lun, ERR=99) + +C---------------------------------------------------------------------- +C Close CDF. +C---------------------------------------------------------------------- + + CALL CDF_close_cdf (id, status) + IF (status .NE. CDF_OK) CALL StatusHandler (status) + + STOP + +C---------------------------------------------------------------------- +C Input file error handler. +C---------------------------------------------------------------------- + + 99 WRITE (6,101) + 101 FORMAT (' ','Error reading input file') + STOP + + END + + + +C---------------------------------------------------------------------------- +C Status handler. +C---------------------------------------------------------------------------- + + SUBROUTINE StatusHandler (status) + INTEGER*4 status + + INCLUDE '../include/cdf.inc' + + CHARACTER message*(CDF_ERRTEXT_LEN) + INTEGER*4 statuso + + IF (status .LT. CDF_WARN) THEN + WRITE (6,10) +10 FORMAT (' ','Error (halting)...') + CALL CDF_get_status_text (status, message, statuso) + IF (statuso .EQ. CDF_OK) WRITE (6,11) message +11 FORMAT (' ',A) + STOP + ELSE + IF (status .LT. CDF_OK) THEN + WRITE (6,12) +12 FORMAT (' ','Warning...') + CALL CDF_get_status_text (status, message, statuso) + IF (statuso .EQ. CDF_OK) WRITE (6,13) message +13 FORMAT (' ',A) + ELSE + IF (status .GT. CDF_OK) THEN + WRITE (6,14) +14 FORMAT (' ','Be advised that...') + CALL CDF_get_status_text (status, message, statuso) + IF (statuso .EQ. CDF_OK) WRITE (6,15) message +15 FORMAT (' ',A) + END IF + END IF + END IF + + RETURN + END diff --git a/ext/cdf/cdf38_0-dist/samples/geocpi0.cdf b/ext/cdf/cdf38_0-dist/samples/geocpi0.cdf new file mode 100644 index 0000000..955db81 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/geocpi0.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/geocpi0.skt b/ext/cdf/cdf38_0-dist/samples/geocpi0.skt new file mode 100644 index 0000000..5662bc0 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/geocpi0.skt @@ -0,0 +1,723 @@ +! Skeleton table for the "geocpi0" CDF. +! Generated: Wednesday, 3-Apr-1996 10:19:20 +! CDF created/modified by CDF V2.6.0 +! Skeleton table created by CDF V2.6.0 + +#header + + CDF NAME: geocpi0 + DATA ENCODING: NETWORK + MAJORITY: COLUMN + FORMAT: SINGLE + +! Variables G.Attributes V.Attributes Records Dims Sizes +! --------- ------------ ------------ ------- ---- ----- + 0/23 11 18 0/z 2 3 2 + + +#GLOBALattributes + +! Attribute Entry Data +! Name Number Type Value +! --------- ------ ---- ----- + + "Project" 1: CDF_CHAR { "ISTP>International " - + "Solar-Terrestrial Physics" } . + + "Discipline" 1: CDF_CHAR { "Space " - + "Physics>Magnetospheric " - + "Science" } . + + "Source_name" 1: CDF_CHAR { "GEOTAIL>Geomagnetic Tail" } . + + "Data_type" 1: CDF_CHAR { "K0>Key Parameter" } . + + "Descriptor" 1: CDF_CHAR { "CPI>Comprehensive Plasma " - + "Instrumentation" } . + + "Data_version" 1: CDF_CHAR { "1" } . + + "TITLE" 1: CDF_CHAR { "Geotail CPI" } . + + "TEXT" 1: CDF_CHAR { "GEOTAIL Prelaunch Report" } + 2: CDF_CHAR { " April 1992, SES-TD-92-007SY" } + 3: CDF_CHAR { " CPI-SW Solar Wind Analyzer" } + 4: CDF_CHAR { " Key Parameters" } + 5: CDF_CHAR { " Ion number density" } + 6: CDF_CHAR { " Average energy" } + 7: CDF_CHAR { " Bulk flow velocity" } + 8: CDF_CHAR { " CPI-HP Hot Plasma Analyzer" } + 9: CDF_CHAR { " Key Parameters" } + 10: CDF_CHAR { " Ion number density" } + 11: CDF_CHAR { " Average energy" } + 12: CDF_CHAR { " Bulk flow velocity" } + 13: CDF_CHAR { " CPI-IC Ion Composition " - + "Analyzer" } + 14: CDF_CHAR { " Key Parameters" } + 15: CDF_CHAR { " Principal Species" } + 16: CDF_CHAR { " H+" } + 17: CDF_CHAR { " He++" } + 18: CDF_CHAR { " He+" } + 19: CDF_CHAR { " O+" } . + + "MODS" 1: CDF_CHAR { "First Delivery version, " - + "7-OCT-1993" } + 2: CDF_CHAR { "Second version, " - + "12-APR-1994, RLD" } + 3: CDF_CHAR { " Changed dimensions to" - + " 3 and 2 at" } + 4: CDF_CHAR { " recommendation of " - + "Mona Kessel" } + 5: CDF_CHAR { " With help of Jeff " - + "Love (CDFSUPPORT)" } + 6: CDF_CHAR { " have cleaned up dim " - + "problems" } . + + "ADID_ref" 1: CDF_CHAR { "NSSD0091" } . + + "Logical_file_id" 1: CDF_CHAR { "GE_K0_CPI_19940726_V01" } . + + +#VARIABLEattributes + + "FIELDNAM" + "CATDESC" + "VALIDMIN" + "VALIDMAX" + "SCALEMIN" + "SCALEMAX" + "LABLAXIS" + "UNITS" + "FORMAT" + "MONOTON" + "VAR_TYPE" + "DICT_KEY" + "FILLVAL" + "LABL_PTR_1" + "UNIT_PTR" + "FORM_PTR" + "DEPEND_0" + "DEPEND_1" + + +#variables + +! No rVariables. + + +#zVariables + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "Epoch" CDF_EPOCH 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Time Line" } + "VALIDMIN" CDF_EPOCH { 08-Sep-1992 00:00:00.000 } + "VALIDMAX" CDF_EPOCH { 31-Dec-2020 20:00:00.000 } + "SCALEMIN" CDF_EPOCH { 08-Sep-1992 00:00:00.000 } + "SCALEMAX" CDF_EPOCH { 31-Dec-2020 20:00:00.000 } + "LABLAXIS" CDF_CHAR { "CDF Epoch" } + "UNITS" CDF_CHAR { "ms" } + "MONOTON" CDF_CHAR { "INCREASE" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL8 { -1.0e+31 } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "Time_PB5" CDF_INT4 1 1 3 T T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Time Line" } + "VALIDMIN" CDF_INT4 { 1992, 252, 0 } + "VALIDMAX" CDF_INT4 { 2020, 365, 72000000 } + "SCALEMIN" CDF_INT4 { 1992, 252, 0 } + "SCALEMAX" CDF_INT4 { 2020, 365, 72000000 } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_INT4 { -2147483648 } + "LABL_PTR_1" + CDF_CHAR { "label_time" } + "UNIT_PTR" CDF_CHAR { "unit_time" } + "FORM_PTR" CDF_CHAR { "format_time" } + "DEPEND_0" CDF_CHAR { "Epoch" } + "DEPEND_1" CDF_CHAR { "unit_time" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "SW_P_Den" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Ion Number Density, SW" } + "CATDESC" CDF_CHAR { "Number density for positive ions in " - + "the energy range 144class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "SW_P_AVGE" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Ion Average Energy, SW" } + "CATDESC" CDF_CHAR { "Ion average energy for positive ions " - + "in the energy range 144(sw)" } + "UNITS" CDF_CHAR { "eV" } + "FORMAT" CDF_CHAR { "f7.0" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "SW_V" CDF_REAL4 1 1 2 T T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Ion bulk Flow, SW" } + "CATDESC" CDF_CHAR { "Solar Wind Ion flow velocity for " - + "positive ions in the energy range " - + "144class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "LABL_PTR_1" + CDF_CHAR { "label_v" } + "DEPEND_0" CDF_CHAR { "Epoch" } + "DEPEND_1" CDF_CHAR { "cartesian" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "Quality_SW" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Data Quality Percentage" } + "CATDESC" CDF_CHAR { "0.0: adequate data quality;100.0: " - + "inadequate data quality." } + "VALIDMIN" CDF_REAL4 { 0.0 } + "VALIDMAX" CDF_REAL4 { 100.0 } + "SCALEMIN" CDF_REAL4 { 0.0 } + "SCALEMAX" CDF_REAL4 { 100.0 } + "LABLAXIS" CDF_CHAR { "SW Quality" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "F5.2 " } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "GAP_FLAG" CDF_INT4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Post Gap Flag" } + "CATDESC" CDF_CHAR { "0: no gap immediately prior to this " - + "record;1: gap prior due to instrument" - + " mode;2: gap prior due to missing " - + "SIRIUS data;3: gap prior due to noisy" - + " SIRIUS data;20: gap prior due to " - + "missing Minor Frame(s)." } + "VALIDMIN" CDF_INT4 { 0 } + "VALIDMAX" CDF_INT4 { 5 } + "SCALEMIN" CDF_INT4 { 0 } + "SCALEMAX" CDF_INT4 { 5 } + "LABLAXIS" CDF_CHAR { "Data Gap" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "I1" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_INT4 { -2147483648 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "HP_P_Den" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Ion Number Density, HP" } + "CATDESC" CDF_CHAR { "Ion number density in the range " - + "50class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "HP_P_AVGE" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Ion Average Energy, HP" } + "CATDESC" CDF_CHAR { "Ion average energy in the range " - + "1(hp)" } + "UNITS" CDF_CHAR { "eV" } + "FORMAT" CDF_CHAR { "F7.0" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "HP_V" CDF_REAL4 1 1 2 T T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Ion bulk Flow, HP" } + "CATDESC" CDF_CHAR { "Bulk flow velocity for ions in the " - + "range 1class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "LABL_PTR_1" + CDF_CHAR { "label_v" } + "DEPEND_0" CDF_CHAR { "Epoch" } + "DEPEND_1" CDF_CHAR { "cartesian" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "HP_E_AVGE" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Electron Average Energy, HP" } + "CATDESC" CDF_CHAR { "Average energy for electrons in the " - + "range 50(hp)" } + "UNITS" CDF_CHAR { "eV" } + "FORMAT" CDF_CHAR { "F7.0" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "W" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Plasma Pressure" } + "CATDESC" CDF_CHAR { "Pressure for plasma in the range " - + "50class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "Quality_HP" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Data Quality Percentage" } + "CATDESC" CDF_CHAR { "0.0: adequate data quality;100.0: " - + "inadequate data quality." } + "VALIDMIN" CDF_REAL4 { 0.0 } + "VALIDMAX" CDF_REAL4 { 100.0 } + "SCALEMIN" CDF_REAL4 { 0.0 } + "SCALEMAX" CDF_REAL4 { 100.0 } + "LABLAXIS" CDF_CHAR { "HP Quality" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "F5.2 " } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "Quality_IC" CDF_REAL4 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Data Quality Percentage" } + "CATDESC" CDF_CHAR { "0.0: adequate data quality;100.0: " - + "inadequate data quality." } + "VALIDMIN" CDF_REAL4 { 0.0 } + "VALIDMAX" CDF_REAL4 { 100.0 } + "SCALEMIN" CDF_REAL4 { 0.0 } + "SCALEMAX" CDF_REAL4 { 100.0 } + "LABLAXIS" CDF_CHAR { "IC Quality" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "F5.2 " } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_REAL4 { -1.0e+31 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "H_P_FLAG" CDF_INT1 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "H+ FLAG " } + "CATDESC" CDF_CHAR { "Non-zero value indicates presence of " - + "singly ionized hydrogen" } + "VALIDMIN" CDF_INT1 { 0 } + "VALIDMAX" CDF_INT1 { 99 } + "SCALEMIN" CDF_INT1 { 0 } + "SCALEMAX" CDF_INT1 { 99 } + "LABLAXIS" CDF_CHAR { "H+" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "I2" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_INT1 { -128 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "HE_PP_FLAG" CDF_INT1 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Doubly ionized Helium, He++ " } + "CATDESC" CDF_CHAR { "Non-zero value indicates presence of " - + "doubly ionized helium" } + "VALIDMIN" CDF_INT1 { 0 } + "VALIDMAX" CDF_INT1 { 99 } + "SCALEMIN" CDF_INT1 { 0 } + "SCALEMAX" CDF_INT1 { 99 } + "LABLAXIS" CDF_CHAR { "He++" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "I2" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_INT1 { -128 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "HE_P_FLAG" CDF_INT1 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Singly ionized Helium, He+ " } + "CATDESC" CDF_CHAR { "Non-zero value indicates presence of " - + "singly ionized helium" } + "VALIDMIN" CDF_INT1 { 0 } + "VALIDMAX" CDF_INT1 { 99 } + "SCALEMIN" CDF_INT1 { 0 } + "SCALEMAX" CDF_INT1 { 99 } + "LABLAXIS" CDF_CHAR { "He+" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "I2" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_INT1 { -128 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "O_P_FLAG" CDF_INT1 1 0 T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Singly ionized Oxygen, O+ " } + "CATDESC" CDF_CHAR { "Non-zero value indicates presence of " - + "singly ionized atomic oxygen" } + "VALIDMIN" CDF_INT1 { 0 } + "VALIDMAX" CDF_INT1 { 99 } + "SCALEMIN" CDF_INT1 { 0 } + "SCALEMAX" CDF_INT1 { 99 } + "LABLAXIS" CDF_CHAR { "O+" } + "UNITS" CDF_CHAR { " " } + "FORMAT" CDF_CHAR { "I2" } + "VAR_TYPE" CDF_CHAR { "data" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } + "FILLVAL" CDF_INT1 { -128 } + "DEPEND_0" CDF_CHAR { "Epoch" } . + + ! RV values were not requested. + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "label_time" CDF_CHAR 27 1 3 F T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Label for Time_PB5" } + "VAR_TYPE" CDF_CHAR { "metadata" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } . + + ! NRV values follow... + + [1] = { "Year " } + [2] = { "Day of Year (Jan 1 = Day 1)" } + [3] = { "Elapsed millisecond of day " } + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "unit_time" CDF_CHAR 4 1 3 F T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Units for Time_PB5" } + "VAR_TYPE" CDF_CHAR { "metadata" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } . + + ! NRV values follow... + + [1] = { "year" } + [2] = { "day " } + [3] = { "msec" } + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "format_time" CDF_CHAR 2 1 3 F T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Format for Time_PB5" } + "VAR_TYPE" CDF_CHAR { "metadata" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } . + + ! NRV values follow... + + [1] = { "I4" } + [2] = { "I3" } + [3] = { "I8" } + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "label_v" CDF_CHAR 2 1 2 F T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Label for velocity" } + "VAR_TYPE" CDF_CHAR { "metadata" } + "DICT_KEY" CDF_CHAR { "ISTP>class>subclass" } . + + ! NRV values follow... + + [1] = { "Vx" } + [2] = { "Vy" } + + +! Variable Data Number Record Dimension +! Name Type Elements Dims Sizes Variance Variances +! -------- ---- -------- ---- ----- -------- --------- + + "cartesian" CDF_CHAR 1 1 2 F T + + ! Attribute Data + ! Name Type Value + ! -------- ---- ----- + + "FIELDNAM" CDF_CHAR { "Dimension Label" } + "VAR_TYPE" CDF_CHAR { "metadata" } + "DICT_KEY" CDF_CHAR { "ISTP>vector>cartesian" } . + + ! NRV values follow... + + [1] = { "x" } + [2] = { "y" } + + +#end diff --git a/ext/cdf/cdf38_0-dist/samples/geocpi1.cdf b/ext/cdf/cdf38_0-dist/samples/geocpi1.cdf new file mode 100644 index 0000000..b3c016a Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/geocpi1.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/geocpi2.cdf b/ext/cdf/cdf38_0-dist/samples/geocpi2.cdf new file mode 100644 index 0000000..df990cd Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/geocpi2.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/ij01r39.cdf b/ext/cdf/cdf38_0-dist/samples/ij01r39.cdf new file mode 100644 index 0000000..f21e430 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/ij01r39.cdf differ diff --git a/ext/cdf/cdf38_0-dist/samples/read_example1.c b/ext/cdf/cdf38_0-dist/samples/read_example1.c new file mode 100644 index 0000000..d23fcba --- /dev/null +++ b/ext/cdf/cdf38_0-dist/samples/read_example1.c @@ -0,0 +1,336 @@ +/****************************************************************************** +* +* NSSDC/CDF Reads the CDF file created by example1.c using the +* New Standard Interface that was introduced in CDF 3.1. +* Or, other CDF file if passed in as a sole parameter. +* +* History: +* +* V1.0 17-Jan-2006, D. Han Original version +* V1.1 27-Jun-2008, M. Liu Modified to use dynamic buffer +* allocation +* +******************************************************************************/ + +/****************************************************************************** +* Necessary include files. +******************************************************************************/ + +#include +#include + +#include "cdf.h" + +/****************************************************************************** +* Function prototypes. +******************************************************************************/ + +void StatusHandler (long); +void DynamicErrorHandle (CDFid); + +/****************************************************************************** +* MAIN. +******************************************************************************/ +int main (int argc, char **argv) { + +CDFid id; /* CDF identifier. */ +CDFstatus status; /* CDF completion status. */ + +void *buffer = NULL, *units, *lat; +void *time, *image, *pixelValue; +char varName[CDF_VAR_NAME_LEN256+1], + attrName[CDF_ATTR_NAME_LEN256+1], subincrement, + copyright[CDF_COPYRIGHT_LEN+1]; +int i, j; +long TimeVarNum, ImageVarNum, LatVarNum, attrNum, recNum, numDims, recVary, + dimIndices[CDF_MAX_DIMS], dimCounts[CDF_MAX_DIMS], + dimInterval[CDF_MAX_DIMS], dimSizes[CDF_MAX_DIMS], dimVarys[CDF_MAX_DIMS]; +long datatype, numElements, numRecs, arraySize, attrScope, maxgEntry, + maxrEntry, maxzEntry; +long encoding, majority, maxrRec, numrVars, maxzRec, numzVars, numAttrs; +long version, release, increment; +long ilen; + +/****************************************************************************** +* Get the current CDF library version number. +******************************************************************************/ +status = CDFgetLibraryVersion (&version, &release, &increment, &subincrement); +if (status != CDF_OK) StatusHandler (status); +printf ("Current CDF library version: CDF %d.%d.%d\n\n", + version, release, increment); + +status = CDFgetLibraryCopyright (copyright); +if (status != CDF_OK) StatusHandler (status); +printf ("CDF library copyright:\n\t%s\n\n", copyright); + +/****************************************************************************** +* Open the CDF. +******************************************************************************/ +if (argc > 1) + status = CDFopenCDF (argv[1], &id); +else + status = CDFopenCDF ("example1", &id); +if (status != CDF_OK) StatusHandler (status); + +status = CDFgetCopyright (id, copyright); +if (status != CDF_OK) StatusHandler (status); +printf ("CDF copyright:\n\t%s\n\n", copyright); + +/* Get the CDF version that was used to create this CDF file */ +status = CDFgetVersion (id, &version, &release, &increment); +if (status != CDF_OK) StatusHandler (status); + +status = CDFinquireCDF (id, + &numDims, dimSizes, /* only good for rVars */ + &encoding, &majority, + &maxrRec, &numrVars, /* only good for rVars */ + &maxzRec, &numzVars, &numAttrs); +if (status != CDF_OK) StatusHandler (status); + +printf ("CDF file name: example1.cdf\n"); +printf ("\tVersion: CDF %d.%d.%d\n", version, release, increment); +printf ("\tNumber of variables: %d rVars, %d zVars\n", numrVars, numzVars); +printf ("\tNumber of attributes (global & variable): %d\n", numAttrs); +printf ("\tMax record number for zVariables: %d\n\n", maxzRec); + +/****************************************************************************** +* Read the value of the global attribute named TITLE. +******************************************************************************/ +attrNum = CDFgetAttrNum (id, "TITLE"); +if (attrNum < CDF_OK) StatusHandler (status); + +status = CDFinquireAttr (id, attrNum, attrName, &attrScope, + &maxgEntry, + &maxrEntry, /* only applicable for variable attr */ + &maxzEntry); /* only applicable for variable attr */ +if (status != CDF_OK) StatusHandler (status); + +if (attrScope == GLOBAL_SCOPE) { + printf ("Global attribute TITLE:\n"); + for (i=0; i <= maxgEntry; i++) { + status = CDFinquireAttrgEntry (id, attrNum, (long) i, &datatype, + &numElements); + if (status != CDF_OK) StatusHandler (status); + + status = CDFgetDataTypeSize (datatype, &ilen); + ilen = ilen * numElements; + if (datatype == CDF_CHAR || datatype == CDF_UCHAR) ++ilen; + buffer = (void *) malloc (ilen); + if (buffer == NULL) DynamicErrorHandle (id); + + status = CDFgetAttrgEntry (id, attrNum, (long) i, buffer); + if (status != CDF_OK) StatusHandler (status); + ((char *) buffer)[numElements] = '\0'; + printf (" entry #%d: %s\n", i, buffer); + free (buffer); + } +} + +/****************************************************************************** +* Read the value of the zVariable attribute named UNITS and FIELDNAM that +* are associated with the Time variable +******************************************************************************/ +TimeVarNum = CDFgetVarNum (id, "Time"); +if (TimeVarNum < CDF_OK) StatusHandler (TimeVarNum); + +attrNum = CDFgetAttrNum (id, "FIELDNAM"); +if (attrNum < CDF_OK) StatusHandler (attrNum); + +status = CDFinquireAttrzEntry (id, attrNum, TimeVarNum, + &datatype, &numElements); +if (status != CDF_OK) StatusHandler (status); + +if (datatype == CDF_CHAR) { + buffer = (char *) malloc (sizeof(char) * numElements + 1); + if (buffer == NULL) DynamicErrorHandle (id); + status = CDFgetAttrzEntry (id, attrNum, TimeVarNum, buffer); + ((char *) buffer)[numElements] = '\0'; + printf ("\nTime:\n FIELDNAME = %s\n", buffer); + free (buffer); +} + +attrNum = CDFgetAttrNum (id, "UNITS"); +if (attrNum < CDF_OK) StatusHandler (attrNum); + +status = CDFinquireAttrzEntry (id, attrNum, TimeVarNum, + &datatype, &numElements); +if (status != CDF_OK) StatusHandler (status); + +status = CDFgetDataTypeSize (datatype, &ilen); +ilen = ilen * numElements; +if (datatype == CDF_CHAR || datatype == CDF_UCHAR) ++ilen; +units = (void *) malloc (ilen); +if (buffer == NULL) DynamicErrorHandle (id); +status = CDFgetAttrzEntry (id, attrNum, TimeVarNum, units); +if (status != CDF_OK) StatusHandler (status); +((char *)units)[numElements] = '\0'; +printf (" UNITS = %s\n", units); +free (units); + +/****************************************************************************** +* Read data for 'Time' zVariable. +******************************************************************************/ +recNum = 0L; +status = CDFgetDataTypeSize (datatype, &ilen); +ilen = ilen * numElements; +if (datatype == CDF_CHAR || datatype == CDF_UCHAR) ++ilen; +time = (void *) malloc (ilen); +if (time == NULL) DynamicErrorHandle (id); +status = CDFgetzVarRecordData (id, TimeVarNum, recNum, time); +if (status != CDF_OK) StatusHandler (status); + +printf ("Time:\n Record #1: %d\n", *(int *) time); +recNum = 1L; +status = CDFgetzVarRecordData (id, TimeVarNum, recNum, time); +if (status != CDF_OK) StatusHandler (status); +printf (" Record #2: %d\n", *(int *)time); +free (time); + +/****************************************************************************** +* Delete the second record from 'Time' zVariable. Record number starts at 0. +******************************************************************************/ +status = CDFdeletezVarRecords (id, TimeVarNum, + 1L, /* start record number */ + 1L); /* end record number */ +if (status != CDF_OK) StatusHandler (status); + +/****************************************************************************** +* Read data for 'Latitude' zVariable. +******************************************************************************/ +dimIndices[0] = 0; +dimIndices[1] = 0; +recNum = 0; + +LatVarNum = CDFgetVarNum(id,"Latitude"); +if (LatVarNum < CDF_OK) StatusHandler (LatVarNum); + +status = CDFsetzVarSeqPos (id, LatVarNum, recNum, dimIndices); +if (status != CDF_OK) StatusHandler (status); + +printf ("\nLatitude:\n Record #1:\n"); + +/* Read one value at a time - inefficient way of reading data if the whole */ +/* array needs to be read. */ +status = CDFgetDataTypeSize (datatype, &ilen); +ilen = ilen * numElements; +if (datatype == CDF_CHAR || datatype == CDF_UCHAR) ++ilen; +lat = (void *) malloc (ilen); +if (lat == NULL) DynamicErrorHandle (id); +for (i=0; i < 181; i++) { + status = CDFgetzVarSeqData (id, LatVarNum, lat); + if (status != CDF_OK) StatusHandler (status); + printf ("%d ", *(short *)lat); +} +printf ("\n"); +free (lat); + +/****************************************************************************** +* Read data for 'Image' zVariable (10 x 20 array). +******************************************************************************/ +dimIndices[0] = 0; +dimIndices[1] = 0; +dimInterval[0] = 1; +dimInterval[1] = 1; + +ImageVarNum = CDFgetVarNum (id, "Image"); +if (ImageVarNum < CDF_OK) StatusHandler (ImageVarNum); + +status = CDFinquirezVar (id, ImageVarNum, varName, &datatype, + &numElements, &numDims, dimSizes, &recVary, dimVarys); +if (status != CDF_OK) StatusHandler (status); + +status = CDFgetzVarNumRecsWritten (id, ImageVarNum, &numRecs); +if (status != CDF_OK) StatusHandler (status); + +status = CDFgetDataTypeSize (datatype, &ilen); +ilen = ilen * numElements; +if (buffer == NULL) DynamicErrorHandle (id); + +arraySize = 1; +for (i=0; i < numDims; i++) { + arraySize *= dimSizes[i]; + dimCounts[i] = dimSizes[i]; +} +image = (void *) malloc (ilen * arraySize * numRecs); + +/* read 3 records in one scoop */ +status = CDFhyperGetzVarData (id, ImageVarNum, + 0L, /* record start */ + 3L, /* # of records to read */ + 1L, /* record interval */ + dimIndices, /* dimension dimIndices */ + dimCounts, /* dimension counts */ + dimInterval, /* dimension interval */ + image); +if (status != CDF_OK) StatusHandler (status); +printf ("\nImage: \n"); +for (i=0; i < numRecs; i++) { + printf ("Record # %d:\n", i); + for (j=0; j < arraySize; j++) + printf ("%d ", *(((int *)image)+i*arraySize+j)); + printf ("\n\n"); +} +free (image); + +/* Read a single value - image[1,1] of the second record */ +recNum = 1; /* record number starts at 0 */ +dimIndices[0] = 1; +dimIndices[1] = 1; + +pixelValue = (void *) malloc (ilen); +if (pixelValue == NULL) DynamicErrorHandle (id); +status = CDFgetzVarData (id, ImageVarNum, recNum, dimIndices, pixelValue); +if (status != CDF_OK) StatusHandler (status); +printf ("Image record #2:[1,1] = %d\n", *(int *)pixelValue); +free (pixelValue); + +/****************************************************************************** +* Close CDF. +******************************************************************************/ +status = CDFcloseCDF (id); +if (status != CDF_OK) StatusHandler (status); + +return 0; +} + +/****************************************************************************** +* Status handler. +******************************************************************************/ +void StatusHandler (status) +CDFstatus status; +{ +char message[CDF_STATUSTEXT_LEN+1]; + +if (status < CDF_WARN) { + printf ("An error has occurred, halting...\n"); + CDFgetStatusText (status, message); + printf ("%s\n", message); + exit (1); +} +else + if (status < CDF_OK) { + printf ("Warning, function may not have completed as expected...\n"); + CDFgetStatusText (status, message); + printf ("%s\n", message); + } + else + if (status > CDF_OK) { + printf ("Function completed successfully, but be advised that...\n"); + CDFgetStatusText (status, message); + printf ("%s\n", message); + } +return; +} + +/****************************************************************************** +* Dynamic allocation error handler. +******************************************************************************/ +void DynamicErrorHandle (id) +CDFid id; +{ + CDFstatus status; + printf ("An error has occurred while doing malloc, halting...\n"); + status = CDFcloseCDF (id); + if (status != CDF_OK) StatusHandler (status); + return; +} diff --git a/ext/cdf/cdf38_0-dist/samples/zfia10x.cdf b/ext/cdf/cdf38_0-dist/samples/zfia10x.cdf new file mode 100644 index 0000000..44a8088 Binary files /dev/null and b/ext/cdf/cdf38_0-dist/samples/zfia10x.cdf differ diff --git a/ext/cdf/cdf38_0-dist/src/definitions/definitions.B b/ext/cdf/cdf38_0-dist/src/definitions/definitions.B new file mode 100644 index 0000000..3336736 --- /dev/null +++ b/ext/cdf/cdf38_0-dist/src/definitions/definitions.B @@ -0,0 +1,66 @@ +#------------------------------------------------------------------------------ +# +# 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. +# V1.3 05-Aug-08, M Liu CDF V3.3. +# V1.4 12-Apr-11, M Liu CDF V3.3.2 for adding leap seconds env. var. +# +#----------------------------------------------------------------------------- +# 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 environment 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= + +export CDF_INC=$CDF_BASE/include +export CDF_LIB=$CDF_BASE/lib +export CDF_BIN=$CDF_BASE/bin +export CDF_JAVA=$CDF_BASE/cdfjava +export CDF_HELP=$CDF_BASE/lib/cdf/help +export CDF_LEAPSECONDSTABLE=$CDF_BASE/CDFLeapSeconds.txt + +alias cdfedit=$CDF_BIN/cdfedit +alias cdfexport=$CDF_BIN/cdfexport +alias cdfconvert=$CDF_BIN/cdfconvert +alias cdfinquire=$CDF_BIN/cdfinquire +alias cdfstats=$CDF_BIN/cdfstats +alias cdfdump=$CDF_BIN/cdfdump +alias cdfirsdump=$CDF_BIN/cdfirsdump +alias cdfcompare=$CDF_BIN/cdfcompare +alias skeletontable=$CDF_BIN/skeletontable +alias skeletoncdf=$CDF_BIN/skeletoncdf +alias cdfdir=$CDF_BIN/cdfdir +alias cdfirsdump=$CDF_BIN/cdfirsdump +alias cdfmerge=$CDF_BIN/cdfmerge +alias cdfbrowse="$CDF_BIN/cdfedit -prompt -browse" +alias cdfvalidate=$CDF_BIN/cdfvalidate +alias cdfleapsecondsinfo=$CDF_BIN/cdfleapsecondsinfo +# The following statements are relevant only for Mac OS X +if [ "$OSTYPE" = "darwin" ]; then + alias cdf-to-netCDF=$CDF_BIN/cdf-to-netCDF + alias netCDF-to-cdf=$CDF_BIN/netCDF-to-cdf +fi diff --git a/ext/cdf/cdf38_0-dist/src/definitions/definitions.C b/ext/cdf/cdf38_0-dist/src/definitions/definitions.C new file mode 100644 index 0000000..d91d95a --- /dev/null +++ b/ext/cdf/cdf38_0-dist/src/definitions/definitions.C @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------ +# +# NSSDC/CDF Definitions for using CDF. +# C-shell and `tcsh'. +# +# 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. +# V1.3 05-Aug-08, M Liu CDF V3.3. +# V1.4 12-Apr-11, M Liu CDF V3.3.2 for adding leap seconds env. var. +# +#----------------------------------------------------------------------------- +# 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... +# +# $ source /bin/definitions.C +# +# ...to setup the necessary environment variables and aliases (where +# is the full directory path leading to where CDF was installed). Note that +# `/bin' could also be added to a user's path. +#----------------------------------------------------------------------------- + +setenv CDF_BASE + +setenv CDF_INC $CDF_BASE/include +setenv CDF_LIB $CDF_BASE/lib +setenv CDF_BIN $CDF_BASE/bin +setenv CDF_JAVA $CDF_BASE/cdfjava +setenv CDF_HELP $CDF_BASE/lib/cdf/help +setenv CDF_LEAPSECONDSTABLE $CDF_BASE/CDFLeapSeconds.txt + +alias cdfedit $CDF_BIN/cdfedit +alias cdfexport $CDF_BIN/cdfexport +alias cdfconvert $CDF_BIN/cdfconvert +alias cdfinquire $CDF_BIN/cdfinquire +alias cdfstats $CDF_BIN/cdfstats +alias cdfdump $CDF_BIN/cdfdump +alias cdfirsdump $CDF_BIN/cdfirsdump +alias cdfcompare $CDF_BIN/cdfcompare +alias skeletontable $CDF_BIN/skeletontable +alias skeletoncdf $CDF_BIN/skeletoncdf +alias cdfdir $CDF_BIN/cdfdir +alias cdfmerge $CDF_BIN/cdfmerge +alias cdfbrowse "$CDF_BIN/cdfedit -prompt -browse" +alias cdfvalidate $CDF_BIN/cdfvalidate +alias cdfleapsecondsinfo $CDF_BIN/cdfleapsecondsinfo +# The following statements are relevant only for Mac OS X +if ( "$OSTYPE" == "darwin" ) then + alias cdf-to-netCDF $CDF_BIN/cdf-to-netCDF + alias netCDF-to-cdf $CDF_BIN/netCDF-to-cdf +endif + diff --git a/ext/cdf/cdf38_0-dist/src/definitions/definitions.K b/ext/cdf/cdf38_0-dist/src/definitions/definitions.K new file mode 100644 index 0000000..1445a2e --- /dev/null +++ b/ext/cdf/cdf38_0-dist/src/definitions/definitions.K @@ -0,0 +1,56 @@ +#------------------------------------------------------------------------------ +# +# NSSDC/CDF Definitions for using CDF. +# Korn, Bash, and posixSHELL. +# +# 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. +# V1.3 05-Aug-08, M Liu CDF V3.3. +# V1.4 12-Apr-11, M Liu CDF V3.3.2 for adding leap seconds env. var. +# +#----------------------------------------------------------------------------- +# 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.K +# +# ...to setup the necessary environment variables and aliases (where +# is the full directory path leading to where CDF was installed). Note that +# `/bin' could also be added to a user's path. +#----------------------------------------------------------------------------- + +export CDF_BASE= + +export CDF_INC=$CDF_BASE/include +export CDF_LIB=$CDF_BASE/lib +export CDF_BIN=$CDF_BASE/bin +export CDF_JAVA=$CDF_BASE/cdfjava +export CDF_HELP=$CDF_BASE/lib/cdf/help +export CDF_LEAPSECONDSTABLE=$CDF_BASE/CDFLeapSeconds.txt + +alias cdfedit=$CDF_BIN/cdfedit +alias cdfexport=$CDF_BIN/cdfexport +alias cdfconvert=$CDF_BIN/cdfconvert +alias cdfinquire=$CDF_BIN/cdfinquire +alias cdfstats=$CDF_BIN/cdfstats +alias cdfdump=$CDF_BIN/cdfdump +alias cdfirsdump=$CDF_BIN/cdfirsdump +alias cdfcompare=$CDF_BIN/cdfcompare +alias skeletontable=$CDF_BIN/skeletontable +alias skeletoncdf=$CDF_BIN/skeletoncdf +alias cdfdir=$CDF_BIN/cdfdir +alias cdfmerge=$CDF_BIN/cdfmerge +alias cdfbrowse="$CDF_BIN/cdfedit -prompt -browse" +alias cdfvalidate=$CDF_BIN/cdfvalidate +alias cdfleapsecondsinfo=$CDF_BIN/cdfleapsecondsinfo +# The following statements are relevant only for Mac OS X +if [ "$OSTYPE" = "darwin" ]; then + alias cdf-to-netCDF=$CDF_BIN/cdf-to-netCDF + alias netCDF-to-cdf=$CDF_BIN/netCDF-to-cdf +fi diff --git a/ext/cdf/cdf38_0-dist/src/help/cdf2skt.olh b/ext/cdf/cdf38_0-dist/src/help/cdf2skt.olh new file mode 100644 index 0000000..423795d --- /dev/null +++ b/ext/cdf/cdf38_0-dist/src/help/cdf2skt.olh @@ -0,0 +1,416 @@ +#****************************************************************************** +# Copyright 1996-2014 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +#****************************************************************************** +#------------------------------------------------------------------------------ +# +# NSSDC/CDF SkeletonTable online help. +# +# Version 1.1c, 21-Nov-97, Hughes STX. +# +# Modification history: +# +# V1.0 ?, J Love Original version. +# V1.1 23-Sep-96, J Love CDF V2.6. +# V1.1a 7-Jan-97, J Love Fixed cache qualifier. +# V1.1b 21-Feb-97, J Love Removed RICE. +# V1.1c 21-Nov-97, J Love Windows NT/95. +# +#------------------------------------------------------------------------------ +#ifos mac win +SkeletonTable is used to create a skeleton table file from a CDF. The +parameters/qualifiers dialog box displayed when SkeletonTable is 'executed' +contains the following controls. + +Edit fields for... + + CDF: The pathname of the CDF from which a skeleton table + will be created. At the end of this field a button + labeled "Select" is present. When selected, a + standard input file dialog is displayed from which + the CDF may be selected. + + Skeleton: The pathname of the skeleton table to be created. At + the end of this field a button labeled "Select" is + present. When selected, a standard output file dialog + is displayed in which the skeleton table pathname may + be specified. Don't specify an extension - '.skt' is + appended automatically. If this field is left blank, + the skeleton table name defaults to the name of the CDF + (with '.skt' appended) and is placed in the folder + containing the SkeletonTable executable. The "Output + to screen" check box also affects the destination of + the skeleton table. + + Cache sizes: The number of buffers to be used for the CDF's dotCDF + file, staging file, and compression scratch file. + This field, used only in the CDF access process during + the run, will not change the contents of the skeleton + table. Large number(s) will likely reduce physical I/Os + if variable data are involved. If this field is left + blank, default cache sizes chosen by the CDF library + are used. The cache sizes are specified with a + comma-separated list of pairs where + is the number of cache buffers and is + the type of file. The file 's are as follows: + 'd' for the dotCDF file, 's' for the staging file, and + 'c' for the compression scratch file. For example, + '200d,100s' specifies 200 cache buffers for the dotCDF + file and 100 cache buffers for the staging file. The + dotCDF file cache size can also be specified without + the 'd' for 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. + + Variables: If the values for selected variables are to be + displayed, this field should contain a comma-separated + list of delimited variable names. See the 'Selected + variables' radio button. + +Check boxes for... + + Output to screen: Whether or not the skeleton table is displayed on the + screen in the 'SkeletonTable: standard output' window. + If not checked, the skeleton table is written to a + file. + + Use FORMAT: Whether or not the FORMAT attribute is used when + writing variable values (if the FORMAT attribute + exists and an entry exists for the variable). + + -0.0 to 0.0: Whether or not -0.0 is converted to 0.0 by the CDF + library when read from a CDF. + + Page output: If the skeleton table is being displayed on the screen, + whether or not the output is displayed one page (screen) + at a time. + + Report info's: Whether or not informational status codes from the CDF + library should be reported. + + Report warnings: Whether or not warning status codes from the CDF + library should be reported. + + Report errors: Whether or not error status codes from the CDF library + should be reported. + + Log progress: Whether or not progress messages are displayed. + + Display statistics: Whether or not caching statistics are displayed at the + end of each CDF. + +Radio buttons for... + + zMode: The zMode to be used for the CDF. + 0...zMode is disabled. + 1...zMode/1 should be used. The dimension + variances of the rVariables will be preserved. + 2...zMode/2 should be used. The dimensions of + rVariables having a variance of NOVARY (false) + are hidden. + + No values: Place no variable values in the skeleton table. + NRV values: Place only NRV variable values in the skeleton table. + RV values: Place only RV variable values in the skeleton table. + All values: Place all variable values in the skeleton table. + Selected values: Place the values of the variables named in the + 'Variables' edit field in the skeleton table. + +Buttons for... + + Enter Causes SkeletonTable to create a skeleton table based + on the parameters/qualifiers specified. + + Help Causes this online help to be displayed. + +#ifos mac + Quit Causes SkeletonTable to terminate. (A skeleton table + is not created.) 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 skeleton table is not created.) +#ifos mac + This button is only present after the first time the + parameters/qualifiers dialog box is displayed. +#endos +#else +#ifos vms +Usage: $ SKELETONTABLE [/SKELETON=] [/[NO]NEG2POSFP0] + [/NONRV | /NRVTABLE | /VALUES=] + [/CACHE=()] [/[NO]FORMAT] [/[NO]SCREEN] + [/[NO]LOG] [/[NO]PAGE] [/[NO]STATISTICS] + [/REPORT=()] [/ZMODE=] [/ABOUT] + [/ISO8601 | /ZISO8601] [/ADVFORMAT=