15 #include "nc4internal.h"
16 #include "nc4dispatch.h"
34 NC_GRP_INFO_T *grp, *g;
39 LOG((2,
"nc_inq_ncid: ncid 0x%x name %s", ncid, name));
50 g = (NC_GRP_INFO_T*)ncindexlookup(grp->children,norm_name);
54 *grp_ncid = grp->nc4_info->controller->ext_ncid | g->hdr.id;
77 NC_GRP_INFO_T *grp, *g;
83 LOG((2,
"nc_inq_grps: ncid 0x%x", ncid));
91 for(i=0;i<ncindexsize(grp->children);i++)
93 g = (NC_GRP_INFO_T*)ncindexith(grp->children,i);
94 if(g == NULL)
continue;
100 *ncids = g->hdr.id | g->nc4_info->controller->ext_ncid;
130 LOG((2,
"nc_inq_grpname: ncid 0x%x", ncid));
139 strcpy(name, grp->hdr.name);
163 int g,
id = ncid, parent_id, *gid;
171 if (!(name = malloc((g + 1) * (
NC_MAX_NAME + 1) + 1)))
173 if (!(gid = malloc((g + 1) *
sizeof(
int))))
181 strcpy(name, NC_GROUP_NAME);
185 for (i = 1; i < g && !ret; i++)
189 for (i = g - 1; !ret && i >= 0 && !ret; i--)
193 strcat(name, grp_name);
200 *lenp = strlen(name);
203 if (!ret && full_name)
204 strcpy(full_name, name);
233 LOG((2,
"nc_inq_grp_parent: ncid 0x%x", ncid));
244 *parent_ncid = grp->nc4_info->controller->ext_ncid | grp->parent->hdr.id;
272 char *cp, *full_name_cpy;
285 if (!(full_name_cpy = strdup(full_name)))
289 if (!(cp = strtok(full_name_cpy,
"/")))
304 for (; cp; id1 = id2)
311 cp = strtok(NULL,
"/");
345 LOG((2,
"nc_inq_varids: ncid 0x%x", ncid));
354 for (i=0; i < ncindexsize(grp->vars); i++)
356 var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i);
359 varids[num_vars] = var->hdr.id;
384 const int *ia = (
const int *)a;
385 const int *ib = (
const int *)b;
407 NC_GRP_INFO_T *grp, *g;
413 LOG((2,
"nc_inq_dimids: ncid 0x%x include_parents: %d", ncid,
422 num = ncindexcount(grp->dim);
423 if (include_parents) {
424 for (g = grp->parent; g; g = g->parent)
425 num += ncindexcount(g->dim);
435 for(i=0;i<ncindexsize(grp->dim);i++) {
436 dim = (NC_DIM_INFO_T*)ncindexith(grp->dim,i);
437 if(dim == NULL)
continue;
438 dimids[n++] = dim->hdr.id;
443 for (g = grp->parent; g; g = g->parent) {
444 for(i=0;i<ncindexsize(g->dim);i++) {
445 dim = (NC_DIM_INFO_T*)ncindexith(g->dim,i);
446 if(dim == NULL)
continue;
447 dimids[n++] = dim->hdr.id;
450 qsort(dimids, num,
sizeof(
int),
int_cmp);