User request to have all orphaned DAP2 attributes kept as netcdf
global attributes. This is primarily a change in the oc code
nplus testcase dataset changes.

Result may be inconsistent with netcdf-Java output.
This commit is contained in:
dmh 2015-11-29 20:38:12 -07:00
parent 5d1207b335
commit cbb6df3232
33 changed files with 1323 additions and 902 deletions

View File

@ -504,9 +504,9 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
CHECK_LIBRARY_EXISTS(hdf5 H5Pget_fapl_mpiposix "" HDF5_IS_PARALLEL_MPIPOSIX)
CHECK_LIBRARY_EXISTS(hdf5 H5Pget_fapl_mpio "" HDF5_IS_PARALLEL_MPIO)
IF(HDF5_IS_PARALLEL_MPIPOSIX OR HDF5_IS_PARALLEL_MPIO)
SET(HDF5_IS_PARALLEL ON)
SET(HDF5_PARALLEL ON)
ELSE()
SET(HDF5_IS_PARALLEL OFF)
SET(HDF5_PARALLEL OFF)
ENDIF()
IF(HDF5_IS_PARALLEL_MPIO)
@ -530,7 +530,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
# Assert HDF5 version.
SET(HDF5_VERSION_REQUIRED 1.8.10)
IF(HDF5_IS_PARALLEL)
IF(HDF5_PARALLEL)
SET(HDF5_CC h5pcc)
ELSE()
SET(HDF5_CC h5cc)
@ -841,18 +841,20 @@ ENDIF()
# Enable Parallel (different than pnetcdf).
SET(STATUS_PARALLEL "OFF")
OPTION(ENABLE_PARALLEL4 "Build netCDF-4 with parallel IO" "${HDF5_IS_PARALLEL}")
OPTION(ENABLE_PARALLEL4 "Build netCDF-4 with parallel IO" "${HDF5_PARALLEL}")
IF(ENABLE_PARALLEL4 AND ENABLE_NETCDF_4)
IF(NOT HDF5_IS_PARALLEL)
IF(NOT HDF5_PARALLEL)
SET(USE_PARALLEL OFF CACHE BOOL "")
MESSAGE(STATUS "Cannot find HDF5 library built with parallel support. Disabling parallel build.")
ELSE()
SET(HDF5_PARALLEL ON CACHE BOOL "")
SET(USE_PARALLEL ON CACHE BOOL "")
SET(USE_PARALLEL4 ON CACHE BOOL "")
SET(STATUS_PARALLEL "ON")
ENDIF()
ENDIF()
# Options to enable parallel IO, tests.
SET(STATUS_PNETCDF "OFF")
OPTION(ENABLE_PNETCDF "Build with parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)

View File

@ -1,16 +1,25 @@
rm -fr build
mkdir build
cd build
UL=/usr/local
PPATH="$UL"
ZLIB="-DZLIB_LIBRARY=${UL}/lib/libz.so -DZLIB_INCLUDE_DIR=${UL}/include"
HDF5="-DHDF5_LIB=${UL}/lib/libhdf5.so -DHDF5_HL_LIB=${UL}/lib/libhdf5_hl.so -DHDF5_INCLUDE_DIR=${UL}/include"
CURL="-DCURL_LIBRARY=${UL}/lib/libcurl.so -DCURL_INCLUDE_DIR=${UL}/include -DCURL_INCLUDE_DIRS=${UL}/include"
FLAGS="-DCMAKE_PREFIX_PATH=$PPATH"
FLAGS="$FLAGS -DCMAKE_INSTALL_PREFIX=${UL}"
FLAGS="$FLAGS -DCMAKE_PREFIX_PATH=$PPATH"
export CC=mpicc
for p in /usr/local/lib /usr/lib ; do
if test -z "$ZP" -a -f $p/libz.so ; then ZP=$p; fi
if test -z "$HP" -a -f $p/libhdf5.so ; then HP=$p; fi
if test -z "$CP" -a -f $p/libcurl.so ; then CP=$p; fi
done
ZLIB="-DZLIB_LIBRARY=${ZP}/libz.so -DZLIB_INCLUDE_DIR=${ZP}/include -DZLIB_INCLUDE_DIRS=${ZP}/include"
HDF5="-DHDF5_LIB=${HP}/libhdf5.so -DHDF5_HL_LIB=${HP}/libhdf5_hl.so -DHDF5_INCLUDE_DIR=${HP}/include"
CURL="-DCURL_LIBRARY=${CP}/libcurl.so -DCURL_INCLUDE_DIR=${CP}/include -DCURL_INCLUDE_DIRS=${CP}/include"
FLAGS="$FLAGS -DCMAKE_INSTALL_PREFIX=/usr/local"
#FLAGS="-DCMAKE_PREFIX_PATH=$PPATH"
#FLAGS="$FLAGS -DCMAKE_PREFIX_PATH=$PPATH"
FLAGS="$FLAGS -DENABLE_DAP_REMOTE_TESTS=true"
FLAGS="$FLAGS -DENABLE_DAP_AUTH_TESTS=true"
cmake $FLAGS ${ZLIB} ${HDF5} ${CURL} ..
#cmake --build .
#cmake --build . --target test
cmake --build .
cmake --build . --target test

View File

@ -89,6 +89,7 @@ are set when opening a binary file on Windows. */
#cmakedefine USE_PARALLEL_POSIX 1
#cmakedefine USE_PARALLEL_MPIO 1
#cmakedefine HDF5_HAS_H5FREE 1
#cmakedefine HDF5_PARALLEL 1
#cmakedefine USE_PARALLEL 1
#cmakedefine USE_PARALLEL4 1
#cmakedefine USE_PNETCDF 1

View File

@ -19,6 +19,12 @@ variables:
double types.f64(types) ;
char types.s(types, maxStrlen64) ;
char types.u(types, maxStrlen64) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
person.name =

View File

@ -10,6 +10,12 @@ variables:
int exp.i ;
short exp.g(exp.g_0, exp.g_1, exp.g_2) ;
short exp.f(exp.f_0, exp.f_1) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
exp.j = 1 ;

View File

@ -20,6 +20,12 @@ types:
variables:
person_t person ;
types_t types ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
person =

View File

@ -8,6 +8,12 @@ types:
}; // exp_t
variables:
exp_t exp ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
exp =

