Skip to content

Commit

Permalink
Allow missing 'storage' attribute in <sequence>'s
Browse files Browse the repository at this point in the history
  • Loading branch information
cpiker committed Aug 27, 2024
1 parent 6f41c1a commit 27bb664
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions das2/serial3.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,26 @@ static void _serial_onSequence(context_t* pCtx, const char** psAttr)
return;
}

/* For sequences, expect them to tell me the storage type */
/* For sequences, pick a storage type if none given */
if(pCtx->valStorage[0] == '\0'){
pCtx->nDasErr = das_error(DASERR_SERIAL,
"Attribute 'storage' needed for variable %s in dimension %s for dataset "
"ID %d since values are generated by a sequence.", pCtx->varUse,
DasDim_id(pCtx->pCurDim), pCtx->nPktId
);
return;
/* Pick a default based on the semantic */
if(strcmp(pCtx->valSemantic, "real"))
strncpy(pCtx->valStorage, "double", _VAL_STOREAGE_SZ);
else if(strcmp(pCtx->valSemantic, "int"))
strncpy(pCtx->valStorage, "int", _VAL_STOREAGE_SZ);
else if(strcmp(pCtx->valSemantic, "bool"))
strncpy(pCtx->valStorage, "byte", _VAL_STOREAGE_SZ);
else if(strcmp(pCtx->valSemantic, "datetime")){
if(pCtx->varUnits == UNIT_TT2000)
strncpy(pCtx->valStorage, "long", _VAL_STOREAGE_SZ);
else
strncpy(pCtx->valStorage, "double", _VAL_STOREAGE_SZ);
}
else if(strcmp(pCtx->valSemantic, "string"))
strncpy(pCtx->valStorage, "utf8", _VAL_STOREAGE_SZ);
else{
strncpy(pCtx->valStorage, "ubyte*", _VAL_STOREAGE_SZ);
}
}

/* Item type can't be set when the variable opens because we could bubble it
Expand Down

0 comments on commit 27bb664

Please sign in to comment.