From 611eda87de73f01d38dca68e85b5c3f4a8079b54 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 24 Sep 2015 19:14:27 -0400 Subject: [PATCH] app/cmDspPgmJsonToDot.h/c : Initial partial implementation. --- app/cmDspPgmJsonToDot.c | 110 ++++++++++++++++++++++++++++++++++++++++ app/cmDspPgmJsonToDot.h | 22 ++++++++ 2 files changed, 132 insertions(+) create mode 100644 app/cmDspPgmJsonToDot.c create mode 100644 app/cmDspPgmJsonToDot.h diff --git a/app/cmDspPgmJsonToDot.c b/app/cmDspPgmJsonToDot.c new file mode 100644 index 0000000..1d4d3e1 --- /dev/null +++ b/app/cmDspPgmJsonToDot.c @@ -0,0 +1,110 @@ + +typedef struct cmDotPort_str +{ + cmChar_t* label; + struct cmDotPort_str* link; +} cmDotPort_t; + +typedef struct cmDotProc_str +{ + cmChar_t* class; + cmChar_t* inst; + + cmDotPort_t* list; + struct cmDotProc_str* link; +} cmDotProc_t; + +typedef struct cmDot_str +{ + cmDotProc_t* list; +} cmDot_t; + + +void _cmDotNewProc( cmDot_t* p, const cmChar_t* class, const cmChar_t* inst ) +{ + +} + +void _cmDotNewPort( cmDot_t* p, const cmChar_t* srcStr, const cmChar_t* srcPortStr, const cmChar_t* dstStr, const cmChar_t* dstPortStr ) +{ +} + + +cmDotRC_t cmDspPgmJsonToDot( cmCtx_t* ctx, const cmChar_t* inFn, const cmChar_t* outFn ) +{ + cmDotRC_t rc = kOkDotRC; + cmJsonH_t jsH = cmJsonNullHandle; + cmErr_t err; + cmJsonNode_t* arr; + cmJsonNode_t* rp; + const char* errLbl = NULL; + + cmErrSetup(&err,&ctx->rpt,"cmDspPgmJsonToDot"); + + if( cmJsonInitializeFromFile( &jsH, inFn, ctx ) != kOkJsRC ) + return cmErrMsg(&err,kJsonFailDotRC,"The program description file '%s' could not be opened.",cmStringNullGuard(inFn)); + + if((arr = cmJsonFindValue(jsH, "inst_array", NULL, kArrayTId )) == NULL ) + { + } + + unsigned n = cmJsonChildCount(arr); + + for(i=0; i