cmScoreProc.c : Updated the TakeSeqBldr JSON file generation code to match the

file parser code in cmTakeSeqBldr.c.
This commit is contained in:
Kevin Larke 2015-02-25 16:58:40 -08:00
parent e540ee91f9
commit 15a0c7beeb

View File

@ -596,6 +596,7 @@ typedef struct
unsigned mni; unsigned mni;
bool failFl; bool failFl;
cmJsonH_t jsH; cmJsonH_t jsH;
cmJsonNode_t* takeArray;
cmJsonNode_t* takeObj; cmJsonNode_t* takeObj;
cmJsonNode_t* array; cmJsonNode_t* array;
@ -641,8 +642,8 @@ cmSpRC_t _cmSpProcAssocCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlOb
m->mni = 0; m->mni = 0;
m->failFl = false; m->failFl = false;
// insert a section object // insert a take object
if((m->takeObj = cmJsonInsertPairObject(m->jsH, cmJsonRoot(m->jsH), "take" )) == NULL ) if((m->takeObj = cmJsonCreateObject(m->jsH, m->takeArray )) == NULL )
{ {
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Take insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text)); rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Take insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
goto errLabel; goto errLabel;
@ -755,14 +756,22 @@ cmSpRC_t _cmScoreProcGenAssocMain(cmCtx_t* ctx)
// store the time-line and score file name // store the time-line and score file name
if( cmJsonInsertPairs(m->jsH, cmJsonRoot(m->jsH), if( cmJsonInsertPairs(m->jsH, cmJsonRoot(m->jsH),
"tlFn", kStringTId, cmTimeLineFileName( sp->tlH), "timeLineFn", kStringTId, cmTimeLineFileName( sp->tlH),
"scoreFn", kStringTId, cmScoreFileName( sp->scH ), "scoreFn", kStringTId, cmScoreFileName( sp->scH ),
"tlPrefixPath", kStringTId, cmTimeLinePrefixPath( sp->tlH ),
NULL ) != kOkJsRC ) NULL ) != kOkJsRC )
{ {
cmErrMsg(&m->ctx->err,kJsonFailSpRC,"File name JSON field insertion failed."); cmErrMsg(&m->ctx->err,kJsonFailSpRC,"File name JSON field insertion failed.");
goto errLabel; goto errLabel;
} }
// create an array to hold each take
if((m->takeArray = cmJsonInsertPairArray(m->jsH, cmJsonRoot(m->jsH), "takeArray" )) == NULL )
{
cmErrMsg(&m->ctx->err,kJsonFailSpRC,"JSON take-array create failed.");
goto errLabel;
}
// run the score processor // run the score processor
_cmScoreProcProcess(ctx,sp); _cmScoreProcProcess(ctx,sp);