Exemple #1
0
int
ncaux_begin_compound(int ncid, const char *name, int alignmode, void** tagp)
{
    int status = NC_NOERR;
    struct NCAUX_CMPD* cmpd = NULL;

    if(!ncaux_initialized) {
        compute_alignments();
        ncaux_initialized = 1;
    }

    if(tagp) *tagp = NULL;

    cmpd = (struct NCAUX_CMPD*)calloc(1,sizeof(struct NCAUX_CMPD));
    if(cmpd == NULL) {
        status = NC_ENOMEM;
        goto fail;
    }
    cmpd->ncid = ncid;
    cmpd->mode = alignmode;
    cmpd->nfields = 0;
    cmpd->name = strdup(name);
    if(cmpd->name == NULL) {
        status = NC_ENOMEM;
        goto fail;
    }

    if(tagp) *tagp = (void*)cmpd;

    return status;

fail:
    ncaux_abort_compound((void*)cmpd);
    return status;
}
Exemple #2
0
void
init_netcdf(void) /* initialize global counts, flags */
{
    compute_alignments();
    memset((void*)&nullconstant,0,sizeof(NCConstant));
    fillconstant = nullconstant;
    fillconstant.nctype = NC_FILLVALUE;

    codebuffer = bbNew();
    stmt = bbNew();
    error_count = 0; /* Track # of errors */
}
Exemple #3
0
int
main(int argc, char** argv)
{
    int i;

    compute_alignments();

    verify(vec);

/*
    for(i=0;i<NCTYPES;i++) {
	printf("%s:\talignment=%d\n",vec[i].typename,vec[i].alignment);
    }
*/
    exit(0);
}
Exemple #4
0
int
ncaux_begin_compound(int ncid, const char *name, int alignmode, void** tagp)
{
#ifdef USE_NETCDF4
    int status = NC_NOERR;
    struct NCAUX_CMPD* cmpd = NULL;

    if(!ncaux_initialized) {
	compute_alignments();
	ncaux_initialized = 1;
    }

    if(tagp) *tagp = NULL;
	
    cmpd = (struct NCAUX_CMPD*)calloc(1,sizeof(struct NCAUX_CMPD));
    if(cmpd == NULL) {status = NC_ENOMEM; goto fail;}
    cmpd->ncid = ncid;
    cmpd->mode = alignmode;
    cmpd->nfields = 0;
    cmpd->name = strdup(name);    
    if(cmpd->name == NULL) {status = NC_ENOMEM; goto fail;}

    if(tagp) {
      *tagp = (void*)cmpd;
    } else { /* Error, free cmpd to avoid memory leak. */
      free(cmpd);
    }
    return status;

fail:
    ncaux_abort_compound((void*)cmpd);
    return status;
#else
    return NC_ENOTBUILT;
#endif
}