View File

@ -1,6 +1,16 @@
netcdf test {
variables:
double f64 ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:
f64 = 1000 ;

View File

@ -15,6 +15,12 @@ variables:
double f64 ;
char s(maxStrlen64) ;
char u(maxStrlen64) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
b = 0 ;

View File

@ -3,6 +3,16 @@ dimensions:
person = 5 ;
variables:
int person.age(person) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:
person.age = 1, 2, 3, 5, 8 ;

View File

@ -5,6 +5,16 @@ dimensions:
variables:
char person.name(person, maxStrlen64) ;
int person.age(person) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:
person.name =

View File

@ -3,6 +3,16 @@ dimensions:
types = 5 ;
variables:
float types.f32(types) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:
types.f32 = 0, 0.9999833, 1.999867, 2.99955, 3.998933 ;

View File

@ -19,6 +19,12 @@ variables:
double types.f64(types) ;
char types.s(types, maxStrlen64) ;
char types.u(types, maxStrlen64) ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
person.name =

View File

@ -1,6 +1,16 @@
netcdf test {
variables:
double f64 ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:
f64 = 1000 ;

View File

@ -13,6 +13,12 @@ variables:
double f64 ;
string s ;
string u ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
b = 0 ;

View File

@ -3,6 +3,16 @@ types:
int(*) person_t ;
variables:
person_t person ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:
person = {1, 2, 3, 5, 8} ;

View File

@ -20,6 +20,12 @@ types:
variables:
person_t person ;
types_t types ;
// global attributes:
:Facility.PrincipleInvestigator = "Mark Abbott\n",
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
data:
person =

View File

@ -124,8 +124,8 @@ int main()
/* Assume that TESTS_ENVIRONMENT was set */
topsrcdir = getenv("TOPSRCDIR");
if(topsrcdir == NULL) {
fprintf(stderr,"*** FAIL: $abs_top_srcdir not defined: location= %s:%d\n",__FILE__,__LINE__);
exit(1);
fprintf(stderr,"$abs_top_srcdir not defined: using '../'");
topsrcdir = "..";
}
len = strlen("file://") + strlen(topsrcdir) + strlen("/ncdap_test/testdata3/test.02") + 1;
#ifdef DEBUG

View File

@ -1,2 +1,24 @@
Attributes {}
Attributes {
S1 {
v3 {
Int32 a1 32;
}
}
GLOBAL {
Int32 globalattr 177;
}
CoreMetadata {
OrbitNumber {
Int32 Value 375;
String Data_Location "PGE";
String Mandatory "FALSE";
}
RangeBeginningDate {
String Value "1997/12/21";
String Data_Location "PGE";
String Mandatory "FALSE";
}
}
}

View File

@ -30,12 +30,5 @@ if [ ! -f c5.nc ]; then
exit 1
fi
echo "**** creating file to test ncf-345..."
./ncgen -b -o ncf345.nc $srcdir/ncf345.cdl
if [ ! -f ncf345.nc ]; then
echo "Failure."
exit 1
fi
echo "*** Test successful!"
exit 0

View File

@ -1,4 +1,4 @@
SET(oc_SOURCES oc.c daplex.c dapparse.c daptab.c occlientparams.c occompile.c occurlfunctions.c ocdata.c ocdebug.c ocdump.c ocinternal.c ocnode.c ochttp.c ocrc.c ocread.c ocutil.c ocbytes.c oclist.c ocuri.c oclog.c occurlflags.c xxdr.c)
SET(oc_SOURCES oc.c daplex.c dapparse.c dapy.c occlientparams.c occompile.c occurlfunctions.c ocdata.c ocdebug.c ocdump.c ocinternal.c ocnode.c ochttp.c ocrc.c ocread.c ocutil.c ocbytes.c oclist.c ocuri.c oclog.c occurlflags.c xxdr.c)
add_library(oc2 OBJECT ${oc_SOURCES})

View File

@ -6,7 +6,7 @@ THISDIR=../oc2
# Make consistent with Makefile.am
SRC=oc.c \
daplex.c dapparse.c daptab.c \
daplex.c dapparse.c dapy.c \
occlientparams.c occompile.c occurlfunctions.c \
ocdata.c ocdebug.c ocdump.c \
ocinternal.c ocnode.c \
@ -17,7 +17,7 @@ occurlflags.c \
xxdr.c
HDRS=oc.h ocx.h \
dapparselex.h daptab.h \
dapparselex.h dapy.h \
occlientparams.h occompile.h occonstraints.h occurlfunctions.h \
ocdata.h ocdatatypes.h ocdebug.h ocdump.h \
ocinternal.h ocnode.h \
@ -47,7 +47,7 @@ makeoc::
# This should match the bison command in Makefile.am
rm -f dap.tab.c dap.tab.h
bison --debug -d -p dap dap.y
mv dap.tab.c daptab.c; mv dap.tab.h daptab.h
mv dap.tab.c dapy.c; mv dap.tab.h dapy.h
changed:
${MAKE} -f Make0 NAMEONLY=1 diffoc
@ -57,7 +57,7 @@ diffoc::
@for file in ${FILES} ; do \
f="${OCDIR}/$$file" ; \
x=`basename $$f|tr -d ' ' ` ; \
if test "x$${x}" = "xdaptab.c" -o "x$${x}" = "xdaptab.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test "x$${x}" = "xdapy.c" -o "x$${x}" = "xdapy.h" ; then echo "ignore: $${x}"; continue; fi ;\
if ! test -e ${THISDIR}/$$x ; then \
echo "Missing file: $$x"; \
fi ; \
@ -78,7 +78,7 @@ olddiff::
for file in ${FILES} ; do \
f="${OCDIR}/$$file" ; \
x=`basename $$f | tr -d ' ' ` ; \
if test "x$${x}" = "xdaptab.c" -o "x$${x}" = "xdaptab.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test "x$${x}" = "xdapy.c" -o "x$${x}" = "xdapy.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test -e ${THISDIR}/$$x -a -e ${OCDIR}/$$x ; then \
diff --brief -wBb ${THISDIR}/$$x $$f ; \
else \
@ -88,7 +88,7 @@ olddiff::
for file in ${FILES} ; do \
f="${OCDIR}/$$file" ; \
x=`basename $$f|tr -d ' ' ` ; \
if test "x$${x}" = "xdaptab.c" -o "x$${x}" = "xdaptab.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test "x$${x}" = "xdapy.c" -o "x$${x}" = "xdapy.h" ; then echo "ignore: $${x}"; continue; fi ;\
if test -e ${THISDIR}/$$x -a -e ${OCDIR}/$$x ; then \
if ! diff --brief -wBb ${THISDIR}/$$x $$f > /dev/null ; then \
echo diff -wBb ${THISDIR}/$$x $$f ;\

View File

@ -10,9 +10,9 @@
# Cause C preprocessor to search current and parent directory.
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/include
# OC Sources; include the daptab.[ch] to avoid the need for bison by user
# OC Sources; include the dapy.[ch] to avoid the need for bison by user
SRC=oc.c \
daplex.c dapparse.c daptab.c \
daplex.c dapparse.c dapy.c \
occlientparams.c occompile.c occurlfunctions.c \
ocdata.c ocdebug.c ocdump.c \
ocinternal.c ocnode.c \
@ -23,7 +23,7 @@ occurlflags.c \
xxdr.c
HDRS=oc.h ocx.h \
dapparselex.h daptab.h \
dapparselex.h dapy.h \
occlientparams.h occompile.h occonstraints.h occurlfunctions.h \
ocdata.h ocdatatypes.h ocdebug.h ocdump.h \
ocinternal.h ocnode.h \
@ -49,6 +49,6 @@ endif
bison:: dap.y
rm -f dap.tab.c dap.tab.h
bison --debug -d -p dap dap.y
mv dap.tab.c daptab.c; mv dap.tab.h daptab.h
mv dap.tab.c dapy.c; mv dap.tab.h dapy.h

View File

@ -2,7 +2,7 @@
<!- See the COPYRIGHT file for more information. -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="oc.css">
<!--css-->
</head>
<body>
@ -12,7 +12,7 @@
<h1>Address: http://www.unidata.ucar.edu/staff/dmh/</h1>
<h1>Draft: 11/21/2014</h1>
<h1>Last Revised: 10/24/2015</h1>
<OC><h1>ZZ Version 4.0</h1>
<OC><h1>ZZ Version VVVV</h1>
</div>
<h1 class="toc">Table of Contents</h1>

View File

@ -11,7 +11,7 @@
%{
#include "config.h"
#include "dapparselex.h"
#include "daptab.h"
#include "dapy.h"
int dapdebug = 0;
%}

View File

@ -6,7 +6,7 @@
#include <strings.h>
#endif
#include "dapparselex.h"
#include "daptab.h"
#include "dapy.h"
#undef URLCVT /* NEVER turn this on */

View File

@ -4,7 +4,7 @@
#include "config.h"
#include "dapparselex.h"
#include "daptab.h"
#include "dapy.h"
/* Forward */

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
/* A Bison parser, made by GNU Bison 3.0. */
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -26,62 +26,54 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_DAP_DAP_TAB_H_INCLUDED
# define YY_DAP_DAP_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#if YYDEBUG
extern int dapdebug;
#endif
/* Token type. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
SCAN_ALIAS = 258,
SCAN_ARRAY = 259,
SCAN_ATTR = 260,
SCAN_BYTE = 261,
SCAN_CODE = 262,
SCAN_DATASET = 263,
SCAN_DATA = 264,
SCAN_ERROR = 265,
SCAN_FLOAT32 = 266,
SCAN_FLOAT64 = 267,
SCAN_GRID = 268,
SCAN_INT16 = 269,
SCAN_INT32 = 270,
SCAN_MAPS = 271,
SCAN_MESSAGE = 272,
SCAN_SEQUENCE = 273,
SCAN_STRING = 274,
SCAN_STRUCTURE = 275,
SCAN_UINT16 = 276,
SCAN_UINT32 = 277,
SCAN_URL = 278,
SCAN_PTYPE = 279,
SCAN_PROG = 280,
WORD_WORD = 281,
WORD_STRING = 282
};
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
SCAN_ALIAS = 258,
SCAN_ARRAY = 259,
SCAN_ATTR = 260,
SCAN_BYTE = 261,
SCAN_CODE = 262,
SCAN_DATASET = 263,
SCAN_DATA = 264,
SCAN_ERROR = 265,
SCAN_FLOAT32 = 266,
SCAN_FLOAT64 = 267,
SCAN_GRID = 268,
SCAN_INT16 = 269,
SCAN_INT32 = 270,
SCAN_MAPS = 271,
SCAN_MESSAGE = 272,
SCAN_SEQUENCE = 273,
SCAN_STRING = 274,
SCAN_STRUCTURE = 275,
SCAN_UINT16 = 276,
SCAN_UINT32 = 277,
SCAN_URL = 278,
SCAN_PTYPE = 279,
SCAN_PROG = 280,
WORD_WORD = 281,
WORD_STRING = 282
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
int dapparse (DAPparsestate* parsestate);
#endif /* !YY_DAP_DAP_TAB_H_INCLUDED */

View File

@ -1,39 +0,0 @@
<style>
.break { page-break-before: always; }
body { counter-reset: H2; font-size: 12pt; }
h1.title {
font-size: 18pt;
text-decoration: underline;
}
div.subtitle {
}
.subtitle h1 {
font-size: 14pt;
margin-top: 0;
margin-bottom: 0;
}
h1.toc {
font-size: 16pt;
text-decoration: underline;
}
h1.appendix {
font-size: 14pt;
}
h2:before {
content: counter(H2) " ";
counter-increment: H2;
}
h2 { counter-reset: H3; text-decoration: underline; }
h3:before {
content: counter(H2) "." counter(H3) " ";
counter-increment:H3;
}
h3 { counter-reset: H4; }
h4:before {
content: counter(H2) "." counter(H3) "." counter(H4) " ";
counter-increment:H4;
}
</style>

View File

@ -537,7 +537,7 @@ extern OCerror oc_svcerrordata(OClink link, char** codep,
note that this may or may not be the same as returned
by oc_svcerrordata.
*/
extern OCerror oc_httpcode(OClink);
extern int oc_httpcode(OClink);
/*
(Re-)initialize the oc library as if nothing had been called.

View File

@ -373,5 +373,3 @@ done:
}
return OCTHROW(stat);
}

View File

@ -8,9 +8,10 @@
static const unsigned int MAX_UINT = 0xffffffff;
static int mergedas1(OCnode* dds, OCnode* das);
static int mergedods1(OCnode* dds, OCnode* das);
static char* pathtostring(OClist* path, char* separator, int usecdfname);
static OCerror mergedas1(OCnode* dds, OCnode* das);
static OCerror mergedods1(OCnode* dds, OCnode* das);
static OCerror mergeother1(OCnode* root, OCnode* das);
static char* pathtostring(OClist* path, char* separator);
static void computefullname(OCnode* node);
/* Process ocnodes to fix various semantic issues*/
@ -60,9 +61,11 @@ computefullname(OCnode* node)
OClist* path;
OCASSERT((node->name != NULL));
if(node->fullname != NULL)
return;
path = oclistnew();
occollectpathtonode(node,path);
tmp = pathtostring(path,PATHSEPARATOR,1);
tmp = pathtostring(path,PATHSEPARATOR);
if(tmp == NULL) {
fullname = nulldup(node->name);
} else {
@ -72,14 +75,16 @@ computefullname(OCnode* node)
oclistfree(path);
}
/* Convert path to a string; leave off the dataset name*/
/* Convert path to a string */
static char*
pathtostring(OClist* path, char* separator, int usecdfname)
pathtostring(OClist* path, char* separator)
{
int slen,i,len;
char* pathname;
if(path == NULL || (len = oclistlength(path))==0) return NULL;
for(slen=0,i=0;i<len;i++) {
if(path == NULL) return NULL;
len = oclistlength(path);
if(len == 0) return NULL;
for(i=0,slen=0;i<len;i++) {
OCnode* node = (OCnode*)oclistget(path,(size_t)i);
if(node->container == NULL || node->name == NULL) continue;
slen += strlen(node->name);
@ -140,12 +145,6 @@ makeattribute(char* name, OCtype ptype, OClist* values)
return att;
}
static void
marklostattribute(OCnode* att)
{
oclog(OCLOGNOTE,"Lost attribute: %s",att->name);
}
void
ocroot_free(OCnode* root)
{
@ -239,6 +238,7 @@ As described there, the algorithm is as follows.
Note: If a dataset contains two constructor types which have field names
that are the same (say point.x and pair.x) one should use fully qualified
names to get each of those variables.
*/
OCerror
@ -262,7 +262,7 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
/* 1. collect all the relevant DAS nodes;
namely those that contain at least one
attribute value.
attribute value, not including the leaf attributes.
Simultaneously look for potential ambiguities
if found; complain but continue: result are indeterminate.
also collect globals separately*/
@ -305,7 +305,7 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
attributes to the DDS node(s).
Match means:
1. DAS->fullname :: DDS->fullname
2. DAS->name :: DDS->fullname (support DAS names with embedded '.'
2. DAS->name :: DDS->fullname (support DAS names with embedded '.')
3. DAS->name :: DDS->name
*/
for(i=0;i<oclistlength(dasnodes);i++) {
@ -322,22 +322,25 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
}
}
/* 4. If there are attributes left, then complain about them being lost.*/
for(i=0;i<oclistlength(dasnodes);i++) {
OCnode* das = (OCnode*)oclistget(dasnodes,i);
if(das != NULL) marklostattribute(das);
}
/* 5. Assign globals*/
/* 4. Assign globals*/
for(i=0;i<oclistlength(dasglobals);i++) {
OCnode* das = (OCnode*)oclistget(dasglobals,i);
if(das == NULL) continue;
mergedas1(ddsroot,das);
}
/* 6. Assign DODS_*/
/* 5. Assign DODS_*/
for(i=0;i<oclistlength(dodsglobals);i++) {
OCnode* das = (OCnode*)oclistget(dodsglobals,i);
if(das == NULL) continue;
mergedods1(ddsroot,das);
}
/* 6. Assign other orphan attributes, which means
construct their full name and assign as a global attribute. */
for(i=0;i<oclistlength(dasnodes);i++) {
OCnode* das = (OCnode*)oclistget(dasnodes,i);
if(das == NULL) continue;
mergeother1(ddsroot, das);
}
done:
/* cleanup*/
@ -348,11 +351,11 @@ done:
return OCTHROW(stat);
}
static int
static OCerror
mergedas1(OCnode* dds, OCnode* das)
{
unsigned int i;
int stat = OC_NOERR;
OCerror stat = OC_NOERR;
if(das == NULL) return OC_NOERR; /* nothing to do */
if(dds->attributes == NULL) dds->attributes = oclistnew();
/* assign the simple attributes in the das set to this dds node*/
@ -368,11 +371,11 @@ mergedas1(OCnode* dds, OCnode* das)
return OCTHROW(stat);
}
static int
static OCerror
mergedods1(OCnode* dds, OCnode* dods)
{
unsigned int i;
int stat = OC_NOERR;
OCerror stat = OC_NOERR;
if(dods == NULL) return OC_NOERR; /* nothing to do */
OCASSERT(dods->octype == OC_Attributeset);
if(dds->attributes == NULL) dds->attributes = oclistnew();
@ -395,9 +398,7 @@ mergedods1(OCnode* dds, OCnode* dods)
strcpy(newname,dods->name);
strcat(newname,".");
strcat(newname,attnode->name);
att = makeattribute(newname,
attnode->etype,
attnode->att.values);
att = makeattribute(newname,attnode->etype,attnode->att.values);
free(newname);
oclistpush(dds->attributes,(void*)att);
}
@ -405,89 +406,34 @@ mergedods1(OCnode* dds, OCnode* dods)
return OCTHROW(stat);
}
#if 0
int
ocddsdasmerge(OCstate* state, OCnode* ddsroot, OCnode* dasroot)
static OCerror
mergeother1(OCnode* root, OCnode* das)
{
int i,j;
int stat = OC_NOERR;
OClist* globals = oclistnew();
if(dasroot == NULL) return OCTHROW(stat);
/* Start by looking for global attributes*/
for(i=0;i<oclistlength(dasroot->subnodes);i++) {
OCnode* node = (OCnode*)oclistget(dasroot->subnodes,i);
if(node->att.isglobal) {
for(j=0;j<oclistlength(node->subnodes);j++) {
OCnode* attnode = (OCnode*)oclistget(node->subnodes,j);
Attribute* att = makeattribute(attnode->name,
attnode->etype,
attnode->att.values);
oclistpush(globals,(void*)att);
}
}
}
ddsroot->attributes = globals;
/* Now try to match subnode names with attribute set names*/
for(i=0;i<oclistlength(dasroot->subnodes);i++) {
OCnode* das = (OCnode*)oclistget(dasroot->subnodes,i);
int match = 0;
if(das->att.isglobal) continue;
if(das->octype == OC_Attributeset) {
for(j=0;j<oclistlength(ddsroot->subnodes) && !match;j++) {
OCnode* dds = (OCnode*)oclistget(ddsroot->subnodes,j);
if(strcmp(das->name,dds->name) == 0) {
match = 1;
stat = mergedas1(dds,das);
if(stat != OC_NOERR) break;
}
}
}
if(!match) {marklostattribute(das);}
}
if(stat == OC_NOERR) ddsroot->attributed = 1;
OCerror stat = OC_NOERR;
OCattribute* att = NULL;
OCASSERT(root != NULL);
if(root->attributes == NULL) root->attributes = oclistnew();
if(das->octype == OC_Attribute) {
/* compute the full name of this attribute */
computefullname(das);
/* create attribute */
att = makeattribute(das->fullname,das->etype,das->att.values);
oclistpush(root->attributes,(void*)att);
} else if(das->octype == OC_Attributeset) {
int i;
/* Recurse */
for(i=0;i<oclistlength(das->subnodes);i++) {
OCnode* sub = (OCnode*)oclistget(das->subnodes,i);
if(sub == NULL) continue;
mergeother1(root,sub);
}
} else
stat = OC_EDAS;
return OCTHROW(stat);
}
/* Merge das attributes into the dds node*/
static int
mergedas1(OCnode* dds, OCnode* das)
{
int i,j;
int stat = OC_NOERR;
if(dds->attributes == NULL) dds->attributes = oclistnew();
/* assign the simple attributes in the das set to this dds node*/
for(i=0;i<oclistlength(das->subnodes);i++) {
OCnode* attnode = (OCnode*)oclistget(das->subnodes,i);
if(attnode->octype == OC_Attribute) {
Attribute* att = makeattribute(attnode->name,
attnode->etype,
attnode->att.values);
oclistpush(dds->attributes,(void*)att);
}
}
/* Try to merge any enclosed sets with subnodes of dds*/
for(i=0;i<oclistlength(das->subnodes);i++) {
OCnode* dasnode = (OCnode*)oclistget(das->subnodes,i);
int match = 0;
if(dasnode->octype == OC_Attribute) continue; /* already dealt with above*/
for(j=0;j<oclistlength(dds->subnodes) && !match;j++) {
OCnode* ddsnode = (OCnode*)oclistget(dds->subnodes,j);
if(strcmp(dasnode->name,ddsnode->name) == 0) {
match = 1;
stat = mergedas1(ddsnode,dasnode);
if(stat != OC_NOERR) break;
}
}
if(!match) {marklostattribute(dasnode);}
}
return OCTHROW(stat);
}
#endif
static void
ocuncorrelate(OCnode* root)
{
@ -612,6 +558,85 @@ ocmarkcacheable(OCstate* state, OCnode* ddsroot)
}
#if 0
OCerror
ocddsdasmerge(OCstate* state, OCnode* ddsroot, OCnode* dasroot)
{
int i,j;
OCerror stat = OC_NOERR;
OClist* globals = oclistnew();
if(dasroot == NULL) return OCTHROW(stat);
/* Start by looking for global attributes*/
for(i=0;i<oclistlength(dasroot->subnodes);i++) {
OCnode* node = (OCnode*)oclistget(dasroot->subnodes,i);
if(node->att.isglobal) {
for(j=0;j<oclistlength(node->subnodes);j++) {
OCnode* attnode = (OCnode*)oclistget(node->subnodes,j);
Attribute* att = makeattribute(attnode->name,
attnode->etype,
attnode->att.values);
oclistpush(globals,(void*)att);
}
}
}
ddsroot->attributes = globals;
/* Now try to match subnode names with attribute set names*/
for(i=0;i<oclistlength(dasroot->subnodes);i++) {
OCnode* das = (OCnode*)oclistget(dasroot->subnodes,i);
int match = 0;
if(das->att.isglobal) continue;
if(das->octype == OC_Attributeset) {
for(j=0;j<oclistlength(ddsroot->subnodes) && !match;j++) {
OCnode* dds = (OCnode*)oclistget(ddsroot->subnodes,j);
if(strcmp(das->name,dds->name) == 0) {
match = 1;
stat = mergedas1(dds,das);
if(stat != OC_NOERR) break;
}
}
}
if(!match) {marklostattribute(das);}
}
if(stat == OC_NOERR) ddsroot->attributed = 1;
return OCTHROW(stat);
}
/* Merge das attributes into the dds node*/
static int
mergedas1(OCnode* dds, OCnode* das)
{
int i,j;
int stat = OC_NOERR;
if(dds->attributes == NULL) dds->attributes = oclistnew();
/* assign the simple attributes in the das set to this dds node*/
for(i=0;i<oclistlength(das->subnodes);i++) {
OCnode* attnode = (OCnode*)oclistget(das->subnodes,i);
if(attnode->octype == OC_Attribute) {
Attribute* att = makeattribute(attnode->name,
attnode->etype,
attnode->att.values);
oclistpush(dds->attributes,(void*)att);
}
}
/* Try to merge any enclosed sets with subnodes of dds*/
for(i=0;i<oclistlength(das->subnodes);i++) {
OCnode* dasnode = (OCnode*)oclistget(das->subnodes,i);
int match = 0;
if(dasnode->octype == OC_Attribute) continue; /* already dealt with above*/
for(j=0;j<oclistlength(dds->subnodes) && !match;j++) {
OCnode* ddsnode = (OCnode*)oclistget(dds->subnodes,j);
if(strcmp(dasnode->name,ddsnode->name) == 0) {
match = 1;
stat = mergedas1(ddsnode,dasnode);
if(stat != OC_NOERR) break;
}
}
if(!match) {marklostattribute(dasnode);}
}
return OCTHROW(stat);
}
void*
oclinearize(OCtype etype, unsigned int nstrings, char** strings)
{