diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c index d60eb674ad..e269345107 100644 --- a/libdap2/ncd2dispatch.c +++ b/libdap2/ncd2dispatch.c @@ -769,6 +769,8 @@ fprintf(stderr,"buildvars.candidate=|%s|\n",var->ncfullname); } } + + definename = getdefinename(var); #ifdef DEBUG1 diff --git a/oc2/ocnode.c b/oc2/ocnode.c index b840f9d39c..86913b5031 100644 --- a/oc2/ocnode.c +++ b/oc2/ocnode.c @@ -6,22 +6,14 @@ #include "occompile.h" #include "ocdebug.h" -/* If enabled, then DAS attributes that cannot - be connected to any variable will be shown as - global attributes. No obvious reason to enable - except possibly for debugging purposes. -*/ -#undef SHOWORPHAN - static const unsigned int MAX_UINT = 0xffffffff; static OCerror mergedas1(OCnode* dds, OCnode* das); static OCerror mergedods1(OCnode* dds, OCnode* das); static char* pathtostring(OClist* path, char* separator); static void computefullname(OCnode* node); -#ifdef SHOWORPHAN static OCerror mergeother1(OCnode* root, OCnode* das); -#endif +static OCerror mergeother(OCnode* ddsroot, OClist* dasnodes); /* Process ocnodes to fix various semantic issues*/ void @@ -344,15 +336,13 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot) mergedods1(ddsroot,das); } -#ifdef SHOWORPHAN /* 6. Assign other orphan attributes, which means - construct their full name and assign as a global attribute. */ - for(i=0;isubnodes);i++) { OCnode* attnode = (OCnode*)oclistget(das->subnodes,i); if(attnode->octype == OC_Attribute) { + if(dds->octype == OC_Atomic + || dds->octype == OC_Sequence + || dds->octype == OC_Structure + || dds->octype == OC_Grid) + attnode->att.var = dds; OCattribute* att = makeattribute(attnode->name, attnode->etype, attnode->att.values); @@ -418,7 +413,19 @@ mergedods1(OCnode* dds, OCnode* dods) return OCTHROW(stat); } -#ifdef SHOWORPHAN +static OCerror +mergeother(OCnode* ddsroot, OClist* dasnodes) +{ + OCerror stat = OC_NOERR; + int i; + for(i=0;iattributes == NULL) root->attributes = oclistnew(); + /* Only include if this is not connected to a variable */ + if(das->att.var != NULL) goto done; + if(das->octype == OC_Attribute) { /* compute the full name of this attribute */ computefullname(das); @@ -444,9 +454,9 @@ mergeother1(OCnode* root, OCnode* das) } } else stat = OC_EDAS; +done: return OCTHROW(stat); } -#endif static void ocuncorrelate(OCnode* root) diff --git a/oc2/ocnode.h b/oc2/ocnode.h index 12cf0a9405..e7821dfaa3 100644 --- a/oc2/ocnode.h +++ b/oc2/ocnode.h @@ -37,6 +37,7 @@ typedef struct OCattinfo { int isglobal; /* is this supposed to be a global attribute set?*/ int isdods; /* is this a global DODS_XXX attribute set */ OClist* values; /* oclist*/ + struct OCnode* var; /* containing var else null */ } OCattinfo; /*! Specifies the OCnode. */