diff --git a/.github/actions/setup-osal/action.yml b/.github/actions/setup-osal/action.yml
index 9eecf95..f16e83f 100644
--- a/.github/actions/setup-osal/action.yml
+++ b/.github/actions/setup-osal/action.yml
@@ -19,7 +19,7 @@ runs:
using: 'composite'
steps:
- name: Checkout OSAL
- uses: actions/checkout@v5
+ uses: actions/checkout@v6
with:
repository: ${{ inputs.upstream-repo }}
ref: ${{ inputs.upstream-ref }}
diff --git a/.github/workflows/format-check-internal.yml b/.github/workflows/format-check-internal.yml
new file mode 100644
index 0000000..2779e00
--- /dev/null
+++ b/.github/workflows/format-check-internal.yml
@@ -0,0 +1,19 @@
+name: Internal Format Check
+
+# Run on all push and pull requests
+on:
+ push:
+ branches:
+ - dev
+ - main
+ pull_request:
+ types:
+ - opened
+ - reopened
+ - synchronize
+ workflow_dispatch:
+
+jobs:
+ format-check:
+ name: Run format check
+ uses: cFS/workflows/.github/workflows/format-check-reusable-internal.yml@dev
diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml
index 441199a..243ad40 100644
--- a/.github/workflows/format-check.yml
+++ b/.github/workflows/format-check.yml
@@ -2,13 +2,18 @@ name: Format Check
# Run on all push and pull requests
on:
+ push:
+ branches:
+ - dev
+ - main
pull_request:
types:
- opened
- reopened
- synchronize
+ workflow_dispatch:
jobs:
format-check:
name: Run format check
- uses: nasa/cFS/.github/workflows/format-check.yml@main
+ uses: nasa/cFS/.github/workflows/format-check.yml@dev
\ No newline at end of file
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index c4e2734..53af785 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -46,13 +46,13 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v5
+ uses: actions/checkout@v6
with:
path: source
- name: CMake Setup
- run: |
- cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DENABLE_UNIT_TESTS=FALSE -B build -S source
+ run: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DENABLE_UNIT_TESTS=FALSE -B build -S source
+
- name: Run general cppcheck
run: cppcheck --force --inline-suppr --xml --project=build/compile_commands.json 2> cppcheck_err.xml
@@ -60,4 +60,4 @@ jobs:
run: xsltproc source/.github/scripts/cppcheck-output.xslt cppcheck_err.xml | tee $GITHUB_STEP_SUMMARY cppcheck_err.txt
- name: Check for reported errors
- run: tail -n 1 cppcheck_err.txt | grep -q '^\*\*0 error(s) reported\*\*$'
\ No newline at end of file
+ run: tail -n 1 cppcheck_err.txt | grep -q '^\*\*0 error(s) reported\*\*$'
diff --git a/.github/workflows/validation-test.yml b/.github/workflows/validation-test.yml
index 824f7c9..c85cead 100644
--- a/.github/workflows/validation-test.yml
+++ b/.github/workflows/validation-test.yml
@@ -37,9 +37,9 @@ jobs:
prepare-dependencies:
name: Prepare Dependencies
- runs-on: ubuntu-latest
needs: checks-for-duplicates
if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'dev') }}
+ runs-on: ubuntu-latest
container: ghcr.io/core-flight-system/cfsbuildenv-linux:latest
steps:
- name: Cache EdsLib Source
@@ -58,7 +58,7 @@ jobs:
- name: Checkout EdsLib
if: steps.cache-edslib.outputs.cache-hit != 'True'
- uses: actions/checkout@v5
+ uses: actions/checkout@v6
with:
path: source
@@ -73,7 +73,7 @@ jobs:
build-and-test:
name: Build EdsLib and Execute Tests
needs: [prepare-dependencies]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-latest
container: ghcr.io/core-flight-system/cfsbuildenv-linux:latest
strategy:
@@ -109,6 +109,7 @@ jobs:
sudo find /usr/local -type d -exec chmod go+rx {} \;
sudo find /usr/local -type f -exec chmod go+r {} \;
sudo find /usr/local -type f -path '*/bin/*' -exec chmod go+x {} \;
+
- name: Refresh Dynamic Linker Cache
run: sudo ldconfig
@@ -148,4 +149,4 @@ jobs:
fi
if [ -s '${{ env.MATRIX_ID }}/lcov-summary.xml' ]; then
cat '${{ env.MATRIX_ID }}/lcov-summary.xml' >> $GITHUB_STEP_SUMMARY
- fi
\ No newline at end of file
+ fi
diff --git a/cfecfs/CMakeLists.txt b/cfecfs/CMakeLists.txt
index f82474d..421f1e8 100644
--- a/cfecfs/CMakeLists.txt
+++ b/cfecfs/CMakeLists.txt
@@ -24,9 +24,4 @@
add_subdirectory(missionlib)
add_subdirectory(eds2cfetbl)
add_subdirectory(util)
-
-# the test executive is an optional component to provide a black-box
-# style test framework. It is built using OSAL and UT-Assert.
-if (ENABLE_EDS_TESTEXEC)
- add_subdirectory(testexecutive)
-endif (ENABLE_EDS_TESTEXEC)
+add_subdirectory(testrunner)
diff --git a/cfecfs/eds2cfetbl/eds2cfetbl.c b/cfecfs/eds2cfetbl/eds2cfetbl.c
index 9e53f4c..0b392d0 100644
--- a/cfecfs/eds2cfetbl/eds2cfetbl.c
+++ b/cfecfs/eds2cfetbl/eds2cfetbl.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file eds2cfetbl.c
* \ingroup cfecfs
@@ -105,7 +104,6 @@ typedef struct EdsTableTool_CObj
} EdsTableTool_CObj_t;
-
typedef struct EdsTableTool_Global
{
/* The Instance number of the current target (in cases where it is instance specific) */
@@ -132,7 +130,9 @@ const EdsLib_Id_t EDS_TABLE_LOAD_CMD_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_TBL), Eds
*-----------------------------------------------------------------*/
EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_CmdTopicIdToMsgId(uint16_t TopicId, uint16_t InstanceNum)
{
- const EdsComponent_CFE_SB_Listener_t Params = {{ .InstanceNumber = InstanceNum, .TopicId = TopicId }};
+ const EdsComponent_CFE_SB_Listener_t Params = {
+ { .InstanceNumber = InstanceNum, .TopicId = TopicId }
+ };
EdsInterface_CFE_SB_SoftwareBus_PubSub_t Output;
CFE_MissionLib_MapListenerComponent(&Output, &Params);
@@ -148,7 +148,9 @@ EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_CmdTopicIdToMsgId(uint16_t TopicId, uint1
*-----------------------------------------------------------------*/
EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_TlmTopicIdToMsgId(uint16_t TopicId, uint16_t InstanceNum)
{
- const EdsComponent_CFE_SB_Publisher_t Params = {{ .InstanceNumber = InstanceNum, .TopicId = TopicId }};
+ const EdsComponent_CFE_SB_Publisher_t Params = {
+ { .InstanceNumber = InstanceNum, .TopicId = TopicId }
+ };
EdsInterface_CFE_SB_SoftwareBus_PubSub_t Output;
CFE_MissionLib_MapPublisherComponent(&Output, &Params);
@@ -177,7 +179,11 @@ uint16_t EdsTableTool_GetProcessorId(void)
* in the caller context.
*
*-----------------------------------------------------------------*/
-void EdsTableTool_DoExport(const void *filedefptr, const void *objptr, size_t objsize, const char *typename, size_t typesize)
+void EdsTableTool_DoExport(const void *filedefptr,
+ const void *objptr,
+ size_t objsize,
+ const char *typename,
+ size_t typesize)
{
EdsTableTool_CObj_t *CObj = &EdsTableTool_Global.CObj;
@@ -194,8 +200,10 @@ void EdsTableTool_DoExport(const void *filedefptr, const void *objptr, size_t ob
*/
if (CObj->FileDefInfo.ObjectSize != objsize)
{
- fprintf(stderr, EDSTABLETOOL_WARNING "Size from FileDef (%lu) differs from actual object (%lu)\n",
- (unsigned long)CObj->FileDefInfo.ObjectSize, (unsigned long)objsize);
+ fprintf(stderr,
+ EDSTABLETOOL_WARNING "Size from FileDef (%lu) differs from actual object (%lu)\n",
+ (unsigned long)CObj->FileDefInfo.ObjectSize,
+ (unsigned long)objsize);
}
CObj->ObjPtr = malloc(objsize);
@@ -207,10 +215,10 @@ void EdsTableTool_DoExport(const void *filedefptr, const void *objptr, size_t ob
memcpy(CObj->ObjPtr, objptr, objsize);
- strncpy(CObj->CTypeName, typename, sizeof(CObj->CTypeName)-1);
+ strncpy(CObj->CTypeName, typename, sizeof(CObj->CTypeName) - 1);
CObj->TotalObjectSize = objsize;
- CObj->ElementSize = typesize;
+ CObj->ElementSize = typesize;
}
/*----------------------------------------------------------------
@@ -225,8 +233,8 @@ void EdsTableTool_DoExport(const void *filedefptr, const void *objptr, size_t ob
*-----------------------------------------------------------------*/
void EdsTableTool_LoadCTemplateFile(const char *Filename)
{
- void *dlhandle;
- void *fptr;
+ void *dlhandle;
+ void *fptr;
const char *tmpstr;
void (*DynamicGeneratorFuncPtr)(void);
char ModuleTempName[64];
@@ -235,7 +243,7 @@ void EdsTableTool_LoadCTemplateFile(const char *Filename)
dlerror();
dlhandle = dlopen(Filename, RTLD_LAZY | RTLD_LOCAL);
- tmpstr = dlerror();
+ tmpstr = dlerror();
if (tmpstr != NULL || dlhandle == NULL)
{
if (tmpstr == NULL)
@@ -247,7 +255,7 @@ void EdsTableTool_LoadCTemplateFile(const char *Filename)
}
/* The generated wrapper always has the same function name */
- fptr = dlsym(dlhandle, "EdsTableTool_GENERATOR");
+ fptr = dlsym(dlhandle, "EdsTableTool_GENERATOR");
tmpstr = dlerror();
if (fptr == NULL || tmpstr != NULL)
{
@@ -270,9 +278,9 @@ void EdsTableTool_LoadCTemplateFile(const char *Filename)
DynamicGeneratorFuncPtr();
printf(EDSTABLETOOL_INFO "Got object from C domain, shape=%lux%lu, total size=%lu\n",
- (unsigned long)EdsTableTool_Global.CObj.TotalObjectSize / EdsTableTool_Global.CObj.ElementSize,
- (unsigned long)EdsTableTool_Global.CObj.ElementSize,
- (unsigned long)EdsTableTool_Global.CObj.TotalObjectSize);
+ (unsigned long)EdsTableTool_Global.CObj.TotalObjectSize / EdsTableTool_Global.CObj.ElementSize,
+ (unsigned long)EdsTableTool_Global.CObj.ElementSize,
+ (unsigned long)EdsTableTool_Global.CObj.TotalObjectSize);
}
dlclose(dlhandle);
@@ -292,10 +300,10 @@ void EdsTableTool_LoadCTemplateFile(const char *Filename)
*-----------------------------------------------------------------*/
EdsLib_Id_t EdsTableTool_FindCommonType(EdsLib_Id_t Type1, EdsLib_Id_t Type2)
{
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
EdsLib_DataTypeDB_EntityInfo_t MemberInfo;
- EdsLib_Id_t ResultEdsId;
- int32_t EdsStatus;
+ EdsLib_Id_t ResultEdsId;
+ int32_t EdsStatus;
/* Find some common point between the two types */
ResultEdsId = Type1;
@@ -319,7 +327,7 @@ EdsLib_Id_t EdsTableTool_FindCommonType(EdsLib_Id_t Type1, EdsLib_Id_t Type2)
/* another possibility is that the table intf type contains/wraps the C data type */
/* Check the first member type - if its a container, this is the base type,
- * or if it is an array, this is the array data type */
+ * or if it is an array, this is the array data type */
EdsStatus = EdsLib_DataTypeDB_GetMemberByIndex(&EDS_DATABASE, ResultEdsId, 0, &MemberInfo);
if (EdsStatus != EDSLIB_SUCCESS)
{
@@ -347,14 +355,14 @@ EdsLib_Id_t EdsTableTool_FindCommonType(EdsLib_Id_t Type1, EdsLib_Id_t Type2)
void EdsTableTool_IdentifyCObj(void)
{
EdsTableTool_CObj_t *CObj = &EdsTableTool_Global.CObj;
- const char *tmpstr;
- char *TempPtr;
- size_t tmplen;
- char TypeNameBuff[64];
- EdsLib_Id_t TblIntfEdsId;
- EdsLib_Id_t AppComponentEdsId;
- uint8_t PkgIdx;
- int32_t EdsStatus;
+ const char *tmpstr;
+ char *TempPtr;
+ size_t tmplen;
+ char TypeNameBuff[64];
+ EdsLib_Id_t TblIntfEdsId;
+ EdsLib_Id_t AppComponentEdsId;
+ uint8_t PkgIdx;
+ int32_t EdsStatus;
/*
* The TableName in the FileDef object is supposed to be of the form "AppName.TableName" -
@@ -389,7 +397,9 @@ void EdsTableTool_IdentifyCObj(void)
CObj->TableName[sizeof(CObj->TableName) - 1] = 0;
printf(EDSTABLETOOL_INFO "Identifying C Object: AppName=\'%s\', TableName=\'%s\', CType=\'%s\'\n",
- CObj->RuntimeAppName, CObj->TableName, CObj->CTypeName);
+ CObj->RuntimeAppName,
+ CObj->TableName,
+ CObj->CTypeName);
/* Try to determine the EdsId of the C data type. This should exist, but in some cases
* the user has defined a custom type only for the table definition (such as a union). This
@@ -403,7 +413,7 @@ void EdsTableTool_IdentifyCObj(void)
/* The C typedef should have a "_t" suffix - trim this off for EDS type names */
tmplen = strlen(TypeNameBuff);
- if (tmplen > 2 && strcmp(&TypeNameBuff[tmplen-2], "_t") == 0)
+ if (tmplen > 2 && strcmp(&TypeNameBuff[tmplen - 2], "_t") == 0)
{
TypeNameBuff[tmplen - 2] = 0;
}
@@ -411,12 +421,14 @@ void EdsTableTool_IdentifyCObj(void)
CObj->CTypeEdsId = EdsLib_DisplayDB_LookupTypeName(&EDS_DATABASE, TypeNameBuff);
if (EdsLib_Is_Valid(CObj->CTypeEdsId))
{
- printf(EDSTABLETOOL_INFO "Found EDS type definition \'%s\' for C datatype \'%s\'\n", TypeNameBuff, CObj->CTypeName);
+ printf(EDSTABLETOOL_INFO "Found EDS type definition \'%s\' for C datatype \'%s\'\n",
+ TypeNameBuff,
+ CObj->CTypeName);
}
/* Now find an EDS interface definition and data type that matches */
AppComponentEdsId = EDSLIB_ID_INVALID;
- TblIntfEdsId = EDSLIB_ID_INVALID;
+ TblIntfEdsId = EDSLIB_ID_INVALID;
/* Note that tables will not be loadable by TBL services unless there is an exact match. This
* previously made extra assumptions about the possibility of an _APP suffix and other differences,
@@ -429,15 +441,18 @@ void EdsTableTool_IdentifyCObj(void)
EdsStatus = EdsLib_IntfDB_FindComponentByLocalName(&EDS_DATABASE, PkgIdx, "Application", &AppComponentEdsId);
if (EdsStatus == EDSLIB_SUCCESS)
{
- EdsStatus = EdsLib_IntfDB_FindComponentInterfaceByLocalName(&EDS_DATABASE, AppComponentEdsId, CObj->TableName, &TblIntfEdsId);
+ EdsStatus = EdsLib_IntfDB_FindComponentInterfaceByLocalName(&EDS_DATABASE,
+ AppComponentEdsId,
+ CObj->TableName,
+ &TblIntfEdsId);
}
/* Fallback - if no exact match, check for a numeric suffix. Some apps (such as MD)
- * have multiple instances of the same table and they attach a numeric suffix to the name */
+ * have multiple instances of the same table and they attach a numeric suffix to the name */
if (EdsStatus != EDSLIB_SUCCESS)
{
TempPtr = CObj->TableName + strlen(CObj->TableName);
- while(TempPtr > CObj->TableName)
+ while (TempPtr > CObj->TableName)
{
--TempPtr;
if (!isdigit((int)(*TempPtr)))
@@ -447,24 +462,31 @@ void EdsTableTool_IdentifyCObj(void)
*TempPtr = 0;
}
- EdsStatus = EdsLib_IntfDB_FindComponentInterfaceByLocalName(&EDS_DATABASE, AppComponentEdsId, CObj->TableName, &TblIntfEdsId);
+ EdsStatus = EdsLib_IntfDB_FindComponentInterfaceByLocalName(&EDS_DATABASE,
+ AppComponentEdsId,
+ CObj->TableName,
+ &TblIntfEdsId);
}
if (EdsStatus == EDSLIB_SUCCESS)
{
/* Determine the argument data type for "load" command */
- EdsStatus = EdsLib_IntfDB_FindAllArgumentTypes(&EDS_DATABASE, EDS_TABLE_LOAD_CMD_ID, TblIntfEdsId, &CObj->IntfDataTypeEdsId, 1);
+ EdsStatus = EdsLib_IntfDB_FindAllArgumentTypes(&EDS_DATABASE,
+ EDS_TABLE_LOAD_CMD_ID,
+ TblIntfEdsId,
+ &CObj->IntfDataTypeEdsId,
+ 1);
}
/*
- * If we only got one of the two types (C Datatype or Intf Datatype) then use that.
- * (the table may not load correctly but that is a problem elsewhere)
- *
- * If we got both, and they are equal, then there is also no problem.
- * However if we get both an they are different, we have to correlate them somehow.
- * The most likely situation is that the C table is an array, and there is possibly
- * a separate container around that array.
- */
+ * If we only got one of the two types (C Datatype or Intf Datatype) then use that.
+ * (the table may not load correctly but that is a problem elsewhere)
+ *
+ * If we got both, and they are equal, then there is also no problem.
+ * However if we get both an they are different, we have to correlate them somehow.
+ * The most likely situation is that the C table is an array, and there is possibly
+ * a separate container around that array.
+ */
if (!EdsLib_Is_Valid(CObj->IntfDataTypeEdsId))
{
/* Intf type not known - just use the C type */
@@ -497,7 +519,9 @@ void EdsTableTool_IdentifyCObj(void)
/* sanity check that the type name is valid - it might have returned undefined string */
if (EdsLib_Is_Valid(EdsLib_DisplayDB_LookupTypeName(&EDS_DATABASE, TypeNameBuff)))
{
- printf(EDSTABLETOOL_INFO "Selected EDS type definition \'%s\' for table \'%s\'\n", TypeNameBuff, CObj->FileDefInfo.TableName);
+ printf(EDSTABLETOOL_INFO "Selected EDS type definition \'%s\' for table \'%s\'\n",
+ TypeNameBuff,
+ CObj->FileDefInfo.TableName);
strncpy(CObj->EdsTypeName, TypeNameBuff, sizeof(CObj->EdsTypeName) - 1);
CObj->EdsTypeName[sizeof(CObj->EdsTypeName) - 1] = 0;
@@ -509,7 +533,9 @@ void EdsTableTool_IdentifyCObj(void)
}
else
{
- fprintf(stderr, EDSTABLETOOL_ERROR "Could not map table \'%s\' to an EDS-defined data type\n", CObj->FileDefInfo.TableName);
+ fprintf(stderr,
+ EDSTABLETOOL_ERROR "Could not map table \'%s\' to an EDS-defined data type\n",
+ CObj->FileDefInfo.TableName);
exit(EXIT_FAILURE);
}
}
@@ -526,15 +552,15 @@ void EdsTableTool_IdentifyCObj(void)
*-----------------------------------------------------------------*/
void EdsTableTool_AppendObjsFromCObj(lua_State *lua, EdsTableTool_CObj_t *CObj)
{
- EdsLib_Binding_DescriptorObject_t *ObjectUserData;
+ EdsLib_Binding_DescriptorObject_t *ObjectUserData;
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- int32_t EdsStatus;
- const uint8_t *sptr;
- void *tptr;
- size_t tsz;
- int tbl_pos;
- size_t bytes_remain;
- size_t bytes_per_elem;
+ int32_t EdsStatus;
+ const uint8_t *sptr;
+ void *tptr;
+ size_t tsz;
+ int tbl_pos;
+ size_t bytes_remain;
+ size_t bytes_per_elem;
/* There should be a table at the top of the initial stack */
tbl_pos = lua_gettop(lua);
@@ -548,13 +574,13 @@ void EdsTableTool_AppendObjsFromCObj(lua_State *lua, EdsTableTool_CObj_t *CObj)
lua_rawseti(lua, tbl_pos, 1);
bytes_per_elem = 0;
- bytes_remain = 0;
- sptr = NULL;
+ bytes_remain = 0;
+ sptr = NULL;
}
else
{
bytes_remain = CObj->TotalObjectSize;
- sptr = CObj->ObjPtr;
+ sptr = CObj->ObjPtr;
if (CObj->ElementSize < CObj->TotalObjectSize && DerivInfo.MaxSize.Bytes <= CObj->ElementSize)
{
@@ -590,13 +616,16 @@ void EdsTableTool_AppendObjsFromCObj(lua_State *lua, EdsTableTool_CObj_t *CObj)
/* this should not happen because the size was checked earlier */
if (tsz < bytes_per_elem)
{
- fprintf(stderr, EDSTABLETOOL_ERROR "Object of %lu bytes cannot be copied into buffer of %lu bytes (datatype=%s)\n",
- (unsigned long)bytes_per_elem, (unsigned long)tsz, CObj->EdsTypeName);
+ fprintf(stderr,
+ EDSTABLETOOL_ERROR "Object of %lu bytes cannot be copied into buffer of %lu bytes (datatype=%s)\n",
+ (unsigned long)bytes_per_elem,
+ (unsigned long)tsz,
+ CObj->EdsTypeName);
exit(EXIT_FAILURE);
}
memcpy(tptr, sptr, bytes_per_elem);
- sptr += bytes_per_elem;
+ sptr += bytes_per_elem;
bytes_remain -= bytes_per_elem;
/* Append to the table at the top of the initial stack */
@@ -618,7 +647,7 @@ void EdsTableTool_AppendObjsFromCObj(lua_State *lua, EdsTableTool_CObj_t *CObj)
void EdsTableTool_CreateLuaObjFromCObj(lua_State *lua)
{
EdsTableTool_CObj_t *CObj = &EdsTableTool_Global.CObj;
- int obj_idx;
+ int obj_idx;
lua_getglobal(lua, CObj->RuntimeAppName);
if (lua_type(lua, -1) != LUA_TTABLE)
@@ -633,13 +662,13 @@ void EdsTableTool_CreateLuaObjFromCObj(lua_State *lua)
obj_idx = lua_gettop(lua);
lua_pushstring(lua, CObj->FileDefInfo.TableName);
- lua_setfield(lua, obj_idx, "TableName"); /* Set "TableName" in Table object */
+ lua_setfield(lua, obj_idx, "TableName"); /* Set "TableName" in Table object */
lua_pushstring(lua, CObj->FileDefInfo.Description);
- lua_setfield(lua, obj_idx, "Description"); /* Set "Description" in Table object */
+ lua_setfield(lua, obj_idx, "Description"); /* Set "Description" in Table object */
lua_pushstring(lua, CObj->FileDefInfo.TgtFilename);
- lua_setfield(lua, obj_idx, "TgtFilename"); /* Set "TgtFilename" in Table object */
+ lua_setfield(lua, obj_idx, "TgtFilename"); /* Set "TgtFilename" in Table object */
/*
* If a C object is loaded, make EDS objects out of it
@@ -662,7 +691,7 @@ void EdsTableTool_CreateLuaObjFromCObj(lua_State *lua)
{
lua_rawgeti(lua, -1, 1);
}
- lua_setfield(lua, obj_idx, "Content"); /* Set "Content" in Table object */
+ lua_setfield(lua, obj_idx, "Content"); /* Set "Content" in Table object */
lua_settop(lua, obj_idx);
}
@@ -672,7 +701,7 @@ void EdsTableTool_CreateLuaObjFromCObj(lua_State *lua)
lua_rawseti(lua, -2, 1 + lua_rawlen(lua, -2));
lua_settop(lua, obj_idx);
- lua_setfield(lua, -2, CObj->TableName); /* Set entry in App table */
+ lua_setfield(lua, -2, CObj->TableName); /* Set entry in App table */
lua_pop(lua, 1);
printf(EDSTABLETOOL_INFO "Stored in global context as %s.%s \n", CObj->RuntimeAppName, CObj->TableName);
@@ -724,7 +753,7 @@ void EdsTableTool_PushEncodedSingleObject(lua_State *lua)
{
lua_getglobal(lua, "EdsDB");
lua_getfield(lua, -1, "Encode");
- lua_remove(lua, -2); /* remove the EdsDB global */
+ lua_remove(lua, -2); /* remove the EdsDB global */
lua_pushvalue(lua, -2);
lua_call(lua, 1, 1);
}
@@ -750,7 +779,7 @@ void EdsTableTool_PushEncodedMultiObject(lua_State *lua)
{
size_t num_tbl;
size_t num_enc;
- int obj_idx;
+ int obj_idx;
obj_idx = lua_gettop(lua);
@@ -759,12 +788,12 @@ void EdsTableTool_PushEncodedMultiObject(lua_State *lua)
num_tbl = lua_rawlen(lua, obj_idx);
num_enc = 0;
- while(num_enc < num_tbl)
+ while (num_enc < num_tbl)
{
++num_enc;
lua_rawgeti(lua, obj_idx, num_enc); /* Get the EdsLib_Object table entry */
EdsTableTool_PushEncodedSingleObject(lua);
- lua_remove(lua, -2); /* remove the EdsLib_Object table entry from stack */
+ lua_remove(lua, -2); /* remove the EdsLib_Object table entry from stack */
}
lua_concat(lua, num_enc);
@@ -790,10 +819,10 @@ void EdsTableTool_PushEncodedMultiObject(lua_State *lua)
*-----------------------------------------------------------------*/
FILE *EdsTableTool_OpenOutputFile(lua_State *lua, int filename_pos)
{
- FILE *OutputFile = NULL;
- int start_top = lua_gettop(lua);
+ FILE *OutputFile = NULL;
+ int start_top = lua_gettop(lua);
const char *OutputName = luaL_checkstring(lua, filename_pos);
- char OutputFullNameBuffer[256];
+ char OutputFullNameBuffer[256];
const char *OutputPath;
if (OutputName != NULL)
@@ -840,7 +869,15 @@ int EdsTableTool_WriteGenericFile(lua_State *lua)
return luaL_error(lua, "%s: %s", lua_tostring(lua, 1), strerror(errno));
}
- EdsTableTool_PushEncodedSingleObject(lua);
+ if (lua_type(lua, -1) == LUA_TTABLE)
+ {
+ EdsTableTool_PushEncodedMultiObject(lua);
+ }
+ else
+ {
+ EdsTableTool_PushEncodedSingleObject(lua);
+ }
+
fwrite(lua_tostring(lua, -1), lua_rawlen(lua, -1), 1, OutputFile);
fclose(OutputFile);
lua_pop(lua, 1);
@@ -866,19 +903,19 @@ int EdsTableTool_WriteCfeTableFile(lua_State *lua)
{
union
{
- EdsDataType_CFE_FS_Header_t FileHeader;
+ EdsDataType_CFE_FS_Header_t FileHeader;
EdsDataType_CFE_TBL_File_Hdr_t TblHeader;
} Buffer;
- EdsPackedBuffer_CFE_FS_Header_t PackedFileHeader;
+ EdsPackedBuffer_CFE_FS_Header_t PackedFileHeader;
EdsPackedBuffer_CFE_TBL_File_Hdr_t PackedTblHeader;
- uint32_t TblHeaderBlockSize;
- uint32_t FileHeaderBlockSize;
- EdsLib_Id_t PackedEdsId;
- FILE *OutputFile;
- const char *OutputName;
- EdsLib_DataTypeDB_TypeInfo_t BlockInfo;
- const void *content_ptr;
- size_t content_sz;
+ uint32_t TblHeaderBlockSize;
+ uint32_t FileHeaderBlockSize;
+ EdsLib_Id_t PackedEdsId;
+ FILE *OutputFile;
+ const char *OutputName;
+ EdsLib_DataTypeDB_TypeInfo_t BlockInfo;
+ const void *content_ptr;
+ size_t content_sz;
OutputFile = NULL;
OutputName = luaL_checkstring(lua, 1);
@@ -902,20 +939,28 @@ int EdsTableTool_WriteCfeTableFile(lua_State *lua)
strncpy(Buffer.TblHeader.TableName, luaL_checkstring(lua, 3), sizeof(Buffer.TblHeader.TableName));
PackedEdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_TBL), EdsContainer_CFE_TBL_File_Hdr_DATADICTIONARY);
- EdsLib_DataTypeDB_PackCompleteObject(&EDS_DATABASE, &PackedEdsId,
- PackedTblHeader, &Buffer.TblHeader, sizeof(PackedTblHeader) * 8, sizeof(Buffer.TblHeader));
+ EdsLib_DataTypeDB_PackCompleteObject(&EDS_DATABASE,
+ &PackedEdsId,
+ PackedTblHeader,
+ &Buffer.TblHeader,
+ sizeof(PackedTblHeader) * 8,
+ sizeof(Buffer.TblHeader));
EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE, PackedEdsId, &BlockInfo);
TblHeaderBlockSize = (BlockInfo.Size.Bits + 7) / 8;
memset(&Buffer, 0, sizeof(Buffer));
Buffer.FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID;
- Buffer.FileHeader.SubType = luaL_checkinteger(lua, lua_upvalueindex(1));
- Buffer.FileHeader.Length = TblHeaderBlockSize + lua_rawlen(lua, -1);
+ Buffer.FileHeader.SubType = luaL_checkinteger(lua, lua_upvalueindex(1));
+ Buffer.FileHeader.Length = TblHeaderBlockSize + lua_rawlen(lua, -1);
snprintf(Buffer.FileHeader.Description, sizeof(Buffer.FileHeader.Description), "%s", luaL_checkstring(lua, 2));
PackedEdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_FS), EdsContainer_CFE_FS_Header_DATADICTIONARY);
- EdsLib_DataTypeDB_PackCompleteObject(&EDS_DATABASE, &PackedEdsId,
- PackedFileHeader, &Buffer, sizeof(PackedFileHeader) * 8, sizeof(Buffer));
+ EdsLib_DataTypeDB_PackCompleteObject(&EDS_DATABASE,
+ &PackedEdsId,
+ PackedFileHeader,
+ &Buffer,
+ sizeof(PackedFileHeader) * 8,
+ sizeof(Buffer));
EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE, PackedEdsId, &BlockInfo);
FileHeaderBlockSize = (BlockInfo.Size.Bits + 7) / 8;
@@ -928,7 +973,7 @@ int EdsTableTool_WriteCfeTableFile(lua_State *lua)
fwrite(PackedFileHeader, FileHeaderBlockSize, 1, OutputFile);
fwrite(PackedTblHeader, TblHeaderBlockSize, 1, OutputFile);
content_ptr = lua_tostring(lua, -1);
- content_sz = lua_rawlen(lua, -1);
+ content_sz = lua_rawlen(lua, -1);
if (content_ptr != NULL && content_sz > 0)
{
fwrite(content_ptr, content_sz, 1, OutputFile);
@@ -1014,8 +1059,8 @@ static int EdsTableTool_ErrorHandler(lua_State *lua)
*-----------------------------------------------------------------*/
int main(int argc, char *argv[])
{
- int arg;
- size_t slen;
+ int arg;
+ size_t slen;
lua_State *lua;
EdsLib_Initialize();
@@ -1032,48 +1077,50 @@ int main(int argc, char *argv[])
lua_newtable(lua);
lua_rawsetp(lua, LUA_REGISTRYINDEX, &LUA_APPLIST_KEY);
- while ((arg = getopt (argc, argv, "e:p")) != -1)
+ while ((arg = getopt(argc, argv, "e:p")) != -1)
{
- switch (arg)
- {
- case 'p':
- EdsTableTool_Global.AllowPassthrough = true;
- break;
-
- case 'e':
- if (luaL_loadstring(lua, optarg) != LUA_OK)
- {
- fprintf(stderr, EDSTABLETOOL_ERROR "Invalid command line expression: %s\n",
- luaL_tolstring(lua,-1, NULL));
- lua_pop(lua, 2);
- return EXIT_FAILURE;
- }
-
- if (lua_pcall(lua, 0, 0, 1) != LUA_OK)
- {
- fprintf(stderr, EDSTABLETOOL_ERROR "Cannot evaluate command line expression: %s\n",
- luaL_tolstring(lua,-1, NULL));
- lua_pop(lua, 2);
- return EXIT_FAILURE;
- }
- break;
-
- case '?':
- if (isprint (optopt))
- {
- fprintf(stderr, EDSTABLETOOL_ERROR "Unknown option `-%c'.\n", optopt);
- }
- else
- {
- fprintf(stderr, EDSTABLETOOL_ERROR "Unknown option character `\\x%x'.\n", optopt);
- }
- return EXIT_FAILURE;
- break;
-
- default:
- return EXIT_FAILURE;
- break;
- }
+ switch (arg)
+ {
+ case 'p':
+ EdsTableTool_Global.AllowPassthrough = true;
+ break;
+
+ case 'e':
+ if (luaL_loadstring(lua, optarg) != LUA_OK)
+ {
+ fprintf(stderr,
+ EDSTABLETOOL_ERROR "Invalid command line expression: %s\n",
+ luaL_tolstring(lua, -1, NULL));
+ lua_pop(lua, 2);
+ return EXIT_FAILURE;
+ }
+
+ if (lua_pcall(lua, 0, 0, 1) != LUA_OK)
+ {
+ fprintf(stderr,
+ EDSTABLETOOL_ERROR "Cannot evaluate command line expression: %s\n",
+ luaL_tolstring(lua, -1, NULL));
+ lua_pop(lua, 2);
+ return EXIT_FAILURE;
+ }
+ break;
+
+ case '?':
+ if (isprint(optopt))
+ {
+ fprintf(stderr, EDSTABLETOOL_ERROR "Unknown option `-%c'.\n", optopt);
+ }
+ else
+ {
+ fprintf(stderr, EDSTABLETOOL_ERROR "Unknown option character `\\x%x'.\n", optopt);
+ }
+ return EXIT_FAILURE;
+ break;
+
+ default:
+ return EXIT_FAILURE;
+ break;
+ }
}
/* All additional args are input files. If none, this should be considered an error */
@@ -1152,7 +1199,7 @@ int main(int argc, char *argv[])
}
else
{
- fprintf(stderr, EDSTABLETOOL_ERROR "Unable to handle file argument: %s\n",argv[arg]);
+ fprintf(stderr, EDSTABLETOOL_ERROR "Unable to handle file argument: %s\n", argv[arg]);
return EXIT_FAILURE;
}
}
diff --git a/cfecfs/eds2cfetbl/scripts/eds_tbltool_filedef.h b/cfecfs/eds2cfetbl/scripts/eds_tbltool_filedef.h
index 9f39f90..d7ecc9b 100644
--- a/cfecfs/eds2cfetbl/scripts/eds_tbltool_filedef.h
+++ b/cfecfs/eds2cfetbl/scripts/eds_tbltool_filedef.h
@@ -10,8 +10,11 @@ EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_CmdTopicIdToMsgId(uint16_t TopicId, uint1
EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_TlmTopicIdToMsgId(uint16_t TopicId, uint16_t InstanceNum);
uint16_t EdsTableTool_GetProcessorId(void);
-void EdsTableTool_DoExport(const void *filedefptr, const void *objptr, size_t objsize, const char *typename, size_t typesize);
-
+void EdsTableTool_DoExport(const void *filedefptr,
+ const void *objptr,
+ size_t objsize,
+ const char *typename,
+ size_t typesize);
static inline EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_GlobalCmdTopicIdToMsgId(uint16_t TopicId)
{
@@ -37,5 +40,4 @@ static inline EdsDataType_CFE_SB_MsgIdValue_t CFE_SB_LocalTlmTopicIdToMsgId(uint
return CFE_SB_TlmTopicIdToMsgId(TopicId, EdsTableTool_GetProcessorId());
}
-
#endif
diff --git a/cfecfs/edsmsg/eds/cfe_hdr.xml b/cfecfs/edsmsg/eds/cfe_hdr.xml
index f2acfb8..6c64643 100644
--- a/cfecfs/edsmsg/eds/cfe_hdr.xml
+++ b/cfecfs/edsmsg/eds/cfe_hdr.xml
@@ -91,6 +91,7 @@
-->
+
diff --git a/cfecfs/edsmsg/fsw/inc/edsmsg_dispatcher.h b/cfecfs/edsmsg/fsw/inc/edsmsg_dispatcher.h
index ee81450..c7c0303 100644
--- a/cfecfs/edsmsg/fsw/inc/edsmsg_dispatcher.h
+++ b/cfecfs/edsmsg/fsw/inc/edsmsg_dispatcher.h
@@ -74,7 +74,9 @@
* \param DispatchTable Pointer to the dispatch table
* \returns If successfully dispatched, returns code from handler function, otherwise an error code.
*/
-CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ComponentId, const CFE_SB_Buffer_t *Buffer,
- const void *DispatchTable);
+CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId,
+ EdsLib_Id_t ComponentId,
+ const CFE_SB_Buffer_t *Buffer,
+ const void *DispatchTable);
#endif /* edsmsg_dispatcher_H */
diff --git a/cfecfs/edsmsg/fsw/inc/edsmsg_hdr.h b/cfecfs/edsmsg/fsw/inc/edsmsg_hdr.h
index 84a47d4..982df2d 100644
--- a/cfecfs/edsmsg/fsw/inc/edsmsg_hdr.h
+++ b/cfecfs/edsmsg/fsw/inc/edsmsg_hdr.h
@@ -65,18 +65,18 @@
/**
* \brief Macro to initialize a command header, useful in tables that define commands
*/
-#define CFE_MSG_CMD_HDR_INIT(mid, size, fc, cksum) \
- { \
+#define CFE_MSG_CMD_HDR_INIT(mid, size, fc, cksum) \
+ { \
.CommandHeader = { \
.Message.CCSDS.CommonHdr = \
{ \
.SecHdrFlags = (mid) >> 11, \
.AppId = (mid) & 0x7FF, \
.SeqFlag = 0x03, \
- .Length = (size), \
+ .Length = (size - 7), \
}, \
.Sec = {.FunctionCode = (fc), .Checksum = (cksum)} \
- } \
+ } \
}
/*
diff --git a/cfecfs/edsmsg/fsw/src/edsmsg_dispatcher.c b/cfecfs/edsmsg/fsw/src/edsmsg_dispatcher.c
index a0586ab..9d8bbc7 100644
--- a/cfecfs/edsmsg/fsw/src/edsmsg_dispatcher.c
+++ b/cfecfs/edsmsg/fsw/src/edsmsg_dispatcher.c
@@ -161,8 +161,8 @@ bool CFE_EDSMSG_Dispatch_CheckComponentMatch(EdsLib_Id_t ComponentId, CFE_Missio
* This just finds the base type using the information in the EDS DB only
*
*-----------------------------------------------------------------*/
-CFE_Status_t CFE_EDSMSG_Dispatch_FindArgBaseType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t CompIntfId,
- EdsLib_Id_t *ArgTypeBuf)
+CFE_Status_t
+CFE_EDSMSG_Dispatch_FindArgBaseType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t CompIntfId, EdsLib_Id_t *ArgTypeBuf)
{
const EdsLib_DatabaseObject_t *GD;
EdsLib_Id_t CommandEdsId;
@@ -199,8 +199,9 @@ CFE_Status_t CFE_EDSMSG_Dispatch_FindArgBaseType(EdsLib_Id_t DeclIntfId, EdsLib_
* expected/defined size in EDS
*
*-----------------------------------------------------------------*/
-CFE_Status_t CFE_EDSMSG_Dispatch_CheckActualBufferType(const CFE_SB_Buffer_t *Buffer, EdsLib_Id_t *EdsId,
- uint32_t *DispatchTblPosition)
+CFE_Status_t CFE_EDSMSG_Dispatch_CheckActualBufferType(const CFE_SB_Buffer_t *Buffer,
+ EdsLib_Id_t *EdsId,
+ uint32_t *DispatchTblPosition)
{
const EdsLib_DatabaseObject_t *GD;
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
@@ -254,8 +255,10 @@ CFE_Status_t CFE_EDSMSG_Dispatch_CheckActualBufferType(const CFE_SB_Buffer_t *Bu
* Completely look up the data type from the supplied interface IDs
*
*-----------------------------------------------------------------*/
-CFE_Status_t CFE_EDSMSG_Dispatch_FindArgType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ParentIntfId,
- const CFE_SB_Buffer_t *Buffer, uint32_t *DispatchPosition)
+CFE_Status_t CFE_EDSMSG_Dispatch_FindArgType(EdsLib_Id_t DeclIntfId,
+ EdsLib_Id_t ParentIntfId,
+ const CFE_SB_Buffer_t *Buffer,
+ uint32_t *DispatchPosition)
{
CFE_Status_t ReturnCode;
EdsLib_Id_t ArgType;
@@ -281,15 +284,15 @@ CFE_Status_t CFE_EDSMSG_Dispatch_FindArgType(EdsLib_Id_t DeclIntfId, EdsLib_Id_t
* Finds the matching handler function from the dispatch table
*
*-----------------------------------------------------------------*/
-CFE_EDSMSG_DispatchFunc_t CFE_EDSMSG_Dispatch_LookupHandler(const void *DispatchTable, size_t DispatchStartOffset,
- uint32_t DispatchPosition)
+CFE_EDSMSG_DispatchFunc_t
+CFE_EDSMSG_Dispatch_LookupHandler(const void *DispatchTable, size_t DispatchStartOffset, uint32_t DispatchPosition)
{
const uint8 *MemAddr;
const CFE_EDSMSG_DispatchFunc_t *DispatchTbl;
/* calculate the address of the first handler routine for this intf
* Note the START offsets are in bytes, so this must be done in uint8* logic */
- MemAddr = (const uint8 *)DispatchTable;
+ MemAddr = (const uint8 *)DispatchTable;
MemAddr += DispatchStartOffset;
/* now shift to the correct type (function pointer) and apply the position offset */
@@ -304,8 +307,10 @@ CFE_EDSMSG_DispatchFunc_t CFE_EDSMSG_Dispatch_LookupHandler(const void *Dispatch
* Dispatch the message based on the IDs and dispatch table
*
*-----------------------------------------------------------------*/
-CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ComponentId, const CFE_SB_Buffer_t *Buffer,
- const void *DispatchTable)
+CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId,
+ EdsLib_Id_t ComponentId,
+ const CFE_SB_Buffer_t *Buffer,
+ const void *DispatchTable)
{
CFE_Status_t ReturnCode;
CFE_MissionLib_TopicInfo_t TopicInfo;
diff --git a/cfecfs/edsmsg/fsw/src/edsmsg_init.c b/cfecfs/edsmsg/fsw/src/edsmsg_init.c
index 5c1a76a..26714d4 100644
--- a/cfecfs/edsmsg/fsw/src/edsmsg_init.c
+++ b/cfecfs/edsmsg/fsw/src/edsmsg_init.c
@@ -26,6 +26,7 @@
*/
#include "cfe_msg.h"
#include "cfe_time.h"
+#include "cfe_sb.h"
#include "cfe_missionlib_runtime.h"
#include "ccsds_spacepacket_eds_datatypes.h"
@@ -41,8 +42,7 @@
*-----------------------------------------------------------------*/
CFE_Status_t CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size)
{
- EdsDataType_CCSDS_CommonHdr_t *CommonHdr;
- CFE_Status_t Status;
+ CFE_Status_t Status;
if (MsgPtr == NULL || Size < sizeof(EdsDataType_CCSDS_CommonHdr_t))
{
@@ -52,17 +52,22 @@ CFE_Status_t CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_M
/* Clear and set defaults */
memset(MsgPtr, 0, Size);
- /* Set various fields in the MsgPtr Metadata object from the bits in MsgId */
- Status = CFE_MSG_SetMsgId(MsgPtr, MsgId);
- if (Status == CFE_SUCCESS)
+ /* Allow "CFE_SB_INVALID_MSG_ID" here - in some cases the real msgid is filled in later */
+ /* however the size should always be a valid value */
+ if (CFE_SB_MsgIdToValue(MsgId) == CFE_SB_MsgIdToValue(CFE_SB_INVALID_MSG_ID))
+ {
+ Status = CFE_SUCCESS;
+ }
+ else
{
- CommonHdr = (EdsDataType_CCSDS_CommonHdr_t *)(void *)MsgPtr;
+ Status = CFE_MSG_SetMsgId(MsgPtr, MsgId);
+ }
- /* Default to complete packets */
- CommonHdr->SeqFlag = 3; /* jphfix: enum? */
+ if (Status == CFE_SUCCESS)
+ {
+ CFE_MSG_SetSegmentationFlag(MsgPtr, CFE_MSG_SegFlag_Unsegmented);
- /* Set the standard size field */
- CommonHdr->Length = Size - 7;
+ Status = CFE_MSG_SetSize(MsgPtr, Size);
}
return Status;
diff --git a/cfecfs/edsmsg/fsw/ut-stubs/edsmsg_dispatcher_stubs.c b/cfecfs/edsmsg/fsw/ut-stubs/edsmsg_dispatcher_stubs.c
index 7d33a5a..6fcc838 100644
--- a/cfecfs/edsmsg/fsw/ut-stubs/edsmsg_dispatcher_stubs.c
+++ b/cfecfs/edsmsg/fsw/ut-stubs/edsmsg_dispatcher_stubs.c
@@ -32,8 +32,10 @@
* Generated stub function for CFE_EDSMSG_Dispatch()
* ----------------------------------------------------
*/
-CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId, EdsLib_Id_t ComponentId, const CFE_SB_Buffer_t *Buffer,
- const void *DispatchTable)
+CFE_Status_t CFE_EDSMSG_Dispatch(EdsLib_Id_t DeclIntfId,
+ EdsLib_Id_t ComponentId,
+ const CFE_SB_Buffer_t *Buffer,
+ const void *DispatchTable)
{
UT_GenStub_SetupReturnBuffer(CFE_EDSMSG_Dispatch, CFE_Status_t);
diff --git a/cfecfs/missionlib/cmake/dbobj_patternrules.mk b/cfecfs/missionlib/cmake/dbobj_patternrules.mk
index 0a02dd3..d39ed46 100644
--- a/cfecfs/missionlib/cmake/dbobj_patternrules.mk
+++ b/cfecfs/missionlib/cmake/dbobj_patternrules.mk
@@ -21,9 +21,11 @@ include $(EDS_REPO_SOURCE_DIR)/edslib/cmake/base_patternrules.mk
# linker logic that CMake uses, this just assumes a GNU-style LD, and that the file extension
# (.so or .obj) indicates the style of loadable object being used.
+$(O)/$(EDS_FILE_PREFIX)_sb_dispatchdb.so: EXTRA_LINK_LIBS=-l:$(EDS_FILE_PREFIX)_db.so
+
$(O)/%.so:
@echo EDS: Linking shared object $(@) for $(EDSTOOL_ARCH)
- $(LD) $(SHARED_LDFLAGS) -shared -o $@ $^ -L$(O) -l:$(EDS_FILE_PREFIX)_db.so
+ $(LD) $(SHARED_LDFLAGS) -shared -o $@ $^ -L$(O) $(EXTRA_LINK_LIBS)
$(O)/%.obj:
@echo EDS: Linking relocatable object $(@) for $(EDSTOOL_ARCH)
diff --git a/cfecfs/missionlib/eds/91-write_cosmos_txt.lua b/cfecfs/missionlib/eds/91-write_cosmos_txt.lua
index b27b58a..9f87eb3 100644
--- a/cfecfs/missionlib/eds/91-write_cosmos_txt.lua
+++ b/cfecfs/missionlib/eds/91-write_cosmos_txt.lua
@@ -150,9 +150,13 @@ write_cosmos_lineitem = function(output,line_writer,entry,qual_prefix,descr)
bits_remainder = bits_remainder - attribs.bitsize
end
attribs.bitsize = bits_remainder
- elseif (entry.entity_type == "STRING_DATATYPE" or entry.entity_type == "BINARY_DATATYPE") then
+ elseif (entry.entity_type == "STRING_DATATYPE") then
attribs.ctype = "STRING"
- elseif (SEDS.index_datatype_filter(entry)) then
+ elseif (entry.entity_type == "BINARY_DATATYPE") then
+ attribs.ctype = "BLOCK"
+ elseif (entry.entity_type == "FLOAT_DATATYPE") then
+ attribs.ctype = "FLOAT"
+ elseif (entry.entity_type == "BOOLEAN_DATATYPE" or SEDS.index_datatype_filter(entry)) then
attribs.ctype = (entry.is_signed and "INT") or "UINT"
-- This only handles integers
@@ -193,38 +197,68 @@ write_cosmos_block = function(output,line_writer,entry,qual_prefix,descr)
end
-
-- -------------------------------------------------------------------------
-- Helper function: write a flattened array, adding a digit to the name prefix
-- -------------------------------------------------------------------------
write_cosmos_array_members = function(output,line_writer,arr,qual_prefix)
- local min, max
-
-- Arrays can be dimensioned by an index type, and that type may have a better string representation
-- This also means that the range could be something other than the typical limits
+ local min, max
+ local minv, maxv
local dimension_typename
+ local writer
+ local datatyperef
+ local dimension_obj
+
+ -- This wrapper handles the case where the array elements are not at byte boundaries
+ -- The output is expressed as a series of 8 bit values (packed)
+ local_packedarray_writer = function(idx, element_qual_prefix)
+ local attribs = {
+ name = SEDS.to_macro_name(element_qual_prefix),
+ ctype = "UINT",
+ bitsize = 8,
+ descr = string.format("%s packed byte %d", qual_prefix or "array", idx)
+ }
+ line_writer(output, attribs)
+ end
+
+ -- This wrapper handles the normal case where the array elements are a
+ -- whole number of bytes, and thus spelled out normally in the definition
+ local_array_writer = function(idx, element_qual_prefix)
+ write_cosmos_block(output,line_writer,datatyperef,element_qual_prefix)
+ end
+
+ datatyperef = arr.datatyperef
- for dimension in arr:iterate_subtree("DIMENSION") do
- if (dimension.indextyperef) then
- dimension_typename = dimension.indextyperef:get_qualified_name()
- min = dimension.indextyperef.resolved_range.min
- max = dimension.indextyperef.resolved_range.max
+ -- Check if this needs to be output as a bitmap
+ if ((datatyperef.resolved_size.bits % 8) ~= 0) then
+ -- Packing: The dimension is the size of the whole array
+ min = { value = 0, inclusive = true }
+ max = { value = arr.resolved_size.bits / 8, inclusive = false }
+ writer = local_packedarray_writer
+ else
+ -- Normal: The actual dimension will be used
+ for dimension in arr:iterate_subtree("DIMENSION") do
+ if (dimension.indextyperef) then
+ dimension_typename = dimension.indextyperef:get_qualified_name()
+ min = dimension.indextyperef.resolved_range.min
+ max = dimension.indextyperef.resolved_range.max
+ end
end
+ writer = local_array_writer
end
-- As a fallback use a generic 32-bit integer as the index type
- local dimension_obj = SEDS.edslib.NewObject(dimension_typename or "BASE_TYPES/int32")
+ dimension_obj = SEDS.edslib.NewObject(dimension_typename or "BASE_TYPES/int32")
-- Determine the usable min/max -- this means adjusting for inclusiveness of the limits
- local minv
if (min) then
minv = min.value + (min.inclusive and 0 or 1)
else
minv = 0
end
- local maxv
if (max) then
maxv = max.value - (max.inclusive and 0 or 1)
else
@@ -234,7 +268,7 @@ write_cosmos_array_members = function(output,line_writer,arr,qual_prefix)
for i=minv,maxv do
dimension_obj(i)
- write_cosmos_block(output,line_writer,arr.datatyperef,append_qual_prefix(qual_prefix, dimension_obj))
+ writer(i, append_qual_prefix(qual_prefix, dimension_obj))
end
@@ -272,23 +306,12 @@ local write_tlm_intf_items = function (output,ds,reqintf,msgid,argtype)
tlmname = string.sub(tlmname, 1, -5)
end
- output:write(string.format("TELEMETRY %s %s %s_ENDIAN \"%s\"", global_fsw_title, tlmname,
- endianness, reqintf.attributes.shortdescription or "Telemetry Message"))
+ -- Use the predefined values in the cfs_tlm_hdr() function for packet specifics
+ output:write(string.format("<%%= cfs_tlm_hdr(target_name, '%s', \"%s\") %%>", tlmname,
+ reqintf.attributes.shortdescription or "Telemetry Message"))
output:start_group("")
-
- -- BACKWARD COMPATIBILITY: A proper identification of the packet involves multiple fields.
- -- Historically these were merged into a single 16-bit "StreamID" value and that's what
- -- appears to be done in existing/old cosmos DB files. This mimics that for now. There
- -- should be a better/more correct way to do this. But for now, this just duplicates the
- -- simplified (3x 16-bit UINT) view of the CCSDS v1 header. These should always be big-endian.
- output:write(string.format("APPEND_ID_ITEM CCSDS_STREAMID 16 UINT 0x%04X \"CCSDS Packet Identification\" FORMAT_STRING \"0x%%04X\"%s", msgid.Value(), ccsds_append))
- output:write(string.format("APPEND_ITEM CCSDS_SEQUENCE 16 UINT \"CCSDS Packet Sequence Control\" FORMAT_STRING \"0x%%04X\"%s", ccsds_append))
- output:write(string.format("APPEND_ITEM CCSDS_LENGTH 16 UINT \"CCSDS Packet Data Length\"%s", ccsds_append))
- output:write(string.format("APPEND_ITEM SECONDS 32 UINT \"Whole number of Seconds since CFS Epoch\"%s", ccsds_append))
- output:write(string.format("APPEND_ITEM SUBSECS 16 UINT \"Fractional portion of Seconds since CFS Epoch\"%s", ccsds_append))
-
-- Write the definition of the payload
-- Do not output the basetype, only direct members (Payload)
-- This is done by checking that refnode is non-nil
@@ -314,22 +337,12 @@ local write_cmd_intf_params = function (output,ds,reqintf,msgid,cc)
cmdname = string.sub(cmdname, 1, -5)
end
- output:write(string.format("COMMAND %s %s %s_ENDIAN \"%s\"", global_fsw_title, cmdname,
- endianness, argtype.attributes.shortdescription or "Telecommand Message"))
+ -- Use the predefined values in the cfs_cmd_hdr() function for packet specifics
+ output:write(string.format("<%%= cfs_cmd_hdr(target_name, '%s', %d, \"%s\") %%>", cmdname, cc.value,
+ argtype.attributes.shortdescription or "Telecommand Message"))
output:start_group("")
- -- BACKWARD COMPATIBILITY: A proper identification of the packet involves multiple fields.
- -- Historically these were merged into a single 16-bit "StreamID" value and that's what
- -- appears to be done in existing/old cosmos DB files. This mimics that for now. There
- -- should be a better/more correct way to do this. But for now, this just duplicates the
- -- simplified (3x 16-bit UINT) view of the CCSDS v1 header. These should always be big-endian.
- output:write(string.format("APPEND_ID_PARAMETER CCSDS_STREAMID 16 UINT MIN MAX 0x%04X \"CCSDS Packet Identification\" FORMAT_STRING \"0x%%04X\"%s", msgid.Value(), ccsds_append))
- output:write(string.format("APPEND_PARAMETER CCSDS_SEQUENCE 16 UINT MIN MAX 0xC000 \"CCSDS Packet Sequence Control\" FORMAT_STRING \"0x%%04X\"%s", ccsds_append))
- output:write(string.format("APPEND_PARAMETER CCSDS_LENGTH 16 UINT MIN MAX %d \"CCSDS Packet Data Length\"%s", math.ceil(argtype.resolved_size.bits / 8) - 7, ccsds_append))
- output:write(string.format("APPEND_PARAMETER CCSDS_FC 8 UINT MIN MAX %d \"CCSDS Command Function Code\"", cc.value))
- output:write(string.format("APPEND_PARAMETER CCSDS_CHECKSUM 8 UINT MIN MIN 0 \"Checksum\""))
-
-- Write the definition of the payload
-- Do not output the basetype, only direct members (Payload)
-- This is done by checking that refnode is non-nil
@@ -355,7 +368,7 @@ for _,instance in ipairs(SEDS.highlevel_interfaces) do
-- The various interfaces should be attached under required_links
for _,binding in ipairs(instance.required_links) do
local reqintf = binding.reqintf
- local intf_type_str = reqintf.type:get_qualified_name()
+ local intf_type_str = reqintf.type:get_qualified_name()
if (intf_type_str == "CFE_SB/Telemetry" or intf_type_str == "CFE_SB/Telecommand") then
local cmd = reqintf.intf_commands and reqintf.intf_commands[1]
@@ -367,13 +380,14 @@ for _,instance in ipairs(SEDS.highlevel_interfaces) do
local argtype = cmd.args[1].type
if (sb_params) then
- local file = "cosmos/" .. SEDS.to_filename(reqintf.name .. "_cosmos_intf.txt", ds.name)
+ local file = "cosmos/" .. SEDS.to_filename(reqintf.name .. "_def.txt", ds.name)
local msgid = sb_params.PubSub.MsgId -- This is the actual hex msgid value
local output
if (reqintf.type.name == "Telecommand") then
if (cmd.cc_list) then
output = SEDS.output_open(file)
+
for _,cc in ipairs(cmd.cc_list) do
write_cmd_intf_params(output,ds,reqintf,msgid,cc)
output:add_whitespace(1)
@@ -391,4 +405,3 @@ for _,instance in ipairs(SEDS.highlevel_interfaces) do
end
end
end
-
diff --git a/cfecfs/missionlib/fsw/inc/cfe_missionlib_api.h b/cfecfs/missionlib/fsw/inc/cfe_missionlib_api.h
index 85f0939..85bee6f 100644
--- a/cfecfs/missionlib/fsw/inc/cfe_missionlib_api.h
+++ b/cfecfs/missionlib/fsw/inc/cfe_missionlib_api.h
@@ -139,8 +139,9 @@ extern "C"
* @param[out] TopicInfo output buffer for detail information, if successful
* @return CFE_MISSIONLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, uint16_t TopicId,
- CFE_MissionLib_TopicInfo_t *TopicInfo);
+ int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
+ uint16_t TopicId,
+ CFE_MissionLib_TopicInfo_t *TopicInfo);
/**
* Get the instance name corresponding to an instance number
@@ -196,7 +197,8 @@ extern "C"
* @param[inout] OpaqueArg an argument that is passed to the callback, may be NULL if not needed
*/
void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
- CFE_MissionLib_TopicInfo_Callback_t Callback, void *OpaqueArg);
+ CFE_MissionLib_TopicInfo_Callback_t Callback,
+ void *OpaqueArg);
/**
* Finds a topic ID matching the given interface ID
@@ -210,7 +212,8 @@ extern "C"
* @return CFE_MISSIONLIB_SUCCESS if successful, error code if unsuccessful
*/
int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
- EdsLib_Id_t IntfEdsId, uint16_t *TopicIdBuffer);
+ EdsLib_Id_t IntfEdsId,
+ uint16_t *TopicIdBuffer);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/cfecfs/missionlib/fsw/inc/cfe_missionlib_runtime.h b/cfecfs/missionlib/fsw/inc/cfe_missionlib_runtime.h
index 5a6d231..e23519e 100644
--- a/cfecfs/missionlib/fsw/inc/cfe_missionlib_runtime.h
+++ b/cfecfs/missionlib/fsw/inc/cfe_missionlib_runtime.h
@@ -69,21 +69,21 @@ extern "C"
{
#endif
- void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
- const EdsComponent_CFE_SB_Listener_t * Input);
- void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t * Output,
+ bool CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
+ const EdsComponent_CFE_SB_Listener_t *Input);
+ bool CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input);
- void CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
- const EdsComponent_CFE_SB_Publisher_t * Input);
- void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t * Output,
+ bool CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
+ const EdsComponent_CFE_SB_Publisher_t *Input);
+ bool CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input);
bool CFE_MissionLib_PubSub_IsListenerComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params);
bool CFE_MissionLib_PubSub_IsPublisherComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params);
void CFE_MissionLib_Get_PubSub_Parameters(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params,
- const EdsDataType_CFE_HDR_Message_t * Packet);
- void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t * Packet,
+ const EdsDataType_CFE_HDR_Message_t *Packet);
+ void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t *Packet,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params);
#ifdef __cplusplus
diff --git a/cfecfs/missionlib/fsw/src/cfe_missionlib_api.c b/cfecfs/missionlib/fsw/src/cfe_missionlib_api.c
index 7be4a5e..e97313f 100644
--- a/cfecfs/missionlib/fsw/src/cfe_missionlib_api.c
+++ b/cfecfs/missionlib/fsw/src/cfe_missionlib_api.c
@@ -101,8 +101,9 @@ uint16_t CFE_MissionLib_GetNumInstances(const CFE_MissionLib_SoftwareBus_Interfa
* Public API function
*
*-----------------------------------------------------------------*/
-int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, uint16_t TopicId,
- CFE_MissionLib_TopicInfo_t *TopicInfo)
+int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
+ uint16_t TopicId,
+ CFE_MissionLib_TopicInfo_t *TopicInfo)
{
const CFE_MissionLib_TopicId_Entry_t *TopicPtr;
int32_t Status;
@@ -200,7 +201,8 @@ uint16_t CFE_MissionLib_GetInstanceNumber(const CFE_MissionLib_SoftwareBus_Inter
*
*-----------------------------------------------------------------*/
void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
- CFE_MissionLib_TopicInfo_Callback_t Callback, void *OpaqueArg)
+ CFE_MissionLib_TopicInfo_Callback_t Callback,
+ void *OpaqueArg)
{
const CFE_MissionLib_TopicId_Entry_t *TopicPtr;
uint16_t TopicId;
@@ -218,8 +220,9 @@ void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t
* Public API function
*
*-----------------------------------------------------------------*/
-int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, EdsLib_Id_t IntfEdsId,
- uint16_t *TopicIdBuffer)
+int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
+ EdsLib_Id_t IntfEdsId,
+ uint16_t *TopicIdBuffer)
{
const CFE_MissionLib_TopicId_Entry_t *TopicPtr;
uint16_t TopicId;
diff --git a/cfecfs/missionlib/fsw/src/cfe_missionlib_runtime_default.c b/cfecfs/missionlib/fsw/src/cfe_missionlib_runtime_default.c
index 20f4afe..1654804 100644
--- a/cfecfs/missionlib/fsw/src/cfe_missionlib_runtime_default.c
+++ b/cfecfs/missionlib/fsw/src/cfe_missionlib_runtime_default.c
@@ -130,7 +130,8 @@ static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_GLOBAL_TLM_LIMITS =
.TopicBase = EdsParam_CFE_MISSION_GLOBAL_TLM_BASE_TOPICID,
.TopicMax = EdsParam_CFE_MISSION_GLOBAL_TLM_MAX_TOPICID,
.InstanceBase = 0,
- .InstanceMax = 1};
+ .InstanceMax = 1
+};
static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_LOCAL_TLM_LIMITS = {
.CheckBitsMask = (CFE_MISSIONLIB_MSGID_TYPE_MASK << CFE_MISSIONLIB_MSGID_TYPE_SHIFT),
@@ -138,7 +139,8 @@ static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_LOCAL_TLM_LIMITS = {
.TopicBase = EdsParam_CFE_MISSION_TELEMETRY_BASE_TOPICID,
.TopicMax = EdsParam_CFE_MISSION_TELEMETRY_MAX_TOPICID,
.InstanceBase = 1,
- .InstanceMax = 1 + CFE_MISSIONLIB_MSGID_SUBSYS_MASK};
+ .InstanceMax = 1 + CFE_MISSIONLIB_MSGID_SUBSYS_MASK
+};
static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_GLOBAL_CMD_LIMITS = {
.CheckBitsMask =
@@ -148,7 +150,8 @@ static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_GLOBAL_CMD_LIMITS =
.TopicBase = EdsParam_CFE_MISSION_GLOBAL_CMD_BASE_TOPICID,
.TopicMax = EdsParam_CFE_MISSION_GLOBAL_CMD_MAX_TOPICID,
.InstanceBase = 0,
- .InstanceMax = 1};
+ .InstanceMax = 1
+};
static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_LOCAL_CMD_LIMITS = {
.CheckBitsMask = (CFE_MISSIONLIB_MSGID_TYPE_MASK << CFE_MISSIONLIB_MSGID_TYPE_SHIFT),
@@ -156,7 +159,8 @@ static const CFE_MissionLib_TopicId_Limits_t CFE_MISSIONLIB_LOCAL_CMD_LIMITS = {
.TopicBase = EdsParam_CFE_MISSION_TELECOMMAND_BASE_TOPICID,
.TopicMax = EdsParam_CFE_MISSION_TELECOMMAND_MAX_TOPICID,
.InstanceBase = 1,
- .InstanceMax = 1 + CFE_MISSIONLIB_MSGID_SUBSYS_MASK};
+ .InstanceMax = 1 + CFE_MISSIONLIB_MSGID_SUBSYS_MASK
+};
static inline uint32_t CFE_MissionLib_GetMsgIdApid(const EdsDataType_CFE_SB_MsgId_t *MsgId)
{
@@ -206,7 +210,7 @@ static inline void CFE_MissionLib_SetMsgIdInterfaceType(EdsDataType_CFE_SB_MsgId
* is not required to pack the bits this way, but the shifts/masks used above
* will produce a MsgId bit pattern comparable to existing versions of CFE.
*/
-static inline void CFE_MissionLib_SpacePacketBasic_BitsToMsgId(EdsDataType_CFE_SB_MsgId_t * MsgId,
+static inline void CFE_MissionLib_SpacePacketBasic_BitsToMsgId(EdsDataType_CFE_SB_MsgId_t *MsgId,
const EdsDataType_CCSDS_SpacePacketBasic_t *Packet)
{
EdsDataType_CFE_SB_MsgId_t ApidPart;
@@ -218,7 +222,7 @@ static inline void CFE_MissionLib_SpacePacketBasic_BitsToMsgId(EdsDataType_CFE_S
}
static inline void CFE_MissionLib_SpacePacketBasic_BitsFromMsgId(EdsDataType_CCSDS_SpacePacketBasic_t *Packet,
- const EdsDataType_CFE_SB_MsgId_t * MsgId)
+ const EdsDataType_CFE_SB_MsgId_t *MsgId)
{
EdsDataType_CFE_SB_MsgId_t ApidPart;
@@ -232,7 +236,7 @@ static inline void CFE_MissionLib_SpacePacketBasic_BitsFromMsgId(EdsDataType_CCS
}
/* The following translations apply only for V2 (ApidQ) headers */
-static inline void CFE_MissionLib_SpacePacketApidQ_BitsToMsgId(EdsDataType_CFE_SB_MsgId_t * MsgId,
+static inline void CFE_MissionLib_SpacePacketApidQ_BitsToMsgId(EdsDataType_CFE_SB_MsgId_t *MsgId,
const EdsDataType_CCSDS_SpacePacketApidQ_t *Packet)
{
CFE_MissionLib_SetMsgIdApid(MsgId, Packet->CommonHdr.AppId);
@@ -242,7 +246,7 @@ static inline void CFE_MissionLib_SpacePacketApidQ_BitsToMsgId(EdsDataType_CFE_S
}
static inline void CFE_MissionLib_SpacePacketApidQ_BitsFromMsgId(EdsDataType_CCSDS_SpacePacketApidQ_t *Packet,
- const EdsDataType_CFE_SB_MsgId_t * MsgId)
+ const EdsDataType_CFE_SB_MsgId_t *MsgId)
{
Packet->CommonHdr.VersionId = 1;
Packet->CommonHdr.AppId = CFE_MissionLib_GetMsgIdApid(MsgId);
@@ -252,11 +256,12 @@ static inline void CFE_MissionLib_SpacePacketApidQ_BitsFromMsgId(EdsDataType_CCS
}
static bool CFE_MissionLib_TryMapping(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
- const CFE_MissionLib_TopicId_Limits_t *Limits, uint16_t InstanceIdx,
- uint16_t TopicIdx)
+ const CFE_MissionLib_TopicId_Limits_t *Limits,
+ uint16_t InstanceIdx,
+ uint16_t TopicIdx)
{
InstanceIdx -= Limits->InstanceBase;
- TopicIdx -= Limits->TopicBase;
+ TopicIdx -= Limits->TopicBase;
if (InstanceIdx >= Limits->InstanceMax || TopicIdx >= Limits->TopicMax)
{
@@ -272,8 +277,9 @@ static bool CFE_MissionLib_TryMapping(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *
return true;
}
-static bool CFE_MissionLib_TryUnmapping(uint16_t *InstanceIdOut, uint16_t *TopicIdOut,
- const CFE_MissionLib_TopicId_Limits_t * Limits,
+static bool CFE_MissionLib_TryUnmapping(uint16_t *InstanceIdOut,
+ uint16_t *TopicIdOut,
+ const CFE_MissionLib_TopicId_Limits_t *Limits,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
EdsDataType_CFE_SB_MsgId_t TempMsgId;
@@ -284,7 +290,7 @@ static bool CFE_MissionLib_TryUnmapping(uint16_t *InstanceIdOut, uint16_t *Topic
return false;
}
- TempMsgId = Input->MsgId;
+ TempMsgId = Input->MsgId;
TempMsgId.Value ^= Limits->CheckBitsValue;
*InstanceIdOut = CFE_MissionLib_GetMsgIdSubsystem(&TempMsgId) + Limits->InstanceBase;
@@ -293,29 +299,47 @@ static bool CFE_MissionLib_TryUnmapping(uint16_t *InstanceIdOut, uint16_t *Topic
return true;
}
-void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
- const EdsComponent_CFE_SB_Listener_t * Input)
+bool CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
+ const EdsComponent_CFE_SB_Listener_t *Input)
{
+ bool Result;
+
memset(Output, 0, sizeof(*Output));
- if (!CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_LOCAL_CMD_LIMITS, Input->Telecommand.InstanceNumber,
- Input->Telecommand.TopicId))
+ Result = CFE_MissionLib_TryMapping(Output,
+ &CFE_MISSIONLIB_LOCAL_CMD_LIMITS,
+ Input->Telecommand.InstanceNumber,
+ Input->Telecommand.TopicId);
+
+ if (!Result)
{
- CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_CMD_LIMITS, 0, Input->Telecommand.TopicId);
+ Result = CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_CMD_LIMITS, 0, Input->Telecommand.TopicId);
}
+
+ return Result;
}
-void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t * Output,
+bool CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
+ bool Result;
+
memset(Output, 0, sizeof(*Output));
- if (!CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber, &Output->Telecommand.TopicId,
- &CFE_MISSIONLIB_GLOBAL_CMD_LIMITS, Input))
+ Result = CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber,
+ &Output->Telecommand.TopicId,
+ &CFE_MISSIONLIB_GLOBAL_CMD_LIMITS,
+ Input);
+
+ if (!Result)
{
- CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber, &Output->Telecommand.TopicId,
- &CFE_MISSIONLIB_LOCAL_CMD_LIMITS, Input);
+ Result = CFE_MissionLib_TryUnmapping(&Output->Telecommand.InstanceNumber,
+ &Output->Telecommand.TopicId,
+ &CFE_MISSIONLIB_LOCAL_CMD_LIMITS,
+ Input);
}
+
+ return Result;
}
bool CFE_MissionLib_PubSub_IsListenerComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params)
@@ -323,29 +347,47 @@ bool CFE_MissionLib_PubSub_IsListenerComponent(const EdsInterface_CFE_SB_Softwar
return (CFE_MissionLib_GetMsgIdInterfaceType(&Params->MsgId) == CFE_MISSIONLIB_MSGID_TELECOMMAND_BITS);
}
-void CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
- const EdsComponent_CFE_SB_Publisher_t * Input)
+bool CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
+ const EdsComponent_CFE_SB_Publisher_t *Input)
{
+ bool Result;
+
memset(Output, 0, sizeof(*Output));
- if (!CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_LOCAL_TLM_LIMITS, Input->Telemetry.InstanceNumber,
- Input->Telemetry.TopicId))
+ Result = CFE_MissionLib_TryMapping(Output,
+ &CFE_MISSIONLIB_LOCAL_TLM_LIMITS,
+ Input->Telemetry.InstanceNumber,
+ Input->Telemetry.TopicId);
+
+ if (!Result)
{
- CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_TLM_LIMITS, 0, Input->Telemetry.TopicId);
+ Result = CFE_MissionLib_TryMapping(Output, &CFE_MISSIONLIB_GLOBAL_TLM_LIMITS, 0, Input->Telemetry.TopicId);
}
+
+ return Result;
}
-void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t * Output,
+bool CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
+ bool Result;
+
memset(Output, 0, sizeof(*Output));
- if (!CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber, &Output->Telemetry.TopicId,
- &CFE_MISSIONLIB_LOCAL_TLM_LIMITS, Input))
+ Result = CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber,
+ &Output->Telemetry.TopicId,
+ &CFE_MISSIONLIB_LOCAL_TLM_LIMITS,
+ Input);
+
+ if (!Result)
{
- CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber, &Output->Telemetry.TopicId,
- &CFE_MISSIONLIB_GLOBAL_TLM_LIMITS, Input);
+ Result = CFE_MissionLib_TryUnmapping(&Output->Telemetry.InstanceNumber,
+ &Output->Telemetry.TopicId,
+ &CFE_MISSIONLIB_GLOBAL_TLM_LIMITS,
+ Input);
}
+
+ return Result;
}
bool CFE_MissionLib_PubSub_IsPublisherComponent(const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params)
@@ -354,13 +396,13 @@ bool CFE_MissionLib_PubSub_IsPublisherComponent(const EdsInterface_CFE_SB_Softwa
}
void CFE_MissionLib_Get_PubSub_Parameters(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params,
- const EdsDataType_CFE_HDR_Message_t * Packet)
+ const EdsDataType_CFE_HDR_Message_t *Packet)
{
memset(Params, 0, sizeof(*Params));
CFE_MISSIONLIB_GET_MSGID_BITS(EdsParam_CFE_MISSION_MSG_HEADER_TYPE, &Params->MsgId, &Packet->CCSDS);
}
-void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t * Packet,
+void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t *Packet,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Params)
{
CFE_MISSIONLIB_SET_MSGID_BITS(EdsParam_CFE_MISSION_MSG_HEADER_TYPE, &Packet->CCSDS, &Params->MsgId);
diff --git a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_handlers.c b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_handlers.c
index 8136b58..759aa6c 100644
--- a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_handlers.c
+++ b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_handlers.c
@@ -33,11 +33,14 @@
* Handler function for CFE_MissionLib_FindTopicByName()
* ----------------------------------------------------
*/
-void UT_DefaultHandler_CFE_MissionLib_FindTopicByName(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_FindTopicByName(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
- CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "TopicIdBuffer", uint16_t *), sizeof(uint16_t));
+ CFE_MissionLib_Stub_DefaultZeroOutput(FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "TopicIdBuffer", uint16_t *),
+ sizeof(uint16_t));
}
/*
@@ -45,10 +48,12 @@ void UT_DefaultHandler_CFE_MissionLib_FindTopicByName(void *UserObj, UT_EntryKey
* Handler function for CFE_MissionLib_GetTopicInfo()
* ----------------------------------------------------
*/
-void UT_DefaultHandler_CFE_MissionLib_GetTopicInfo(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_GetTopicInfo(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
- CFE_MissionLib_Stub_DefaultZeroOutput(FuncKey, Context,
+ CFE_MissionLib_Stub_DefaultZeroOutput(FuncKey,
+ Context,
UT_Hook_GetArgValueByName(Context, "TopicInfo", CFE_MissionLib_TopicInfo_t *),
sizeof(CFE_MissionLib_TopicInfo_t));
}
@@ -58,11 +63,14 @@ void UT_DefaultHandler_CFE_MissionLib_GetTopicInfo(void *UserObj, UT_EntryKey_t
* Handler function for CFE_MissionLib_FindTopicIdFromIntfId()
* ----------------------------------------------------
*/
-void UT_DefaultHandler_CFE_MissionLib_FindTopicIdFromIntfId(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_FindTopicIdFromIntfId(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
- CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "TopicIdBuffer", uint16_t *), sizeof(uint16_t));
+ CFE_MissionLib_Stub_DefaultZeroOutput(FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "TopicIdBuffer", uint16_t *),
+ sizeof(uint16_t));
}
/*
@@ -70,7 +78,8 @@ void UT_DefaultHandler_CFE_MissionLib_FindTopicIdFromIntfId(void *UserObj, UT_En
* Handler function for CFE_MissionLib_GetInstanceName()
* ----------------------------------------------------
*/
-void UT_DefaultHandler_CFE_MissionLib_GetInstanceName(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_GetInstanceName(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultStringOutput(FuncKey, Context);
@@ -81,7 +90,8 @@ void UT_DefaultHandler_CFE_MissionLib_GetInstanceName(void *UserObj, UT_EntryKey
* Handler function for CFE_MissionLib_GetInstanceNumber()
* ----------------------------------------------------
*/
-void UT_DefaultHandler_CFE_MissionLib_GetInstanceNumber(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_GetInstanceNumber(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
int32_t Status;
@@ -97,7 +107,8 @@ void UT_DefaultHandler_CFE_MissionLib_GetInstanceNumber(void *UserObj, UT_EntryK
* Handler function for CFE_MissionLib_GetTopicName()
* ----------------------------------------------------
*/
-void UT_DefaultHandler_CFE_MissionLib_GetTopicName(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_GetTopicName(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultStringOutput(FuncKey, Context);
diff --git a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_stubs.c b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_stubs.c
index 8d7d5e1..9fda64f 100644
--- a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_stubs.c
+++ b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_api_stubs.c
@@ -37,7 +37,8 @@ void UT_DefaultHandler_CFE_MissionLib_GetTopicInfo(void *, UT_EntryKey_t, const
* ----------------------------------------------------
*/
void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
- CFE_MissionLib_TopicInfo_Callback_t Callback, void *OpaqueArg)
+ CFE_MissionLib_TopicInfo_Callback_t Callback,
+ void *OpaqueArg)
{
UT_GenStub_AddParam(CFE_MissionLib_EnumerateTopics, const CFE_MissionLib_SoftwareBus_Interface_t *, SBDB);
UT_GenStub_AddParam(CFE_MissionLib_EnumerateTopics, CFE_MissionLib_TopicInfo_Callback_t, Callback);
@@ -51,8 +52,9 @@ void CFE_MissionLib_EnumerateTopics(const CFE_MissionLib_SoftwareBus_Interface_t
* Generated stub function for CFE_MissionLib_FindTopicIdFromIntfId()
* ----------------------------------------------------
*/
-int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, EdsLib_Id_t IntfEdsId,
- uint16_t *TopicIdBuffer)
+int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
+ EdsLib_Id_t IntfEdsId,
+ uint16_t *TopicIdBuffer)
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_FindTopicIdFromIntfId, int32_t);
@@ -60,7 +62,8 @@ int32_t CFE_MissionLib_FindTopicIdFromIntfId(const CFE_MissionLib_SoftwareBus_In
UT_GenStub_AddParam(CFE_MissionLib_FindTopicIdFromIntfId, EdsLib_Id_t, IntfEdsId);
UT_GenStub_AddParam(CFE_MissionLib_FindTopicIdFromIntfId, uint16_t *, TopicIdBuffer);
- UT_GenStub_Execute(CFE_MissionLib_FindTopicIdFromIntfId, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_FindTopicIdFromIntfId,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_FindTopicIdFromIntfId);
return UT_GenStub_GetReturnValue(CFE_MissionLib_FindTopicIdFromIntfId, int32_t);
@@ -172,8 +175,9 @@ const EdsLib_DatabaseObject_t *CFE_MissionLib_GetParent(const CFE_MissionLib_Sof
* Generated stub function for CFE_MissionLib_GetTopicInfo()
* ----------------------------------------------------
*/
-int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB, uint16_t TopicId,
- CFE_MissionLib_TopicInfo_t *TopicInfo)
+int32_t CFE_MissionLib_GetTopicInfo(const CFE_MissionLib_SoftwareBus_Interface_t *SBDB,
+ uint16_t TopicId,
+ CFE_MissionLib_TopicInfo_t *TopicInfo)
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_GetTopicInfo, int32_t);
diff --git a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_handlers.c b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_handlers.c
index fcfc707..861e82a 100644
--- a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_handlers.c
+++ b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_handlers.c
@@ -33,7 +33,8 @@
* Default handler for CFE_MissionLib_PubSub_IsListenerComponent coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_PubSub_IsListenerComponent(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_PubSub_IsListenerComponent(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
int32 status;
@@ -50,7 +51,8 @@ void UT_DefaultHandler_CFE_MissionLib_PubSub_IsListenerComponent(void *UserObj,
* Default handler for CFE_MissionLib_PubSub_IsPublisherComponent coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_PubSub_IsPublisherComponent(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_PubSub_IsPublisherComponent(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
int32 status;
@@ -67,11 +69,14 @@ void UT_DefaultHandler_CFE_MissionLib_PubSub_IsPublisherComponent(void *UserObj,
* Default handler for CFE_MissionLib_MapListenerComponent coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_MapListenerComponent(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_MapListenerComponent(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "Output", EdsInterface_CFE_SB_SoftwareBus_PubSub_t *),
+ FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "Output", EdsInterface_CFE_SB_SoftwareBus_PubSub_t *),
sizeof(EdsInterface_CFE_SB_SoftwareBus_PubSub_t));
}
@@ -80,11 +85,14 @@ void UT_DefaultHandler_CFE_MissionLib_MapListenerComponent(void *UserObj, UT_Ent
* Default handler for CFE_MissionLib_UnmapListenerComponent coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_UnmapListenerComponent(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_UnmapListenerComponent(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "Output", EdsComponent_CFE_SB_Listener_t *),
+ FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "Output", EdsComponent_CFE_SB_Listener_t *),
sizeof(EdsComponent_CFE_SB_Listener_t));
}
@@ -93,11 +101,14 @@ void UT_DefaultHandler_CFE_MissionLib_UnmapListenerComponent(void *UserObj, UT_E
* Default handler for CFE_MissionLib_MapPublisherComponent coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_MapPublisherComponent(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_MapPublisherComponent(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "Output", EdsInterface_CFE_SB_SoftwareBus_PubSub_t *),
+ FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "Output", EdsInterface_CFE_SB_SoftwareBus_PubSub_t *),
sizeof(EdsInterface_CFE_SB_SoftwareBus_PubSub_t));
}
@@ -106,11 +117,14 @@ void UT_DefaultHandler_CFE_MissionLib_MapPublisherComponent(void *UserObj, UT_En
* Default handler for CFE_MissionLib_UnmapPublisherComponent coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_UnmapPublisherComponent(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_UnmapPublisherComponent(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "Output", EdsComponent_CFE_SB_Publisher_t *),
+ FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "Output", EdsComponent_CFE_SB_Publisher_t *),
sizeof(EdsComponent_CFE_SB_Publisher_t));
}
@@ -119,11 +133,14 @@ void UT_DefaultHandler_CFE_MissionLib_UnmapPublisherComponent(void *UserObj, UT_
* Default handler for CFE_MissionLib_Get_PubSub_Parameters coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_Get_PubSub_Parameters(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_Get_PubSub_Parameters(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
CFE_MissionLib_Stub_DefaultZeroOutput(
- FuncKey, Context, UT_Hook_GetArgValueByName(Context, "Params", EdsInterface_CFE_SB_SoftwareBus_PubSub_t *),
+ FuncKey,
+ Context,
+ UT_Hook_GetArgValueByName(Context, "Params", EdsInterface_CFE_SB_SoftwareBus_PubSub_t *),
sizeof(EdsInterface_CFE_SB_SoftwareBus_PubSub_t));
}
@@ -132,10 +149,12 @@ void UT_DefaultHandler_CFE_MissionLib_Get_PubSub_Parameters(void *UserObj, UT_En
* Default handler for CFE_MissionLib_Set_PubSub_Parameters coverage stub function
*
*------------------------------------------------------------*/
-void UT_DefaultHandler_CFE_MissionLib_Set_PubSub_Parameters(void *UserObj, UT_EntryKey_t FuncKey,
+void UT_DefaultHandler_CFE_MissionLib_Set_PubSub_Parameters(void *UserObj,
+ UT_EntryKey_t FuncKey,
const UT_StubContext_t *Context)
{
- CFE_MissionLib_Stub_DefaultZeroOutput(FuncKey, Context,
+ CFE_MissionLib_Stub_DefaultZeroOutput(FuncKey,
+ Context,
UT_Hook_GetArgValueByName(Context, "Packet", EdsDataType_CFE_HDR_Message_t *),
sizeof(EdsDataType_CFE_HDR_Message_t));
}
diff --git a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_stubs.c b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_stubs.c
index 6e3255d..3a4b8c6 100644
--- a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_stubs.c
+++ b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_runtime_stubs.c
@@ -47,7 +47,8 @@ void CFE_MissionLib_Get_PubSub_Parameters(EdsInterface_CFE_SB_SoftwareBus_PubSub
UT_GenStub_AddParam(CFE_MissionLib_Get_PubSub_Parameters, EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Params);
UT_GenStub_AddParam(CFE_MissionLib_Get_PubSub_Parameters, const EdsDataType_CFE_HDR_Message_t *, Packet);
- UT_GenStub_Execute(CFE_MissionLib_Get_PubSub_Parameters, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_Get_PubSub_Parameters,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_Get_PubSub_Parameters);
}
@@ -56,14 +57,19 @@ void CFE_MissionLib_Get_PubSub_Parameters(EdsInterface_CFE_SB_SoftwareBus_PubSub
* Generated stub function for CFE_MissionLib_MapListenerComponent()
* ----------------------------------------------------
*/
-void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
+bool CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Listener_t *Input)
{
+ UT_GenStub_SetupReturnBuffer(CFE_MissionLib_MapListenerComponent, bool);
+
UT_GenStub_AddParam(CFE_MissionLib_MapListenerComponent, EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_MapListenerComponent, const EdsComponent_CFE_SB_Listener_t *, Input);
- UT_GenStub_Execute(CFE_MissionLib_MapListenerComponent, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_MapListenerComponent,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_MapListenerComponent);
+
+ return UT_GenStub_GetReturnValue(CFE_MissionLib_MapListenerComponent, bool);
}
/*
@@ -71,14 +77,19 @@ void CFE_MissionLib_MapListenerComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_
* Generated stub function for CFE_MissionLib_MapPublisherComponent()
* ----------------------------------------------------
*/
-void CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
+bool CFE_MissionLib_MapPublisherComponent(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Output,
const EdsComponent_CFE_SB_Publisher_t *Input)
{
+ UT_GenStub_SetupReturnBuffer(CFE_MissionLib_MapPublisherComponent, bool);
+
UT_GenStub_AddParam(CFE_MissionLib_MapPublisherComponent, EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_MapPublisherComponent, const EdsComponent_CFE_SB_Publisher_t *, Input);
- UT_GenStub_Execute(CFE_MissionLib_MapPublisherComponent, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_MapPublisherComponent,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_MapPublisherComponent);
+
+ return UT_GenStub_GetReturnValue(CFE_MissionLib_MapPublisherComponent, bool);
}
/*
@@ -90,10 +101,12 @@ bool CFE_MissionLib_PubSub_IsListenerComponent(const EdsInterface_CFE_SB_Softwar
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_PubSub_IsListenerComponent, bool);
- UT_GenStub_AddParam(CFE_MissionLib_PubSub_IsListenerComponent, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
+ UT_GenStub_AddParam(CFE_MissionLib_PubSub_IsListenerComponent,
+ const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
Params);
- UT_GenStub_Execute(CFE_MissionLib_PubSub_IsListenerComponent, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_PubSub_IsListenerComponent,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_PubSub_IsListenerComponent);
return UT_GenStub_GetReturnValue(CFE_MissionLib_PubSub_IsListenerComponent, bool);
@@ -108,10 +121,12 @@ bool CFE_MissionLib_PubSub_IsPublisherComponent(const EdsInterface_CFE_SB_Softwa
{
UT_GenStub_SetupReturnBuffer(CFE_MissionLib_PubSub_IsPublisherComponent, bool);
- UT_GenStub_AddParam(CFE_MissionLib_PubSub_IsPublisherComponent, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
+ UT_GenStub_AddParam(CFE_MissionLib_PubSub_IsPublisherComponent,
+ const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
Params);
- UT_GenStub_Execute(CFE_MissionLib_PubSub_IsPublisherComponent, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_PubSub_IsPublisherComponent,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_PubSub_IsPublisherComponent);
return UT_GenStub_GetReturnValue(CFE_MissionLib_PubSub_IsPublisherComponent, bool);
@@ -128,7 +143,8 @@ void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t
UT_GenStub_AddParam(CFE_MissionLib_Set_PubSub_Parameters, EdsDataType_CFE_HDR_Message_t *, Packet);
UT_GenStub_AddParam(CFE_MissionLib_Set_PubSub_Parameters, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Params);
- UT_GenStub_Execute(CFE_MissionLib_Set_PubSub_Parameters, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_Set_PubSub_Parameters,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_Set_PubSub_Parameters);
}
@@ -137,14 +153,19 @@ void CFE_MissionLib_Set_PubSub_Parameters(EdsDataType_CFE_HDR_Message_t
* Generated stub function for CFE_MissionLib_UnmapListenerComponent()
* ----------------------------------------------------
*/
-void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
+bool CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
+ UT_GenStub_SetupReturnBuffer(CFE_MissionLib_UnmapListenerComponent, bool);
+
UT_GenStub_AddParam(CFE_MissionLib_UnmapListenerComponent, EdsComponent_CFE_SB_Listener_t *, Output);
UT_GenStub_AddParam(CFE_MissionLib_UnmapListenerComponent, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *, Input);
- UT_GenStub_Execute(CFE_MissionLib_UnmapListenerComponent, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_UnmapListenerComponent,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_UnmapListenerComponent);
+
+ return UT_GenStub_GetReturnValue(CFE_MissionLib_UnmapListenerComponent, bool);
}
/*
@@ -152,13 +173,19 @@ void CFE_MissionLib_UnmapListenerComponent(EdsComponent_CFE_SB_Listener_t
* Generated stub function for CFE_MissionLib_UnmapPublisherComponent()
* ----------------------------------------------------
*/
-void CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
+bool CFE_MissionLib_UnmapPublisherComponent(EdsComponent_CFE_SB_Publisher_t *Output,
const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *Input)
{
+ UT_GenStub_SetupReturnBuffer(CFE_MissionLib_UnmapPublisherComponent, bool);
+
UT_GenStub_AddParam(CFE_MissionLib_UnmapPublisherComponent, EdsComponent_CFE_SB_Publisher_t *, Output);
- UT_GenStub_AddParam(CFE_MissionLib_UnmapPublisherComponent, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
+ UT_GenStub_AddParam(CFE_MissionLib_UnmapPublisherComponent,
+ const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *,
Input);
- UT_GenStub_Execute(CFE_MissionLib_UnmapPublisherComponent, Basic,
+ UT_GenStub_Execute(CFE_MissionLib_UnmapPublisherComponent,
+ Basic,
UT_DefaultHandler_CFE_MissionLib_UnmapPublisherComponent);
+
+ return UT_GenStub_GetReturnValue(CFE_MissionLib_UnmapPublisherComponent, bool);
}
diff --git a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.c b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.c
index 96f461c..0c96955 100644
--- a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.c
+++ b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.c
@@ -27,8 +27,10 @@
#include "utstubs.h"
#include "utassert.h"
-void CFE_MissionLib_Stub_DefaultZeroOutput(UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, void *OutputBuffer,
- size_t OutputSize)
+void CFE_MissionLib_Stub_DefaultZeroOutput(UT_EntryKey_t FuncKey,
+ const UT_StubContext_t *Context,
+ void *OutputBuffer,
+ size_t OutputSize)
{
int32_t Status;
@@ -46,8 +48,8 @@ void CFE_MissionLib_Stub_DefaultZeroOutput(UT_EntryKey_t FuncKey, const UT_StubC
void CFE_MissionLib_Stub_DefaultStringOutput(UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)
{
int32_t Status;
- void * DataBuffer;
- const char * Result;
+ void *DataBuffer;
+ const char *Result;
static const char DEFAULT_OUTPUT[] = "UT";
UT_Stub_GetInt32StatusCode(Context, &Status);
diff --git a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.h b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.h
index cf80734..5305d3e 100644
--- a/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.h
+++ b/cfecfs/missionlib/fsw/ut-stubs/cfe_missionlib_stub_helpers.h
@@ -29,8 +29,10 @@
#include "utstubs.h"
#include "utassert.h"
-void CFE_MissionLib_Stub_DefaultZeroOutput(UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, void *OutputBuffer,
- size_t OutputSize);
+void CFE_MissionLib_Stub_DefaultZeroOutput(UT_EntryKey_t FuncKey,
+ const UT_StubContext_t *Context,
+ void *OutputBuffer,
+ size_t OutputSize);
void CFE_MissionLib_Stub_DefaultStringOutput(UT_EntryKey_t FuncKey, const UT_StubContext_t *Context);
#endif /* CFE_MISSIONLIB_STUB_HELPERS_H */
diff --git a/cfecfs/missionlib/lua/inc/cfe_missionlib_lua_softwarebus.h b/cfecfs/missionlib/lua/inc/cfe_missionlib_lua_softwarebus.h
index 3edded8..66d1091 100644
--- a/cfecfs/missionlib/lua/inc/cfe_missionlib_lua_softwarebus.h
+++ b/cfecfs/missionlib/lua/inc/cfe_missionlib_lua_softwarebus.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file cfe_missionlib_lua_softwarebus.h
* \ingroup lua
@@ -29,7 +28,6 @@
#ifndef _CFE_MISSIONLIB_LUA_SOFTWAREBUS_H_
#define _CFE_MISSIONLIB_LUA_SOFTWAREBUS_H_
-
#include
#include "cfe_missionlib_api.h"
#include "cfe_sb_eds_datatypes.h"
@@ -37,19 +35,20 @@
typedef struct
{
const CFE_MissionLib_SoftwareBus_Interface_t *IntfDB;
- bool IsTelecommand;
- bool IsTelemetry;
- uint16_t InstanceNumber;
- uint16_t TopicId;
- EdsLib_Id_t IntfEdsId;
- EdsLib_Id_t IndicationEdsId;
- EdsLib_Id_t IndicationBaseArg;
+ bool IsTelecommand;
+ bool IsTelemetry;
+ uint16_t InstanceNumber;
+ uint16_t TopicId;
+ EdsLib_Id_t IntfEdsId;
+ EdsLib_Id_t IndicationEdsId;
+ EdsLib_Id_t IndicationBaseArg;
} CFE_MissionLib_Lua_Interface_Userdata_t;
-
void CFE_MissionLib_Lua_SoftwareBus_Attach(lua_State *lua, const CFE_MissionLib_SoftwareBus_Interface_t *IntfDB);
-void CFE_MissionLib_Lua_MapPubSubParams(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub, const CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj);
-void CFE_MissionLib_Lua_UnmapPubSubParams(CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub);
+void CFE_MissionLib_Lua_MapPubSubParams(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub,
+ const CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj);
+void CFE_MissionLib_Lua_UnmapPubSubParams(CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj,
+ const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub);
-#endif /* _CFE_MISSIONLIB_LUA_SOFTWAREBUS_H_ */
+#endif /* _CFE_MISSIONLIB_LUA_SOFTWAREBUS_H_ */
diff --git a/cfecfs/missionlib/lua/src/cfe_missionlib_lua_softwarebus.c b/cfecfs/missionlib/lua/src/cfe_missionlib_lua_softwarebus.c
index 68fb136..35f3169 100644
--- a/cfecfs/missionlib/lua/src/cfe_missionlib_lua_softwarebus.c
+++ b/cfecfs/missionlib/lua/src/cfe_missionlib_lua_softwarebus.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file cfe_missionlib_lua_softwarebus.c
* \ingroup lua
@@ -52,23 +51,26 @@
static const char CFE_MISSIONLIB_INTFDB_KEY;
-static const EdsLib_Id_t CFE_SB_TELECOMMAND_INTF_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsInterface_CFE_SB_Telecommand_DECLARATION);
-static const EdsLib_Id_t CFE_SB_TELEMETRY_INTF_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsInterface_CFE_SB_Telemetry_DECLARATION);
+static const EdsLib_Id_t CFE_SB_TELECOMMAND_INTF_ID =
+ EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsInterface_CFE_SB_Telecommand_DECLARATION);
+static const EdsLib_Id_t CFE_SB_TELEMETRY_INTF_ID =
+ EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsInterface_CFE_SB_Telemetry_DECLARATION);
-void CFE_MissionLib_Lua_MapPubSubParams(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub, const CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj)
+void CFE_MissionLib_Lua_MapPubSubParams(EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub,
+ const CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj)
{
if (IntfObj->IsTelecommand)
{
EdsComponent_CFE_SB_Listener_t Params;
Params.Telecommand.InstanceNumber = IntfObj->InstanceNumber;
- Params.Telecommand.TopicId = IntfObj->TopicId;
+ Params.Telecommand.TopicId = IntfObj->TopicId;
CFE_MissionLib_MapListenerComponent(PubSub, &Params);
}
else if (IntfObj->IsTelemetry)
{
EdsComponent_CFE_SB_Publisher_t Params;
Params.Telemetry.InstanceNumber = IntfObj->InstanceNumber;
- Params.Telemetry.TopicId = IntfObj->TopicId;
+ Params.Telemetry.TopicId = IntfObj->TopicId;
CFE_MissionLib_MapPublisherComponent(PubSub, &Params);
}
else
@@ -77,25 +79,26 @@ void CFE_MissionLib_Lua_MapPubSubParams(EdsInterface_CFE_SB_SoftwareBus_PubSub_t
}
}
-void CFE_MissionLib_Lua_UnmapPubSubParams(CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj, const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub)
+void CFE_MissionLib_Lua_UnmapPubSubParams(CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj,
+ const EdsInterface_CFE_SB_SoftwareBus_PubSub_t *PubSub)
{
if (IntfObj->IsTelecommand)
{
EdsComponent_CFE_SB_Listener_t Result;
CFE_MissionLib_UnmapListenerComponent(&Result, PubSub);
- IntfObj->TopicId = Result.Telecommand.TopicId;
+ IntfObj->TopicId = Result.Telecommand.TopicId;
IntfObj->InstanceNumber = Result.Telecommand.InstanceNumber;
}
else if (IntfObj->IsTelemetry)
{
EdsComponent_CFE_SB_Publisher_t Result;
CFE_MissionLib_UnmapPublisherComponent(&Result, PubSub);
- IntfObj->TopicId = Result.Telemetry.TopicId;
+ IntfObj->TopicId = Result.Telemetry.TopicId;
IntfObj->InstanceNumber = Result.Telemetry.InstanceNumber;
}
else
{
- IntfObj->TopicId = 0;
+ IntfObj->TopicId = 0;
IntfObj->InstanceNumber = 0;
}
}
@@ -105,7 +108,7 @@ CFE_MissionLib_Lua_Interface_Userdata_t *CFE_MissionLib_Lua_NewInterfaceObject(l
CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj;
IntfObj = lua_newuserdata(lua, sizeof(*IntfObj));
- memset(IntfObj,0,sizeof(*IntfObj));
+ memset(IntfObj, 0, sizeof(*IntfObj));
/*
* Set metatable for the new object
@@ -123,12 +126,12 @@ CFE_MissionLib_Lua_Interface_Userdata_t *CFE_MissionLib_Lua_NewInterfaceObject(l
static int CFE_MissionLib_Lua_GetInterface(lua_State *lua)
{
- const char *DestName = luaL_checkstring(lua, 1);
- const char *IndicationName = luaL_optstring(lua, 3, "indication");
+ const char *DestName = luaL_checkstring(lua, 1);
+ const char *IndicationName = luaL_optstring(lua, 3, "indication");
CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj;
- const EdsLib_DatabaseObject_t *GD;
- EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
- int32_t Status;
+ const EdsLib_DatabaseObject_t *GD;
+ EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
+ int32_t Status;
lua_settop(lua, 3);
@@ -147,7 +150,7 @@ static int CFE_MissionLib_Lua_GetInterface(lua_State *lua)
IntfObj->InstanceNumber = 1;
}
- GD = CFE_MissionLib_GetParent(IntfObj->IntfDB);
+ GD = CFE_MissionLib_GetParent(IntfObj->IntfDB);
Status = EdsLib_IntfDB_FindComponentInterfaceByFullName(GD, DestName, &IntfObj->IntfEdsId);
if (Status != EDSLIB_SUCCESS)
{
@@ -168,16 +171,21 @@ static int CFE_MissionLib_Lua_GetInterface(lua_State *lua)
}
IntfObj->IsTelecommand = EdsLib_Is_Similar(IntfInfo.IntfTypeEdsId, CFE_SB_TELECOMMAND_INTF_ID);
- IntfObj->IsTelemetry = EdsLib_Is_Similar(IntfInfo.IntfTypeEdsId, CFE_SB_TELEMETRY_INTF_ID);
+ IntfObj->IsTelemetry = EdsLib_Is_Similar(IntfInfo.IntfTypeEdsId, CFE_SB_TELEMETRY_INTF_ID);
- Status = EdsLib_IntfDB_FindCommandByLocalName(GD, IntfInfo.IntfTypeEdsId, IndicationName, &IntfObj->IndicationEdsId);
+ Status =
+ EdsLib_IntfDB_FindCommandByLocalName(GD, IntfInfo.IntfTypeEdsId, IndicationName, &IntfObj->IndicationEdsId);
if (Status != EDSLIB_SUCCESS)
{
return 0;
}
/* Now we can finally determine the argument type */
- Status = EdsLib_IntfDB_FindAllArgumentTypes(GD, IntfObj->IndicationEdsId, IntfObj->IntfEdsId, &IntfObj->IndicationBaseArg, 1);
+ Status = EdsLib_IntfDB_FindAllArgumentTypes(GD,
+ IntfObj->IndicationEdsId,
+ IntfObj->IntfEdsId,
+ &IntfObj->IndicationBaseArg,
+ 1);
if (Status != EDSLIB_SUCCESS)
{
return 0;
@@ -188,13 +196,12 @@ static int CFE_MissionLib_Lua_GetInterface(lua_State *lua)
static int CFE_MissionLib_Lua_InterfaceObjectGetProperty(lua_State *lua)
{
- CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj =
- luaL_checkudata(lua, 1, "CFE_MissionLib_Lua_Interface");
- EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
- int32_t Status;
- const char *Str;
- char StringBuffer[256];
- int retval = 0;
+ CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj = luaL_checkudata(lua, 1, "CFE_MissionLib_Lua_Interface");
+ EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
+ int32_t Status;
+ const char *Str;
+ char StringBuffer[256];
+ int retval = 0;
if (lua_type(lua, 2) == LUA_TSTRING)
{
@@ -223,10 +230,15 @@ static int CFE_MissionLib_Lua_InterfaceObjectGetProperty(lua_State *lua)
else if (strcmp(PropName, "IntfName") == 0)
{
/* This is really the interface type name */
- Status = EdsLib_IntfDB_GetComponentInterfaceInfo(CFE_MissionLib_GetParent(IntfObj->IntfDB), IntfObj->IntfEdsId, &IntfInfo);
+ Status = EdsLib_IntfDB_GetComponentInterfaceInfo(CFE_MissionLib_GetParent(IntfObj->IntfDB),
+ IntfObj->IntfEdsId,
+ &IntfInfo);
if (Status == EDSLIB_SUCCESS)
{
- Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB), IntfInfo.IntfTypeEdsId, StringBuffer, sizeof(StringBuffer));
+ Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB),
+ IntfInfo.IntfTypeEdsId,
+ StringBuffer,
+ sizeof(StringBuffer));
}
if (Status == EDSLIB_SUCCESS)
@@ -237,7 +249,10 @@ static int CFE_MissionLib_Lua_InterfaceObjectGetProperty(lua_State *lua)
}
else if (strcmp(PropName, "TopicName") == 0)
{
- Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB), IntfObj->IntfEdsId, StringBuffer, sizeof(StringBuffer));
+ Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB),
+ IntfObj->IntfEdsId,
+ StringBuffer,
+ sizeof(StringBuffer));
if (Status == EDSLIB_SUCCESS)
{
lua_pushstring(lua, StringBuffer);
@@ -246,7 +261,10 @@ static int CFE_MissionLib_Lua_InterfaceObjectGetProperty(lua_State *lua)
}
else if (strcmp(PropName, "IndicationName") == 0)
{
- Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB), IntfObj->IndicationEdsId, StringBuffer, sizeof(StringBuffer));
+ Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB),
+ IntfObj->IndicationEdsId,
+ StringBuffer,
+ sizeof(StringBuffer));
if (Status == EDSLIB_SUCCESS)
{
lua_pushstring(lua, StringBuffer);
@@ -276,20 +294,16 @@ static int CFE_MissionLib_Lua_InterfaceObjectGetProperty(lua_State *lua)
static int CFE_MissionLib_Lua_InterfaceObjectEqual(lua_State *lua)
{
- CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj1 =
- luaL_testudata(lua, 1, "CFE_MissionLib_Lua_Interface");
- CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj2 =
- luaL_testudata(lua, 2, "CFE_MissionLib_Lua_Interface");
+ CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj1 = luaL_testudata(lua, 1, "CFE_MissionLib_Lua_Interface");
+ CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj2 = luaL_testudata(lua, 2, "CFE_MissionLib_Lua_Interface");
if (IntfObj1 == NULL || IntfObj2 == NULL)
{
lua_pushboolean(lua, 0);
}
- else if (IntfObj1->IntfDB != IntfObj2->IntfDB ||
- EdsLib_Is_Match(IntfObj1->IntfEdsId, IntfObj2->IntfEdsId) ||
- EdsLib_Is_Match(IntfObj1->IndicationEdsId, IntfObj2->IndicationEdsId) ||
- IntfObj1->TopicId != IntfObj2->TopicId ||
- IntfObj1->InstanceNumber != IntfObj2->InstanceNumber)
+ else if (IntfObj1->IntfDB != IntfObj2->IntfDB || EdsLib_Is_Match(IntfObj1->IntfEdsId, IntfObj2->IntfEdsId)
+ || EdsLib_Is_Match(IntfObj1->IndicationEdsId, IntfObj2->IndicationEdsId)
+ || IntfObj1->TopicId != IntfObj2->TopicId || IntfObj1->InstanceNumber != IntfObj2->InstanceNumber)
{
lua_pushboolean(lua, 0);
}
@@ -303,11 +317,10 @@ static int CFE_MissionLib_Lua_InterfaceObjectEqual(lua_State *lua)
static int CFE_MissionLib_Lua_InterfaceObjectToString(lua_State *lua)
{
- char StringBuffer[128];
- const char *Str;
- int32_t Status;
- CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj =
- luaL_checkudata(lua, 1, "CFE_MissionLib_Lua_Interface");
+ char StringBuffer[128];
+ const char *Str;
+ int32_t Status;
+ CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj = luaL_checkudata(lua, 1, "CFE_MissionLib_Lua_Interface");
int top_start = lua_gettop(lua);
int top_end;
@@ -325,7 +338,10 @@ static int CFE_MissionLib_Lua_InterfaceObjectToString(lua_State *lua)
lua_pushstring(lua, ":");
}
- Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB), IntfObj->IntfEdsId, StringBuffer, sizeof(StringBuffer));
+ Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->IntfDB),
+ IntfObj->IntfEdsId,
+ StringBuffer,
+ sizeof(StringBuffer));
if (Status == EDSLIB_SUCCESS)
{
lua_pushstring(lua, StringBuffer);
@@ -351,18 +367,17 @@ static int CFE_MissionLib_Lua_InterfaceObjectToString(lua_State *lua)
return 1;
}
-
static int CFE_MissionLib_Lua_NewMessage(lua_State *lua)
{
- const EdsLib_Lua_Database_Userdata_t *DbObj = lua_touserdata(lua, lua_upvalueindex(1));
+ const EdsLib_Lua_Database_Userdata_t *DbObj = lua_touserdata(lua, lua_upvalueindex(1));
const CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj = luaL_checkudata(lua, 1, "CFE_MissionLib_Lua_Interface");
- const char *CommandName = luaL_optstring(lua, 2, NULL);
- EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- EdsLib_LuaBinding_DescriptorObject_t *ObjectUserData;
- EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
- EdsLib_Id_t PossibleId;
- uint16_t DerivIdx;
- int32_t Status;
+ const char *CommandName = luaL_optstring(lua, 2, NULL);
+ EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
+ EdsLib_LuaBinding_DescriptorObject_t *ObjectUserData;
+ EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
+ EdsLib_Id_t PossibleId;
+ uint16_t DerivIdx;
+ int32_t Status;
Status = EdsLib_DataTypeDB_GetDerivedInfo(DbObj->GD, IntfObj->IndicationBaseArg, &DerivInfo);
if (Status != EDSLIB_SUCCESS)
@@ -371,8 +386,8 @@ static int CFE_MissionLib_Lua_NewMessage(lua_State *lua)
return 0;
}
- ObjectUserData = EdsLib_LuaBinding_CreateEmptyObject(lua, DerivInfo.MaxSize.Bytes);
- ObjectUserData->GD = DbObj->GD;
+ ObjectUserData = EdsLib_LuaBinding_CreateEmptyObject(lua, DerivInfo.MaxSize.Bytes);
+ ObjectUserData->GD = DbObj->GD;
ObjectUserData->EdsId = IntfObj->IndicationBaseArg;
/*
@@ -390,8 +405,9 @@ static int CFE_MissionLib_Lua_NewMessage(lua_State *lua)
break;
}
- if (EdsLib_DataTypeDB_GetDerivedTypeById(DbObj->GD, IntfObj->IndicationBaseArg, DerivIdx, &PossibleId) == EDSLIB_SUCCESS &&
- strcmp(EdsLib_DisplayDB_GetBaseName(DbObj->GD, PossibleId), CommandName) == 0)
+ if (EdsLib_DataTypeDB_GetDerivedTypeById(DbObj->GD, IntfObj->IndicationBaseArg, DerivIdx, &PossibleId)
+ == EDSLIB_SUCCESS
+ && strcmp(EdsLib_DisplayDB_GetBaseName(DbObj->GD, PossibleId), CommandName) == 0)
{
ObjectUserData->EdsId = PossibleId;
break;
@@ -412,23 +428,23 @@ static int CFE_MissionLib_Lua_NewMessage(lua_State *lua)
static int CFE_MissionLib_Lua_IdentifyMessage(lua_State *lua)
{
- const EdsLib_Lua_Database_Userdata_t *DbObj = lua_touserdata(lua, lua_upvalueindex(1));
- const uint8_t *SourceBuffer = (const uint8_t*)luaL_checkstring(lua, 1);
- uint32_t SourceBufferSize = lua_rawlen(lua, 1);
- const char *IndicationName = luaL_optstring(lua, 2, "indication");
- EdsLib_Binding_DescriptorObject_t *ObjectUserData;
+ const EdsLib_Lua_Database_Userdata_t *DbObj = lua_touserdata(lua, lua_upvalueindex(1));
+ const uint8_t *SourceBuffer = (const uint8_t *)luaL_checkstring(lua, 1);
+ uint32_t SourceBufferSize = lua_rawlen(lua, 1);
+ const char *IndicationName = luaL_optstring(lua, 2, "indication");
+ EdsLib_Binding_DescriptorObject_t *ObjectUserData;
CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj;
EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
- EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
- EdsLib_SizeInfo_t MaxSize;
- EdsLib_SizeInfo_t DecodeSize;
- CFE_MissionLib_TopicInfo_t TopicInfo;
- const EdsLib_DatabaseObject_t *GD;
- EdsLib_Id_t EdsId;
- int32_t Status;
-
- EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_Message_DATADICTIONARY);
+ EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
+ EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
+ EdsLib_SizeInfo_t MaxSize;
+ EdsLib_SizeInfo_t DecodeSize;
+ CFE_MissionLib_TopicInfo_t TopicInfo;
+ const EdsLib_DatabaseObject_t *GD;
+ EdsLib_Id_t EdsId;
+ int32_t Status;
+
+ EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_Message_DATADICTIONARY);
Status = EdsLib_DataTypeDB_GetDerivedInfo(DbObj->GD, EdsId, &DerivInfo);
if (Status != EDSLIB_SUCCESS)
{
@@ -437,15 +453,19 @@ static int CFE_MissionLib_Lua_IdentifyMessage(lua_State *lua)
memset(&DecodeSize, 0, sizeof(DecodeSize));
- ObjectUserData = EdsLib_LuaBinding_CreateEmptyObject(lua, DerivInfo.MaxSize.Bytes);
- ObjectUserData->GD = DbObj->GD;
+ ObjectUserData = EdsLib_LuaBinding_CreateEmptyObject(lua, DerivInfo.MaxSize.Bytes);
+ ObjectUserData->GD = DbObj->GD;
ObjectUserData->EdsId = EdsId;
MaxSize.Bytes = DerivInfo.MaxSize.Bytes;
- MaxSize.Bits = EdsLib_OCTETS_TO_BITS(SourceBufferSize);
-
- Status = EdsLib_DataTypeDB_UnpackPartialObjectVarSize(DbObj->GD, &EdsId, EdsLib_Binding_GetNativeObject(ObjectUserData),
- SourceBuffer, &MaxSize, &DecodeSize);
+ MaxSize.Bits = EdsLib_OCTETS_TO_BITS(SourceBufferSize);
+
+ Status = EdsLib_DataTypeDB_UnpackPartialObjectVarSize(DbObj->GD,
+ &EdsId,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ SourceBuffer,
+ &MaxSize,
+ &DecodeSize);
if (Status != EDSLIB_SUCCESS)
{
return 0;
@@ -455,24 +475,24 @@ static int CFE_MissionLib_Lua_IdentifyMessage(lua_State *lua)
CFE_MissionLib_Get_PubSub_Parameters(&PubSub, EdsLib_Binding_GetNativeObject(ObjectUserData));
IntfObj = CFE_MissionLib_Lua_NewInterfaceObject(lua, lua_upvalueindex(1));
- GD = CFE_MissionLib_GetParent(IntfObj->IntfDB);
+ GD = CFE_MissionLib_GetParent(IntfObj->IntfDB);
/* It is not clear if this is a TLM or CMD, so need to try both, only one will work */
if (IntfObj->TopicId == 0)
{
EdsComponent_CFE_SB_Listener_t Result;
CFE_MissionLib_UnmapListenerComponent(&Result, &PubSub);
- IntfObj->TopicId = Result.Telecommand.TopicId;
+ IntfObj->TopicId = Result.Telecommand.TopicId;
IntfObj->InstanceNumber = Result.Telecommand.InstanceNumber;
- IntfObj->IsTelecommand = true;
+ IntfObj->IsTelecommand = true;
}
if (IntfObj->TopicId == 0)
{
EdsComponent_CFE_SB_Publisher_t Result;
CFE_MissionLib_UnmapPublisherComponent(&Result, &PubSub);
- IntfObj->TopicId = Result.Telemetry.TopicId;
+ IntfObj->TopicId = Result.Telemetry.TopicId;
IntfObj->InstanceNumber = Result.Telemetry.InstanceNumber;
- IntfObj->IsTelemetry = true;
+ IntfObj->IsTelemetry = true;
}
Status = CFE_MissionLib_GetTopicInfo(IntfObj->IntfDB, IntfObj->TopicId, &TopicInfo);
@@ -490,30 +510,43 @@ static int CFE_MissionLib_Lua_IdentifyMessage(lua_State *lua)
return 0;
}
- Status = EdsLib_IntfDB_FindCommandByLocalName(GD, IntfInfo.IntfTypeEdsId, IndicationName, &IntfObj->IndicationEdsId);
+ Status =
+ EdsLib_IntfDB_FindCommandByLocalName(GD, IntfInfo.IntfTypeEdsId, IndicationName, &IntfObj->IndicationEdsId);
if (Status != EDSLIB_SUCCESS)
{
return 0;
}
/* Now we can finally determine the argument type */
- Status = EdsLib_IntfDB_FindAllArgumentTypes(GD, IntfObj->IndicationEdsId, IntfObj->IntfEdsId, &IntfObj->IndicationBaseArg, 1);
+ Status = EdsLib_IntfDB_FindAllArgumentTypes(GD,
+ IntfObj->IndicationEdsId,
+ IntfObj->IntfEdsId,
+ &IntfObj->IndicationBaseArg,
+ 1);
if (Status != EDSLIB_SUCCESS)
{
return 0;
}
/* Beyond this, the IntfObj is considered OK so return 1 */
- EdsId = IntfObj->IndicationBaseArg;
- Status = EdsLib_DataTypeDB_UnpackPartialObjectVarSize(DbObj->GD, &EdsId, EdsLib_Binding_GetNativeObject(ObjectUserData),
- SourceBuffer, &MaxSize, &DecodeSize);
+ EdsId = IntfObj->IndicationBaseArg;
+ Status = EdsLib_DataTypeDB_UnpackPartialObjectVarSize(DbObj->GD,
+ &EdsId,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ SourceBuffer,
+ &MaxSize,
+ &DecodeSize);
if (Status != EDSLIB_SUCCESS)
{
return 1;
}
- Status = EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(DbObj->GD, EdsId, EdsLib_Binding_GetNativeObject(ObjectUserData),
- SourceBuffer, EDSLIB_DATATYPEDB_RECOMPUTE_NONE, &DecodeSize);
+ Status = EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(DbObj->GD,
+ EdsId,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ SourceBuffer,
+ EDSLIB_DATATYPEDB_RECOMPUTE_NONE,
+ &DecodeSize);
if (Status == EDSLIB_SUCCESS)
{
return 1;
@@ -527,7 +560,7 @@ static int CFE_MissionLib_Lua_IdentifyMessage(lua_State *lua)
void CFE_MissionLib_Lua_SoftwareBus_Attach(lua_State *lua, const CFE_MissionLib_SoftwareBus_Interface_t *IntfDB)
{
- int Obj = lua_gettop(lua);
+ int Obj = lua_gettop(lua);
EdsLib_Lua_Database_Userdata_t *DbObj = luaL_checkudata(lua, Obj, "EdsDb");
if (DbObj->GD == NULL)
{
@@ -537,7 +570,7 @@ void CFE_MissionLib_Lua_SoftwareBus_Attach(lua_State *lua, const CFE_MissionLib_
lua_getuservalue(lua, -1);
- lua_pushlightuserdata(lua, (void*)IntfDB);
+ lua_pushlightuserdata(lua, (void *)IntfDB);
lua_rawsetp(lua, -2, &CFE_MISSIONLIB_INTFDB_KEY);
lua_pushvalue(lua, Obj);
@@ -552,7 +585,6 @@ void CFE_MissionLib_Lua_SoftwareBus_Attach(lua_State *lua, const CFE_MissionLib_
lua_pushcclosure(lua, CFE_MissionLib_Lua_IdentifyMessage, 1);
lua_setfield(lua, -2, "IdentifyMessage");
-
/*
* Create a metatable for EDS objects (userdata blobs)
* This also has the hook to call our routine when old objects are collected
@@ -572,5 +604,4 @@ void CFE_MissionLib_Lua_SoftwareBus_Attach(lua_State *lua, const CFE_MissionLib_
/* Reset the stack top to where it was initially */
lua_settop(lua, Obj);
-
}
diff --git a/cfecfs/missionlib/python/CMakeLists.txt b/cfecfs/missionlib/python/CMakeLists.txt
index 903fbb4..54dd012 100644
--- a/cfecfs/missionlib/python/CMakeLists.txt
+++ b/cfecfs/missionlib/python/CMakeLists.txt
@@ -78,6 +78,12 @@ option(CFE_MISSIONLIB_PYTHON_BUILD_STANDALONE_MODULE
if (NOT PYTHON_FOUND)
message(" Python support not configured, skipping MissionLib Python bindings")
else ()
+ # Note when using the Python.h header file it sometimes defines things like _XOPEN_SOURCE directly
+ # To avoid triggering errors, do not use any existing compile definitions in this module. Also
+ # sometimes Python marks something as deprecated even with minimal/no overlap in having an alternate.
+ set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "")
+ set_directory_properties(PROPERTIES COMPILE_OPTIONS "-Wno-deprecated-declarations")
+
include_directories(inc)
include_directories(${EDSLIB_FSW_SOURCE_DIR}/inc)
include_directories(${EDSLIB_PYTHONBINDINGS_SOURCE_DIR}/inc)
diff --git a/cfecfs/missionlib/python/inc/cfe_missionlib_python.h b/cfecfs/missionlib/python/inc/cfe_missionlib_python.h
index c5c45ed..218c91d 100644
--- a/cfecfs/missionlib/python/inc/cfe_missionlib_python.h
+++ b/cfecfs/missionlib/python/inc/cfe_missionlib_python.h
@@ -40,7 +40,7 @@
*
* This is provided for applications that supply their own custom init routine.
*/
-#define CFE_MISSIONLIB_PYTHON_DOC "Module which provides an interface to the CFE_MissionLib Runtime Library."
+#define CFE_MISSIONLIB_PYTHON_DOC "Module which provides an interface to the CFE_MissionLib Runtime Library."
/**
* Base Name of the Python module
@@ -50,7 +50,7 @@
* as the base name, which carries through to the respective "repr()"
* implementation and other user-visible items.
*/
-#define CFE_MISSIONLIB_PYTHON_MODULE_NAME "CFE_MissionLib"
+#define CFE_MISSIONLIB_PYTHON_MODULE_NAME "CFE_MissionLib"
/**
* Get the name of a Python entity
@@ -59,8 +59,7 @@
* by adding a prefix of CFE_MISSIONLIB_PYTHON_MODULE_NAME. It is used
* by all types to keep the naming consistent.
*/
-#define CFE_MISSIONLIB_PYTHON_ENTITY_NAME(x) CFE_MISSIONLIB_PYTHON_MODULE_NAME "." x
-
+#define CFE_MISSIONLIB_PYTHON_ENTITY_NAME(x) CFE_MISSIONLIB_PYTHON_MODULE_NAME "." x
/**
* Main Initializer function that sets up a newly-minted module object
@@ -75,7 +74,7 @@
* different naming and calling conventions). So it is expected that
* an additional wrapper around this will be added to accommodate this.
*/
-PyObject* CFE_MissionLib_Python_CreateModule(void);
+PyObject *CFE_MissionLib_Python_CreateModule(void);
/**
* Gets the C EDS Database object from a Python MissionLib Database Object
diff --git a/cfecfs/missionlib/python/src/cfe_missionlib_python_database.c b/cfecfs/missionlib/python/src/cfe_missionlib_python_database.c
index 1f16999..8a03985 100644
--- a/cfecfs/missionlib/python/src/cfe_missionlib_python_database.c
+++ b/cfecfs/missionlib/python/src/cfe_missionlib_python_database.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/******************************************************************************
** File: cfe_missionlib_python_database.c
**
@@ -44,73 +43,70 @@
#include "cfe_sb_eds_datatypes.h"
#include "edslib_binding_objects.h"
-static const EdsLib_Id_t CFE_SB_TELECOMMAND_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telecommand_indication_DECLARATION);
-static const EdsLib_Id_t CFE_SB_TELEMETRY_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telemetry_indication_DECLARATION);
+static const EdsLib_Id_t CFE_SB_TELECOMMAND_ID =
+ EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telecommand_indication_DECLARATION);
+static const EdsLib_Id_t CFE_SB_TELEMETRY_ID =
+ EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telemetry_indication_DECLARATION);
PyObject *CFE_MissionLib_Python_DatabaseCache = NULL;
-static void CFE_MissionLib_Python_Database_dealloc(PyObject * obj);
-static PyObject * CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
-static PyObject * CFE_MissionLib_Python_Database_repr(PyObject *obj);
-static int CFE_MissionLib_Python_Database_traverse(PyObject *obj, visitproc visit, void *arg);
-static int CFE_MissionLib_Python_Database_clear(PyObject *obj);
-
-static PyObject * CFE_MissionLib_Python_Database_GetInterface(PyObject *obj, PyObject *key);
-static PyObject * CFE_MissionLib_Python_DecodeEdsId(PyObject *obj, PyObject *args);
-static PyObject * CFE_MissionLib_Python_Set_PubSub(PyObject *obj, PyObject *args);
-
-static PyObject * CFE_MissionLib_Python_Instance_iter(PyObject *obj);
-static void CFE_MissionLib_Python_InstanceIterator_dealloc(PyObject * obj);
-static int CFE_MissionLib_Python_InstanceIterator_traverse(PyObject *obj, visitproc visit, void *arg);
-static int CFE_MissionLib_Python_InstanceIterator_clear(PyObject *obj);
-static PyObject * CFE_MissionLib_Python_InstanceIterator_iternext(PyObject *obj);
-
-static PyMethodDef CFE_MissionLib_Python_Database_methods[] =
-{
- {"Interface", CFE_MissionLib_Python_Database_GetInterface, METH_O, "Lookup an Interface type from DB."},
- {"DecodeEdsId", CFE_MissionLib_Python_DecodeEdsId, METH_VARARGS, "Decode the EdsID from a packed cFE message"},
- {"SetPubSub", CFE_MissionLib_Python_Set_PubSub, METH_VARARGS, "Set the PubSub parameters for a command message"},
- {NULL} /* Sentinel */
+static void CFE_MissionLib_Python_Database_dealloc(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
+static PyObject *CFE_MissionLib_Python_Database_repr(PyObject *obj);
+static int CFE_MissionLib_Python_Database_traverse(PyObject *obj, visitproc visit, void *arg);
+static int CFE_MissionLib_Python_Database_clear(PyObject *obj);
+
+static PyObject *CFE_MissionLib_Python_Database_GetInterface(PyObject *obj, PyObject *key);
+static PyObject *CFE_MissionLib_Python_DecodeEdsId(PyObject *obj, PyObject *args);
+static PyObject *CFE_MissionLib_Python_Set_PubSub(PyObject *obj, PyObject *args);
+static PyObject *CFE_MissionLib_Python_GetMsgId(PyObject *obj, PyObject *args);
+
+static PyObject *CFE_MissionLib_Python_Instance_iter(PyObject *obj);
+static void CFE_MissionLib_Python_InstanceIterator_dealloc(PyObject *obj);
+static int CFE_MissionLib_Python_InstanceIterator_traverse(PyObject *obj, visitproc visit, void *arg);
+static int CFE_MissionLib_Python_InstanceIterator_clear(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_InstanceIterator_iternext(PyObject *obj);
+
+static PyMethodDef CFE_MissionLib_Python_Database_methods[] = {
+ { "Interface", CFE_MissionLib_Python_Database_GetInterface, METH_O, "Lookup an Interface type from DB." },
+ { "DecodeEdsId", CFE_MissionLib_Python_DecodeEdsId, METH_VARARGS, "Decode the EdsID from a packed cFE message" },
+ { "SetPubSub", CFE_MissionLib_Python_Set_PubSub, METH_VARARGS, "Set the PubSub parameters for a command message" },
+ { "GetMsgId", CFE_MissionLib_Python_GetMsgId, METH_VARARGS, "Get the MsgId for a topic" },
+ { NULL } /* Sentinel */
};
-static struct PyMemberDef CFE_MissionLib_Python_Database_members[] =
-{
- {"Name", T_OBJECT_EX, offsetof(CFE_MissionLib_Python_Database_t, DbName), READONLY, "Database Name" },
- {NULL} /* Sentinel */
+static struct PyMemberDef CFE_MissionLib_Python_Database_members[] = {
+ { "Name", T_OBJECT_EX, offsetof(CFE_MissionLib_Python_Database_t, DbName), READONLY, "Database Name" },
+ { NULL } /* Sentinel */
};
-
-PyTypeObject CFE_MissionLib_Python_DatabaseType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("Database"),
- .tp_basicsize = sizeof(CFE_MissionLib_Python_Database_t),
- .tp_dealloc = CFE_MissionLib_Python_Database_dealloc,
- .tp_new = CFE_MissionLib_Python_Database_new,
- .tp_methods = CFE_MissionLib_Python_Database_methods,
- .tp_members = CFE_MissionLib_Python_Database_members,
- .tp_repr = CFE_MissionLib_Python_Database_repr,
- .tp_traverse = CFE_MissionLib_Python_Database_traverse,
- .tp_clear = CFE_MissionLib_Python_Database_clear,
- .tp_iter = CFE_MissionLib_Python_Instance_iter,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,
- .tp_weaklistoffset = offsetof(CFE_MissionLib_Python_Database_t, WeakRefList),
- .tp_doc = PyDoc_STR("Interface database")
-};
-
-PyTypeObject CFE_MissionLib_Python_InstanceIteratorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("InstanceIterator"),
- .tp_basicsize = sizeof(CFE_MissionLib_Python_InstanceIterator_t),
- .tp_dealloc = CFE_MissionLib_Python_InstanceIterator_dealloc,
- .tp_getattro = PyObject_GenericGetAttr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
- .tp_traverse = CFE_MissionLib_Python_InstanceIterator_traverse,
- .tp_clear = CFE_MissionLib_Python_InstanceIterator_clear,
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = CFE_MissionLib_Python_InstanceIterator_iternext,
- .tp_doc = PyDoc_STR("CFE MissionLib InstanceIteratorType")
+PyTypeObject CFE_MissionLib_Python_DatabaseType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ CFE_MISSIONLIB_PYTHON_ENTITY_NAME("Database"),
+ .tp_basicsize = sizeof(CFE_MissionLib_Python_Database_t),
+ .tp_dealloc = CFE_MissionLib_Python_Database_dealloc,
+ .tp_new = CFE_MissionLib_Python_Database_new,
+ .tp_methods = CFE_MissionLib_Python_Database_methods,
+ .tp_members = CFE_MissionLib_Python_Database_members,
+ .tp_repr = CFE_MissionLib_Python_Database_repr,
+ .tp_traverse = CFE_MissionLib_Python_Database_traverse,
+ .tp_clear = CFE_MissionLib_Python_Database_clear,
+ .tp_iter = CFE_MissionLib_Python_Instance_iter,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_weaklistoffset =
+ offsetof(CFE_MissionLib_Python_Database_t, WeakRefList),
+ .tp_doc = PyDoc_STR("Interface database") };
+
+PyTypeObject CFE_MissionLib_Python_InstanceIteratorType = {
+ PyVarObject_HEAD_INIT(NULL, 0).tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("InstanceIterator"),
+ .tp_basicsize = sizeof(CFE_MissionLib_Python_InstanceIterator_t),
+ .tp_dealloc = CFE_MissionLib_Python_InstanceIterator_dealloc,
+ .tp_getattro = PyObject_GenericGetAttr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_traverse = CFE_MissionLib_Python_InstanceIterator_traverse,
+ .tp_clear = CFE_MissionLib_Python_InstanceIterator_clear,
+ .tp_iter = PyObject_SelfIter,
+ .tp_iternext = CFE_MissionLib_Python_InstanceIterator_iternext,
+ .tp_doc = PyDoc_STR("CFE MissionLib InstanceIteratorType")
};
static int CFE_MissionLib_Python_Database_traverse(PyObject *obj, visitproc visit, void *arg)
@@ -129,7 +125,7 @@ static int CFE_MissionLib_Python_Database_clear(PyObject *obj)
return 0;
}
-static void CFE_MissionLib_Python_Database_dealloc(PyObject * obj)
+static void CFE_MissionLib_Python_Database_dealloc(PyObject *obj)
{
CFE_MissionLib_Python_Database_t *self = (CFE_MissionLib_Python_Database_t *)obj;
@@ -220,38 +216,40 @@ const CFE_MissionLib_SoftwareBus_Interface_t *CFE_MissionLib_Python_Database_Get
}
if (!PyObject_TypeCheck(obj, &CFE_MissionLib_Python_DatabaseType))
{
- PyErr_SetObject(PyExc_TypeError, obj);
+ PyErr_SetObject(PyExc_TypeError, obj);
return NULL;
}
- return ((CFE_MissionLib_Python_Database_t*)obj)->IntfDb;
+ return ((CFE_MissionLib_Python_Database_t *)obj)->IntfDb;
}
static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
{
- PyObject *arg1;
- PyObject *arg2;
- PyObject *dbname;
- const char *dbstr;
- char *p;
- char tempstring[512];
- void *handle;
- void *symbol;
- const char *errstr;
- bool IsSuccess;
+ PyObject *arg1;
+ PyObject *arg2;
+ PyObject *dbname;
+ const char *dbstr;
+ char *p;
+ char tempstring[512];
+ void *handle;
+ void *symbol;
+ const char *errstr;
+ bool IsSuccess;
CFE_MissionLib_Python_Database_t *self;
if (!PyArg_UnpackTuple(args, "Database_new", 1, 2, &arg1, &arg2))
{
- PyErr_Format(PyExc_RuntimeError, "Database arguments: Interface Database Identifier and EdsDb Python Object (If Database associated with Identifier has not been created");
- return NULL;
+ PyErr_Format(PyExc_RuntimeError,
+ "Database arguments: Interface Database Identifier and EdsDb Python Object (If Database "
+ "associated with Identifier has not been created");
+ return NULL;
}
- dbname = NULL;
- handle = NULL;
- symbol = NULL;
- errstr = NULL;
- self = NULL;
+ dbname = NULL;
+ handle = NULL;
+ symbol = NULL;
+ errstr = NULL;
+ self = NULL;
IsSuccess = false;
do
@@ -271,11 +269,14 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
}
/*
- * To avoid wasting resources, do not create the same database multiple times.
- * First check if the db cache object already contains an instance for this name
- * note: PyDict_GetItem returns borrowed reference
- */
- self = (CFE_MissionLib_Python_Database_t *)CFE_MissionLib_Python_GetFromCache(CFE_MissionLib_Python_DatabaseCache, dbname, &CFE_MissionLib_Python_DatabaseType);
+ * To avoid wasting resources, do not create the same database multiple times.
+ * First check if the db cache object already contains an instance for this name
+ * note: PyDict_GetItem returns borrowed reference
+ */
+ self =
+ (CFE_MissionLib_Python_Database_t *)CFE_MissionLib_Python_GetFromCache(CFE_MissionLib_Python_DatabaseCache,
+ dbname,
+ &CFE_MissionLib_Python_DatabaseType);
if (self != NULL)
{
IsSuccess = true;
@@ -288,11 +289,11 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
break;
}
- snprintf(tempstring,sizeof(tempstring),"%s_eds_sb_dispatchdb.so", dbstr);
+ snprintf(tempstring, sizeof(tempstring), "%s_eds_sb_dispatchdb.so", dbstr);
/* Clear any pending dlerror value */
dlerror();
- handle = dlopen(tempstring, RTLD_LOCAL|RTLD_NOW);
+ handle = dlopen(tempstring, RTLD_LOCAL | RTLD_NOW);
errstr = dlerror();
if (handle == NULL && errstr == NULL)
@@ -306,7 +307,7 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
break;
}
- snprintf(tempstring,sizeof(tempstring),"%s_SOFTWAREBUS_INTERFACE", dbstr);
+ snprintf(tempstring, sizeof(tempstring), "%s_SOFTWAREBUS_INTERFACE", dbstr);
p = tempstring;
while (*p != 0)
{
@@ -321,7 +322,7 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
break;
}
- self = (CFE_MissionLib_Python_Database_t*)obj->tp_alloc(obj, 0);
+ self = (CFE_MissionLib_Python_Database_t *)obj->tp_alloc(obj, 0);
if (self == NULL)
{
break;
@@ -339,8 +340,8 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
}
/* Create a weak reference to store in the local cache in case this
- * database is constructed again. */
- if (CFE_MissionLib_Python_SaveToCache(CFE_MissionLib_Python_DatabaseCache, dbname, (PyObject*)self) < 0)
+ * database is constructed again. */
+ if (CFE_MissionLib_Python_SaveToCache(CFE_MissionLib_Python_DatabaseCache, dbname, (PyObject *)self) < 0)
{
/* if something went wrong this raises an error and must return NULL */
break;
@@ -349,8 +350,7 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
self->dl = handle;
IsSuccess = true;
- }
- while (false);
+ } while (false);
Py_XDECREF(dbname);
if (!IsSuccess)
@@ -369,7 +369,7 @@ static PyObject *CFE_MissionLib_Python_Database_new(PyTypeObject *obj, PyObject
}
}
- return (PyObject*)self;
+ return (PyObject *)self;
}
PyObject *CFE_MissionLib_Python_Database_repr(PyObject *obj)
@@ -381,14 +381,14 @@ PyObject *CFE_MissionLib_Python_Database_repr(PyObject *obj)
static PyObject *CFE_MissionLib_Python_Database_GetInterface(PyObject *obj, PyObject *arg)
{
PyObject *tempargs = NULL;
- PyObject *result = NULL;
+ PyObject *result = NULL;
tempargs = PyTuple_Pack(2, obj, arg);
if (tempargs == NULL)
{
return NULL;
}
- result = PyObject_Call((PyObject*)&CFE_MissionLib_Python_InterfaceType, tempargs, NULL);
+ result = PyObject_Call((PyObject *)&CFE_MissionLib_Python_InterfaceType, tempargs, NULL);
Py_DECREF(tempargs);
return result;
@@ -397,24 +397,24 @@ static PyObject *CFE_MissionLib_Python_Database_GetInterface(PyObject *obj, PyOb
static PyObject *CFE_MissionLib_Python_DecodeEdsId(PyObject *obj, PyObject *args)
{
CFE_MissionLib_Python_Database_t *IntfDb = (CFE_MissionLib_Python_Database_t *)obj;
- PyObject *arg1;
+ PyObject *arg1;
Py_ssize_t BytesSize;
- char *NetworkBuffer;
+ char *NetworkBuffer;
EdsNativeBuffer_CFE_HDR_Message_t LocalBuffer;
EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSubParams;
- EdsComponent_CFE_SB_Publisher_t PublisherParams;
- EdsComponent_CFE_SB_Listener_t ListenerParams;
-
- EdsLib_Id_t EdsId;
- EdsLib_Id_t CmdEdsId;
- uint16_t TopicId;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- CFE_MissionLib_TopicInfo_t TopicInfo;
+ EdsComponent_CFE_SB_Publisher_t PublisherParams;
+ EdsComponent_CFE_SB_Listener_t ListenerParams;
+
+ EdsLib_Id_t EdsId;
+ EdsLib_Id_t CmdEdsId;
+ uint16_t TopicId;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ CFE_MissionLib_TopicInfo_t TopicInfo;
const EdsDataType_CFE_HDR_Message_t *MsgPtr;
- int32_t Status;
+ int32_t Status;
PyObject *result = NULL;
@@ -428,28 +428,35 @@ static PyObject *CFE_MissionLib_Python_DecodeEdsId(PyObject *obj, PyObject *args
do
{
- if (!PyBytes_Check(arg1))
- {
- PyErr_Format(PyExc_RuntimeError, "DecodeEdsId argument not of bytes string type");
- break;
- }
- BytesSize = PyBytes_Size(arg1);
+ if (!PyBytes_Check(arg1))
+ {
+ PyErr_Format(PyExc_RuntimeError, "DecodeEdsId argument not of bytes string type");
+ break;
+ }
+ BytesSize = PyBytes_Size(arg1);
PyBytes_AsStringAndSize(arg1, &NetworkBuffer, &BytesSize);
- EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_TelemetryHeader_DATADICTIONARY);
+ EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_TelemetryHeader_DATADICTIONARY);
Status = EdsLib_DataTypeDB_GetTypeInfo(CFE_MissionLib_GetParent(IntfDb->IntfDb), EdsId, &TypeInfo);
if (Status != CFE_MISSIONLIB_SUCCESS)
{
- PyErr_Format(PyExc_RuntimeError, "Unable to get type info for CCSDS_SPACEPACKET: return status = %d", Status);
- break;
+ PyErr_Format(PyExc_RuntimeError,
+ "Unable to get type info for CCSDS_SPACEPACKET: return status = %d",
+ Status);
+ break;
}
- Status = EdsLib_DataTypeDB_UnpackPartialObject(CFE_MissionLib_GetParent(IntfDb->IntfDb), &EdsId,
- LocalBuffer.Byte, NetworkBuffer, sizeof(LocalBuffer), 8*TypeInfo.Size.Bytes, 0);
+ Status = EdsLib_DataTypeDB_UnpackPartialObject(CFE_MissionLib_GetParent(IntfDb->IntfDb),
+ &EdsId,
+ LocalBuffer.Byte,
+ NetworkBuffer,
+ sizeof(LocalBuffer),
+ 8 * TypeInfo.Size.Bytes,
+ 0);
if (Status != CFE_MISSIONLIB_SUCCESS)
{
- PyErr_Format(PyExc_RuntimeError, "Unable to unpack partial object: return status = %d", Status);
- break;
+ PyErr_Format(PyExc_RuntimeError, "Unable to unpack partial object: return status = %d", Status);
+ break;
}
MsgPtr = (const EdsDataType_CFE_HDR_Message_t *)&LocalBuffer;
@@ -459,113 +466,184 @@ static PyObject *CFE_MissionLib_Python_DecodeEdsId(PyObject *obj, PyObject *args
if (CFE_MissionLib_PubSub_IsPublisherComponent(&PubSubParams))
{
CFE_MissionLib_UnmapPublisherComponent(&PublisherParams, &PubSubParams);
- TopicId = PublisherParams.Telemetry.TopicId;
+ TopicId = PublisherParams.Telemetry.TopicId;
CmdEdsId = CFE_SB_TELEMETRY_ID;
}
else if (CFE_MissionLib_PubSub_IsListenerComponent(&PubSubParams))
{
CFE_MissionLib_UnmapListenerComponent(&ListenerParams, &PubSubParams);
- TopicId = ListenerParams.Telecommand.TopicId;
+ TopicId = ListenerParams.Telecommand.TopicId;
CmdEdsId = CFE_SB_TELECOMMAND_ID;
}
else
{
- PyErr_Format(PyExc_RuntimeError, "Unable to identify component for MsgId=0x%x", (unsigned int)PubSubParams.MsgId.Value);
- break;
+ PyErr_Format(PyExc_RuntimeError,
+ "Unable to identify component for MsgId=0x%x",
+ (unsigned int)PubSubParams.MsgId.Value);
+ break;
}
Status = CFE_MissionLib_GetTopicInfo(IntfDb->IntfDb, TopicId, &TopicInfo);
if (Status != CFE_MISSIONLIB_SUCCESS)
{
- PyErr_Format(PyExc_RuntimeError, "CFE_MissionLib_GetTopicInfo(%d) rc=%d", (int)TopicId, (int)Status);
- break;
+ PyErr_Format(PyExc_RuntimeError, "CFE_MissionLib_GetTopicInfo(%d) rc=%d", (int)TopicId, (int)Status);
+ break;
}
- Status = EdsLib_IntfDB_FindAllArgumentTypes(CFE_MissionLib_GetParent(IntfDb->IntfDb), CmdEdsId,
- TopicInfo.ParentIntfId, &EdsId, 1);
+ Status = EdsLib_IntfDB_FindAllArgumentTypes(CFE_MissionLib_GetParent(IntfDb->IntfDb),
+ CmdEdsId,
+ TopicInfo.ParentIntfId,
+ &EdsId,
+ 1);
if (Status != EDSLIB_SUCCESS)
{
- PyErr_Format(PyExc_RuntimeError, "Unable to get argument type: return status = %d", Status);
- break;
+ PyErr_Format(PyExc_RuntimeError, "Unable to get argument type: return status = %d", Status);
+ break;
}
result = PyTuple_New(2);
- PyTuple_SetItem(result, 0, PyLong_FromLong((long int) EdsId));
- PyTuple_SetItem(result, 1, PyLong_FromLong((long int) TopicId));
- }
- while(0);
+ PyTuple_SetItem(result, 0, PyLong_FromLong((long int)EdsId));
+ PyTuple_SetItem(result, 1, PyLong_FromLong((long int)TopicId));
+ } while (0);
Py_XDECREF(arg1);
return result;
}
-static PyObject * CFE_MissionLib_Python_Set_PubSub(PyObject *obj, PyObject *args)
+static uint16_t CFE_MissionLib_Python_ArgToInstanceNum(const CFE_MissionLib_SoftwareBus_Interface_t *IntfDb,
+ PyObject *arg)
+{
+ uint16_t Result;
+ PyObject *temparg;
+
+ Result = 0;
+
+ if (PyNumber_Check(arg))
+ {
+ temparg = PyNumber_Long(arg);
+ }
+ else if (PyUnicode_Check(arg))
+ {
+ /* Do a lookup but make sure the string is plain ASCII */
+ temparg = PyUnicode_AsASCIIString(arg);
+ }
+ else
+ {
+ temparg = PyObject_ASCII(arg);
+ }
+
+ if (temparg != NULL)
+ {
+ if (PyNumber_Check(arg))
+ {
+ Result = PyLong_AsUnsignedLong(temparg);
+ }
+ else
+ {
+ Result = CFE_MissionLib_GetInstanceNumber(IntfDb, PyBytes_AsString(temparg));
+ }
+
+ Py_DECREF(temparg);
+ temparg = NULL;
+ }
+
+ if (Result == 0)
+ {
+ PyErr_Format(PyExc_ValueError, "Cannot convert %R to an instance number", arg);
+ }
+
+ return Result;
+}
+
+static uint16_t CFE_MissionLib_Python_ArgToTopicId(const CFE_MissionLib_SoftwareBus_Interface_t *IntfDb, PyObject *arg)
+{
+ uint16_t Result;
+ PyObject *temparg;
+ CFE_MissionLib_Python_Topic_t *topic_obj;
+
+ Result = 0;
+
+ if (PyObject_TypeCheck(arg, &CFE_MissionLib_Python_TopicType))
+ {
+ topic_obj = (CFE_MissionLib_Python_Topic_t *)arg;
+ Result = topic_obj->TopicId;
+ }
+ else if (PyNumber_Check(arg))
+ {
+ temparg = PyNumber_Long(arg);
+
+ Result = PyLong_AsUnsignedLong(temparg);
+ Py_DECREF(temparg);
+ }
+
+ if (Result == 0)
+ {
+ /* In theory this could accept a named topic as well, if needed */
+ PyErr_Format(PyExc_ValueError, "Cannot convert %R to a topic ID", arg);
+ }
+
+ return Result;
+}
+
+static PyObject *CFE_MissionLib_Python_Set_PubSub(PyObject *obj, PyObject *args)
{
PyObject *arg1;
PyObject *arg2;
PyObject *arg3;
- PyObject *tempargs;
- PyObject *result = NULL;
+ PyObject *result;
- EdsLib_Python_ObjectBase_t *Python_Packet;
- EdsLib_Python_Buffer_t *StorageBuffer;
+ EdsLib_Python_ObjectBase_t *Python_Packet;
+ EdsLib_Python_Buffer_t *StorageBuffer;
EdsLib_Binding_Buffer_Content_t edsbuf;
- EdsDataType_CFE_HDR_Message_t *Packet;
+ EdsDataType_CFE_HDR_Message_t *Packet;
- EdsComponent_CFE_SB_Listener_t Params;
+ EdsComponent_CFE_SB_Listener_t Params;
EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
- if (!PyArg_UnpackTuple(args, "DecodeEdsId", 3, 3, &arg1, &arg2, &arg3))
+ CFE_MissionLib_Python_Database_t *IntfDb = (CFE_MissionLib_Python_Database_t *)obj;
+
+ if (!PyArg_UnpackTuple(args, "SetPubSub", 3, 3, &arg1, &arg2, &arg3))
{
PyErr_Format(PyExc_RuntimeError, "Arguments expected: InstanceNumber, TopicId, and SpacePacket Message");
- return Py_False;
+ return Py_False;
}
Py_INCREF(arg1);
Py_INCREF(arg2);
Py_INCREF(arg3);
+ result = NULL;
+ memset(&Params, 0, sizeof(Params));
+
do
{
- if (PyNumber_Check(arg1))
- {
- tempargs = PyNumber_Long(arg1);
-
- Params.Telecommand.InstanceNumber = PyLong_AsUnsignedLong(tempargs);
- Py_DECREF(tempargs);
- }
- else
- {
- PyErr_Format(PyExc_RuntimeError, "InstanceNumber needs to be an integer");
+ Params.Telecommand.InstanceNumber = CFE_MissionLib_Python_ArgToInstanceNum(IntfDb->IntfDb, arg1);
+ if (Params.Telecommand.InstanceNumber == 0)
+ {
+ /* error already raised */
break;
- }
+ }
- if (PyNumber_Check(arg2))
+ Params.Telecommand.TopicId = CFE_MissionLib_Python_ArgToTopicId(IntfDb->IntfDb, arg2);
+ if (Params.Telecommand.TopicId == 0)
{
- tempargs = PyNumber_Long(arg2);
-
- Params.Telecommand.TopicId = PyLong_AsUnsignedLong(tempargs);
- Py_DECREF(tempargs);
- }
- else
- {
- PyErr_Format(PyExc_RuntimeError, "TopicId needs to be an integer");
+ /* error already raised */
break;
- }
+ }
- // Dive through an EdsLib python base object to get to the actual EDS data
- Python_Packet = (EdsLib_Python_ObjectBase_t *) arg3;
+ // Dive through an EdsLib python base object to get to the actual EDS data
+ Python_Packet = (EdsLib_Python_ObjectBase_t *)arg3;
StorageBuffer = Python_Packet->StorageBuf;
- edsbuf = StorageBuffer->edsbuf;
- Packet = (EdsDataType_CFE_HDR_Message_t *) edsbuf.Data;
+ edsbuf = StorageBuffer->edsbuf;
+ Packet = (EdsDataType_CFE_HDR_Message_t *)edsbuf.Data;
CFE_MissionLib_MapListenerComponent(&PubSub, &Params);
CFE_MissionLib_Set_PubSub_Parameters(Packet, &PubSub);
Py_INCREF(Py_True);
result = Py_True;
- } while(0);
+ } while (0);
Py_XDECREF(arg1);
Py_XDECREF(arg2);
@@ -574,10 +652,82 @@ static PyObject * CFE_MissionLib_Python_Set_PubSub(PyObject *obj, PyObject *arg
return result;
}
-static PyObject * CFE_MissionLib_Python_Instance_iter(PyObject *obj)
+static PyObject *CFE_MissionLib_Python_GetMsgId(PyObject *obj, PyObject *args)
{
- CFE_MissionLib_Python_InstanceIterator_t *InstIter;
- PyObject *result = NULL;
+ PyObject *arg1;
+ PyObject *arg2;
+ PyObject *result;
+
+ union
+ {
+ EdsComponent_CFE_SB_Listener_t L;
+ EdsComponent_CFE_SB_Publisher_t P;
+ } Params;
+ EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
+ uint16_t TopicId;
+ uint16_t InstanceNum;
+
+ CFE_MissionLib_Python_Database_t *IntfDb = (CFE_MissionLib_Python_Database_t *)obj;
+
+ if (!PyArg_UnpackTuple(args, "GetMsgId", 2, 2, &arg1, &arg2))
+ {
+ return PyErr_Format(PyExc_RuntimeError, "Arguments expected: InstanceNumber, TopicId");
+ }
+
+ Py_INCREF(arg1);
+ Py_INCREF(arg2);
+
+ result = NULL;
+ memset(&Params, 0, sizeof(Params));
+
+ do
+ {
+ InstanceNum = CFE_MissionLib_Python_ArgToInstanceNum(IntfDb->IntfDb, arg1);
+ if (InstanceNum == 0)
+ {
+ /* error already raised */
+ break;
+ }
+
+ TopicId = CFE_MissionLib_Python_ArgToTopicId(IntfDb->IntfDb, arg2);
+ if (TopicId == 0)
+ {
+ /* error already raised */
+ break;
+ }
+
+ /*
+ * There is not a direct way to tell if a topic is CMD or TLM, for now
+ * the approach has been to try both
+ */
+ Params.L.Telecommand.InstanceNumber = InstanceNum;
+ Params.L.Telecommand.TopicId = TopicId;
+ if (!CFE_MissionLib_MapListenerComponent(&PubSub, &Params.L))
+ {
+ Params.P.Telemetry.InstanceNumber = InstanceNum;
+ Params.P.Telemetry.TopicId = TopicId;
+ if (!CFE_MissionLib_MapPublisherComponent(&PubSub, &Params.P))
+ {
+ /* If neither worked, the TopicId must be bad */
+ PyErr_Format(PyExc_ValueError, "TopicID %R cannot be converted to MsgID", arg2);
+ break;
+ }
+ }
+
+ result = PyLong_FromLong(PubSub.MsgId.Value);
+
+ } while (0);
+
+ Py_XDECREF(arg1);
+ Py_XDECREF(arg2);
+
+ return result;
+}
+
+static PyObject *CFE_MissionLib_Python_Instance_iter(PyObject *obj)
+{
+ CFE_MissionLib_Python_InstanceIterator_t *InstIter;
+ PyObject *result = NULL;
InstIter = PyObject_GC_New(CFE_MissionLib_Python_InstanceIterator_t, &CFE_MissionLib_Python_InstanceIteratorType);
@@ -588,7 +738,7 @@ static PyObject * CFE_MissionLib_Python_Instance_iter(PyObject *obj)
Py_INCREF(obj);
InstIter->refobj = obj;
- InstIter->Index = 1;
+ InstIter->Index = 1;
result = (PyObject *)InstIter;
PyObject_GC_Track(result);
@@ -596,9 +746,9 @@ static PyObject * CFE_MissionLib_Python_Instance_iter(PyObject *obj)
return result;
}
-static void CFE_MissionLib_Python_InstanceIterator_dealloc(PyObject * obj)
+static void CFE_MissionLib_Python_InstanceIterator_dealloc(PyObject *obj)
{
- CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t*)obj;
+ CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t *)obj;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->refobj);
PyObject_GC_Del(self);
@@ -606,27 +756,27 @@ static void CFE_MissionLib_Python_InstanceIterator_dealloc(PyObject * obj)
static int CFE_MissionLib_Python_InstanceIterator_traverse(PyObject *obj, visitproc visit, void *arg)
{
- CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t*)obj;
+ CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t *)obj;
Py_VISIT(self->refobj);
return 0;
}
static int CFE_MissionLib_Python_InstanceIterator_clear(PyObject *obj)
{
- CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t*)obj;
+ CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t *)obj;
Py_CLEAR(self->refobj);
return 0;
}
static PyObject *CFE_MissionLib_Python_InstanceIterator_iternext(PyObject *obj)
{
- CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t*)obj;
- CFE_MissionLib_Python_Database_t *dbobj = NULL;
- const char * Label = NULL;
+ CFE_MissionLib_Python_InstanceIterator_t *self = (CFE_MissionLib_Python_InstanceIterator_t *)obj;
+ CFE_MissionLib_Python_Database_t *dbobj = NULL;
+ const char *Label = NULL;
- PyObject *key = NULL;
+ PyObject *key = NULL;
PyObject *instanceid = NULL;
- PyObject *result = NULL;
+ PyObject *result = NULL;
if (self->refobj == NULL)
{
@@ -652,8 +802,7 @@ static PyObject *CFE_MissionLib_Python_InstanceIterator_iternext(PyObject *obj)
++self->Index;
result = PyTuple_Pack(2, key, instanceid);
- }
- while(0);
+ } while (0);
Py_XDECREF(key);
Py_XDECREF(instanceid);
diff --git a/cfecfs/missionlib/python/src/cfe_missionlib_python_interface.c b/cfecfs/missionlib/python/src/cfe_missionlib_python_interface.c
index 5fd1cd1..175786b 100644
--- a/cfecfs/missionlib/python/src/cfe_missionlib_python_interface.c
+++ b/cfecfs/missionlib/python/src/cfe_missionlib_python_interface.c
@@ -37,68 +37,63 @@
#include "cfe_mission_eds_designparameters.h"
#include "cfe_mission_eds_interface_parameters.h"
-
-static void CFE_MissionLib_Python_Interface_dealloc(PyObject * obj);
-static PyObject * CFE_MissionLib_Python_Interface_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
-static PyObject * CFE_MissionLib_Python_Interface_gettopic(PyObject *obj, PyObject *arg);
-static PyObject * CFE_MissionLib_Python_Interface_repr(PyObject *obj);
-static int CFE_MissionLib_Python_Interface_traverse(PyObject *obj, visitproc visit, void *arg);
-static int CFE_MissionLib_Python_Interface_clear(PyObject *obj);
-static PyObject * CFE_MissionLib_Python_Interface_GetCmdMessage(PyObject *obj, PyObject *args);
-
-static PyObject * CFE_MissionLib_Python_Interface_iter(PyObject *obj);
-static void CFE_MissionLib_Python_InterfaceIterator_dealloc(PyObject * obj);
-static int CFE_MissionLib_Python_InterfaceIterator_traverse(PyObject *obj, visitproc visit, void *arg);
-static int CFE_MissionLib_Python_InterfaceIterator_clear(PyObject *obj);
-static PyObject * CFE_MissionLib_Python_InterfaceIterator_iternext(PyObject *obj);
-
-static CFE_MissionLib_Python_Interface_t *CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(PyTypeObject *obj, PyObject *dbobj, EdsLib_Id_t DeclEdsId);
-
-static PyMethodDef CFE_MissionLib_Python_Interface_methods[] =
-{
- {"Topic", CFE_MissionLib_Python_Interface_gettopic, METH_O, "Lookup a Topic from an Interface."},
- {"GetCmdMessage", CFE_MissionLib_Python_Interface_GetCmdMessage, METH_VARARGS, "Get a CFE command message EDS Object from a Topic"},
- {NULL} /* Sentinel */
-};
-
-static struct PyMemberDef CFE_MissionLib_Python_Interface_members[] =
-{
- {"Name", T_OBJECT_EX, offsetof(CFE_MissionLib_Python_Interface_t, IntfName), READONLY, "Interface Name" },
- {NULL} /* Sentinel */
+static void CFE_MissionLib_Python_Interface_dealloc(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_Interface_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
+static PyObject *CFE_MissionLib_Python_Interface_gettopic(PyObject *obj, PyObject *arg);
+static PyObject *CFE_MissionLib_Python_Interface_repr(PyObject *obj);
+static int CFE_MissionLib_Python_Interface_traverse(PyObject *obj, visitproc visit, void *arg);
+static int CFE_MissionLib_Python_Interface_clear(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_Interface_GetCmdMessage(PyObject *obj, PyObject *args);
+
+static PyObject *CFE_MissionLib_Python_Interface_iter(PyObject *obj);
+static void CFE_MissionLib_Python_InterfaceIterator_dealloc(PyObject *obj);
+static int CFE_MissionLib_Python_InterfaceIterator_traverse(PyObject *obj, visitproc visit, void *arg);
+static int CFE_MissionLib_Python_InterfaceIterator_clear(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_InterfaceIterator_iternext(PyObject *obj);
+
+static CFE_MissionLib_Python_Interface_t *
+CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(PyTypeObject *obj, PyObject *dbobj, EdsLib_Id_t DeclEdsId);
+
+static PyMethodDef CFE_MissionLib_Python_Interface_methods[] = {
+ { "Topic", CFE_MissionLib_Python_Interface_gettopic, METH_O, "Lookup a Topic from an Interface." },
+ { "GetCmdMessage",
+ CFE_MissionLib_Python_Interface_GetCmdMessage, METH_VARARGS,
+ "Get a CFE command message EDS Object from a Topic" },
+ { NULL } /* Sentinel */
};
-
-PyTypeObject CFE_MissionLib_Python_InterfaceType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("Interface"),
- .tp_basicsize = sizeof(CFE_MissionLib_Python_Interface_t),
- .tp_dealloc = CFE_MissionLib_Python_Interface_dealloc,
- .tp_new = CFE_MissionLib_Python_Interface_new,
- .tp_methods = CFE_MissionLib_Python_Interface_methods,
- .tp_members = CFE_MissionLib_Python_Interface_members,
- .tp_repr = CFE_MissionLib_Python_Interface_repr,
- .tp_traverse = CFE_MissionLib_Python_Interface_traverse,
- .tp_clear = CFE_MissionLib_Python_Interface_clear,
- .tp_iter = CFE_MissionLib_Python_Interface_iter,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,
- .tp_weaklistoffset = offsetof(CFE_MissionLib_Python_Interface_t, WeakRefList),
- .tp_doc = PyDoc_STR("Interface database entry")
+static struct PyMemberDef CFE_MissionLib_Python_Interface_members[] = {
+ { "Name", T_OBJECT_EX, offsetof(CFE_MissionLib_Python_Interface_t, IntfName), READONLY, "Interface Name" },
+ { NULL } /* Sentinel */
};
-PyTypeObject CFE_MissionLib_Python_InterfaceIteratorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("InterfaceIterator"),
- .tp_basicsize = sizeof(CFE_MissionLib_Python_InterfaceIterator_t),
- .tp_dealloc = CFE_MissionLib_Python_InterfaceIterator_dealloc,
- .tp_getattro = PyObject_GenericGetAttr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
- .tp_traverse = CFE_MissionLib_Python_InterfaceIterator_traverse,
- .tp_clear = CFE_MissionLib_Python_InterfaceIterator_clear,
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = CFE_MissionLib_Python_InterfaceIterator_iternext,
- .tp_doc = PyDoc_STR("CFE MissionLib InterfaceIteratorType")
+PyTypeObject CFE_MissionLib_Python_InterfaceType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ CFE_MISSIONLIB_PYTHON_ENTITY_NAME("Interface"),
+ .tp_basicsize = sizeof(CFE_MissionLib_Python_Interface_t),
+ .tp_dealloc = CFE_MissionLib_Python_Interface_dealloc,
+ .tp_new = CFE_MissionLib_Python_Interface_new,
+ .tp_methods = CFE_MissionLib_Python_Interface_methods,
+ .tp_members = CFE_MissionLib_Python_Interface_members,
+ .tp_repr = CFE_MissionLib_Python_Interface_repr,
+ .tp_traverse = CFE_MissionLib_Python_Interface_traverse,
+ .tp_clear = CFE_MissionLib_Python_Interface_clear,
+ .tp_iter = CFE_MissionLib_Python_Interface_iter,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_weaklistoffset =
+ offsetof(CFE_MissionLib_Python_Interface_t, WeakRefList),
+ .tp_doc = PyDoc_STR("Interface database entry") };
+
+PyTypeObject CFE_MissionLib_Python_InterfaceIteratorType = {
+ PyVarObject_HEAD_INIT(NULL, 0).tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("InterfaceIterator"),
+ .tp_basicsize = sizeof(CFE_MissionLib_Python_InterfaceIterator_t),
+ .tp_dealloc = CFE_MissionLib_Python_InterfaceIterator_dealloc,
+ .tp_getattro = PyObject_GenericGetAttr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_traverse = CFE_MissionLib_Python_InterfaceIterator_traverse,
+ .tp_clear = CFE_MissionLib_Python_InterfaceIterator_clear,
+ .tp_iter = PyObject_SelfIter,
+ .tp_iternext = CFE_MissionLib_Python_InterfaceIterator_iternext,
+ .tp_doc = PyDoc_STR("CFE MissionLib InterfaceIteratorType")
};
static int CFE_MissionLib_Python_Interface_traverse(PyObject *obj, visitproc visit, void *arg)
@@ -119,7 +114,7 @@ static int CFE_MissionLib_Python_Interface_clear(PyObject *obj)
return 0;
}
-static void CFE_MissionLib_Python_Interface_dealloc(PyObject * obj)
+static void CFE_MissionLib_Python_Interface_dealloc(PyObject *obj)
{
CFE_MissionLib_Python_Interface_t *self = (CFE_MissionLib_Python_Interface_t *)obj;
Py_CLEAR(self->DbObj);
@@ -135,14 +130,15 @@ static void CFE_MissionLib_Python_Interface_dealloc(PyObject * obj)
CFE_MissionLib_Python_InterfaceType.tp_base->tp_dealloc(obj);
}
-static CFE_MissionLib_Python_Interface_t *CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(PyTypeObject *obj, PyObject *dbobj, EdsLib_Id_t DeclEdsId)
+static CFE_MissionLib_Python_Interface_t *
+CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(PyTypeObject *obj, PyObject *dbobj, EdsLib_Id_t DeclEdsId)
{
- CFE_MissionLib_Python_Database_t *DbObj = (CFE_MissionLib_Python_Database_t *)dbobj;
- CFE_MissionLib_Python_Interface_t *self = NULL;
- char Buffer[128];
- int32_t Status;
- PyObject *DeclEdsIdVal;
- bool IsSuccess;
+ CFE_MissionLib_Python_Database_t *DbObj = (CFE_MissionLib_Python_Database_t *)dbobj;
+ CFE_MissionLib_Python_Interface_t *self = NULL;
+ char Buffer[128];
+ int32_t Status;
+ PyObject *DeclEdsIdVal;
+ bool IsSuccess;
IsSuccess = false;
do
@@ -153,7 +149,8 @@ static CFE_MissionLib_Python_Interface_t *CFE_MissionLib_Python_Interface_GetFro
break;
}
- self = (CFE_MissionLib_Python_Interface_t *)CFE_MissionLib_Python_GetFromCache(DbObj->IntfCache, DeclEdsIdVal, &CFE_MissionLib_Python_InterfaceType);
+ self = (CFE_MissionLib_Python_Interface_t *)
+ CFE_MissionLib_Python_GetFromCache(DbObj->IntfCache, DeclEdsIdVal, &CFE_MissionLib_Python_InterfaceType);
if (self != NULL)
{
if (EdsLib_Is_Match(DeclEdsId, self->DeclEdsId))
@@ -167,14 +164,14 @@ static CFE_MissionLib_Python_Interface_t *CFE_MissionLib_Python_Interface_GetFro
self = NULL;
}
- self = (CFE_MissionLib_Python_Interface_t*)obj->tp_alloc(obj, 0);
+ self = (CFE_MissionLib_Python_Interface_t *)obj->tp_alloc(obj, 0);
if (self == NULL)
{
break;
}
Py_INCREF(DbObj);
- self->DbObj = DbObj;
+ self->DbObj = DbObj;
self->DeclEdsId = DeclEdsId;
self->TopicCache = PyDict_New();
@@ -206,15 +203,14 @@ static CFE_MissionLib_Python_Interface_t *CFE_MissionLib_Python_Interface_GetFro
/* Create a weak reference to store in the local cache in case this
* database is constructed again. */
- if (CFE_MissionLib_Python_SaveToCache(DbObj->IntfCache, DeclEdsIdVal, (PyObject*)self) < 0)
+ if (CFE_MissionLib_Python_SaveToCache(DbObj->IntfCache, DeclEdsIdVal, (PyObject *)self) < 0)
{
/* if something went wrong this raises an error and must return NULL */
break;
}
IsSuccess = true;
- }
- while(0);
+ } while (0);
Py_XDECREF(DeclEdsIdVal);
if (!IsSuccess && self != NULL)
@@ -230,15 +226,15 @@ static CFE_MissionLib_Python_Interface_t *CFE_MissionLib_Python_Interface_GetFro
static PyObject *CFE_MissionLib_Python_Interface_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
{
- PyObject *arg1;
- PyObject *arg2;
- PyObject *arg3 = NULL;
+ PyObject *arg1;
+ PyObject *arg2;
+ PyObject *arg3 = NULL;
CFE_MissionLib_Python_Database_t *DbObj = NULL;
EdsLib_Id_t DeclEdsId = EDSLIB_ID_INVALID;
PyObject *tempargs = NULL;
- PyObject *result = NULL;
+ PyObject *result = NULL;
/*
* Interface entries are constructed from two values:
@@ -254,16 +250,18 @@ static PyObject *CFE_MissionLib_Python_Interface_new(PyTypeObject *obj, PyObject
*/
if (!PyArg_UnpackTuple(args, "Interface_new", 2, 3, &arg1, &arg2, &arg3))
{
- PyErr_Format(PyExc_RuntimeError, "Interface arguments expected: Interface Database, Interface Identifier, and EdsDb Python Object (optional)");
- return NULL;
+ PyErr_Format(PyExc_RuntimeError,
+ "Interface arguments expected: Interface Database, Interface Identifier, and EdsDb Python Object "
+ "(optional)");
+ return NULL;
}
do
{
- // Set up the Interface Database Python Object
+ // Set up the Interface Database Python Object
if (Py_TYPE(arg1) == &CFE_MissionLib_Python_DatabaseType)
{
- DbObj = (CFE_MissionLib_Python_Database_t*)arg1;
+ DbObj = (CFE_MissionLib_Python_Database_t *)arg1;
Py_INCREF(DbObj);
}
else
@@ -281,7 +279,9 @@ static PyObject *CFE_MissionLib_Python_Interface_new(PyTypeObject *obj, PyObject
{
break;
}
- DbObj = (CFE_MissionLib_Python_Database_t*)PyObject_Call((PyObject*)&CFE_MissionLib_Python_DatabaseType, tempargs, NULL);
+ DbObj = (CFE_MissionLib_Python_Database_t *)PyObject_Call((PyObject *)&CFE_MissionLib_Python_DatabaseType,
+ tempargs,
+ NULL);
Py_DECREF(tempargs);
tempargs = NULL;
}
@@ -292,15 +292,19 @@ static PyObject *CFE_MissionLib_Python_Interface_new(PyTypeObject *obj, PyObject
}
// Set up the Interface Python Object from an Interface Id or Interface Name
- DeclEdsId = CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_IntfDB_FindDeclaredInterfaceByFullName, CFE_MissionLib_GetParent(DbObj->IntfDb), arg2);
+ DeclEdsId = CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_IntfDB_FindDeclaredInterfaceByFullName,
+ CFE_MissionLib_GetParent(DbObj->IntfDb),
+ arg2);
/* if the lookup failed it should have already set an exception */
if (EdsLib_Is_Valid(DeclEdsId))
{
- result = (PyObject*)CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(&CFE_MissionLib_Python_InterfaceType, (PyObject *)DbObj, DeclEdsId);
+ result =
+ (PyObject *)CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(&CFE_MissionLib_Python_InterfaceType,
+ (PyObject *)DbObj,
+ DeclEdsId);
}
- }
- while(0);
+ } while (0);
/* decrement refcount for all temporary objects created */
Py_XDECREF(DbObj);
@@ -317,41 +321,45 @@ PyObject *CFE_MissionLib_Python_Interface_repr(PyObject *obj)
static PyObject *CFE_MissionLib_Python_Interface_gettopic(PyObject *obj, PyObject *arg)
{
- CFE_MissionLib_Python_Interface_t *IntfObj = (CFE_MissionLib_Python_Interface_t *)obj;
- PyObject *tempargs = NULL;
- PyObject *result = NULL;
+ CFE_MissionLib_Python_Interface_t *IntfObj = (CFE_MissionLib_Python_Interface_t *)obj;
+ PyObject *tempargs = NULL;
+ PyObject *result = NULL;
tempargs = PyTuple_Pack(3, IntfObj->DbObj, IntfObj, arg);
if (tempargs == NULL)
{
return NULL;
}
- result = PyObject_Call((PyObject*)&CFE_MissionLib_Python_TopicType, tempargs, NULL);
+ result = PyObject_Call((PyObject *)&CFE_MissionLib_Python_TopicType, tempargs, NULL);
Py_DECREF(tempargs);
return result;
}
-PyObject *CFE_MissionLib_Python_Interface_GetFromIntfName(CFE_MissionLib_Python_Database_t *obj, PyObject *InterfaceName)
+PyObject *CFE_MissionLib_Python_Interface_GetFromIntfName(CFE_MissionLib_Python_Database_t *obj,
+ PyObject *InterfaceName)
{
- int32_t status;
+ int32_t status;
EdsLib_Id_t DeclEdsId;
status = EdsLib_IntfDB_FindDeclaredInterfaceByFullName(CFE_MissionLib_GetParent(obj->IntfDb),
- PyBytes_AsString(InterfaceName), &DeclEdsId);
+ PyBytes_AsString(InterfaceName),
+ &DeclEdsId);
if (status != EDSLIB_SUCCESS)
{
PyErr_Format(PyExc_RuntimeError, "Interface %s undefined", PyBytes_AsString(InterfaceName));
return NULL;
}
- return (PyObject*)CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(&CFE_MissionLib_Python_InterfaceType, (PyObject *)obj, DeclEdsId);
+ return (PyObject *)CFE_MissionLib_Python_Interface_GetFromDeclEdsId_Impl(&CFE_MissionLib_Python_InterfaceType,
+ (PyObject *)obj,
+ DeclEdsId);
}
-static PyObject * CFE_MissionLib_Python_Interface_iter(PyObject *obj)
+static PyObject *CFE_MissionLib_Python_Interface_iter(PyObject *obj)
{
CFE_MissionLib_Python_InterfaceIterator_t *IntfIter;
- PyObject *result = NULL;
+ PyObject *result = NULL;
IntfIter = PyObject_GC_New(CFE_MissionLib_Python_InterfaceIterator_t, &CFE_MissionLib_Python_InterfaceIteratorType);
@@ -371,9 +379,9 @@ static PyObject * CFE_MissionLib_Python_Interface_iter(PyObject *obj)
return result;
}
-static void CFE_MissionLib_Python_InterfaceIterator_dealloc(PyObject * obj)
+static void CFE_MissionLib_Python_InterfaceIterator_dealloc(PyObject *obj)
{
- CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t*)obj;
+ CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t *)obj;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->refobj);
PyObject_GC_Del(self);
@@ -381,28 +389,29 @@ static void CFE_MissionLib_Python_InterfaceIterator_dealloc(PyObject * obj)
static int CFE_MissionLib_Python_InterfaceIterator_traverse(PyObject *obj, visitproc visit, void *arg)
{
- CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t*)obj;
+ CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t *)obj;
Py_VISIT(self->refobj);
return 0;
}
static int CFE_MissionLib_Python_InterfaceIterator_clear(PyObject *obj)
{
- CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t*)obj;
+ CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t *)obj;
Py_CLEAR(self->refobj);
return 0;
}
static PyObject *CFE_MissionLib_Python_InterfaceIterator_iternext(PyObject *obj)
{
- CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t*)obj;
- CFE_MissionLib_Python_Interface_t *intf = NULL;
- char Buffer[128];
- CFE_MissionLib_TopicInfo_t TopicInfo;
- int32_t Status;
- PyObject *key = NULL;
- PyObject *topicid = NULL;
- PyObject *result = NULL;
+ CFE_MissionLib_Python_InterfaceIterator_t *self = (CFE_MissionLib_Python_InterfaceIterator_t *)obj;
+ CFE_MissionLib_Python_Interface_t *intf = NULL;
+ char Buffer[128];
+ CFE_MissionLib_TopicInfo_t TopicInfo;
+ EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
+ int32_t Status;
+ PyObject *key = NULL;
+ PyObject *topicid = NULL;
+ PyObject *result = NULL;
if (self->refobj == NULL)
{
@@ -424,10 +433,27 @@ static PyObject *CFE_MissionLib_Python_InterfaceIterator_iternext(PyObject *obj)
break;
}
- /* This fails quickly if passed an invalid identifier - it will not assemble the string */
- Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(intf->DbObj->IntfDb), TopicInfo.ParentIntfId, Buffer, sizeof(Buffer));
- }
- while(Status != EDSLIB_SUCCESS);
+ Status = EdsLib_IntfDB_GetComponentInterfaceInfo(CFE_MissionLib_GetParent(intf->DbObj->IntfDb),
+ TopicInfo.ParentIntfId,
+ &IntfInfo);
+ if (Status == EDSLIB_SUCCESS)
+ {
+ /* Only look at entries associated with this interface (Bypass topics from other interfaces) */
+ if (IntfInfo.IntfTypeEdsId != intf->DeclEdsId)
+ {
+ Status = EDSLIB_NO_MATCHING_VALUE;
+ }
+ else
+ {
+ /* This fails quickly if passed an invalid identifier - it will not assemble the string */
+ Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(intf->DbObj->IntfDb),
+ TopicInfo.ParentIntfId,
+ Buffer,
+ sizeof(Buffer));
+ }
+ }
+
+ } while (Status != EDSLIB_SUCCESS);
if (Status == EDSLIB_SUCCESS)
{
@@ -441,7 +467,7 @@ static PyObject *CFE_MissionLib_Python_InterfaceIterator_iternext(PyObject *obj)
else
{
topicid = PyLong_FromLong(self->TopicId);
- result = PyTuple_Pack(2, key, topicid);
+ result = PyTuple_Pack(2, key, topicid);
}
}
@@ -456,14 +482,15 @@ static PyObject *CFE_MissionLib_Python_Interface_GetCmdMessage(PyObject *obj, Py
return PyUnicode_FromFormat("Interface_GetCmdMessage still needs to be implemented");
}
-EdsLib_Id_t CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_NameLookupFunc_t Func, const EdsLib_DatabaseObject_t *GD, PyObject* arg)
+EdsLib_Id_t
+CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_NameLookupFunc_t Func, const EdsLib_DatabaseObject_t *GD, PyObject *arg)
{
EdsLib_Id_t Result;
- int32_t Status;
- PyObject *temp_id;
+ int32_t Status;
+ PyObject *temp_id;
temp_id = NULL;
- Result = EDSLIB_ID_INVALID;
+ Result = EDSLIB_ID_INVALID;
/*
* The identifier might come from the python interpreter as a string or number.
@@ -500,7 +527,10 @@ EdsLib_Id_t CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_NameLookupFunc_t Func
Status = Func(GD, PyBytes_AsString(temp_id), &Result);
if (Status != EDSLIB_SUCCESS)
{
- PyErr_Format(PyExc_ValueError, "Name lookup on \'%s\' failed with code=%d", PyBytes_AsString(temp_id), (int)Status);
+ PyErr_Format(PyExc_ValueError,
+ "Name lookup on \'%s\' failed with code=%d",
+ PyBytes_AsString(temp_id),
+ (int)Status);
Result = EDSLIB_ID_INVALID;
}
}
diff --git a/cfecfs/missionlib/python/src/cfe_missionlib_python_internal.h b/cfecfs/missionlib/python/src/cfe_missionlib_python_internal.h
index 184548e..fc697aa 100644
--- a/cfecfs/missionlib/python/src/cfe_missionlib_python_internal.h
+++ b/cfecfs/missionlib/python/src/cfe_missionlib_python_internal.h
@@ -29,7 +29,6 @@
**
******************************************************************************/
-
#ifndef CFE_MISSIONLIB_PYTHON_INTERNAL_H
#define CFE_MISSIONLIB_PYTHON_INTERNAL_H
@@ -49,69 +48,65 @@
typedef struct
{
- PyObject_HEAD
- void *dl;
+ PyObject_HEAD void *dl;
const CFE_MissionLib_SoftwareBus_Interface_t *IntfDb;
- PyObject *DbName;
- PyObject *IntfCache;
- PyObject *WeakRefList;
+ PyObject *DbName;
+ PyObject *IntfCache;
+ PyObject *WeakRefList;
} CFE_MissionLib_Python_Database_t;
/* An "Interface" here is analogous to a declared intf in EDS. In the software bus realm there
* are two - Telecommand and Telemetry, differing only in the direction of data flow */
typedef struct
{
- PyObject_HEAD
- CFE_MissionLib_Python_Database_t *DbObj;
- PyObject *IntfName;
- EdsLib_Id_t DeclEdsId;
- EdsLib_Id_t CmdEdsId;
- PyObject *TopicCache;
- PyObject *WeakRefList;
+ PyObject_HEAD CFE_MissionLib_Python_Database_t *DbObj;
+ PyObject *IntfName;
+ EdsLib_Id_t DeclEdsId;
+ EdsLib_Id_t CmdEdsId;
+ PyObject *TopicCache;
+ PyObject *WeakRefList;
} CFE_MissionLib_Python_Interface_t;
typedef struct
{
- PyObject_HEAD
- CFE_MissionLib_Python_Interface_t *IntfObj;
- PyObject *TopicName;
- uint16_t TopicId;
+ PyObject_HEAD CFE_MissionLib_Python_Interface_t *IntfObj;
+ PyObject *TopicName;
+ uint16_t TopicId;
CFE_MissionLib_TopicInfo_t TopicInfo;
EdsLib_Id_t DataEdsId; /* The actual data type for messages on this topic */
- PyObject *WeakRefList;
+ PyObject *WeakRefList;
} CFE_MissionLib_Python_Topic_t;
typedef struct
{
- PyObject_HEAD
- uint16_t Index;
- PyObject* refobj;
+ PyObject_HEAD uint16_t Index;
+ PyObject *refobj;
} CFE_MissionLib_Python_InstanceIterator_t;
typedef struct
{
- PyObject_HEAD
- uint16_t TopicId;
- PyObject* refobj;
+ PyObject_HEAD uint16_t TopicId;
+ PyObject *refobj;
} CFE_MissionLib_Python_InterfaceIterator_t;
typedef struct
{
- PyObject_HEAD
- EdsLib_Id_t Index;
- PyObject* refobj;
+ PyObject_HEAD EdsLib_Id_t Index;
+ PyObject *refobj;
} CFE_MissionLib_Python_TopicIterator_t;
typedef int32_t (*EdsLib_NameLookupFunc_t)(const EdsLib_DatabaseObject_t *, const char *, EdsLib_Id_t *);
-EdsLib_Id_t CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_NameLookupFunc_t Func, const EdsLib_DatabaseObject_t *GD, PyObject* arg);
+EdsLib_Id_t
+CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_NameLookupFunc_t Func, const EdsLib_DatabaseObject_t *GD, PyObject *arg);
PyObject *CFE_MissionLib_Python_GetFromCache(PyObject *cachedict, PyObject *idxval, PyTypeObject *reqtype);
-int CFE_MissionLib_Python_SaveToCache(PyObject *cachedict, PyObject *idxval, PyObject *obj);
+int CFE_MissionLib_Python_SaveToCache(PyObject *cachedict, PyObject *idxval, PyObject *obj);
-PyObject *CFE_MissionLib_Python_Interface_GetFromIntfName(CFE_MissionLib_Python_Database_t *obj, PyObject *InterfaceName);
+PyObject *CFE_MissionLib_Python_Interface_GetFromIntfName(CFE_MissionLib_Python_Database_t *obj,
+ PyObject *InterfaceName);
PyObject *CFE_MissionLib_Python_Topic_GetFromTopicName(CFE_MissionLib_Python_Interface_t *obj, PyObject *TopicName);
extern PyObject *CFE_MissionLib_Python_DatabaseCache;
diff --git a/cfecfs/missionlib/python/src/cfe_missionlib_python_module.c b/cfecfs/missionlib/python/src/cfe_missionlib_python_module.c
index 5540911..5f69aa6 100644
--- a/cfecfs/missionlib/python/src/cfe_missionlib_python_module.c
+++ b/cfecfs/missionlib/python/src/cfe_missionlib_python_module.c
@@ -86,7 +86,6 @@ PyMODINIT_FUNC PyInit_CFE_MissionLib(void)
#define PyMODINIT_FUNC void
#endif
-
PyMODINIT_FUNC initCFE_MissionLib(void)
{
/* python2 does not want module object */
@@ -94,4 +93,3 @@ PyMODINIT_FUNC initCFE_MissionLib(void)
}
#endif
-
diff --git a/cfecfs/missionlib/python/src/cfe_missionlib_python_setup.c b/cfecfs/missionlib/python/src/cfe_missionlib_python_setup.c
index 5c08f5a..c563204 100644
--- a/cfecfs/missionlib/python/src/cfe_missionlib_python_setup.c
+++ b/cfecfs/missionlib/python/src/cfe_missionlib_python_setup.c
@@ -40,15 +40,12 @@
*/
#if (PY_MAJOR_VERSION >= 3)
-static PyModuleDef CFE_MissionLib_Python_ModuleDef =
-{
- PyModuleDef_HEAD_INIT,
- CFE_MISSIONLIB_PYTHON_MODULE_NAME,
- PyDoc_STR(CFE_MISSIONLIB_PYTHON_DOC),
- -1
-};
+static PyModuleDef CFE_MissionLib_Python_ModuleDef = { PyModuleDef_HEAD_INIT,
+ CFE_MISSIONLIB_PYTHON_MODULE_NAME,
+ PyDoc_STR(CFE_MISSIONLIB_PYTHON_DOC),
+ -1 };
-static inline PyObject* CFE_MissionLib_Python_InstantiateModule(void)
+static inline PyObject *CFE_MissionLib_Python_InstantiateModule(void)
{
/* python3 uses PyModule_Create() API */
return PyModule_Create(&CFE_MissionLib_Python_ModuleDef);
@@ -56,7 +53,7 @@ static inline PyObject* CFE_MissionLib_Python_InstantiateModule(void)
#else
-static inline PyObject* CFE_MissionLib_Python_InstantiateModule(void)
+static inline PyObject *CFE_MissionLib_Python_InstantiateModule(void)
{
/* python2 uses Py_InitModule3() API */
return Py_InitModule3(CFE_MISSIONLIB_PYTHON_MODULE_NAME, NULL, CFE_MISSIONLIB_PYTHON_DOC);
@@ -64,8 +61,7 @@ static inline PyObject* CFE_MissionLib_Python_InstantiateModule(void)
#endif
-
-PyObject* CFE_MissionLib_Python_CreateModule(void)
+PyObject *CFE_MissionLib_Python_CreateModule(void)
{
PyObject *m = NULL;
@@ -74,9 +70,9 @@ PyObject* CFE_MissionLib_Python_CreateModule(void)
/*
* Prepare all of the types defined here
*/
- if (PyType_Ready(&CFE_MissionLib_Python_DatabaseType) != 0 ||
- PyType_Ready(&CFE_MissionLib_Python_InterfaceType) != 0 ||
- PyType_Ready(&CFE_MissionLib_Python_TopicType) != 0)
+ if (PyType_Ready(&CFE_MissionLib_Python_DatabaseType) != 0
+ || PyType_Ready(&CFE_MissionLib_Python_InterfaceType) != 0
+ || PyType_Ready(&CFE_MissionLib_Python_TopicType) != 0)
{
break;
}
@@ -99,11 +95,10 @@ PyObject* CFE_MissionLib_Python_CreateModule(void)
/*
* Add appropriate types so object instances can be constructed
*/
- PyModule_AddObject(m, "Database", (PyObject*)&CFE_MissionLib_Python_DatabaseType);
- PyModule_AddObject(m, "Interface", (PyObject*)&CFE_MissionLib_Python_InterfaceType);
- PyModule_AddObject(m, "Topic", (PyObject*)&CFE_MissionLib_Python_TopicType);
- }
- while(0);
+ PyModule_AddObject(m, "Database", (PyObject *)&CFE_MissionLib_Python_DatabaseType);
+ PyModule_AddObject(m, "Interface", (PyObject *)&CFE_MissionLib_Python_InterfaceType);
+ PyModule_AddObject(m, "Topic", (PyObject *)&CFE_MissionLib_Python_TopicType);
+ } while (0);
return m;
}
diff --git a/cfecfs/missionlib/python/src/cfe_missionlib_python_topic.c b/cfecfs/missionlib/python/src/cfe_missionlib_python_topic.c
index 36f0537..fa186ce 100644
--- a/cfecfs/missionlib/python/src/cfe_missionlib_python_topic.c
+++ b/cfecfs/missionlib/python/src/cfe_missionlib_python_topic.c
@@ -39,80 +39,77 @@
#include
#include "edslib_id.h"
-static void CFE_MissionLib_Python_Topic_dealloc(PyObject * obj);
-static PyObject * CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
-static PyObject * CFE_MissionLib_Python_Topic_repr(PyObject *obj);
-static int CFE_MissionLib_Python_Topic_traverse(PyObject *obj, visitproc visit, void *arg);
-static int CFE_MissionLib_Python_Topic_clear(PyObject *obj);
-static PyObject * CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode(PyObject *obj, PyObject *args);
-
-static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(PyTypeObject *obj, PyObject *intfobj, uint16_t TopicId);
-
-static PyObject * CFE_MissionLib_Python_Topic_iter(PyObject *obj);
-static void CFE_MissionLib_Python_TopicIterator_dealloc(PyObject * obj);
-static int CFE_MissionLib_Python_TopicIterator_traverse(PyObject *obj, visitproc visit, void *arg);
-static int CFE_MissionLib_Python_TopicIterator_clear(PyObject *obj);
-static PyObject * CFE_MissionLib_Python_TopicIterator_iternext(PyObject *obj);
+static void CFE_MissionLib_Python_Topic_dealloc(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
+static PyObject *CFE_MissionLib_Python_Topic_repr(PyObject *obj);
+static int CFE_MissionLib_Python_Topic_traverse(PyObject *obj, visitproc visit, void *arg);
+static int CFE_MissionLib_Python_Topic_clear(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode(PyObject *obj, PyObject *args);
+
+static CFE_MissionLib_Python_Topic_t *
+CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(PyTypeObject *obj, PyObject *intfobj, uint16_t TopicId);
+
+static PyObject *CFE_MissionLib_Python_Topic_iter(PyObject *obj);
+static void CFE_MissionLib_Python_TopicIterator_dealloc(PyObject *obj);
+static int CFE_MissionLib_Python_TopicIterator_traverse(PyObject *obj, visitproc visit, void *arg);
+static int CFE_MissionLib_Python_TopicIterator_clear(PyObject *obj);
+static PyObject *CFE_MissionLib_Python_TopicIterator_iternext(PyObject *obj);
struct CbArg
{
- uint8_t CommandCode;
+ uint8_t CommandCode;
EdsLib_Id_t PossibleId;
EdsLib_Id_t EdsId;
};
typedef struct CbArg CbArg_t;
-void SubcommandCallback(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
- EdsLib_GenericValueBuffer_t *ConstraintValue, void *Arg);
+void SubcommandCallback(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
+ EdsLib_GenericValueBuffer_t *ConstraintValue,
+ void *Arg);
-static PyMethodDef CFE_MissionLib_Python_Topic_methods[] =
-{
- {"GetCmdEdsId", CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode, METH_VARARGS, "Get a CFE command message EDS Object from a Topic"},
- {NULL} /* Sentinel */
+static PyMethodDef CFE_MissionLib_Python_Topic_methods[] = {
+ { "GetCmdEdsId",
+ CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode, METH_VARARGS,
+ "Get a CFE command message EDS Object from a Topic" },
+ { NULL } /* Sentinel */
};
-static struct PyMemberDef CFE_MissionLib_Python_Topic_members[] =
-{
- {"Name", T_OBJECT_EX, offsetof(CFE_MissionLib_Python_Topic_t, TopicName), READONLY, "Topic Name" },
- {"TopicId", T_SHORT, offsetof(CFE_MissionLib_Python_Topic_t, TopicId), READONLY, "Topic ID" },
- {"EdsId", T_INT, offsetof(CFE_MissionLib_Python_Topic_t, DataEdsId), READONLY, "EDS ID" },
- {NULL} /* Sentinel */
+static struct PyMemberDef CFE_MissionLib_Python_Topic_members[] = {
+ { "Name", T_OBJECT_EX, offsetof(CFE_MissionLib_Python_Topic_t, TopicName), READONLY, "Topic Name" },
+ { "TopicId", T_SHORT, offsetof(CFE_MissionLib_Python_Topic_t, TopicId), READONLY, "Topic ID" },
+ { "EdsId", T_INT, offsetof(CFE_MissionLib_Python_Topic_t, DataEdsId), READONLY, "EDS ID" },
+ { NULL } /* Sentinel */
};
-
-PyTypeObject CFE_MissionLib_Python_TopicType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("Topic"),
- .tp_basicsize = sizeof(CFE_MissionLib_Python_Topic_t),
- .tp_dealloc = CFE_MissionLib_Python_Topic_dealloc,
- .tp_new = CFE_MissionLib_Python_Topic_new,
- .tp_methods = CFE_MissionLib_Python_Topic_methods,
- .tp_members = CFE_MissionLib_Python_Topic_members,
- .tp_repr = CFE_MissionLib_Python_Topic_repr,
- .tp_traverse = CFE_MissionLib_Python_Topic_traverse,
- .tp_clear = CFE_MissionLib_Python_Topic_clear,
- .tp_iter = CFE_MissionLib_Python_Topic_iter,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,
- .tp_weaklistoffset = offsetof(CFE_MissionLib_Python_Topic_t, WeakRefList),
- .tp_doc = PyDoc_STR("Topic entry")
-};
-
-PyTypeObject CFE_MissionLib_Python_TopicIteratorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = CFE_MISSIONLIB_PYTHON_ENTITY_NAME("TopicIterator"),
- .tp_basicsize = sizeof(CFE_MissionLib_Python_TopicIterator_t),
- .tp_dealloc = CFE_MissionLib_Python_TopicIterator_dealloc,
- .tp_getattro = PyObject_GenericGetAttr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
- .tp_traverse = CFE_MissionLib_Python_TopicIterator_traverse,
- .tp_clear = CFE_MissionLib_Python_TopicIterator_clear,
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = CFE_MissionLib_Python_TopicIterator_iternext,
- .tp_doc = PyDoc_STR("CFE MissionLib TopicIteratorType")
-};
+PyTypeObject CFE_MissionLib_Python_TopicType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ CFE_MISSIONLIB_PYTHON_ENTITY_NAME("Topic"),
+ .tp_basicsize = sizeof(CFE_MissionLib_Python_Topic_t),
+ .tp_dealloc = CFE_MissionLib_Python_Topic_dealloc,
+ .tp_new = CFE_MissionLib_Python_Topic_new,
+ .tp_methods = CFE_MissionLib_Python_Topic_methods,
+ .tp_members = CFE_MissionLib_Python_Topic_members,
+ .tp_repr = CFE_MissionLib_Python_Topic_repr,
+ .tp_traverse = CFE_MissionLib_Python_Topic_traverse,
+ .tp_clear = CFE_MissionLib_Python_Topic_clear,
+ .tp_iter = CFE_MissionLib_Python_Topic_iter,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_weaklistoffset =
+ offsetof(CFE_MissionLib_Python_Topic_t, WeakRefList),
+ .tp_doc = PyDoc_STR("Topic entry") };
+
+PyTypeObject CFE_MissionLib_Python_TopicIteratorType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ CFE_MISSIONLIB_PYTHON_ENTITY_NAME("TopicIterator"),
+ .tp_basicsize = sizeof(CFE_MissionLib_Python_TopicIterator_t),
+ .tp_dealloc = CFE_MissionLib_Python_TopicIterator_dealloc,
+ .tp_getattro = PyObject_GenericGetAttr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_traverse = CFE_MissionLib_Python_TopicIterator_traverse,
+ .tp_clear = CFE_MissionLib_Python_TopicIterator_clear,
+ .tp_iter = PyObject_SelfIter,
+ .tp_iternext = CFE_MissionLib_Python_TopicIterator_iternext,
+ .tp_doc = PyDoc_STR("CFE MissionLib TopicIteratorType") };
static int CFE_MissionLib_Python_Topic_traverse(PyObject *obj, visitproc visit, void *arg)
{
@@ -130,7 +127,7 @@ static int CFE_MissionLib_Python_Topic_clear(PyObject *obj)
return 0;
}
-static void CFE_MissionLib_Python_Topic_dealloc(PyObject * obj)
+static void CFE_MissionLib_Python_Topic_dealloc(PyObject *obj)
{
CFE_MissionLib_Python_Topic_t *self = (CFE_MissionLib_Python_Topic_t *)obj;
Py_CLEAR(self->IntfObj);
@@ -145,13 +142,14 @@ static void CFE_MissionLib_Python_Topic_dealloc(PyObject * obj)
CFE_MissionLib_Python_TopicType.tp_base->tp_dealloc(obj);
}
-static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(PyTypeObject *obj, PyObject *intfobj, uint16_t TopicId)
+static CFE_MissionLib_Python_Topic_t *
+CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(PyTypeObject *obj, PyObject *intfobj, uint16_t TopicId)
{
CFE_MissionLib_Python_Interface_t *IntfObj = (CFE_MissionLib_Python_Interface_t *)intfobj;
- CFE_MissionLib_Python_Topic_t *self = NULL;
- char Buffer[128];
- int32_t Status;
- PyObject *TopicIdVal;
+ CFE_MissionLib_Python_Topic_t *self = NULL;
+ char Buffer[128];
+ int32_t Status;
+ PyObject *TopicIdVal;
do
{
@@ -161,7 +159,9 @@ static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId
break;
}
- self = (CFE_MissionLib_Python_Topic_t *)CFE_MissionLib_Python_GetFromCache(IntfObj->TopicCache, TopicIdVal, &CFE_MissionLib_Python_TopicType);
+ self = (CFE_MissionLib_Python_Topic_t *)CFE_MissionLib_Python_GetFromCache(IntfObj->TopicCache,
+ TopicIdVal,
+ &CFE_MissionLib_Python_TopicType);
if (self != NULL)
{
if (TopicId == self->TopicId)
@@ -175,7 +175,7 @@ static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId
self = NULL;
}
- self = (CFE_MissionLib_Python_Topic_t*)obj->tp_alloc(obj, 0);
+ self = (CFE_MissionLib_Python_Topic_t *)obj->tp_alloc(obj, 0);
if (self == NULL)
{
break;
@@ -187,12 +187,18 @@ static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId
Status = CFE_MissionLib_GetTopicInfo(IntfObj->DbObj->IntfDb, TopicId, &self->TopicInfo);
if (Status != CFE_MISSIONLIB_SUCCESS)
{
- PyErr_Format(PyExc_RuntimeError, "Failure in CFE_MissionLib_GetTopicInfo(%d) rc=%d", (int)TopicId, (int)Status);
+ PyErr_Format(PyExc_RuntimeError,
+ "Failure in CFE_MissionLib_GetTopicInfo(%d) rc=%d",
+ (int)TopicId,
+ (int)Status);
Py_CLEAR(self);
break;
}
- Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->DbObj->IntfDb), self->TopicInfo.ParentIntfId, Buffer, sizeof(Buffer));
+ Status = EdsLib_IntfDB_GetFullName(CFE_MissionLib_GetParent(IntfObj->DbObj->IntfDb),
+ self->TopicInfo.ParentIntfId,
+ Buffer,
+ sizeof(Buffer));
if (Status != EDSLIB_SUCCESS)
{
/* Intf ID does not appear to be valid, this is not a valid topic ID */
@@ -202,29 +208,34 @@ static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId
}
self->TopicName = PyUnicode_FromFormat("%s", Buffer);
- self->TopicId = TopicId;
+ self->TopicId = TopicId;
/* All SB topics should map to an interface type with a single command on it */
- Status = EdsLib_IntfDB_FindAllArgumentTypes(CFE_MissionLib_GetParent(IntfObj->DbObj->IntfDb), IntfObj->CmdEdsId,
- self->TopicInfo.ParentIntfId, &self->DataEdsId, 1);
+ Status = EdsLib_IntfDB_FindAllArgumentTypes(CFE_MissionLib_GetParent(IntfObj->DbObj->IntfDb),
+ IntfObj->CmdEdsId,
+ self->TopicInfo.ParentIntfId,
+ &self->DataEdsId,
+ 1);
if (Status != EDSLIB_SUCCESS)
{
/* Unable to determine data type on this topic */
- PyErr_Format(PyExc_RuntimeError, "EdsLib_IntfDB_FindAllArgumentTypes(%x) rc=%d", (unsigned int)IntfObj->CmdEdsId, (int)Status);
+ PyErr_Format(PyExc_RuntimeError,
+ "EdsLib_IntfDB_FindAllArgumentTypes(%x) rc=%d",
+ (unsigned int)IntfObj->CmdEdsId,
+ (int)Status);
Py_CLEAR(self);
break;
}
/* Create a weak reference to store in the local cache in case this
* database is constructed again. */
- if (CFE_MissionLib_Python_SaveToCache(IntfObj->TopicCache, TopicIdVal, (PyObject*)self) < 0)
+ if (CFE_MissionLib_Python_SaveToCache(IntfObj->TopicCache, TopicIdVal, (PyObject *)self) < 0)
{
/* if something went wrong this raises an error and must return NULL */
Py_DECREF(self);
self = NULL;
}
- }
- while(0);
+ } while (0);
Py_XDECREF(TopicIdVal);
return self;
@@ -232,24 +243,25 @@ static CFE_MissionLib_Python_Topic_t *CFE_MissionLib_Python_Topic_GetFromTopicId
static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
{
- PyObject *arg1;
- PyObject *arg2;
- PyObject *arg3;
- PyObject *arg4 = NULL;
- CFE_MissionLib_Python_Database_t *DbObj;
+ PyObject *arg1;
+ PyObject *arg2;
+ PyObject *arg3;
+ PyObject *arg4 = NULL;
+ CFE_MissionLib_Python_Database_t *DbObj;
CFE_MissionLib_Python_Interface_t *IntfObj;
- uint16_t TopicId = 0; // 0 is an invalid TopicId
- EdsLib_Id_t CompIntfId;
- uint16_t status;
- PyObject *tempargs = NULL;
- PyObject *result = NULL;
+ uint16_t TopicId = 0; // 0 is an invalid TopicId
+ EdsLib_Id_t CompIntfId;
+ uint16_t status;
+ PyObject *tempargs = NULL;
+ PyObject *result = NULL;
/*
* Topic entries are constructed from three values:
* - An Interface Database
* - An Interface Identifier
* - A Topic Identifier
- * - An EdsDb Python Object (only needed if Database associated with the Interface Database Identifier has not been set up)
+ * - An EdsDb Python Object (only needed if Database associated with the Interface Database Identifier has not
+ * been set up)
*
* Databases are natively of the CFE_MissionLib_Python_Database_t type
* Interface Identifiers are indices which are natively unsigned integers (EdsLib_Id_t specifically)
@@ -260,33 +272,37 @@ static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *ar
*/
if (!PyArg_UnpackTuple(args, "Topic_new", 3, 4, &arg1, &arg2, &arg3, &arg4))
{
- PyErr_Format(PyExc_RuntimeError, "Topic arguments expected: Interface Database, Interface Identifier, Topic Identifier, and EdsDb Python Object (optional)");
- return NULL;
+ PyErr_Format(PyExc_RuntimeError,
+ "Topic arguments expected: Interface Database, Interface Identifier, Topic Identifier, and EdsDb "
+ "Python Object (optional)");
+ return NULL;
}
do
{
- // Set up the Interface Database
+ // Set up the Interface Database
if (Py_TYPE(arg1) == &CFE_MissionLib_Python_DatabaseType)
{
- DbObj = (CFE_MissionLib_Python_Database_t*)arg1;
+ DbObj = (CFE_MissionLib_Python_Database_t *)arg1;
Py_INCREF(DbObj);
}
else
{
if (arg4 != NULL)
{
- tempargs = PyTuple_Pack(2, arg1, arg4);
+ tempargs = PyTuple_Pack(2, arg1, arg4);
}
else
{
- tempargs = PyTuple_Pack(2, arg1, Py_None);
+ tempargs = PyTuple_Pack(2, arg1, Py_None);
}
if (tempargs == NULL)
{
break;
}
- DbObj = (CFE_MissionLib_Python_Database_t*)PyObject_Call((PyObject*)&CFE_MissionLib_Python_DatabaseType, tempargs, NULL);
+ DbObj = (CFE_MissionLib_Python_Database_t *)PyObject_Call((PyObject *)&CFE_MissionLib_Python_DatabaseType,
+ tempargs,
+ NULL);
Py_DECREF(tempargs);
tempargs = NULL;
}
@@ -299,7 +315,7 @@ static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *ar
// Set up the interface
if (Py_TYPE(arg2) == &CFE_MissionLib_Python_InterfaceType)
{
- IntfObj = (CFE_MissionLib_Python_Interface_t*)arg2;
+ IntfObj = (CFE_MissionLib_Python_Interface_t *)arg2;
Py_INCREF(IntfObj);
}
else
@@ -309,7 +325,10 @@ static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *ar
{
break;
}
- IntfObj = (CFE_MissionLib_Python_Interface_t*)PyObject_Call((PyObject*)&CFE_MissionLib_Python_InterfaceType, tempargs, NULL);
+ IntfObj =
+ (CFE_MissionLib_Python_Interface_t *)PyObject_Call((PyObject *)&CFE_MissionLib_Python_InterfaceType,
+ tempargs,
+ NULL);
Py_DECREF(tempargs);
tempargs = NULL;
}
@@ -333,7 +352,9 @@ static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *ar
else
{
// Set up the topic with either a TopicId or Topic Name
- CompIntfId = CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_IntfDB_FindComponentInterfaceByFullName, CFE_MissionLib_GetParent(DbObj->IntfDb), arg3);
+ CompIntfId = CFE_MissionLib_Python_ConvertArgToEdsId(EdsLib_IntfDB_FindComponentInterfaceByFullName,
+ CFE_MissionLib_GetParent(DbObj->IntfDb),
+ arg3);
/* if the lookup failed it should have already set an exception */
if (!EdsLib_Is_Valid(CompIntfId))
@@ -347,12 +368,12 @@ static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *ar
PyErr_Format(PyExc_RuntimeError, "No TopicID maps to %s", PyBytes_AsString(tempargs));
break;
}
-
}
- result = (PyObject*)CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(&CFE_MissionLib_Python_TopicType, (PyObject *)IntfObj, TopicId);
- }
- while(0);
+ result = (PyObject *)CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(&CFE_MissionLib_Python_TopicType,
+ (PyObject *)IntfObj,
+ TopicId);
+ } while (0);
/* decrement refcount for all temporary objects created */
Py_XDECREF(tempargs);
@@ -363,18 +384,24 @@ static PyObject *CFE_MissionLib_Python_Topic_new(PyTypeObject *obj, PyObject *ar
PyObject *CFE_MissionLib_Python_Topic_repr(PyObject *obj)
{
CFE_MissionLib_Python_Topic_t *self = (CFE_MissionLib_Python_Topic_t *)obj;
- return PyUnicode_FromFormat("%s(%R,%R,%R)", obj->ob_type->tp_name, self->IntfObj->DbObj->DbName, self->IntfObj->IntfName, self->TopicName);
+ return PyUnicode_FromFormat("%s(%R,%R,%R)",
+ obj->ob_type->tp_name,
+ self->IntfObj->DbObj->DbName,
+ self->IntfObj->IntfName,
+ self->TopicName);
}
PyObject *CFE_MissionLib_Python_Topic_GetFromTopicName(CFE_MissionLib_Python_Interface_t *obj, PyObject *TopicName)
{
CFE_MissionLib_Python_Topic_t *TopicEntry;
- int32_t status;
- uint16_t TopicId;
+ int32_t status;
+ uint16_t TopicId;
EdsLib_Id_t CompIntfId;
- TopicEntry = (CFE_MissionLib_Python_Topic_t *)CFE_MissionLib_Python_GetFromCache(obj->TopicCache, TopicName, &CFE_MissionLib_Python_TopicType);
+ TopicEntry = (CFE_MissionLib_Python_Topic_t *)CFE_MissionLib_Python_GetFromCache(obj->TopicCache,
+ TopicName,
+ &CFE_MissionLib_Python_TopicType);
if (TopicEntry != NULL)
{
if (TopicEntry->TopicName != TopicName)
@@ -383,13 +410,14 @@ PyObject *CFE_MissionLib_Python_Topic_GetFromTopicName(CFE_MissionLib_Python_Int
Py_DECREF(TopicEntry);
TopicEntry = NULL;
}
- return (PyObject*)TopicEntry;
+ return (PyObject *)TopicEntry;
}
/* this is slightly more complicated; the name is actually associated with a component interface,
- * and once that is found, then we need to reverse lookup that intf back to a topic ID */
+ * and once that is found, then we need to reverse lookup that intf back to a topic ID */
status = EdsLib_IntfDB_FindComponentInterfaceByFullName(CFE_MissionLib_GetParent(obj->DbObj->IntfDb),
- PyBytes_AsString(TopicName), &CompIntfId);
+ PyBytes_AsString(TopicName),
+ &CompIntfId);
if (status != EDSLIB_SUCCESS)
{
PyErr_Format(PyExc_RuntimeError, "Component Intf %s not defined", PyBytes_AsString(TopicName));
@@ -403,41 +431,43 @@ PyObject *CFE_MissionLib_Python_Topic_GetFromTopicName(CFE_MissionLib_Python_Int
return NULL;
}
- return (PyObject*)CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(&CFE_MissionLib_Python_TopicType, (PyObject *)obj, TopicId);
+ return (PyObject *)CFE_MissionLib_Python_Topic_GetFromTopicId_Impl(&CFE_MissionLib_Python_TopicType,
+ (PyObject *)obj,
+ TopicId);
}
-static PyObject * CFE_MissionLib_Python_Topic_iter(PyObject *obj)
+static PyObject *CFE_MissionLib_Python_Topic_iter(PyObject *obj)
{
- CFE_MissionLib_Python_Topic_t *Topic = (CFE_MissionLib_Python_Topic_t *) obj;
+ CFE_MissionLib_Python_Topic_t *Topic = (CFE_MissionLib_Python_Topic_t *)obj;
CFE_MissionLib_Python_TopicIterator_t *TopicIter;
- PyObject *result = NULL;
+ PyObject *result = NULL;
if (Topic->TopicInfo.NumSubcommands > 0)
{
- TopicIter = PyObject_GC_New(CFE_MissionLib_Python_TopicIterator_t, &CFE_MissionLib_Python_TopicIteratorType);
+ TopicIter = PyObject_GC_New(CFE_MissionLib_Python_TopicIterator_t, &CFE_MissionLib_Python_TopicIteratorType);
- if (TopicIter == NULL)
- {
+ if (TopicIter == NULL)
+ {
return NULL;
- }
+ }
- Py_INCREF(obj);
- TopicIter->Index = 0;
- TopicIter->refobj = obj;
+ Py_INCREF(obj);
+ TopicIter->Index = 0;
+ TopicIter->refobj = obj;
- result = (PyObject *)TopicIter;
- PyObject_GC_Track(result);
+ result = (PyObject *)TopicIter;
+ PyObject_GC_Track(result);
}
else
{
- PyErr_Format(PyExc_RuntimeError, "Not an iterable Topic");
+ PyErr_Format(PyExc_RuntimeError, "Not an iterable Topic");
}
return result;
}
-static void CFE_MissionLib_Python_TopicIterator_dealloc(PyObject * obj)
+static void CFE_MissionLib_Python_TopicIterator_dealloc(PyObject *obj)
{
- CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t*)obj;
+ CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t *)obj;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->refobj);
PyObject_GC_Del(self);
@@ -445,7 +475,7 @@ static void CFE_MissionLib_Python_TopicIterator_dealloc(PyObject * obj)
static int CFE_MissionLib_Python_TopicIterator_traverse(PyObject *obj, visitproc visit, void *arg)
{
- CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t*)obj;
+ CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t *)obj;
Py_VISIT(self->refobj);
return 0;
@@ -453,7 +483,7 @@ static int CFE_MissionLib_Python_TopicIterator_traverse(PyObject *obj, visitproc
static int CFE_MissionLib_Python_TopicIterator_clear(PyObject *obj)
{
- CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t*)obj;
+ CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t *)obj;
Py_CLEAR(self->refobj);
return 0;
@@ -461,30 +491,30 @@ static int CFE_MissionLib_Python_TopicIterator_clear(PyObject *obj)
static PyObject *CFE_MissionLib_Python_TopicIterator_iternext(PyObject *obj)
{
- CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t*)obj;
- CFE_MissionLib_Python_Topic_t *topic = NULL;
- const EdsLib_DatabaseObject_t *GD;
- uint16_t idx;
- EdsLib_Id_t PossibleId;
-
- PyObject *key = NULL;
- PyObject *edsid = NULL;
+ CFE_MissionLib_Python_TopicIterator_t *self = (CFE_MissionLib_Python_TopicIterator_t *)obj;
+ CFE_MissionLib_Python_Topic_t *topic = NULL;
+ const EdsLib_DatabaseObject_t *GD;
+ uint16_t idx;
+ EdsLib_Id_t PossibleId;
+
+ PyObject *key = NULL;
+ PyObject *edsid = NULL;
PyObject *result = NULL;
do
{
- if (self->refobj == NULL)
+ if (self->refobj == NULL)
{
break;
}
topic = (CFE_MissionLib_Python_Topic_t *)self->refobj;
- GD = CFE_MissionLib_GetParent(topic->IntfObj->DbObj->IntfDb);
- idx = self->Index;
+ GD = CFE_MissionLib_GetParent(topic->IntfObj->DbObj->IntfDb);
+ idx = self->Index;
if (EdsLib_DataTypeDB_GetDerivedTypeById(GD, topic->DataEdsId, idx, &PossibleId) == EDSLIB_SUCCESS)
{
- key = PyUnicode_FromString(EdsLib_DisplayDB_GetBaseName(GD, PossibleId));
+ key = PyUnicode_FromString(EdsLib_DisplayDB_GetBaseName(GD, PossibleId));
edsid = PyLong_FromLong((long int)PossibleId);
if ((key == NULL) || (edsid == NULL))
@@ -496,8 +526,7 @@ static PyObject *CFE_MissionLib_Python_TopicIterator_iternext(PyObject *obj)
++self->Index;
result = PyTuple_Pack(2, key, edsid);
}
- }
- while(0);
+ } while (0);
Py_XDECREF(key);
Py_XDECREF(edsid);
@@ -505,13 +534,15 @@ static PyObject *CFE_MissionLib_Python_TopicIterator_iternext(PyObject *obj)
return result;
}
-void SubcommandCallback(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
- EdsLib_GenericValueBuffer_t *ConstraintValue, void *Arg)
+void SubcommandCallback(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
+ EdsLib_GenericValueBuffer_t *ConstraintValue,
+ void *Arg)
{
- CbArg_t *Argument = (CbArg_t *) Arg;
+ CbArg_t *Argument = (CbArg_t *)Arg;
- if (MemberInfo->Offset.Bytes == offsetof(EdsDataType_CFE_HDR_CommandHeader_t, Sec.FunctionCode) &&
- ConstraintValue->Value.u8 == Argument->CommandCode)
+ if (MemberInfo->Offset.Bytes == offsetof(EdsDataType_CFE_HDR_CommandHeader_t, Sec.FunctionCode)
+ && ConstraintValue->Value.u8 == Argument->CommandCode)
{
Argument->EdsId = Argument->PossibleId;
}
@@ -519,15 +550,15 @@ void SubcommandCallback(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataType
static PyObject *CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode(PyObject *obj, PyObject *args)
{
- CFE_MissionLib_Python_Topic_t *self = (CFE_MissionLib_Python_Topic_t*) obj;
+ CFE_MissionLib_Python_Topic_t *self = (CFE_MissionLib_Python_Topic_t *)obj;
const EdsLib_DatabaseObject_t *GD;
- PyObject *arg1;
- uint8_t CommandCode;
- int32_t idx;
- EdsLib_Id_t PossibleId;
- EdsLib_ConstraintCallback_t Callback = SubcommandCallback;
- CbArg_t Argument;
- PyObject *result = NULL;
+ PyObject *arg1;
+ uint8_t CommandCode;
+ int32_t idx;
+ EdsLib_Id_t PossibleId;
+ EdsLib_ConstraintCallback_t Callback = SubcommandCallback;
+ CbArg_t Argument;
+ PyObject *result = NULL;
do
{
@@ -550,7 +581,7 @@ static PyObject *CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode(PyObject *obj,
GD = CFE_MissionLib_GetParent(self->IntfObj->DbObj->IntfDb);
Argument.CommandCode = CommandCode;
- Argument.EdsId = EDSLIB_ID_INVALID;
+ Argument.EdsId = EDSLIB_ID_INVALID;
for (idx = 0; idx < self->TopicInfo.NumSubcommands && !EdsLib_Is_Valid(Argument.EdsId); idx++)
{
@@ -561,14 +592,14 @@ static PyObject *CFE_MissionLib_Python_Topic_GetCmdEdsIdFromCode(PyObject *obj,
if (EdsLib_Is_Valid(Argument.EdsId))
{
- result = PyLong_FromLong((long int) Argument.EdsId);
+ result = PyLong_FromLong((long int)Argument.EdsId);
}
else
{
result = Py_None;
Py_INCREF(result);
}
- } while(0);
+ } while (0);
return result;
}
diff --git a/cfecfs/scriptengine/fsw/src/scriptengine.c b/cfecfs/scriptengine/fsw/src/scriptengine.c
index 943bb26..9615070 100644
--- a/cfecfs/scriptengine/fsw/src/scriptengine.c
+++ b/cfecfs/scriptengine/fsw/src/scriptengine.c
@@ -43,7 +43,7 @@
#include "cfe_missionlib_lua_softwarebus.h"
/* HACK - this is passed direct to Lua, so it must be a native path, not an OSAL path */
-#define SCRIPTENGINE_TESTFILE "./cf/testscript.lua"
+#define SCRIPTENGINE_TESTFILE "./cf/testscript.lua"
#define SCRIPTENGINE_ERRHANDLER_IDX 1
SCRIPTENGINE_Global_t SCRIPTENGINE_Global;
@@ -78,7 +78,8 @@ static void *SCRIPTENGINE_NewEdsObjectBase(lua_State *lua, EdsLib_Id_t EdsId, si
return DescObj;
}
-static EdsLib_Binding_DescriptorObject_t *SCRIPTENGINE_NewEdsObjectWrapper(lua_State *lua, EdsLib_Id_t EdsId, void *DataPtr)
+static EdsLib_Binding_DescriptorObject_t *
+SCRIPTENGINE_NewEdsObjectWrapper(lua_State *lua, EdsLib_Id_t EdsId, void *DataPtr)
{
struct ContentWrapper
{
@@ -94,7 +95,8 @@ static EdsLib_Binding_DescriptorObject_t *SCRIPTENGINE_NewEdsObjectWrapper(lua_S
return &ObjectUserData->DescObj;
}
-static EdsLib_Binding_DescriptorObject_t *SCRIPTENGINE_NewEdsObjectWithContent(lua_State *lua, EdsLib_Id_t EdsId, size_t MaxContentSize)
+static EdsLib_Binding_DescriptorObject_t *
+SCRIPTENGINE_NewEdsObjectWithContent(lua_State *lua, EdsLib_Id_t EdsId, size_t MaxContentSize)
{
struct ContentWrapper
{
@@ -103,7 +105,10 @@ static EdsLib_Binding_DescriptorObject_t *SCRIPTENGINE_NewEdsObjectWithContent(l
EdsLib_GenericValueUnion_t ContentStart;
} *ObjectUserData;
- ObjectUserData = SCRIPTENGINE_NewEdsObjectBase(lua, EdsId, sizeof(struct ContentWrapper) + MaxContentSize - sizeof(EdsLib_GenericValueUnion_t));
+ ObjectUserData = SCRIPTENGINE_NewEdsObjectBase(lua,
+ EdsId,
+ sizeof(struct ContentWrapper) + MaxContentSize
+ - sizeof(EdsLib_GenericValueUnion_t));
EdsLib_Binding_InitUnmanagedBuffer(&ObjectUserData->BufObj, &ObjectUserData->ContentStart, MaxContentSize);
EdsLib_Binding_SetDescBuffer(&ObjectUserData->DescObj, &ObjectUserData->BufObj);
@@ -113,7 +118,7 @@ static EdsLib_Binding_DescriptorObject_t *SCRIPTENGINE_NewEdsObjectWithContent(l
static int SCRIPTENGINE_SendMsg(lua_State *lua)
{
- void *ObjPtr;
+ void *ObjPtr;
size_t ObjSize;
EdsLib_LuaBinding_GetNativeObject(lua, 1, &ObjPtr, &ObjSize);
@@ -128,8 +133,8 @@ static int SCRIPTENGINE_SendMsg(lua_State *lua)
static int SCRIPTENGINE_CreatePipe(lua_State *lua)
{
- lua_Integer Depth = luaL_checkinteger(lua, 1);
- const char *PipeName = luaL_checkstring(lua, 2);
+ lua_Integer Depth = luaL_checkinteger(lua, 1);
+ const char *PipeName = luaL_checkstring(lua, 2);
CFE_SB_PipeId_t *PipeObj;
PipeObj = lua_newuserdata(lua, sizeof(*PipeObj));
@@ -157,22 +162,21 @@ static int SCRIPTENGINE_DeletePipe(lua_State *lua)
return 0;
}
-
static int SCRIPTENGINE_WaitFor(lua_State *lua)
{
CFE_MissionLib_Lua_Interface_Userdata_t *IntfObj = luaL_checkudata(lua, 1, "CFE_MissionLib_Lua_Interface");
- CFE_SB_PipeId_t *PipeObj = luaL_checkudata(lua, 2, "CFE_SB_PipeId");
- lua_Integer timeout = luaL_optinteger(lua, 3, 1000);
+ CFE_SB_PipeId_t *PipeObj = luaL_checkudata(lua, 2, "CFE_SB_PipeId");
+ lua_Integer timeout = luaL_optinteger(lua, 3, 1000);
EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
- CFE_SB_Buffer_t *BufPtr;
- CFE_MSG_Size_t MsgSize;
- EdsLib_Binding_DescriptorObject_t *ObjectUserData;
+ CFE_SB_Buffer_t *BufPtr;
+ CFE_MSG_Size_t MsgSize;
+ EdsLib_Binding_DescriptorObject_t *ObjectUserData;
EdsLib_DataTypeDB_DerivativeObjectInfo_t DerivObjInfo;
- int32 RcvStatus;
- void *LuaObj;
- int nret;
+ int32 RcvStatus;
+ void *LuaObj;
+ int nret;
- nret = 0;
+ nret = 0;
BufPtr = NULL;
/* Map the Intf to a MsgID */
@@ -199,14 +203,15 @@ static int SCRIPTENGINE_WaitFor(lua_State *lua)
if (RcvStatus == CFE_SUCCESS)
{
CFE_MSG_GetSize(&BufPtr->Msg, &MsgSize);
- if (EdsLib_DataTypeDB_IdentifyBuffer(&EDS_DATABASE, IntfObj->IndicationBaseArg, BufPtr, &DerivObjInfo) != EDSLIB_SUCCESS)
+ if (EdsLib_DataTypeDB_IdentifyBuffer(&EDS_DATABASE, IntfObj->IndicationBaseArg, BufPtr, &DerivObjInfo)
+ != EDSLIB_SUCCESS)
{
/* This is OK and may mean that the object simply isn't derived; use the original type */
DerivObjInfo.EdsId = IntfObj->IndicationBaseArg;
}
ObjectUserData = SCRIPTENGINE_NewEdsObjectWithContent(lua, DerivObjInfo.EdsId, MsgSize);
- LuaObj = EdsLib_Binding_GetNativeObject(ObjectUserData);
+ LuaObj = EdsLib_Binding_GetNativeObject(ObjectUserData);
if (LuaObj != NULL)
{
@@ -216,11 +221,11 @@ static int SCRIPTENGINE_WaitFor(lua_State *lua)
}
/*
- * Now release the reference by calling to CFE_SB_ReceiveBuffer() on the same pipe.
- * Problem is, this will also return the next message if the pipe is not empty. So
- * this needs to be done in a loop until it is empty. But that will likely be the
- * case on the first call since nothing is supposed to be subscribed right now.
- */
+ * Now release the reference by calling to CFE_SB_ReceiveBuffer() on the same pipe.
+ * Problem is, this will also return the next message if the pipe is not empty. So
+ * this needs to be done in a loop until it is empty. But that will likely be the
+ * case on the first call since nothing is supposed to be subscribed right now.
+ */
while (CFE_SB_ReceiveBuffer(&BufPtr, *PipeObj, CFE_SB_POLL) == CFE_SUCCESS)
{
/* do nothing, just repeat */
@@ -263,8 +268,6 @@ static void SCRIPTENGINE_Setup(lua_State *lua)
}
lua_pop(lua, 1);
-
-
lua_newtable(lua);
lua_pushstring(lua, "SendMsg");
lua_pushcfunction(lua, SCRIPTENGINE_SendMsg);
@@ -278,10 +281,8 @@ static void SCRIPTENGINE_Setup(lua_State *lua)
lua_pushcfunction(lua, SCRIPTENGINE_WaitFor);
lua_settable(lua, -3);
-
lua_setglobal(lua, "CFE");
-
/* Stack index 1 will be the error handler function (used for protected calls) */
/* This can just sit there at the bottom of the stack, useful for when pcall() is used later */
lua_pushcfunction(lua, SCRIPTENGINE_ErrorHandler);
@@ -321,14 +322,14 @@ static int32 SCRIPTENGINE_DoLoad(lua_State *lua, const char *Filename)
static int32 SCRIPTENGINE_DoCall(lua_State *lua, const char *Function, void *ArgData, EdsLib_Id_t ArgEdsId)
{
- int stack_top;
- int nargs;
- int32 status;
+ int stack_top;
+ int nargs;
+ int32 status;
EdsLib_Binding_DescriptorObject_t *ObjectUserData;
- nargs = 0;
+ nargs = 0;
ObjectUserData = NULL;
- stack_top = lua_gettop(lua);
+ stack_top = lua_gettop(lua);
lua_getglobal(lua, Function);
@@ -358,7 +359,6 @@ static int32 SCRIPTENGINE_DoCall(lua_State *lua, const char *Function, void *Arg
EdsLib_Binding_SetDescBuffer(ObjectUserData, NULL);
}
-
/* Always return the stack to where it was */
lua_settop(lua, stack_top);
diff --git a/cfecfs/scriptengine/fsw/src/scriptengine_internal.h b/cfecfs/scriptengine/fsw/src/scriptengine_internal.h
index c8f412d..170a267 100644
--- a/cfecfs/scriptengine/fsw/src/scriptengine_internal.h
+++ b/cfecfs/scriptengine/fsw/src/scriptengine_internal.h
@@ -28,7 +28,6 @@
#include
-
/*************************************************************************
** Macro Definitions
*************************************************************************/
diff --git a/cfecfs/testexecutive/CMakeLists.txt b/cfecfs/testexecutive/CMakeLists.txt
deleted file mode 100644
index 26afdb7..0000000
--- a/cfecfs/testexecutive/CMakeLists.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
-#
-# Copyright (c) 2020 United States Government as represented by
-# the Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Functional test (black box) framework
-
-include_directories(${MISSION_BINARY_DIR}/inc)
-include_directories(${osal_MISSION_DIR}/src/os/inc)
-include_directories(${osal_MISSION_DIR}/ut_assert/inc)
-include_directories(${OSAL_INCLUDEDIR})
-include_directories(${EDSLIB_FSW_SOURCE_DIR}/inc)
-include_directories(${EDSLIB_LUABINDINGS_SOURCE_DIR}/inc)
-include_directories(${EDS_CFECFS_MISSIONLIB_FSW_SOURCE_DIR}/inc)
-include_directories(${EDS_CFECFS_MISSIONLIB_LUABINDINGS_SOURCE_DIR}/inc)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
-include_directories(${LUALIB_INCLUDE_DIRS})
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-add_definitions(-Wall -Werror)
-set(TESTEXEC_INTF_MODULES Remote)
-
-if (DEFINED to_lab_MISSION_DIR AND DEFINED ci_lab_MISSION_DIR)
- list(APPEND TESTEXEC_INTF_MODULES CI_TO_LAB)
-endif()
-
-set(TESTEXEC_LIBS
- edslib_runtime_static
- cfe_missionlib
- cfe_missionlib_runtime_static
- cfe_edsdb_static
- cfe_missionlib_sb_dispatchdb_static
-)
-
-set(TESTEXEC_INTF_SRCFILES)
-set(TESTEXEC_INTF_MODLIST)
-foreach (MOD ${TESTEXEC_INTF_MODULES})
- string(TOLOWER ${MOD} LMOD)
- list(APPEND TESTEXEC_INTF_SRCFILES modules/${LMOD}_interface.c)
- list(APPEND TESTEXEC_INTF_MODLIST "TESTEXEC_MODULE(${MOD})\n")
-endforeach (MOD ${TESTEXEC_INTF_MODULES})
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testexec_compiledin_modules.h.tmp"
- ${TESTEXEC_INTF_MODLIST})
-execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_CURRENT_BINARY_DIR}/testexec_compiledin_modules.h.tmp"
- "${CMAKE_CURRENT_BINARY_DIR}/testexec_compiledin_modules.h")
-
-
-add_executable(testexec src/testexec.c src/test_interface.c ${TESTEXEC_INTF_SRCFILES})
-add_dependencies(testexec edstool-execute)
-target_link_libraries(testexec
- ut_bsp
- ut_assert
- osal
- edslib_lua
- cfe_missionlib_lua_softwarebus
- ${TESTEXEC_LIBS}
-)
-
-add_executable(testctrl src/testctrl.c)
-add_dependencies(testctrl edstool-execute)
-target_link_libraries(testctrl
- osal
- ${TESTEXEC_LIBS}
-)
-
-install(TARGETS testexec testctrl DESTINATION host)
diff --git a/cfecfs/testexecutive/inc/testexec.h b/cfecfs/testexecutive/inc/testexec.h
deleted file mode 100644
index 445a246..0000000
--- a/cfecfs/testexecutive/inc/testexec.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
- *
- * Copyright (c) 2020 United States Government as represented by
- * the Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * \file testexec.h
- * \ingroup testexecutive
- * \author joseph.p.hickey@nasa.gov
- *
- * Test executive header file
- */
-
-#ifndef _TESTEXEC_H_
-#define _TESTEXEC_H_
-
-
-int TestIntf_Udp_Create(struct lua_State *lua);
-int TestIntf_Remote_Create(struct lua_State *lua);
-int TestIntf_GetFactory(struct lua_State *lua);
-
-#endif /* _TESTEXEC_H_ */
-
diff --git a/cfecfs/testexecutive/modules/ci_to_lab_interface.c b/cfecfs/testexecutive/modules/ci_to_lab_interface.c
deleted file mode 100644
index 26788eb..0000000
--- a/cfecfs/testexecutive/modules/ci_to_lab_interface.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
- *
- * Copyright (c) 2020 United States Government as represented by
- * the Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * \file ci_to_lab_interface.c
- * \ingroup testexecutive
- * \author joseph.p.hickey@nasa.gov
- *
- * Implementation of test executive
- */
-
-#include
-#include /* memset() */
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "cfe_mission_eds_parameters.h"
-#include "cfe_mission_eds_interface_parameters.h"
-#include "edslib_displaydb.h"
-#include "cfe_missionlib_runtime.h"
-#include "cfe_missionlib_api.h"
-#include "edslib_lua_objects.h"
-#include "cfe_missionlib_lua_softwarebus.h"
-
-#include "testexec.h"
-#include "to_lab_eds_datatypes.h"
-
-#define TO_LAB_BASE_PORT 2234
-#define CI_LAB_BASE_PORT 1234
-
-#define UDP_NET_BUFFER_SIZE 8192
-
-
-typedef struct
-{
- EdsInterface_CFE_SB_SoftwareBus_PubSub_t TargetApp;
- struct sockaddr_in LocalAddr;
- struct sockaddr_in TargetAddr;
- struct timespec InterPacketDelay;
- int SocketId;
- luaL_Buffer TempBuf;
-} TestIntf_CI_TO_LAB_Connection_t;
-
-static int TestIntf_CI_TO_LAB_Send(lua_State *lua)
-{
- TestIntf_CI_TO_LAB_Connection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_CI_TO_LAB_Connection");
- const char *Data = luaL_checkstring(lua, 2);
- uint32_t DataLength = lua_rawlen(lua, 2);
-
- printf("%s():\n",__func__);
- EdsLib_Generate_Hexdump(stdout, (const uint8_t*)Data, 0, DataLength);
- printf("\n");
-
- sendto(Conn->SocketId, Data, DataLength, 0,
- (struct sockaddr *)&Conn->TargetAddr, sizeof(Conn->TargetAddr));
-
- clock_nanosleep(CLOCK_REALTIME, 0, &Conn->InterPacketDelay, NULL);
-
- return 0;
-}
-
-static int TestIntf_CI_TO_LAB_Wait(lua_State *lua)
-{
- TestIntf_CI_TO_LAB_Connection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_CI_TO_LAB_Connection");
- int32_t Timeout = luaL_optinteger(lua, 2, -1);
- fd_set rdfd;
- struct timeval tv;
- struct timeval *ptv;
-
- if (Timeout >= 0)
- {
- tv.tv_sec = Timeout / 1000;
- tv.tv_usec = 1000 * (Timeout % 1000);
- ptv = &tv;
- }
- else
- {
- ptv = NULL;
- }
-
- FD_ZERO(&rdfd);
- FD_SET(Conn->SocketId, &rdfd);
-
- if (select(1 + Conn->SocketId, &rdfd, NULL, NULL, ptv) < 0)
- {
- lua_pushboolean(lua, 0);
- }
- else
- {
- lua_pushboolean(lua, 1);
- }
-
- return 1;
-}
-
-static int TestIntf_CI_TO_LAB_Poll(lua_State *lua)
-{
- TestIntf_CI_TO_LAB_Connection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_CI_TO_LAB_Connection");
- ssize_t Length;
-
- lua_pushstring(lua, "Message");
- luaL_buffinit(lua, &Conn->TempBuf);
-
- Length = recv(Conn->SocketId,
- luaL_prepbuffsize(&Conn->TempBuf, UDP_NET_BUFFER_SIZE),
- UDP_NET_BUFFER_SIZE, MSG_DONTWAIT);
-
- if (Length <= 0)
- {
- luaL_pushresultsize(&Conn->TempBuf, 0);
- return 0;
- }
-
- luaL_pushresultsize(&Conn->TempBuf, Length);
- return 2;
-}
-
-static int TestIntf_CI_TO_LAB_CheckSubscribeEvent(lua_State *lua)
-{
- const char *AppName;
-
- lua_settop(lua, 1);
- luaL_checkudata(lua, 1, "EdsLib_Object");
-
- lua_getfield(lua, 1, "Payload");
- lua_getfield(lua, 2, "PacketID");
- lua_getfield(lua, 3, "AppName");
- lua_call(lua, 0, 1);
- AppName = lua_tostring(lua, -1);
- if (AppName == NULL || strcmp(AppName, "TO_LAB_APP") != 0)
- {
- return 0;
- }
-
-
- lua_getfield(lua, 3, "EventID");
- lua_call(lua, 0, 1);
-
- if (lua_compare(lua, lua_upvalueindex(1), -1, LUA_OPEQ))
- {
- printf("%s(): TRUE\n", __func__);
- lua_settop(lua, 1);
- return 1;
- }
-
- return 0;
-}
-
-static int TestIntf_CI_TO_LAB_DoSubscription(lua_State *lua)
-{
- int IsSubscribe;
- luaL_checkudata(lua, 1, "TestIntf_CI_TO_LAB_Connection");
-
- lua_settop(lua, 3);
- lua_getglobal(lua, "EdsDB"); /* top@ 4 */
- lua_pushcfunction(lua, TestIntf_CI_TO_LAB_Send); /* top@ 5 */
- lua_pushvalue(lua, 1); /* top@ 6 */
- lua_getfield(lua, 4, "Encode"); /* top@ 7 */
- lua_getfield(lua, 4, "NewMessage"); /* top@ 8 */
-
- lua_getuservalue(lua, 1); /* top@ 9 */
- lua_getfield(lua, -1, "Interface"); /* top@ 10 */
- lua_remove(lua, -2); /* uservalue, leave interface object @9 */
-
- /* Push the operation type - this is either "AddPacket" (subscribe) or "RemovePacket" (unsubscribe) */
- lua_pushvalue(lua, lua_upvalueindex(1)); /* top@ 10 */
- IsSubscribe = (strcmp(lua_tostring(lua, -1), "AddPacket") == 0);
- lua_call(lua, 2, 1); /* Call EdsDB.NewMessage(intf, command) - result @8 */
-
- lua_getfield(lua, -1, "Payload"); /* Payload @9 */
- lua_pushinteger(lua, 5);
- lua_setfield(lua, -2, "BufLimit");
-
- /* Incorporate any user-specified attributes */
- if (lua_istable(lua, 3))
- {
- lua_pushnil(lua);
- while (lua_next(lua, 3))
- {
- lua_pushvalue(lua, -2);
- lua_insert(lua, -2);
- lua_settable(lua, 9);
- }
- }
-
- /* Set the "MsgId" parameter to be the second argument */
- lua_pushvalue(lua, 2);
- lua_setfield(lua, 9, "MsgId");
- lua_pop(lua, 1);
-
- lua_call(lua, 1, 1); /* Call EdsDB.Encode(msg) - result@ 7 */
-
- /* Send the subscription/unsubscription message via the normal Send() function */
- lua_call(lua, 2, 0); /* Call TestIntf_CI_TO_LAB_Send() - top@ 4 */
-
- /*
- * On subscribe requests, it should delay until the subscription takes effect.
- * Return a wait table value that specifies to wait for CFE_EVS EVENTMSG
- * further specify a callback function that looks specifically for TO_LAB_APP event 15 (subscribe)
- */
- lua_getuservalue(lua, 1); /* top@ 5 */
- lua_newtable(lua); /* top@ 6 */
- lua_newtable(lua); /* top@ 7 */
- lua_getfield(lua, 5, "EventIntf");
- lua_setfield(lua, 7, "Interface");
-
- /*
- * JPHFIX: the magic numbers here are the event IDs for subscribe/unsubscribe.
- * These should be defined as an enumeration in the EDS to clean this up.
- */
- if (IsSubscribe)
- {
- lua_pushinteger(lua, 15); /* subscribe event id */
- }
- else
- {
- lua_pushinteger(lua, 16); /* unsubscribe event id */
- }
-
- lua_pushcclosure(lua, TestIntf_CI_TO_LAB_CheckSubscribeEvent, 1);
- lua_setfield(lua, 7, "Callback");
- lua_rawseti(lua, 6, 1);
- lua_pushinteger(lua, 5000);
-
- return 2;
-}
-
-static int TestIntf_CI_TO_LAB_Destroy(lua_State *lua)
-{
- TestIntf_CI_TO_LAB_Connection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_CI_TO_LAB_Connection");
-
- if (Conn->SocketId >= 0)
- {
- close(Conn->SocketId);
- Conn->SocketId = -1;
- }
-
- return 0;
-}
-
-int TestIntf_CI_TO_LAB_Create(lua_State *lua)
-{
- uint16_t TargetNum = luaL_checkinteger(lua, 1);
- uint16_t LocalPort = 0;
- uint16_t TargetPort = 0;
- uint32_t InterPacketDelay = 25;
- const char *LocalIP = NULL;
- const char *TargetIP = NULL;
- TestIntf_CI_TO_LAB_Connection_t *Conn;
-
- if (lua_isstring(lua, 2))
- {
- TargetIP = lua_tostring(lua, 2);
- }
- else if (lua_istable(lua, 2))
- {
- /* Trim the stack to 2 entries in case extra args were passed */
- lua_settop(lua, 2);
-
- lua_getfield(lua, 2, "TargetIP");
- TargetIP = lua_tostring(lua, -1);
- lua_getfield(lua, 2, "LocalIP");
- LocalIP = lua_tostring(lua, -1);
-
- /*
- * Note that these strings cannot be popped yet,
- * they must sit on the stack until we are done with
- * the C strings above
- */
-
- lua_getfield(lua, 2, "TargetPort");
- if (lua_isnumber(lua, -1))
- {
- TargetPort = lua_tointeger(lua, -1);
- }
- lua_pop(lua, 1);
-
- lua_getfield(lua, 2, "TargetIP");
- if (lua_isnumber(lua, -1))
- {
- LocalPort = lua_tointeger(lua, -1);
- }
- lua_pop(lua, 1);
-
- lua_getfield(lua, 2, "InterPacketDelay");
- if (lua_isnumber(lua, -1))
- {
- InterPacketDelay = lua_tointeger(lua, -1);
- }
- lua_pop(lua, 1);
- }
-
- /*
- * Always adjust the stack to the same level so absolute refs can be used.
- */
- lua_settop(lua, 4);
-
- if (TargetIP == NULL)
- {
- /* If user did not specify target, assume it is running on localhost */
- TargetIP = "127.0.0.1";
- }
-
- if (LocalIP == NULL)
- {
- /* If user did not specify target, assume it is running on localhost */
- LocalIP = "127.0.0.1";
- }
-
- if (TargetPort == 0)
- {
- /* If unspecified, send to the default UDP port that CI_LAB listens on */
- TargetPort = CI_LAB_BASE_PORT + TargetNum - 1;
- }
-
- if (LocalPort == 0)
- {
- /* If unspecified, bind to the default UDP port that TO_LAB sends to */
- LocalPort = TO_LAB_BASE_PORT + TargetNum - 1;
- }
-
- /* index 5 -- this is the object that will be returned */
- Conn = lua_newuserdata(lua, sizeof(TestIntf_CI_TO_LAB_Connection_t));
- if (luaL_newmetatable(lua, "TestIntf_CI_TO_LAB_Connection"))
- {
- lua_newtable(lua);
-
- lua_pushcfunction(lua, TestIntf_CI_TO_LAB_Send);
- lua_setfield(lua, -2, "Send");
- lua_pushcfunction(lua, TestIntf_CI_TO_LAB_Wait);
- lua_setfield(lua, -2, "Wait");
- lua_pushcfunction(lua, TestIntf_CI_TO_LAB_Poll);
- lua_setfield(lua, -2, "Poll");
-
- lua_pushstring(lua, "AddPacket");
- lua_pushcclosure(lua, TestIntf_CI_TO_LAB_DoSubscription, 1);
- lua_setfield(lua, -2, "Subscribe");
- lua_pushstring(lua, "RemovePacket");
- lua_pushcclosure(lua, TestIntf_CI_TO_LAB_DoSubscription, 1);
- lua_setfield(lua, -2, "Unsubscribe");
-
- lua_setfield(lua, -2, "__index");
-
- lua_pushcfunction(lua, TestIntf_CI_TO_LAB_Destroy);
- lua_setfield(lua, -2, "__gc");
- }
- lua_setmetatable(lua, -2);
-
- memset(Conn, 0, sizeof(*Conn));
-
- Conn->SocketId = socket(PF_INET, SOCK_DGRAM, 0);
- if (Conn->SocketId < 0)
- {
- return luaL_error(lua, "Error opening socket: %s", strerror(errno));
- }
-
- Conn->InterPacketDelay.tv_sec = InterPacketDelay / 1000;
- Conn->InterPacketDelay.tv_nsec = 1000000 * (InterPacketDelay % 1000);
- Conn->LocalAddr.sin_family = AF_INET;
- Conn->TargetAddr.sin_family = AF_INET;
- if (inet_pton(AF_INET, TargetIP, &Conn->TargetAddr.sin_addr) <= 0)
- {
- return luaL_argerror(lua, 2, "Invalid target IP address");
- }
- if (inet_pton(AF_INET, LocalIP, &Conn->LocalAddr.sin_addr) <= 0)
- {
- return luaL_argerror(lua, 2, "Invalid local IP address");
- }
-
- Conn->LocalAddr.sin_port = htons(LocalPort);
- Conn->TargetAddr.sin_port = htons(TargetPort);
-
- if (bind(Conn->SocketId, (struct sockaddr *)&Conn->LocalAddr, sizeof(Conn->LocalAddr)) < 0)
- {
- return luaL_error(lua, "Failed to bind: %s", strerror(errno));
- }
-
- lua_pushcfunction(lua, TestIntf_CI_TO_LAB_Send); /* top@ 6 */
- lua_getglobal(lua, "EdsDB"); /* top@ 7 */
- lua_getfield(lua, -1, "Encode");
- lua_getfield(lua, -2, "NewMessage");
- lua_getfield(lua, -3, "GetInterface");
-
- lua_pushvalue(lua, 5); /* Connection object - top@ 11 */
- lua_replace(lua, 7); /* Replace the EdsDB object @7 - top @10 */
-
- /*
- * Top of Lua stack should currently be arranged as follows:
- * @ 6 - TestIntf_CI_TO_LAB_Send() function
- * @ 7 - Connection object (1st argument to TestIntf_CI_TO_LAB_Send)
- * @ 8 - EdsDB.Encode() function (return value is 2nd argument to TestIntf_CI_TO_LAB_Send)
- * @ 9 - EdsDB.NewMessage() function (return value is 1st argument to EdsDB.Encode)
- * @ 10 - EdsDB.GetInterface() function (return value is argument to EdsDB.NewMessage)
- */
-
- /*
- * Save the interface object for future use.
- * Create a table to use as the uservalue and set this as the "Interface" field in it.
- * The CFE_EVS "EVENT_MSG" interface is relevant to check for subscription events.
- */
- lua_newtable(lua); /* top @11 */
- lua_pushvalue(lua, -2); /* GetInterface function - top@ 12 */
- lua_pushstring(lua, "CFE_EVS/Application/EVENT_MSG"); /* top@ 13 */
- lua_call(lua, 1, 1); /* Call GetInterface("CFE_EVS/Application/EVENT_MSG") - result@ 12 */
- if (lua_type(lua, -1) != LUA_TUSERDATA)
- {
- return luaL_error(lua, "Unknown interface \'CFE_EVS/Application/EVENT_MSG\'");
- }
- lua_setfield(lua, -2, "EventIntf"); /* Set object as the "EventIntf" field within the table - top@ 11 */
- lua_pushvalue(lua, -2); /* GetInterface function - top@ 12 */
- lua_pushstring(lua, "TO_LAB/Application/CMD"); /* top@ 13 */
- lua_call(lua, 1, 1); /* Call GetInterface("TO_LAB/Application/CMD") - result@ 12 */
- if (lua_type(lua, -1) != LUA_TUSERDATA)
- {
- return luaL_error(lua, "Unknown interface \'TO_LAB/Application/CMD\'");
- }
- lua_pushvalue(lua, -1); /* save a copy of the intf for next call to NewMessage */
- lua_replace(lua, 10);
- lua_setfield(lua, -2, "Interface"); /* Set object as the "Interface" field within the table - top@ 11 */
- lua_setuservalue(lua, 7); /* Set the table as the uservalue for the returned object - top@ 10 */
-
- /*
- * Create an "OutputEnable" message based on the interface
- */
- lua_pushstring(lua, "EnableOutput"); /* top@ 11 */
- lua_call(lua, 2, 1); /* Call NewMessage(intf, "OutputEnable") - result@ 9 */
-
- /* Set the Payload.dest_IP member to be the value specified by LocalIP */
- lua_getfield(lua, -1, "Payload"); /* top@ 10 */
- lua_pushstring(lua, LocalIP); /* top@ 11 */
- lua_setfield(lua, -2, "dest_IP"); /* top@ 10 */
- lua_pop(lua, 1); /* top@ 9 */
-
- lua_call(lua, 1, 1); /* Call Encode(msg) - result@ 8 */
- lua_call(lua, 2, 0); /* Call TestIntf_CI_TO_LAB_Send(msg) - no return value - top@ 5 */
-
- /* Stack top should be back at 5 (the connection object) */
-
- return 1;
-} /* end TestIntf_CI_TO_LAB_Create */
diff --git a/cfecfs/testexecutive/modules/remote_interface.c b/cfecfs/testexecutive/modules/remote_interface.c
deleted file mode 100644
index 8f41a79..0000000
--- a/cfecfs/testexecutive/modules/remote_interface.c
+++ /dev/null
@@ -1,772 +0,0 @@
-/*
- * LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
- *
- * Copyright (c) 2020 United States Government as represented by
- * the Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * \file remote_interface.c
- * \ingroup testexecutive
- * \author joseph.p.hickey@nasa.gov
- *
- * Implementation of test executive
- */
-
-#include
-#include /* memset() */
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "testexec.h"
-
-#include "cfe_mission_eds_parameters.h"
-#include "cfe_mission_eds_interface_parameters.h"
-#include "edslib_displaydb.h"
-#include "cfe_missionlib_runtime.h"
-#include "cfe_missionlib_api.h"
-#include "edslib_lua_objects.h"
-#include "cfe_missionlib_lua_softwarebus.h"
-
-/* Size to use for ring buffer - keep as power of 2 for masking */
-#define REMOTE_BUFFER_SIZE 0x8000
-#define REMOTE_BUFFER_MASK 0x7FFF
-#define SEND_BUFFER_SIZE 0x4000
-
-typedef struct
-{
- pid_t pid;
- int InFd;
- int OutFd;
- char SendBuffer[SEND_BUFFER_SIZE];
- char RecvBuffer[REMOTE_BUFFER_SIZE];
- size_t RecvBufWrPos;
- size_t RecvBufChkPos;
- size_t RecvBufRdPos;
-
-} TestIntf_RemoteConnection_t;
-
-static void TestIntf_Poll_Subprocess(TestIntf_RemoteConnection_t *Conn)
-{
- if (Conn->pid > 0)
- {
- if (waitpid(Conn->pid, NULL, WNOHANG) == Conn->pid)
- {
- Conn->pid = -1;
-
- if (Conn->InFd >= 0)
- {
- close(Conn->InFd);
- Conn->InFd = -1;
- }
-
- if (Conn->OutFd >= 0)
- {
- close(Conn->OutFd);
- Conn->OutFd = -1;
- }
- }
- }
-}
-
-static int TestIntf_Remote_ObjToString(lua_State *lua)
-{
- switch(lua_type(lua, 1))
- {
- case LUA_TSTRING:
- {
- /*
- * Note this string could contain embedded special chars (including nulls)
- * as well as newlines and other binary data which will throw off the parser.
- * To be safe all strings will be base64 encoded. It will increase the length
- * by 4/3 but it will be guaranteed to get through intact.
- */
- const uint8_t *Data = (const uint8_t *)lua_tostring(lua, 1);
- uint32_t DataLength = 8 * lua_rawlen(lua, 1);
- uint32_t EncodedLength = (DataLength + 32) / 6;
- char *Block;
- luaL_Buffer Buf;
-
- luaL_buffinit(lua, &Buf);
- luaL_addstring(&Buf, "Base64(");
- lua_pushinteger(lua, DataLength);
- luaL_addvalue(&Buf);
- luaL_addstring(&Buf, ",\"");
- Block = luaL_prepbuffsize(&Buf, EncodedLength);
- EdsLib_DisplayDB_Base64Encode(Block, EncodedLength, Data, DataLength);
- luaL_addsize(&Buf, strlen(Block));
- luaL_addstring(&Buf, "\")");
- luaL_pushresult(&Buf);
- break;
- }
- case LUA_TNUMBER:
- case LUA_TBOOLEAN:
- {
- luaL_tolstring(lua, 1, NULL);
- break;
- }
- case LUA_TTABLE:
- {
- lua_pushstring(lua, "{");
- lua_pushnil(lua);
- while(lua_next(lua, 1))
- {
- if (lua_checkstack(lua, 3) && lua_type(lua, -2) == LUA_TSTRING)
- {
- lua_pushcfunction(lua, TestIntf_Remote_ObjToString);
- lua_insert(lua, -2);
- lua_call(lua, 1, 1);
- lua_pushstring(lua, "=");
- lua_insert(lua, -2);
- lua_pushstring(lua, ",");
- lua_pushvalue(lua, -4);
- }
- }
- if (lua_gettop(lua) > 2)
- {
- lua_pop(lua, 1);
- }
- lua_pushstring(lua, "}");
- lua_concat(lua, lua_gettop(lua) - 1);
- break;
- }
- default:
- lua_pushstring(lua, "nil");
- break;
- }
-
- return 1;
-}
-
-static int TestIntf_Remote_DoAction(lua_State *lua)
-{
- TestIntf_RemoteConnection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_RemoteConnection");
- char *BufPtr;
- size_t BufLen;
- ssize_t wrsz;
- int narg;
- int idx;
-
- TestIntf_Poll_Subprocess(Conn);
- if (Conn->OutFd < 0)
- {
- return luaL_error(lua, "Remote subprocess not running");
- }
-
- BufLen = snprintf(Conn->SendBuffer, sizeof(Conn->SendBuffer), "DoAction(\"%s\"",
- lua_tostring(lua, lua_upvalueindex(1)));
-
- if (BufLen < sizeof(Conn->SendBuffer))
- {
- BufPtr = &Conn->SendBuffer[BufLen + 1];
- }
- else
- {
- BufPtr = NULL;
- }
-
- narg = lua_gettop(lua);
- for (idx = 2; idx <= narg && BufPtr != NULL; ++idx)
- {
- lua_pushcfunction(lua, TestIntf_Remote_ObjToString);
- lua_pushvalue(lua, idx);
- lua_call(lua, 1, 1);
-
- /*
- * note that memccpy() returns a pointer to the byte after the null char,
- * so we need to back it up by one to overwrite the null and append the string.
- * for subsequent args we need to replace this with a comma separator.
- */
- *(BufPtr - 1) = ',';
- BufLen = BufPtr - Conn->SendBuffer;
- BufPtr = memccpy(BufPtr, lua_tostring(lua, -1), 0, sizeof(Conn->SendBuffer) - BufLen);
- }
-
- if (BufPtr != NULL)
- {
- --BufPtr;
- BufLen = BufPtr - Conn->SendBuffer;
- BufPtr = memccpy(BufPtr, ")\n", 0, sizeof(Conn->SendBuffer) - BufLen);
- }
-
- if (BufPtr == NULL)
- {
- return luaL_error(lua, "Remote request too long");
- }
-
- BufLen = BufPtr - Conn->SendBuffer;
- BufPtr = Conn->SendBuffer;
- while (BufLen > 0)
- {
- wrsz = write(Conn->OutFd, BufPtr, BufLen);
- if (wrsz == 0)
- {
- lua_pushstring(lua, "zero length write");
- break;
- }
- if (wrsz > 0)
- {
- BufPtr += wrsz;
- BufLen -= wrsz;
- }
- else if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK)
- {
- lua_pushstring(lua, strerror(errno));
- break;
- }
- }
-
- if (BufLen > 0)
- {
- if (lua_gettop(lua) == narg)
- {
- lua_pushstring(lua, "incomplete write");
- }
- return lua_error(lua);
- }
-
-
- return 0;
-}
-
-const char * TestIntf_Remote_RecvBuffReader(lua_State *lua, void *Data, size_t *ChunkSize)
-{
- TestIntf_RemoteConnection_t *Conn = Data;
- const char *BufPtr;
-
- if (Conn->RecvBufRdPos == Conn->RecvBufChkPos)
- {
- BufPtr = NULL;
- *ChunkSize = 0;
- }
- else
- {
- size_t StartPos = Conn->RecvBufRdPos & REMOTE_BUFFER_MASK;
- size_t EndPos = Conn->RecvBufChkPos & REMOTE_BUFFER_MASK;
- BufPtr = &Conn->RecvBuffer[StartPos];
- if (StartPos < EndPos)
- {
- /* The whole chunk may be returned */
- *ChunkSize = EndPos - StartPos;
- }
- else
- {
- *ChunkSize = sizeof(Conn->RecvBuffer) - StartPos;
- }
- Conn->RecvBufRdPos += *ChunkSize;
- }
-
- return BufPtr;
-}
-
-static int TestIntf_Remote_ExecuteAction(lua_State *lua)
-{
- int tbl = lua_upvalueindex(1);
-
- while(lua_gettop(lua) > 0)
- {
- printf("%s(): set %s\n", __func__, lua_typename(lua, lua_type(lua, -1)));
- lua_rawseti(lua, tbl, 1 + lua_rawlen(lua, tbl));
- }
-
- return 0;
-}
-
-static int TestIntf_Remote_Base64(lua_State *lua)
-{
- uint32_t DataLengthBits = luaL_checkinteger(lua, 1);
- const char *EncodedStr = luaL_checkstring(lua, 2);
- uint32_t DataLengthBytes = (DataLengthBits + 7) / 8;
- luaL_Buffer Buf;
-
- luaL_buffinit(lua, &Buf);
- EdsLib_DisplayDB_Base64Decode((uint8_t*)luaL_prepbuffsize(&Buf, DataLengthBytes),
- DataLengthBits, EncodedStr);
- luaL_addsize(&Buf, DataLengthBytes);
- luaL_pushresult(&Buf);
- return 1;
-}
-
-static int TestIntf_Remote_Wait(lua_State *lua)
-{
- TestIntf_RemoteConnection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_RemoteConnection");
- int32_t Timeout = luaL_optinteger(lua, 2, -1);
- struct timeval stime;
- struct timeval *stptr;
- fd_set rdfd;
-
- printf("%s()\n", __func__);
-
- TestIntf_Poll_Subprocess(Conn);
- if (Conn->InFd < 0)
- {
- lua_pushboolean(lua, 0);
- }
- else
- {
- if (Timeout >= 0)
- {
- stime.tv_sec = Timeout / 1000;
- stime.tv_usec = 1000 * (Timeout % 1000);
- stptr = &stime;
- }
- else
- {
- stptr = NULL;
- }
-
- FD_ZERO(&rdfd);
- FD_SET(Conn->InFd, &rdfd);
-
- if (select(1 + Conn->InFd, &rdfd, NULL, NULL, stptr) < 0)
- {
- if (errno != EINTR)
- {
- /* error reading the filehandle */
- fprintf(stderr,"%s(): select: %s\n", __func__, strerror(errno));
- }
- lua_pushboolean(lua, 0);
- }
- else
- {
- lua_pushboolean(lua, 1);
- }
- }
-
- return 1;
-}
-
-static int TestIntf_Remote_Poll(lua_State *lua)
-{
- TestIntf_RemoteConnection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_RemoteConnection");
- int idx;
- size_t TempPos;
- ssize_t rdsz;
-
- lua_settop(lua, 1);
- lua_newtable(lua); /* idx 2 - action table (initially empty) */
-
- /*
- * First poll that the subprocess is still alive.
- * If it has ended, we can close the file handles.
- */
- TestIntf_Poll_Subprocess(Conn);
-
- while (1)
- {
- /*
- * check for anything interesting already in the local buffer
- * before reading more from the pipe.
- */
- while (Conn->RecvBufChkPos != Conn->RecvBufWrPos)
- {
- TempPos = Conn->RecvBufChkPos & REMOTE_BUFFER_MASK;
- ++Conn->RecvBufChkPos;
-
- if (Conn->RecvBuffer[TempPos] == '\n')
- {
- /*
- * Check that the buffer is not overrun -- if so the data is all garbage
- * and must be dropped.
- */
- if ((Conn->RecvBufWrPos - Conn->RecvBufRdPos) < sizeof(Conn->RecvBuffer))
- {
- if (lua_gettop(lua) == 2)
- {
- /* Save the global registry and replace it with a temporary one */
- lua_rawgeti(lua, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); /* idx 3 - saved global environment */
- lua_newtable(lua); /* idx 4 - temp global state */
- lua_pushcfunction(lua, TestIntf_Remote_Base64);
- lua_setfield(lua, -2, "Base64");
- lua_pushvalue(lua, 2);
- lua_pushcclosure(lua, TestIntf_Remote_ExecuteAction, 1);
- lua_setfield(lua, -2, "DoAction");
- lua_rawseti(lua, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); /* Set as temp/protected global environment */
- }
-
- if (lua_load(lua, TestIntf_Remote_RecvBuffReader, Conn, "in", "t") != LUA_OK)
- {
- /* In this case Lua should have pushed an error message */
- fprintf(stderr, "%s(): Load error: %s\n", __func__, luaL_tolstring(lua, -1, NULL));
- lua_pop(lua, 2);
- }
- else if (lua_pcall(lua, 0, 0, 0) != LUA_OK)
- {
- fprintf(stderr, "%s(): %s\n", __func__, luaL_tolstring(lua, -1, NULL));
- lua_pop(lua, 2);
- }
- }
-
- /*
- * Normally this would have consumed all data in the buffer.
- * If not that means data is being dropped and it is probably worth a note.
- */
- if (Conn->RecvBufRdPos != Conn->RecvBufChkPos)
- {
- fprintf(stderr, "%s(): dropped %zu bytes\n", __func__, Conn->RecvBufChkPos - Conn->RecvBufRdPos);
- Conn->RecvBufRdPos = Conn->RecvBufChkPos;
- }
-
- if (lua_rawlen(lua, 2) > 0)
- {
- /* Action(s) got added to the table, so exit the loop now */
- break;
- }
- }
- }
-
- if (lua_rawlen(lua, 2) > 0)
- {
- /* Action(s) got added to the table, so exit the loop now */
- break;
- }
-
- if (Conn->InFd < 0)
- {
- /* No valid filehandle to read, nothing more to do */
- break;
- }
-
- /*
- * Read additional data.
- * Do not read more than 25% of the buffer in one shot -
- * this makes it less likely to overrun in case the remote side
- * starts spewing data, as we can consume some data before reading more.
- *
- * The filehandle should be set to nonblocking (O_NONBLOCK flag)
- * so that there is no risk of getting stuck here.
- */
- TempPos = Conn->RecvBufWrPos & REMOTE_BUFFER_MASK;
- rdsz = sizeof(Conn->RecvBuffer) - TempPos;
- if (rdsz > (sizeof(Conn->RecvBuffer) / 4))
- {
- rdsz = (sizeof(Conn->RecvBuffer) / 4);
- }
- fprintf(stderr, "%s() about to read %ld\n", __func__, (long)rdsz);
- rdsz = read(Conn->InFd, &Conn->RecvBuffer[TempPos], rdsz);
- fprintf(stderr, "%s() read got %ld\n", __func__, (long)rdsz);
-
- if (rdsz == 0)
- {
- /* this is indicative of an EOF condition.
- * for a pipe this means the subprocess must have ended. */
- break;
- }
-
- if (rdsz > 0)
- {
- Conn->RecvBufWrPos += rdsz;
- }
- else
- {
- if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK)
- {
- fprintf(stderr,"%s(): read: %s\n", __func__, strerror(errno));
- }
- break;
- }
- }
-
- if (lua_gettop(lua) == 3)
- {
- /* Restore the original LUA_RIDX_GLOBALS environment */
- lua_rawseti(lua, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
- }
-
- for (idx = lua_rawlen(lua, 2); idx > 0; --idx)
- {
- lua_rawgeti(lua, 2, idx);
- printf("%s(): get %d %s\n", __func__, lua_gettop(lua), lua_typename(lua, lua_type(lua, -1)));
- }
-
- return lua_gettop(lua) - 2;
-}
-
-static int TestIntf_Remote_Close(lua_State *lua)
-{
- TestIntf_RemoteConnection_t *Conn = luaL_checkudata(lua, 1, "TestIntf_RemoteConnection");
- uint32_t Timeout;
- struct pollfd pfd;
- nfds_t nfds;
-
- printf("%s(): START\n", __func__);
- /*
- * Close our side of the output pipe. The subprocess should see
- * this as an EOF on its STDIN stream which (depending on the
- * implementation) may trigger a shutdown/exit procedure.
- */
- if (Conn->OutFd >= 0)
- {
- close(Conn->OutFd);
- Conn->OutFd = -1;
- }
-
- TestIntf_Poll_Subprocess(Conn);
-
- /*
- * When the subprocess exits, it should close its stdout stream,
- * which may appear on this side as a broken pipe signal or a closure of
- * the remote side of the pipe.
- *
- * By using select() on the file descriptor for this side of the pipe we
- * can delay until that happens.
- *
- * This needs to be time-limited to protect against the possibility of a
- * rogue subprocess that ignores the TERM signal and refuses to exit.
- */
- Timeout = 100;
-
- /*
- * If the child process is running then send a TERM signal
- */
- while (Conn->pid > 0)
- {
- if (waitpid(Conn->pid, NULL, WNOHANG) == Conn->pid)
- {
- /* process has exited, status gotten */
- Conn->pid = -1;
- break;
- }
-
- if (Timeout == 0)
- {
- if (lua_toboolean(lua, lua_upvalueindex(1)))
- {
- /*
- * did our best but no status was collected --
- * in garbage collection mode we are losing this reference anyway.
- *
- * This will cause the InStream to be closed if it is still open.
- */
- Conn->pid = -1;
- }
- break;
- }
-
- /*
- * subprocess is not exiting on its own ...
- *
- * First try sending SIGTERM to do graceful shutdown
- * Then do subsequently more aggressive signals to get it to exit
- *
- * Note that some tools only respond to certain signals --
- * e.g. 'nc' in listen mode when nothing is connected only seems to respond to SIGINT
- *
- * If that doesn't work and we are in garbage collection mode (upvalue 1)
- * then finally send a SIGKILL which cannot be ignored
- * (this should take care of a subprocess which is hung)
- */
- if (Timeout == 90)
- {
- fprintf(stderr, "Sending SIGTERM to child task\n");
- kill(Conn->pid, SIGTERM);
- }
- else if (Timeout == 70)
- {
- fprintf(stderr, "Sending SIGQUIT to child task\n");
- kill(Conn->pid, SIGQUIT);
- }
- else if (Timeout == 50)
- {
- fprintf(stderr, "Sending SIGINT to child task\n");
- kill(Conn->pid, SIGINT);
- }
- else if (Timeout == 30 && lua_toboolean(lua, lua_upvalueindex(1)))
- {
- fprintf(stderr, "Sending SIGKILL to child task\n");
- kill(Conn->pid, SIGKILL);
- }
- else
- {
- /*
- * Wait up to 20ms for something to happen.
- * If the input pipe is not yet closed then call poll() on it.
- * Otherwise use poll() as a way to sleep for a bit.
- */
- memset(&pfd, 0, sizeof(pfd));
- if (Conn->InFd >= 0)
- {
- nfds = 1;
- pfd.fd = Conn->InFd;
- pfd.events = POLLIN;
- }
- else
- {
- nfds = 0;
- }
-
- if (poll(&pfd, nfds, 20) > 0)
- {
- /*
- * in case there was actual data available, read it
- * all data at this point is discarded.
- */
- if (read(Conn->InFd, Conn->RecvBuffer, sizeof(Conn->RecvBuffer)) == 0)
- {
- /*
- * zero length read is eof indicator.
- * This means the remote end of the pipe is closed.
- * At this point just poll for task to exit.
- */
- close(Conn->InFd);
- Conn->InFd = -1;
- }
- }
- }
-
- --Timeout;
- }
-
- /*
- * Ensure that the input read pipe is also closed.
- */
- if (Conn->InFd >= 0 && Conn->pid <= 0)
- {
- close(Conn->InFd);
- Conn->InFd = -1;
- }
-
- return 0;
-}
-
-int TestIntf_Remote_Create(lua_State *lua)
-{
- const char *ShellCmd = luaL_checkstring(lua, 2);
- TestIntf_RemoteConnection_t *Conn;
- int rdpipe[2];
- int wrpipe[2];
- int status;
-
- Conn = lua_newuserdata(lua, sizeof(TestIntf_RemoteConnection_t));
- if (luaL_newmetatable(lua, "TestIntf_RemoteConnection"))
- {
- lua_newtable(lua);
-
- lua_pushstring(lua, "Message");
- lua_pushcfunction(lua, TestIntf_Remote_DoAction);
- lua_setfield(lua, -2, "Send");
-
- lua_pushcfunction(lua, TestIntf_Remote_Poll);
- lua_setfield(lua, -2, "Poll");
-
- lua_pushcfunction(lua, TestIntf_Remote_Wait);
- lua_setfield(lua, -2, "Wait");
-
- lua_pushboolean(lua, 0);
- lua_pushcclosure(lua, TestIntf_Remote_Close, 1);
- lua_setfield(lua, -2, "Close");
-
- lua_pushstring(lua, "Subscribe");
- lua_pushcclosure(lua, TestIntf_Remote_DoAction, 1);
- lua_setfield(lua, -2, "Subscribe");
-
- lua_pushstring(lua, "Unsubscribe");
- lua_pushcclosure(lua, TestIntf_Remote_DoAction, 1);
- lua_setfield(lua, -2, "Unsubscribe");
-
- lua_setfield(lua, -2, "__index");
-
- lua_pushboolean(lua, 1);
- lua_pushcclosure(lua, TestIntf_Remote_Close, 1);
- lua_setfield(lua, -2, "__gc");
- }
- lua_setmetatable(lua, -2);
-
- memset(Conn, 0, sizeof(*Conn));
- Conn->InFd = -1;
- Conn->OutFd = -1;
- Conn->pid = -1;
-
- status = pipe(rdpipe);
- if (status < 0)
- {
- return luaL_error(lua, "pipe(rd): %s", strerror(errno));
- }
-
- status = pipe(wrpipe);
- if (status < 0)
- {
- close(rdpipe[1]);
- close(rdpipe[0]);
- return luaL_error(lua, "pipe(wr): %s", strerror(errno));
- }
-
- Conn->pid = fork();
- if (Conn->pid < 0)
- {
- /* Some error occurred */
- close(rdpipe[1]);
- close(rdpipe[0]);
- close(wrpipe[1]);
- close(wrpipe[0]);
- return luaL_error(lua, "fork(): %s", strerror(errno));
- }
-
- if (Conn->pid == 0)
- {
- /* This is the child process */
- close(rdpipe[0]); /* read side */
- close(wrpipe[1]); /* write side */
-
- dup2(wrpipe[0], STDIN_FILENO);
- close(wrpipe[0]);
- dup2(rdpipe[1], STDOUT_FILENO);
- close(rdpipe[1]);
-
- /* Treat the entire string as a command line to pass to the shell for interpretation */
- fprintf(stderr, "running: %s\n", ShellCmd);
- status = execl("/bin/sh", "sh", "-c", ShellCmd, NULL);
- if (status < 0)
- {
- /*
- * Error occurred -- cannot throw a Lua error anymore since this
- * is executing in a child process.
- */
- fprintf(stderr, "execl(): %s\n", strerror(errno));
- }
-
- /* In case e.g. exec did not work, then exit with a failure status code */
- exit(EXIT_FAILURE);
- }
-
- /*
- * This is the parent process
- * Set up the InStream / OutStream FILE objects from the file descriptors.
- */
- close(rdpipe[1]); /* write side */
- close(wrpipe[0]); /* read side */
- Conn->InFd = rdpipe[0];
- Conn->OutFd = wrpipe[1];
-
- status = fcntl(Conn->InFd, F_GETFL);
- status |= O_NONBLOCK;
- fcntl(Conn->InFd, F_SETFL, status);
-
- return 1;
-} /* end TestIntf_Remote_Create */
-
diff --git a/cfecfs/testexecutive/src/test_interface.c b/cfecfs/testexecutive/src/test_interface.c
deleted file mode 100644
index 7dcba98..0000000
--- a/cfecfs/testexecutive/src/test_interface.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
- *
- * Copyright (c) 2020 United States Government as represented by
- * the Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * \file test_interface.c
- * \ingroup testexecutive
- * \author joseph.p.hickey@nasa.gov
- *
- * Interface between test executive and test targets
- */
-
-#include
-#include /* memset() */
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "osapi.h"
-
-#include "cfe_mission_eds_parameters.h"
-#include "cfe_mission_eds_interface_parameters.h"
-#include "edslib_displaydb.h"
-#include "cfe_missionlib_runtime.h"
-#include "cfe_missionlib_api.h"
-#include "edslib_lua_objects.h"
-#include "cfe_missionlib_lua_softwarebus.h"
-
-#include "testexec.h"
-
-typedef struct
-{
- uint16 TargetNum;
-} TestIntf_t;
-
-typedef struct
-{
- const char *LuaName;
- int (*InitFunc)(lua_State *lua);
-} TestExec_Intf_ModuleEntry_t;
-
-#define TESTEXEC_MODULE(x) extern int TestIntf_ ## x ## _Create(lua_State *lua);
-#include "testexec_compiledin_modules.h"
-#undef TESTEXEC_MODULE
-
-#define TESTEXEC_MODULE(x) { #x, TestIntf_ ## x ## _Create },
-static const TestExec_Intf_ModuleEntry_t TESTEXEC_INTF_TABLE[] =
-{
-#include "testexec_compiledin_modules.h"
- { NULL, NULL }
-};
-#undef TESTEXEC_MODULE
-
-
-static int TestIntf_Preprocess_Message(lua_State *lua)
-{
- printf("%s(): Start\n", __func__);
-
- /*
- * Expected arguments:
- * idx@1 - received raw/packed message object (string)
- */
- lua_settop(lua, 1);
- lua_newtable(lua);
-
- lua_getglobal(lua, "EdsDB");
- lua_getfield(lua, -1, "IdentifyMessage");
- lua_pushvalue(lua, 1);
- lua_call(lua, 1, 2);
-
- /*
- * Expected after call:
- * idx@-1 - MissionLib interface object
- * idx@-2 - EdsLib data object
- */
- printf("%s(): Intf=%s\n", __func__,
- luaL_tolstring(lua, -1, NULL));
- lua_pop(lua, 1);
-
- printf("%s(): EdsObj=%s\n", __func__,
- luaL_tolstring(lua, -2, NULL));
- lua_pop(lua, 1);
-
- lua_setfield(lua, 2, "Interface");
- lua_setfield(lua, 2, "Object");
- lua_settop(lua, 2);
-
- printf("%s(): End\n", __func__);
-
- return 1;
-}
-
-static int TestIntf_Filter_Message(lua_State *lua)
-{
- int is_match;
-
- /*
- * Expected arguments:
- * idx@1 - filter criteria (table; may contain field "Interface")
- * idx@2 - preprocessed event data (table; must contain field "Interface" and "Object")
- *
- * If interfaces match, then return the object.
- * If no match, then return nothing.
- */
- luaL_checktype(lua, 1, LUA_TTABLE);
- luaL_checktype(lua, 2, LUA_TTABLE);
- lua_settop(lua, 2);
- lua_getfield(lua, 1, "Interface");
- if (lua_isnil(lua, -1))
- {
- /*
- * if user did not specify an interface, then do not match anything.
- * (user could be looking for events other than messages)
- */
- is_match = 0;
- }
- else
- {
- lua_getfield(lua, 2, "Interface");
- is_match = lua_compare(lua, 3, 4, LUA_OPEQ);
- }
-
- if (is_match)
- {
- /* return the object matched */
- lua_getfield(lua, 2, "Object");
- return 1;
- }
-
- /* no match */
- return 0;
-}
-
-static int TestIntf_WaitAction(lua_State *lua)
-{
- int32_t Timeout = luaL_optinteger(lua, 2, -1);
- struct timespec expire;
- struct timespec current;
- int nret;
- uint32_t conditions_req;
- uint32_t conditions_met;
- enum
- {
- WAIT_STATE_NORMAL = 0,
- WAIT_STATE_SLEEP
- } waitstate;
-
- printf("%s(): Start\n", __func__);
- nret = 0;
- luaL_checktype(lua, 1, LUA_TTABLE);
- lua_settop(lua, 2);
- lua_getfield(lua, lua_upvalueindex(1), "API"); /* @3 (userdata object = low level intf) */
- waitstate = WAIT_STATE_NORMAL;
-
- clock_gettime(CLOCK_MONOTONIC, &expire);
- if (Timeout >= 0)
- {
- expire.tv_sec += Timeout / 1000;
- expire.tv_nsec += (Timeout % 1000) * 1000000;
- }
- if (expire.tv_nsec > 1000000000)
- {
- ++expire.tv_sec;
- expire.tv_nsec -= 1000000000;
- }
-
- while(1)
- {
- lua_settop(lua, 3);
-
- printf("%s(): Poll\n", __func__);
- lua_getfield(lua, 3, "Poll"); /* idx 4 = poll function */
- lua_pushvalue(lua, 3);
- lua_call(lua, 1, 3);
-
- /*
- * After call:
- * idx@4 = type of event ("Message", etc)
- * idx@5 = event data object
- * idx@6 = additional event attributes
- */
- printf("%s(): Stack= %s %s %s\n", __func__,
- lua_typename(lua, lua_type(lua, 4)),
- lua_typename(lua, lua_type(lua, 5)),
- lua_typename(lua, lua_type(lua, 6)));
- if (!lua_isnil(lua, 4))
- {
- /*
- * Preprocess returned data
- */
- if (!lua_isnil(lua, 5))
- {
- lua_getfield(lua, lua_upvalueindex(1), "RecvProcessor");/* idx@7 - preprocessor table */
- lua_pushvalue(lua, 4); /* idx@8 - event type */
- lua_gettable(lua, -2); /* idx@8 - preprocessor func */
- if (lua_isfunction(lua, -1))
- {
- lua_pushvalue(lua, 5); /* idx@9 - event data object */
- lua_call(lua, 1, 1); /* idx@8 - preprocessed event data obj */
- lua_replace(lua, 5); /* replace original event data obj */
- }
- lua_settop(lua, 6);
- }
-
- /*
- * check if the matches have been satisfied
- */
- conditions_req = 0;
- conditions_met = 0;
- lua_pushnil(lua); /* idx @7 - expected event table index */
- while(lua_next(lua, 1)) /* idx @8 - expected event table value */
- {
- ++conditions_req;
- if (lua_type(lua, 8) == LUA_TTABLE)
- {
- lua_getfield(lua, 8, "Matched"); /* idx @9 - already matched? */
- if (lua_toboolean(lua, -1))
- {
- ++conditions_met;
- }
- else
- {
- lua_getfield(lua, lua_upvalueindex(1), "RecvFilter"); /* idx@10 - filter table */
- lua_pushvalue(lua, 4); /* idx@11 - event type */
- lua_gettable(lua, -2); /* idx@11 - filter func */
- if (lua_isfunction(lua, -1))
- {
- lua_pushvalue(lua, 8); /* idx@12 - filter criteria table */
- lua_pushvalue(lua, 5); /* idx@13 - preprocessed event data */
- lua_call(lua, 2, 1); /* idx@11 - object (match) or nil (no match) */
- if (lua_toboolean(lua, -1))
- {
- /* if the user specified a callback,
- * call it now and use its return value.
- * It may return nil or false to drop/reject the event.
- */
- lua_getfield(lua, 8, "Callback");
- if (lua_isfunction(lua, -1))
- {
- lua_pushvalue(lua, -2);
- lua_call(lua, 1, 1);
- }
- else
- {
- lua_pop(lua, 1);
- }
-
- if (lua_toboolean(lua, -1))
- {
- lua_setfield(lua, 8, "Matched");
- lua_pushvalue(lua, 6);
- lua_setfield(lua, 8, "Attribs");
- ++conditions_met;
- }
- }
- }
- }
- }
- lua_settop(lua, 7); /* remove everything above event table index */
- }
-
- if (conditions_met >= conditions_req)
- {
- lua_pushboolean(lua, 1);
- nret = 1;
- break;
- }
-
- /* not all conditions met so poll again for more data */
- }
- else
- {
- /* Poll function returned nothing, so need to wait */
-
- /*
- * If a timeout was specified, check if we have exceeded the timeout yet.
- * If timeout was not passed yet then call a low level wait routine
- */
- if (Timeout >= 0)
- {
- clock_gettime(CLOCK_MONOTONIC, ¤t);
- current.tv_sec = expire.tv_sec - current.tv_sec;
- current.tv_nsec = expire.tv_nsec - current.tv_nsec;
- if (current.tv_nsec < 0)
- {
- --current.tv_sec;
- current.tv_nsec += 1000000000;
- }
-
- if (current.tv_sec < 0)
- {
- /* timeout occurred */
- break;
- }
-
- if (current.tv_sec == 0)
- {
- if (current.tv_nsec == 0)
- {
- /* timeout occurred */
- break;
- }
-
- if (current.tv_nsec < 1000000)
- {
- /* wait a minimum of 1ms -
- * this may exceed original timeout,
- * but that may be less bad than returning prior to the requested timeout.
- */
- current.tv_nsec = 1000000;
- }
- }
- }
- else
- {
- current.tv_sec = 1;
- current.tv_nsec = 0;
- }
-
- /*
- * If the low level interface has a wait routine, then use it.
- * The wait routine should exit and return true if there is any activity
- * that makes it worthwhile to re-poll.
- */
- lua_getfield(lua, 3, "Wait");
- if (!lua_isfunction(lua, -1))
- {
- waitstate = WAIT_STATE_SLEEP;
- lua_pop(lua, 1);
- }
- else
- {
- lua_pushvalue(lua, 3);
-
- /*
- * The wait task should return if any relevant activity occurs, so
- * it is OK to pass in a bigger timeout here. However to be friendly
- * to implementations that may have limitations on their timeouts, we
- * will not ask for anything more than 30 seconds in one shot.
- */
- if (current.tv_sec < 30)
- {
- lua_pushinteger(lua, (current.tv_sec * 1000) + (current.tv_nsec / 1000000));
- }
- else
- {
- lua_pushinteger(lua, 30000);
- }
-
- lua_call(lua, 2, 1);
- if (!lua_toboolean(lua, -1))
- {
- waitstate = WAIT_STATE_SLEEP;
- }
- lua_pop(lua, 1);
- }
-
- if (waitstate == WAIT_STATE_SLEEP)
- {
- /*
- * Fall back to using sleep-based polling
- * since this will not automatically wake up early, limit the
- * sleep time to ~250ms and re-poll.
- */
- if (current.tv_sec > 0 || current.tv_nsec > 250000000)
- {
- current.tv_sec = 0;
- current.tv_nsec = 250000000;
- }
- clock_nanosleep(CLOCK_MONOTONIC, 0, ¤t, NULL);
- waitstate = WAIT_STATE_NORMAL;
- }
- }
- }
-
- return nret;
-}
-
-static int TestIntf_DoAction(lua_State *lua)
-{
- /*
- * Expected inputs:
- * 1 => Generic User argument (object or interface)
- * 2 => Generic User attribute(s)
- *
- * Upvalue 1 => Low Level intf object (uservalue table from TestIntf object)
- * Upvalue 2 => Action name (string)
- */
- lua_settop(lua, 2);
-
- lua_getfield(lua, lua_upvalueindex(1), "API"); /* idx @3 - low level userdata object */
- lua_pushvalue(lua, lua_upvalueindex(2));
- lua_gettable(lua, -2); /* idx @4 - action function */
- if (!lua_isfunction(lua, -1))
- {
- return luaL_error(lua, "Action %s undefined", luaL_tolstring(lua, lua_upvalueindex(2), NULL));
- }
- lua_insert(lua, -2);
-
- /*
- * Stack at this point:
- * @3 => Action function
- * @4 => Low level intf object (API) - must be 1st parameter to action function
- */
-
- if (luaL_testudata(lua, 1, "EdsLib_Object") != NULL)
- {
- /* Desired action is to send the message to the target */
- lua_getglobal(lua, "EdsDB");
- lua_getfield(lua, -1, "Encode");
- lua_replace(lua, -2);
- lua_pushvalue(lua, 1);
- lua_call(lua, 1, 1);
-
- if (!lua_isstring(lua, -1))
- {
- return luaL_error(lua, "EdsDb Encode method did not return a string");
- }
- }
- else if (luaL_testudata(lua, 1, "CFE_MissionLib_Lua_Interface") != NULL)
- {
- lua_getfield(lua, 1, "MsgId");
- }
- else if (!lua_isnil(lua, 1))
- {
- lua_pushvalue(lua, 1);
- }
-
- /*
- * Argument 2 is an optional attribute argument
- * it is passed through unmodified if present.
- * this could be a table to specify several attributes if required
- */
- if (!lua_isnil(lua, 2))
- {
- lua_pushvalue(lua, 2);
- }
-
- /* Call the low level function */
- lua_call(lua, lua_gettop(lua) - 3, 2); /* idx @3,4 = return values */
-
- if (lua_type(lua, 3) == LUA_TTABLE)
- {
- lua_pushnil(lua);
- while(lua_next(lua, 3))
- {
- printf("%s(): %s = %s\n", __func__,
- luaL_tolstring(lua, 5, NULL),
- luaL_tolstring(lua, 6, NULL));
- lua_settop(lua, 5);
- }
- lua_pushvalue(lua, lua_upvalueindex(1));
- lua_pushcclosure(lua, TestIntf_WaitAction, 1);
- lua_insert(lua, 3);
- lua_call(lua, 2, 0);
- }
-
- return 0;
-}
-
-static int TestIntf_GetAction(lua_State *lua)
-{
- luaL_checkudata(lua, 1, "TestIntf");
- lua_settop(lua, 2);
-
- lua_getuservalue(lua, 1); /* @3 */
-
- if (lua_type(lua, 2) == LUA_TSTRING)
- {
- if (strcmp(lua_tostring(lua, 2), "Wait") == 0)
- {
- lua_pushcclosure(lua, TestIntf_WaitAction, 1);
- return 1;
- }
- }
-
- /* if above did not push a function then try to get it from the low level */
- lua_pushvalue(lua, 2);
- lua_pushcclosure(lua, TestIntf_DoAction, 2);
- return 1;
-}
-
-
-static int TestIntf_Destroy(lua_State *lua)
-{
- luaL_checkudata(lua, 1, "TestIntf");
- return 0;
-}
-
-static int TestIntf_Create(lua_State *lua)
-{
- TestIntf_t *Conn;
-
- lua_settop(lua, 3);
-
- Conn = lua_newuserdata(lua, sizeof(TestIntf_t)); /* Index 4 */
- if (luaL_newmetatable(lua, "TestIntf"))
- {
- lua_pushcfunction(lua, TestIntf_GetAction);
- lua_setfield(lua, -2, "__index");
-
- lua_pushcfunction(lua, TestIntf_Destroy);
- lua_setfield(lua, -2, "__gc");
- }
- lua_setmetatable(lua, -2);
-
- if (lua_isstring(lua, 2))
- {
- Conn->TargetNum = CFE_MissionLib_GetInstanceNumber(&CFE_SOFTWAREBUS_INTERFACE, lua_tostring(lua, 2));
- }
- else if (lua_isnumber(lua, 2))
- {
- Conn->TargetNum = lua_tointeger(lua, 2);
- }
- else
- {
- Conn->TargetNum = 1;
- }
-
- luaL_argcheck(lua, Conn->TargetNum != 0, 2, "Invalid target specified");
-
- /* create a table for use as the userdata */
- lua_newtable(lua); /* index 5 */
-
- lua_pushvalue(lua, 1);
- lua_gettable(lua, lua_upvalueindex(1));
- if (!lua_isfunction(lua, -1))
- {
- return luaL_argerror(lua, 1, "Unknown connection type");
- }
-
- lua_pushinteger(lua, Conn->TargetNum);
- lua_pushvalue(lua, 3);
- lua_call(lua, 2, 1);
- lua_setfield(lua, 5, "API");
- lua_newtable(lua);
- lua_setfield(lua, 5, "RecvEvents");
- lua_newtable(lua);
- lua_pushcfunction(lua, TestIntf_Preprocess_Message);
- lua_setfield(lua, -2, "Message");
- lua_setfield(lua, 5, "RecvProcessor");
- lua_newtable(lua);
- lua_pushcfunction(lua, TestIntf_Filter_Message);
- lua_setfield(lua, -2, "Message");
- lua_setfield(lua, 5, "RecvFilter");
- lua_setuservalue(lua, 4);
-
- return 1;
-} /* end TestIntf_Udp_Create */
-
-int TestIntf_GetFactory(lua_State *lua)
-{
- const TestExec_Intf_ModuleEntry_t *ModEnt = TESTEXEC_INTF_TABLE;
-
- lua_newtable(lua);
-
- while (ModEnt != NULL &&
- ModEnt->InitFunc != NULL &&
- ModEnt->LuaName != NULL)
- {
- lua_pushcfunction(lua, ModEnt->InitFunc);
- lua_setfield(lua, -2, ModEnt->LuaName);
- ++ModEnt;
- }
-
- lua_pushcclosure(lua, TestIntf_Create, 1);
- return 1;
-}
diff --git a/cfecfs/testexecutive/src/testctrl.c b/cfecfs/testexecutive/src/testctrl.c
deleted file mode 100644
index 34f34bb..0000000
--- a/cfecfs/testexecutive/src/testctrl.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
- *
- * Copyright (c) 2020 United States Government as represented by
- * the Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * \file testctrl.c
- * \ingroup testexecutive
- * \author joseph.p.hickey@nasa.gov
- *
- * Implementation of test cpu controller
- */
-
-#include
-#include /* memset() */
-#include
-#include
-
-#include "osapi.h"
-
-#include "cfe_mission_eds_parameters.h"
-#include "cfe_mission_eds_interface_parameters.h"
-#include "edslib_displaydb.h"
-#include "cfe_missionlib_runtime.h"
-#include "cfe_missionlib_api.h"
-#include "cfe_missionlib_lua_softwarebus.h"
-#include "ccsds_spacepacket_eds_datatypes.h"
-
-
-/*
-** volume table.
-*/
-OS_VolumeInfo_t OS_VolumeTable [OS_MAX_FILE_SYSTEMS] =
-{
- /*
- ** The following entry is a "pre-mounted" path to a non-volatile device
- ** This is intended to contain the functional test scripts
- */
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 }
-};
-
-uint32_t TargetArgCount;
-char **TargetArgs;
-
-#ifdef JPHFIX_SERVER
-void TestCtrl_ConnHandler(void)
-{
- uint32 SocketID;
- int32 Status;
- OS_SockAddr_t SocketAddress;
- char DataBuf[128];
-
- Status = OS_SocketOpen(&SocketID, OS_SocketDomain_INET, OS_SocketType_STREAM);
- if (Status != OS_SUCCESS)
- {
- fprintf(stderr,"OS_SocketOpen() failed: %d\n", (int)Status);
- return;
- }
-
- OS_SocketAddrInit(&SocketAddress, OS_SocketDomain_INET);
- OS_SocketAddrSetPort(&SocketAddress, 2345);
-
-
- uint32 ConnID;
- OS_SockAddr_t ConnAddress;
-
- Status = OS_SocketBind(SocketID, &SocketAddress);
- if (Status != OS_SUCCESS)
- {
- fprintf(stderr,"OS_SocketBind() failed: %d\n", (int)Status);
- return;
- }
-
- while(1)
- {
- Status = OS_SocketAccept(SocketID, &ConnID, &ConnAddress, OS_PEND);
- if (Status != OS_SUCCESS)
- {
- fprintf(stderr,"OS_SocketAccept() failed: %d\n", (int)Status);
- break;
- }
-
- while (1)
- {
- Status = OS_StreamRead(ConnID, DataBuf, sizeof(DataBuf)-1, OS_PEND);
- if (Status < OS_SUCCESS)
- {
- fprintf(stderr,"OS_StreamRead() failed: %d\n", (int)Status);
- break;
- }
-
- if (Status == 0)
- {
- printf("OS_StreamRead(): disconnect\n");
- break;
- }
-
- DataBuf[Status] = 0;
- printf("OS_StreamRead(): %s\n", DataBuf);
- }
-
- OS_SocketClose(ConnID);
- }
-
- OS_SocketClose(SocketID);
-
-}
-#endif
-
-#define COMMAND_MAX_ARGS 8
-#define NETBUFFER_MAX_SIZE (64 + ((sizeof(CCSDS_SpacePacket_Buffer_t) * 4) / 3))
-#define OBJBUFFER_MAX_SIZE (64 + sizeof(CCSDS_SpacePacket_Buffer_t))
-
-struct
-{
- char *ArgPtr[COMMAND_MAX_ARGS];
- char NetBuffer[NETBUFFER_MAX_SIZE];
- uint8_t ObjBuffer[OBJBUFFER_MAX_SIZE];
- uint32 ArgCount;
- uint32 NetDataLen;
- uint32 ObjBitSize;
-} TestCtrl;
-
-void TestCtrl_TokenizeCommand(char *CommandData)
-{
- char *Ptr = CommandData;
-
- TestCtrl.ArgCount = 0;
-
- /* skip flag char and all leading whitespace */
- do
- {
- ++Ptr;
- }
- while(isspace((int)*Ptr));
-
- while(TestCtrl.ArgCount < COMMAND_MAX_ARGS && *Ptr != 0)
- {
- TestCtrl.ArgPtr[TestCtrl.ArgCount] = Ptr;
- ++TestCtrl.ArgCount;
-
- while(*Ptr != 0 && !isspace((int)*Ptr))
- {
- ++Ptr;
- }
-
- if (*Ptr == 0)
- {
- break;
- }
-
- *Ptr = 0;
- do
- {
- ++Ptr;
- }
- while(isspace((int)*Ptr));
- }
-}
-
-void TestCtrl_ProcessDataBlock(void)
-{
- char *EndPtr;
- uint32_t BitSize;
-
- if (TestCtrl.NetDataLen < sizeof(TestCtrl.NetBuffer))
- {
- TestCtrl.NetBuffer[TestCtrl.NetDataLen] = 0;
- }
- else
- {
- TestCtrl.NetBuffer[sizeof(TestCtrl.NetBuffer) - 1] = 0;
- }
-
- if (TestCtrl.ArgCount > 1)
- {
- BitSize = strtoul(TestCtrl.ArgPtr[1], &EndPtr, 0);
- if (*EndPtr != 0)
- {
- BitSize = 0;
- }
- }
- else
- {
- BitSize = 0;
- }
-
- if (BitSize > (8 * sizeof(TestCtrl.ObjBuffer)))
- {
- BitSize = (8 * sizeof(TestCtrl.ObjBuffer));
- }
-
- EdsLib_DisplayDB_Base64Decode(TestCtrl.ObjBuffer, BitSize, TestCtrl.NetBuffer);
- TestCtrl.ObjBitSize = BitSize;
-
- EdsLib_Generate_Hexdump(stderr, TestCtrl.ObjBuffer, 0, (BitSize + 7) / 8);
-}
-
-void TestCtrl_RunCommandLoop(void)
-{
- char NetworkBuffer[256];
- uint32 ContentLen;
-
- while (fgets(NetworkBuffer, sizeof(NetworkBuffer), stdin) != NULL)
- {
- /*
- * All directives should begin with a consistent character for easy identification.
- * This character should _NOT_ be part of the standard base64 charset, since base64
- * may be used to transfer binary objects across the pipe. Using a non-base64 char
- * as a flag ensures that it is not possible to confuse directives with data.
- *
- * (This means A-Z, a-z, 0-9 and symbols '+', '/', and '=' should be avoided. Other
- * chars are fair game)
- */
- if (NetworkBuffer[0] == '@')
- {
- /* it is a directive */
- TestCtrl_TokenizeCommand(NetworkBuffer);
-
- if (TestCtrl.ArgCount > 0)
- {
- if (strcmp(TestCtrl.ArgPtr[0], "BLOCK") == 0)
- {
- TestCtrl_ProcessDataBlock();
- TestCtrl.NetDataLen = 0;
- }
- else
- {
- /* Call user command handler */
- }
- }
- }
- else if (TestCtrl.NetDataLen < sizeof(TestCtrl.NetBuffer))
- {
- ContentLen = strlen(NetworkBuffer);
- if ((TestCtrl.NetDataLen + ContentLen) > sizeof(TestCtrl.NetBuffer))
- {
- ContentLen = sizeof(TestCtrl.NetBuffer) - TestCtrl.NetDataLen;
- }
- memcpy(&TestCtrl.NetBuffer[TestCtrl.NetDataLen], NetworkBuffer, ContentLen);
- TestCtrl.NetDataLen += ContentLen;
- }
- }
-}
-
-int main(int argc, char *argv[])
-{
- int opt;
-
- /* Initialize the OSAL */
- if (OS_API_Init() != OS_SUCCESS)
- {
- fprintf(stderr,"OS_API_Init() failed");
- return EXIT_FAILURE;
- }
-
- while ((opt = getopt(argc, argv, "c:i:")) >= 0)
- {
- switch (opt)
- {
- case 'c':
- {
- CFE_MissionLib_GetInstanceNumber(&CFE_SOFTWAREBUS_INTERFACE, optarg);
- break;
- }
- case 'i':
- {
- break;
- }
- case 'l':
- {
- break;
- }
- default: /* '?' */
- {
- fprintf(stderr, "Usage: %s [-c cpu_name]\n", argv[0]);
- exit(EXIT_FAILURE);
- }
- }
- }
-
- if (optind < argc)
- {
- TargetArgCount = argc - optind;
- TargetArgs = &argv[optind];
- }
-
- TestCtrl_RunCommandLoop();
-
- return EXIT_SUCCESS;
-}
diff --git a/cfecfs/testexecutive/src/testexec.c b/cfecfs/testexecutive/src/testexec.c
deleted file mode 100644
index 57196c7..0000000
--- a/cfecfs/testexecutive/src/testexec.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * LEW-19710-1, CCSDS SOIS Electronic Data Sheet Implementation
- *
- * Copyright (c) 2020 United States Government as represented by
- * the Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * \file testexec.c
- * \ingroup testexecutive
- * \author joseph.p.hickey@nasa.gov
- *
- * Implementation of test executive
- */
-
-#include
-#include /* memset() */
-
-#include
-#include
-#include
-
-#include "osapi.h"
-#include "utbsp.h"
-#include "uttest.h"
-#include "utassert.h"
-
-#include "cfe_mission_eds_parameters.h"
-#include "cfe_mission_eds_interface_parameters.h"
-#include "edslib_displaydb.h"
-#include "cfe_missionlib_runtime.h"
-#include "cfe_missionlib_api.h"
-#include "edslib_lua_objects.h"
-#include "cfe_missionlib_lua_softwarebus.h"
-
-#include "testexec.h"
-
-static lua_State *BaseState;
-static int BaseStackTop;
-
-typedef struct
-{
- int32 FileId;
- char DataBuffer[252];
-} TestExec_OsalLoadState_t;
-
-
-/*
-** volume table.
-*/
-OS_VolumeInfo_t OS_VolumeTable [OS_MAX_FILE_SYSTEMS] =
-{
- /*
- ** The following entry is a "pre-mounted" path to a non-volatile device
- ** This is intended to contain the functional test scripts
- */
- { "ftest", "./ftest", FS_BASED, FALSE, FALSE, TRUE, "FT", "/ftest", 512 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 },
- { "unused", "unused", FS_BASED, TRUE, TRUE, FALSE, " ", " ", 0 }
-};
-
-
-static const char *TestExec_Lua_FileReader(lua_State *lua, void *data, size_t *size)
-{
- TestExec_OsalLoadState_t *LoadState = data;
- int32 Status;
-
- Status = OS_read(LoadState->FileId, LoadState->DataBuffer, sizeof (LoadState->DataBuffer));
- if (Status < 0)
- {
- *size = 0;
- return NULL;
- }
-
- *size = Status;
- return LoadState->DataBuffer;
-}
-
-static int TestExec_Lua_DoAssert(lua_State *lua)
-{
- /* stack:
- * @1 = condition (boolean)
- * @2 = message (string)
- */
- lua_Debug ar;
- const char *filename;
-
- if (lua_getstack(lua, 1, &ar))
- {
- lua_getinfo(lua, "Sl", &ar);
- }
- else
- {
- memset(&ar, 0, sizeof(ar));
- }
-
- if (ar.source != NULL && *ar.source == '@')
- {
- filename = ar.source + 1;
- }
- else
- {
- filename = NULL;
- ar.currentline = -1;
- }
-
- UtAssertEx(lua_toboolean(lua, 1), UtAssert_GetContext(),
- filename, ar.currentline, "%s", luaL_tolstring(lua, 2, NULL));
-
- return 0;
-}
-
-static int TestExec_Lua_ErrorHandler(lua_State *lua)
-{
- /* Start stack: 1 = user string */
- lua_Debug ar;
- const char *file;
- uint32 line;
-
- file = NULL;
- line = 0;
- if (lua_getstack(lua, 1, &ar) && lua_getinfo(lua, "Sl", &ar))
- {
- file = ar.source;
- if (file != NULL && *file == '@')
- {
- ++file;
- }
- line = ar.currentline;
- }
-
- UtAssertEx(FALSE, UTASSERT_CASETYPE_FAILURE, file, line, "%s", lua_tostring(lua, 1));
-
- lua_getglobal(lua, "debug");
- lua_getfield(lua, -1, "traceback");
- lua_pushnil(lua);
- lua_pushinteger(lua, 3);
- lua_call(lua, 2, 1);
- UT_BSP_DoText(UTASSERT_CASETYPE_DEBUG, lua_tostring(lua, -1));
- return 0;
-}
-
-
-static void TestExec_LoadScript (void)
-{
- const char *SegmentName = UtAssert_GetSegmentName();
- TestExec_OsalLoadState_t LoadState;
- int32 Status;
-
- Status = OS_open(SegmentName, OS_READ_ONLY, 0);
- if (Status < 0)
- {
- os_err_name_t ErrName;
- OS_GetErrorName(Status, &ErrName);
- lua_pushfstring(BaseState, "OS_open(%s): %s", SegmentName, ErrName);
- }
- else
- {
- LoadState.FileId = Status;
- lua_load(BaseState, TestExec_Lua_FileReader, &LoadState, SegmentName, NULL);
- OS_close(LoadState.FileId);
- }
-
- if (lua_type(BaseState, -1) == LUA_TSTRING)
- {
- UtAssert_Failed("%s", lua_tostring(BaseState, -1));
- }
- else
- {
- UtAssert_True(lua_isfunction(BaseState, -1), "Load test script: %s", SegmentName);
- }
-
-}
-
-static void TestExec_RunScript (void)
-{
- if (lua_type(BaseState, -1) == LUA_TFUNCTION)
- {
- lua_pcall(BaseState, 0, 0, BaseStackTop);
- }
-}
-
-static void TestExec_ResetStack (void)
-{
- lua_settop(BaseState, BaseStackTop);
-}
-
-void OS_Application_Shutdown(void)
-{
- lua_close(BaseState);
-}
-
-void OS_Application_Startup(void)
-{
- int32 i;
- const char *OptString;
-
- if (OS_API_Init() != OS_SUCCESS)
- {
- UtAssert_Abort("OS_API_Init() failed");
- }
-
- atexit(OS_Application_Shutdown);
-
- /*
- * Create a new Lua state and load the standard libraries
- */
- BaseState = luaL_newstate();
- luaL_openlibs(BaseState);
-
- EdsLib_Lua_Attach(BaseState, &EDS_DATABASE);
- CFE_MissionLib_Lua_SoftwareBus_Attach(BaseState, &CFE_SOFTWAREBUS_INTERFACE);
- lua_setglobal(BaseState, "EdsDB");
-
- lua_pushcfunction(BaseState, TestIntf_GetFactory);
- lua_call(BaseState, 0, 1);
- lua_setglobal(BaseState, "NewConnection");
-
- lua_pushinteger(BaseState, UTASSERT_CASETYPE_FAILURE);
- lua_pushcclosure(BaseState, TestExec_Lua_DoAssert, 1);
- lua_setglobal(BaseState, "Assert");
-
- lua_pushcfunction(BaseState, TestExec_Lua_ErrorHandler);
- BaseStackTop = lua_gettop(BaseState);
-
- for (i=0; i < UT_BSP_GetTotalOptions(); ++i)
- {
- OptString = UT_BSP_GetOptionString(i);
- if (OptString != NULL)
- {
-
- /* Check if the option has an assignment operator.
- * If so, pass it directly to Lua for interpretation
- * (it can e.g. set a global)
- */
- if (strchr(OptString, '=') != NULL)
- {
- luaL_loadstring(BaseState, OptString);
- lua_pcall(BaseState, 0, 0, 1);
- }
- else
- {
- UtTest_Add(TestExec_RunScript, TestExec_LoadScript, TestExec_ResetStack, OptString);
- }
- }
-
- }
-
-#ifdef JPHFIX_CLIENT
- OS_SocketAddrFromString(&SocketAddress, "127.0.0.1");
- Status = OS_SocketConnect(SocketID, &SocketAddress, OS_PEND);
- if (Status != OS_SUCCESS)
- {
- fprintf(stderr,"OS_SocketConnect() failed: %d\n", (int)Status);
- return;
- }
-
- while (1)
- {
- Status = OS_StreamRead(SocketID, DataBuf, sizeof(DataBuf)-1, OS_PEND);
- if (Status < OS_SUCCESS)
- {
- fprintf(stderr,"OS_StreamRead() failed: %d\n", (int)Status);
- break;
- }
-
- if (Status == 0)
- {
- printf("OS_StreamRead(): disconnect\n");
- break;
- }
-
- DataBuf[Status] = 0;
- printf("OS_StreamRead(): %s\n", DataBuf);
- }
-#endif
-
-
-} /* end OS_Application Startup */
-
diff --git a/cfecfs/testrunner/.gitignore b/cfecfs/testrunner/.gitignore
new file mode 100644
index 0000000..bee8a64
--- /dev/null
+++ b/cfecfs/testrunner/.gitignore
@@ -0,0 +1 @@
+__pycache__
diff --git a/cfecfs/testrunner/CMakeLists.txt b/cfecfs/testrunner/CMakeLists.txt
new file mode 100644
index 0000000..fd5755a
--- /dev/null
+++ b/cfecfs/testrunner/CMakeLists.txt
@@ -0,0 +1,29 @@
+##################################################################
+#
+# TESTRUNNER CMake build
+#
+# This does not build any code - it only installs the TESTRUNNER scripts
+# into the CFS staging directory
+#
+##################################################################
+
+cmake_minimum_required(VERSION 3.10)
+project(EDS_CFS_TESTRUNNER NONE)
+
+set(TESTRUNNER_INSTALL_SYMLINK $ENV{TESTRUNNER_DEBUG}
+ CACHE BOOL "Whether to install library as a symlink for debugging")
+
+# In normal (non-debug) deployment, install the library to the python staging dir
+# The debug mode will be handled by the installation script below
+if (NOT TESTRUNNER_INSTALL_SYMLINK)
+ install(DIRECTORY src/ DESTINATION lib/python/testrunner
+ PATTERN __pycache__ EXCLUDE
+ PATTERN *.py
+ )
+endif ()
+
+install(FILES common/cfs_test_connection.py DESTINATION lib/python)
+install(PROGRAMS examples/runtest.py DESTINATION host)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/stage_app_tests.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/stage_app_tests.cmake @ONLY)
+install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/stage_app_tests.cmake)
diff --git a/cfecfs/testrunner/Makefile b/cfecfs/testrunner/Makefile
new file mode 100644
index 0000000..bd70530
--- /dev/null
+++ b/cfecfs/testrunner/Makefile
@@ -0,0 +1,17 @@
+ifeq ($(O),)
+$(error $$(O) must point to build dir)
+endif
+
+export O
+
+.PHONY: refresh_tests run_test
+
+run_test: export PYTHONPATH=$(CURDIR):$(O)/exe/lib/python
+run_test: export LD_LIBRARY_PATH=$(O)/exe/lib
+
+refresh_tests:
+ mkdir -p $(O)/exe/lib/python/cfs_app_tests
+ make -C $(O)/exe/lib/python/cfs_app_tests -f $(CURDIR)/cfs_app_test_groups.mk __init__.py
+
+run_test: refresh_tests
+ python3 ${SCRIPT}
diff --git a/cfecfs/testrunner/cfs_app_test_groups.mk b/cfecfs/testrunner/cfs_app_test_groups.mk
new file mode 100644
index 0000000..6c3ef9c
--- /dev/null
+++ b/cfecfs/testrunner/cfs_app_test_groups.mk
@@ -0,0 +1,14 @@
+
+# If debug mode is set, then create symlinks instead of copies
+ifneq ($(TESTRUNNER_INSTALL_SYMLINK),)
+%.py:
+ ln -s $(^) $(@)
+else
+%.py:
+ cp $(^) $(@)
+endif
+
+include $(O)/cfs_app_tests.mk
+
+__init__.py: $(ALL_CFS_APP_TESTS)
+ echo "__all__ = [ $(foreach T,$(notdir $(basename $(^))),'$(T)',) ]" > __init__.py
diff --git a/cfecfs/testrunner/common/cfs_test_connection.py b/cfecfs/testrunner/common/cfs_test_connection.py
new file mode 100644
index 0000000..f966dd5
--- /dev/null
+++ b/cfecfs/testrunner/common/cfs_test_connection.py
@@ -0,0 +1,68 @@
+
+from abc import ABC,abstractmethod
+
+class CfsTest_Connection(ABC):
+
+ @abstractmethod
+ def wait_check_packet(self, tlm_id, num_pkt, timeout):
+ print (f"In wait_check_packet({tlm_id}, {timeout})")
+ return
+
+ @abstractmethod
+ def tlm(self, tlm_id, param_id):
+ print (f"In tlm({tlm_id})")
+ return 1
+
+ @abstractmethod
+ def cmd(self, cmd_id):
+ print (f"In cmd({cmd_id})")
+ return 1
+
+ @abstractmethod
+ def wait_check(self, tlm_id, param_id, value, timeout):
+ print (f"In wait_check({tlm_id}, {param_id}, {timeout})")
+ return False
+
+ @abstractmethod
+ def spawn_child(self, app_name:str):
+ pass
+
+ @abstractmethod
+ def wait(timeout):
+ pass
+
+ def print(self, msg : str):
+ print(msg)
+ return
+
+ def get_app_name(self):
+ return self.app_name
+
+ def get_instance_name(self):
+ return self.instance_name
+
+ def __init__(self, method_type, **kwargs):
+ self.method_obj = None
+ self.app_name = None
+ self.instance_name = None
+ self.remote_addr = None
+
+ if method_type is not None:
+ self.method_obj = method_type(self)
+
+ if 'app_name' in kwargs:
+ self.app_name = kwargs['app_name']
+ elif 'DEFAULT_APP_NAME' in method_type.__dict__:
+ self.app_name = method_type.__dict__['DEFAULT_APP_NAME']
+
+ if 'instance_name' in kwargs:
+ self.instance_name = kwargs['instance_name']
+
+ if 'remote_addr' in kwargs:
+ self.remote_addr = kwargs['remote_addr']
+ else:
+ self.remote_addr = ('127.0.0.1',1234)
+
+ print(f"Instantiated CfsTest_Connection with app_name={self.app_name} instance_name={self.instance_name} remote_addr={self.remote_addr}")
+
+ return
diff --git a/cfecfs/testrunner/examples/runtest.py b/cfecfs/testrunner/examples/runtest.py
new file mode 100644
index 0000000..610ae6c
--- /dev/null
+++ b/cfecfs/testrunner/examples/runtest.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python3
+
+import importlib
+import sys
+import argparse
+
+from testrunner.test_group import TestGroup
+
+parser = argparse.ArgumentParser(prog='runtest',
+ description = "Executes test script")
+
+parser.add_argument("-i", "--instance-name", default='cpu1', help="Instance name")
+parser.add_argument("-m", "--mission-name", default='samplemission', help="Mission name")
+parser.add_argument("-l", "--local-addr", default='127.0.0.1:2234', help="Local IP address:port to listen on")
+parser.add_argument("-r", "--remote-addr", default='127.0.0.1:1234', help="Remote IP address:port to send commands to")
+parser.add_argument("app_name", help="The name of the application")
+parser.add_argument("tests", help="Test names to execute", nargs='*')
+
+# 3. Parse arguments
+args = parser.parse_args()
+
+def load_test_group(app_name : str, instance_name : str, mission_name : str, local_addr : tuple, remote_addr : tuple):
+ module_name = f"{app_name}_test_methods"
+ tmod = importlib.import_module(f"cfs_app_tests.{module_name}")
+ tobj = None
+
+ # Look for a class in the module with a matching name
+ tc = tmod.__dict__[module_name]
+
+ print(f"Instantiating: {tc} targeted at {instance_name}")
+ return TestGroup(tc, instance_name=instance_name, mission_name = mission_name, local_addr = local_addr, remote_addr = remote_addr)
+
+def addr_as_tuple(addr_str : str, default_ip : str, default_port : int):
+ (host,port) = addr_str.split(':', 2)
+ if port is None:
+ port = default_port
+ if host is None:
+ host = default_ip
+ return (host, int(port))
+
+local_addr = addr_as_tuple(args.local_addr, '127.0.0.1', 2234)
+remote_addr = addr_as_tuple(args.remote_addr, '127.0.0.1', 1234)
+
+print (f"Starting runtest script, local={local_addr} remote={remote_addr}")
+
+test_group = load_test_group(app_name = args.app_name, instance_name = args.instance_name,
+ mission_name = args.mission_name, local_addr = local_addr, remote_addr = remote_addr)
+
+test_group.enable_output()
+if len(args.tests) == 0:
+ print ("No test specified, will execute all")
+ test_group.execute_all()
+else:
+ for test in args.tests:
+ test_group.execute(test)
diff --git a/cfecfs/testrunner/src/__init__.py b/cfecfs/testrunner/src/__init__.py
new file mode 100644
index 0000000..c4d8e51
--- /dev/null
+++ b/cfecfs/testrunner/src/__init__.py
@@ -0,0 +1,12 @@
+"""
+TESTRUNNER: Automated System Testing for Robust Operations
+
+A functional test framework for verifying cFS-based flight systems using
+Electronic Data Sheets (EDS) for command and telemetry definitions.
+"""
+
+from testrunner.testrunner_sync import TestrunnerSync
+from testrunner.testrunner_adapter import TestrunnerAdapter
+from cfs_test_connection import CfsTest_Connection
+
+__all__ = ['TestrunnerSync', 'CfsTest_Connection', "TestrunnerAdapter"]
diff --git a/cfecfs/testrunner/src/core/controller_sync.py b/cfecfs/testrunner/src/core/controller_sync.py
new file mode 100644
index 0000000..f835dd6
--- /dev/null
+++ b/cfecfs/testrunner/src/core/controller_sync.py
@@ -0,0 +1,189 @@
+'''
+Copyright (c) 2025 United States Government as represented by
+the Administrator of the National Aeronautics and Space Administration.
+All Rights Reserved.
+'''
+
+import EdsLib
+import CFE_MissionLib
+
+class ControllerSync:
+ '''
+ The Controller class contains routines that interact with the EDS and MissionLib databases
+ - Update Instance, Topic, and Subcommand dictionaries/lists
+ - Generate, set, pack, and send telecommand messages
+ '''
+ def __init__(self, mission_name:str='samplemission'):
+ self.initialized = False
+
+ # If the mission name is invlaid a RuntimeError will occur here
+ self.eds_db = EdsLib.Database(mission_name)
+
+ # Set the mission name and the rest of the CFE_MissionLib objects
+ self.mission_name = mission_name
+ self.intf_db = CFE_MissionLib.Database(self.mission_name, self.eds_db)
+ self.telecommand = self.intf_db.Interface('CFE_SB/Telecommand')
+ self.telemetry = self.intf_db.Interface('CFE_SB/Telemetry')
+
+ self.tlm_dict = None
+ self.cmd_dict = None
+ self.all_topics = None
+
+ self.last_sequence = dict()
+
+ def get_telecommand_topics(self):
+ '''
+ Returns a dictionary of Telecommand topics
+ '''
+ print ("Inside get_telecommand_topics")
+ if self.cmd_dict is None:
+ self.cmd_dict = dict() # Initialize topic_list_dict
+
+ for topic in self.telecommand:
+ self.cmd_dict[topic[0]] = self.telecommand.Topic(topic[0])
+
+
+ return self.cmd_dict
+
+
+ def get_telemetry_topics(self):
+ '''
+ Returns a dictionary of Telemetry topics
+ '''
+ print ("Inside get_telemetry_topics")
+ if self.tlm_dict is None:
+ self.tlm_dict = dict() # Initialize topic_list_dict
+
+ for topic in self.telemetry:
+ self.tlm_dict[topic[0]] = self.telemetry.Topic(topic[0])
+
+ return self.tlm_dict
+
+ def get_all_topics(self):
+ if self.all_topics is None:
+ self.all_topics = {**self.get_telecommand_topics(), **self.get_telemetry_topics()} # merge dictionaries
+
+ return self.all_topics
+
+ def get_subcommands(self, topic_name:str):
+ '''
+ Returns a dictionary of Subcommands based on a given telecommand topic
+
+ Inputs:
+ topic_name - User specified telecommand topic name
+ '''
+ subcommand_list_dict = dict() # Initialize subcommand_list_dict
+ try:
+ topic = self.telecommand.Topic(topic_name)
+ for subcommand in topic:
+ subcommand_list_dict[subcommand[0]] = subcommand[1]
+ except RuntimeError:
+ pass
+ return subcommand_list_dict
+
+ def lookup_topic_name(self, topic_name:str):
+ topic_obj = None
+ all_topics = self.get_all_topics()
+
+ if topic_name in all_topics:
+ topic_obj = all_topics[topic_name]
+
+ return topic_obj
+
+ def get_eds_id_from_topic(self, topic_name:str):
+ '''
+ Returns the EdsId associated with a given topic name
+
+ Inputs:
+ topic_name - Telecommand topic name
+ '''
+ result = self.lookup_topic_name(topic_name)
+ if result:
+ result = result.EdsId
+ return result
+
+ def get_msg_id_from_topic(self, topic_name:str, instance_id=1):
+ '''
+ Returns the MsgId associated with a given topic name
+
+ Inputs:
+ topic_name - Telecommand topic name
+ '''
+ result = None
+ topic_obj = self.lookup_topic_name(topic_name)
+ if topic_obj:
+ result = self.intf_db.GetMsgId(instance_id, topic_obj)
+ return result
+
+ def identify_datagram(self, datagram:bytes):
+ topic_name = None
+ eds_id, topic_id = self.intf_db.DecodeEdsId(datagram)
+ msg_datatype = self.eds_db.Entry(eds_id)
+
+ # most items expected to be telemetry so try that first
+ topic_obj = self.telemetry.Topic(topic_id)
+ if not topic_obj:
+ # must be a command
+ topic_obj = self.telecommand.Topic(topic_id)
+
+ # get the name associated with this topic
+ if topic_obj:
+ topic_name = topic_obj.Name
+
+ # instantiating an object of the decoded type performs decoding
+ decoded_obj = msg_datatype(EdsLib.PackedObject(datagram))
+ return decoded_obj, topic_name
+
+ def get_sequence(self, topic_name:str, decoded_data) -> int:
+ # note that these sequence numbers are mod 2^14, they wrap from 2^14-1 to 0
+ this_seq = decoded_data['CCSDS']['Sequence'] # this gives back an edslib ref
+ this_seq = this_seq() & 0x3FFF # "calling" the ref converts to plain int
+ if topic_name in self.last_sequence:
+ seq_diff = this_seq - (self.last_sequence[topic_name] & 0x3FFF)
+ if seq_diff < 0:
+ seq_diff += 0x4000
+ this_seq += seq_diff
+ self.last_sequence[topic_name] = this_seq
+ return this_seq
+
+ def generate_message(self, topic_name:str, cmd_name:str=None) -> EdsLib.DatabaseEntry:
+ topic_obj = self.get_all_topics()[topic_name]
+ eds_id = topic_obj.EdsId
+ if cmd_name:
+ for sc_name,sc_id in topic_obj:
+ if sc_name == cmd_name:
+ eds_id = sc_id
+ break
+
+ msg_datatype = self.eds_db.Entry(eds_id)
+
+ # this instantiates the message with default content
+ return msg_datatype()
+
+ def setup_header(self, msg_obj:EdsLib.DatabaseEntry, instance_name:str, topic_name:str) -> EdsLib.DatabaseEntry:
+ '''
+ Sets the Publish/Subscribe parameters in a command header based on the instance_id
+ and topic_id. We call the function SetPubSub defined in the CFE_Missionlib
+ python bindings that set the header values of the cmd message based on the
+ CFE_MissionLib runtime library.
+
+ Inputs:
+ instance_id - The ID associated with the desitination core flight instance
+ topic_id - The ID associated with the desired telecommand topic
+ '''
+ topic_obj = self.get_all_topics()[topic_name]
+
+ this_seq = 1
+ if topic_name in self.last_sequence:
+ this_seq += self.last_sequence[topic_name]
+
+ self.last_sequence[topic_name] = this_seq
+
+ # this sets the correct msg id
+ self.intf_db.SetPubSub(instance_name, topic_obj.TopicId, msg_obj)
+ msg_obj['CCSDS']['Sequence'] = this_seq & 0x3FFF
+ msg_obj['CCSDS']['SeqFlag'] = 3 # SeqFlag is hardcoded for now, cfs does not fragment commands
+ return self
+
+ def encode_datagram(self, msg_data) -> bytes:
+ return EdsLib.PackedObject(msg_data)
diff --git a/cfecfs/testrunner/src/core/data_model_sync.py b/cfecfs/testrunner/src/core/data_model_sync.py
new file mode 100644
index 0000000..5fcc191
--- /dev/null
+++ b/cfecfs/testrunner/src/core/data_model_sync.py
@@ -0,0 +1,116 @@
+'''
+Copyright (c) 2025 United States Government as represented by
+the Administrator of the National Aeronautics and Space Administration.
+All Rights Reserved.
+'''
+
+from testrunner.core.timestamp import Timestamp
+
+class DataModelSync:
+
+ class HistoryEntry:
+ next_seq = 0
+
+ @classmethod
+ def next_global_seq(self):
+ self.next_seq = self.next_seq + 1
+ return self.next_seq
+
+ def get_raw_data(self) -> bytes:
+ return self.raw_data
+
+ def get_msg_seq(self) -> int:
+ return self.msg_seq
+
+ def get_msg_data(self):
+ return self.msg_data
+
+ def __init__(self, remote_host:str, msg_seq:int, raw_data:bytes, msg_data):
+ self.remote_host = remote_host
+ self.raw_data = raw_data
+ self.msg_seq = msg_seq
+ self.msg_data = msg_data
+ self.when = Timestamp()
+ self.global_seq = DataModelSync.HistoryEntry.next_global_seq()
+
+ '''
+ The DataModel class contains structures related to the data saved in the cFS-Groundstation
+ - Stores dictionaries of Instances, Topics, Subcommands, and Telemetry Types
+ - Stores an array of raw messages based on Telmetry Type
+ '''
+ def __init__(self, mission:str):
+ self.mission = mission
+ self.history_by_topic = dict()
+ self.history_len = 100
+
+ def get_topic(self, topic_name:str) -> list | None:
+ topic_list = None
+ if topic_name in self.history_by_topic:
+ topic_list = self.history_by_topic[topic_name]
+ return topic_list
+
+ def get_or_add_topic(self, topic_name:str) -> list:
+ if topic_name not in self.history_by_topic:
+ self.history_by_topic[topic_name] = list()
+ return self.get_topic(topic_name)
+
+ def append_to_topic(self, topic_id, entry : HistoryEntry):
+ topic_list = self.get_or_add_topic(topic_id)
+ topic_list.append(entry)
+
+ # Make sure the history does not grow excessively large
+ expire_len = len(topic_list) - self.history_len
+ if expire_len > 0:
+ del topic_list[:expire_len] # "prune" the oldest entries from list
+
+ def get_last_entry(self, topic_name:str) -> HistoryEntry:
+ '''
+ Returns the most recent history object associated with topic_id.
+ '''
+ last_entry = None
+ topic_list = self.get_topic(topic_name)
+ if isinstance(topic_list, list) and len(topic_list) > 0:
+ last_entry = topic_list[-1]
+ return last_entry
+
+ def get_count(self, topic_name:str) -> int:
+ '''
+ Returns the most recent history object associated with topic_id.
+ '''
+ topic_list = self.get_topic(topic_name)
+ count = 0
+ if isinstance(topic_list, list):
+ count = len(topic_list)
+ return count
+
+ def generate_message(self, instance_id : int|str, topic_id, fcn_code : int = None):
+ '''
+ Sorts the raw message into the associated data array (or creates one if it doesn't exist).
+ Sorts the decoded EDS object from the message into the associated data array (or creates one if it doesn't exist).
+ Generates a telemetry display string based on the instance and topic names.
+
+ Inputs:
+ host - Information where the telemetry message came from
+ datagram - Raw telemetry message as a bytes string
+ '''
+ topic_obj = None
+ eds_id = None
+ eds_datatype = None
+ msg_data = None
+
+ if topic_id in self.telecommand:
+ topic_obj = self.telecommand.Topic(topic_id)
+ elif topic_id in self.telemetry:
+ topic_obj = self.telemetry.Topic(topic_id)
+
+ if topic_obj is not None:
+ if fcn_code is None:
+ eds_id = topic_obj.GetEdsId()
+ else:
+ eds_id = topic_obj.GetCmdEdsId(fcn_code)
+
+ if eds_id is not None:
+ eds_datatype = self.eds_db.Entry(eds_id)
+ msg_data = eds_datatype()
+
+ return msg_data
diff --git a/cfecfs/testrunner/src/core/timestamp.py b/cfecfs/testrunner/src/core/timestamp.py
new file mode 100644
index 0000000..0389aae
--- /dev/null
+++ b/cfecfs/testrunner/src/core/timestamp.py
@@ -0,0 +1,103 @@
+'''
+Copyright (c) 2025 United States Government as represented by
+the Administrator of the National Aeronautics and Space Administration.
+All Rights Reserved.
+
+'''
+import time
+import operator
+
+class Timestamp:
+
+ # by default use the monotonic clock for all computations
+ REF = time.CLOCK_MONOTONIC
+ NONE = None
+
+ @staticmethod
+ def now():
+ return Timestamp(time.clock_gettime_ns(Timestamp.REF))
+
+ @classmethod
+ def undefined(self):
+ if self.NONE is None:
+ self.NONE = Timestamp()
+ self.NONE.ticks = None
+
+ return self.NONE
+
+ @classmethod
+ def from_ticks(self,ticks):
+ if ticks is None:
+ result = self.undefined()
+ else:
+ result = self(ticks)
+ return result
+
+ @classmethod
+ def from_relative_ticks(self,relative_ticks):
+ result = self.from_ticks(relative_ticks)
+ if result.ticks:
+ result.ticks += time.clock_gettime_ns(Timestamp.REF)
+ return result
+
+ @classmethod
+ def from_relative_seconds(self,relative_seconds):
+ return self.from_relative_ticks(relative_seconds * 1000000000)
+
+ def calc_ticks(self, other, op):
+ if (self.ticks is not None and other is not None):
+ result = op(self.ticks, int(other))
+ else:
+ result = None # operation with None is always undefined (like NaN)
+
+ return result
+
+ def remaining_seconds(self):
+ return float(self.calc_ticks(Timestamp.now(), operator.sub)) / 1000000000
+
+ def __int__(self):
+ return int(self.ticks)
+
+ def __add__(self, other):
+ return Timestamp.from_ticks(self.calc_ticks(other, operator.add))
+
+ def __sub__(self, other):
+ return Timestamp.from_ticks(self.calc_ticks(other, operator.sub))
+
+ def __iadd__(self, other):
+ new_ticks = self.calc_ticks(other, operator.add)
+ if new_ticks is None:
+ raise ValueError("Undefined result")
+ self.ticks = new_ticks
+
+ def __isub__(self, other):
+ new_ticks = self.calc_ticks(other, operator.sub)
+ if new_ticks is None:
+ raise ValueError("Undefined result")
+ self.ticks = new_ticks
+
+ def __bool__(self):
+ return self.ticks is not None
+
+ def __eq__(self, other):
+ return self.calc_ticks(other, operator.eq)
+
+ def __ne__(self, other):
+ return self.calc_ticks(other, operator.ne)
+
+ def __gt__(self, other):
+ return self.calc_ticks(other, operator.gt)
+
+ def __lt__(self, other):
+ return self.calc_ticks(other, operator.lt)
+
+ def __ge__(self, other):
+ return self.calc_ticks(other, operator.ge)
+
+ def __le__(self, other):
+ return self.calc_ticks(other, operator.le)
+
+ def __init__(self, ticks=0):
+ if ticks is None:
+ raise ValueError("Attempt to create duplicate undefined timestamp. Use Timestamp.from_ticks() when value might be None.")
+ self.ticks = int(ticks)
diff --git a/cfecfs/testrunner/src/core/transport_base.py b/cfecfs/testrunner/src/core/transport_base.py
new file mode 100644
index 0000000..73267f2
--- /dev/null
+++ b/cfecfs/testrunner/src/core/transport_base.py
@@ -0,0 +1,29 @@
+'''
+Copyright (c) 2025 United States Government as represented by
+the Administrator of the National Aeronautics and Space Administration.
+All Rights Reserved.
+
+cFS TESTRUNNER Data Interface:
+Generic top-level class for data interfaces, such as UDP.
+'''
+
+
+from abc import ABC,abstractmethod
+from testrunner.core.timestamp import Timestamp
+
+class TransportBase(ABC):
+
+ @abstractmethod
+ def wait_readable(self, timeout:Timestamp):
+ # Abstract class method
+ raise NotImplementedError
+
+ @abstractmethod
+ def transmit(self, data:bytes):
+ # Abstract class method
+ raise NotImplementedError
+
+ @abstractmethod
+ def receive(self, timeout:Timestamp):
+ # Abstract class method
+ raise NotImplementedError
diff --git a/cfecfs/testrunner/src/test_group.py b/cfecfs/testrunner/src/test_group.py
new file mode 100644
index 0000000..af5f552
--- /dev/null
+++ b/cfecfs/testrunner/src/test_group.py
@@ -0,0 +1,32 @@
+import re
+from testrunner import TestrunnerAdapter
+
+class TestGroup:
+
+ def execute(self, method : str, **kwargs):
+ print(f"execute {method}")
+ f = self.test_dict[method]
+ return f(**kwargs)
+
+ # Some tests are prefixed with a number in order to
+ def find_matching_test(self, method : str, **kwargs):
+ result = None
+ for test_name in self.test_dict.keys():
+ m = re.match(r'^test_[\d_]*(\w+)$', test_name)
+ if m and m.group(1) == method:
+ result = test_name
+ return result
+
+
+ def execute_all(self, **kwargs):
+ # Using "sorted" makes them execute in a deterministic order
+ for test_name in sorted(self.test_dict.keys()):
+ self.execute(test_name, **kwargs)
+
+ def enable_output(self):
+ self.Methods.enable_output()
+
+ def __init__(self, method_type : type, **kwargs):
+ self.Methods = TestrunnerAdapter(method_type, **kwargs)
+ self.Methods.register_tests(self)
+ return
diff --git a/cfecfs/testrunner/src/testrunner_adapter.py b/cfecfs/testrunner/src/testrunner_adapter.py
new file mode 100644
index 0000000..40798a2
--- /dev/null
+++ b/cfecfs/testrunner/src/testrunner_adapter.py
@@ -0,0 +1,156 @@
+from testrunner import TestrunnerSync
+from cfs_test_connection import CfsTest_Connection
+from testrunner.core.timestamp import Timestamp
+from testrunner.transports.transport_udp import Transport_UDP
+from types import MethodType
+
+import re
+
+class TestrunnerAdapter(CfsTest_Connection):
+
+ def print(self, msg : str):
+ print (msg)
+ return
+
+ def wait_next_packet(self, expire:Timestamp):
+ while True:
+ remain = expire.remaining_seconds()
+ if remain > 1:
+ cycle_expire = Timestamp.from_relative_seconds(1)
+ else:
+ cycle_expire = expire
+ got_packets = self.testrunner.process_traffic(cycle_expire,1)
+ if got_packets != 0 or remain <= 0:
+ break
+
+ # Prod the app to send its HK_TLM
+ self.testrunner.trigger_hk(self.app_name)
+
+ return (got_packets != 0)
+
+ def wait_check_packet(self, tlm_id, num_pkt:int=1, timeout:int=None):
+ topic_name = f"{self.app_name}/Application/{tlm_id}_TLM"
+ print (f"In testrunner wait_check_packet({topic_name}, {num_pkt}, {timeout})")
+
+ start_seq = self.testrunner.get_last_seq(topic_name)
+ curr_seq = start_seq
+ got_count = 0
+ expire = Timestamp.from_relative_seconds(timeout)
+ while self.wait_next_packet(expire):
+ curr_seq = self.testrunner.get_last_seq(topic_name)
+ if curr_seq is not None:
+ if start_seq is None:
+ start_seq = curr_seq - 1 # fake it so diff will be 1
+ got_count = curr_seq - start_seq
+ if got_count >= num_pkt:
+ break # got the amount desired
+
+ return got_count
+
+ def tlm(self, tlm_id, param_id):
+ topic_name = f"{self.app_name}/Application/{tlm_id}_TLM"
+ print (f"In testrunner tlm({topic_name}): {param_id}")
+
+ result = self.testrunner.get_last_msg(topic_name)
+ #Returns EdsLib.DatabaseEntry: A parsed EDS object representing the telemetry packet.
+ if result != None:
+ result = result.Payload[param_id]()
+
+ assert result is not None
+
+ return result
+
+ def debug_print_tlm(self, tlm_id):
+ topic_name = f"{self.app_name}/Application/{tlm_id}_TLM"
+ print (f"In testrunner debug_print_tlm({topic_name})")
+
+ result = self.testrunner.get_last_msg(topic_name)
+ #Returns EdsLib.DatabaseEntry: A parsed EDS object representing the telemetry packet.
+ if result != None:
+ for member in result.Payload:
+ print(f'{member[0]} => {member[1]()}')
+
+
+ def cmd(self, cmd_id, **kwargs):
+ topic_name = f"{self.app_name}/Application/CMD"
+ print (f"In testrunner cmd({topic_name}.{cmd_id}): {kwargs}")
+
+ # Note that the command codes in EDS have a "Cmd" suffix on them
+ result = self.testrunner.send_cmd(topic_name, cmd_id + 'Cmd', **kwargs)
+ print (f"In testrunner cmd result: {result}")
+ return result
+
+ def wait_check(self, tlm_id, param_id, value, timeout):
+ topic_name = f"{self.app_name}/Application/{tlm_id}_TLM"
+ result = False
+ print (f"In testrunner wait_check({topic_name}): {param_id}, {value} {timeout}")
+
+ expire = Timestamp.from_relative_seconds(timeout)
+ while True:
+ last_msg = self.testrunner.get_last_msg(topic_name)
+ if last_msg is not None:
+ last_value = last_msg.Payload[param_id]()
+ result = (last_value == value)
+
+ if result or not self.wait_next_packet(expire):
+ break
+
+ assert result
+ return result
+
+ def spawn_child(self, app_name:str):
+ return TestrunnerSecondary(self, app_name)
+
+ def get_tlm_msg_id(self, tlm_id:str):
+ topic_name = f"{self.app_name}/Application/{tlm_id}_TLM"
+ return self.testrunner.get_msg_id_from_topic(topic_name)
+
+ def get_cmd_msg_id(self):
+ topic_name = f"{self.app_name}/Application/CMD"
+ return self.testrunner.get_msg_id_from_topic(topic_name)
+
+ def get_tests(self):
+ return self.test_dict.keys()
+
+ def register_test_method(self,test_obj,test_method):
+ func = lambda s: test_method(self.method_obj)
+ return MethodType(func, test_obj)
+
+ def register_tests(self,test_obj):
+ test_dict = dict()
+ for prop,val in type(self.method_obj).__dict__.items():
+ if prop.startswith("test_") and callable(val):
+ print(f"Found test method: {prop}")
+ test_dict[prop] = self.register_test_method(test_obj,val)
+ test_obj.test_dict = test_dict
+
+ def wait(self, timeout : Timestamp):
+ expire = Timestamp.from_relative_seconds(timeout)
+ self.testrunner.process_traffic(expire)
+
+ def enable_output(self):
+ to_app = self.spawn_child("TO_LAB")
+ to_app.cmd("EnableOutput", dest_IP=self.local_addr[0])
+ to_app.cmd("AddPacket", Stream={'Value':self.get_tlm_msg_id("HK")}, BufLimit=5)
+
+ def __init__(self, method_type : type, **kwargs):
+ CfsTest_Connection.__init__(self, method_type, **kwargs)
+ # For the time being, this assumes it is always using the UDP transport provided by CI/TO_LAB
+ if 'remote_addr' in kwargs:
+ remote_addr = kwargs['remote_addr']
+ else:
+ remote_addr = ('127.0.0.1',1234)
+ if 'local_addr' in kwargs:
+ local_addr = kwargs['local_addr']
+ else:
+ local_addr = ('127.0.0.1',2234)
+ self.remote_addr = remote_addr
+ self.local_addr = local_addr
+ default_transport = Transport_UDP(remote_addr,local_addr)
+ self.testrunner = TestrunnerSync(transport=default_transport, **kwargs)
+
+# A secondary shares the same testrunner instance and just talks to a different app
+class TestrunnerSecondary(TestrunnerAdapter):
+ def __init__(self, parent_obj : TestrunnerAdapter, app_name:str):
+ CfsTest_Connection.__init__(self, None, app_name = app_name, instance_name = parent_obj.get_instance_name(), remote_addr = parent_obj.remote_addr)
+ self.testrunner = parent_obj.testrunner
diff --git a/cfecfs/testrunner/src/testrunner_sync.py b/cfecfs/testrunner/src/testrunner_sync.py
new file mode 100644
index 0000000..02f12ea
--- /dev/null
+++ b/cfecfs/testrunner/src/testrunner_sync.py
@@ -0,0 +1,110 @@
+'''
+Copyright (c) 2025 United States Government as represented by
+the Administrator of the National Aeronautics and Space Administration.
+All Rights Reserved.
+'''
+
+import operator
+from testrunner.core.transport_base import TransportBase
+from testrunner.core.controller_sync import ControllerSync
+from testrunner.core.data_model_sync import DataModelSync
+from testrunner.core.timestamp import Timestamp
+
+class TestrunnerSync:
+ """
+ High-level API for test scripts to interact with TESTRUNNER.
+ """
+
+ # The data model handles encoding and decoding of commands and telemetry,
+ # and also stores all received messages into a dictionary for future checks
+ DataModel = None
+
+ # The controller manages the connection(s) to the target, sending raw commands
+ # and receiving raw telemetry, and also starting and stopping cfs if relevant
+ # (such as powering on or off or invoking a restart)
+ Controller = None
+
+ OPS = {
+ "==": operator.eq,
+ "!=": operator.ne,
+ "<": operator.lt,
+ "<=": operator.le,
+ ">": operator.gt,
+ ">=": operator.ge,
+ }
+
+ def __init__(
+ self,
+ transport: TransportBase,
+ **kwargs
+ ):
+ if 'mission_name' in kwargs:
+ self.mission_name = kwargs['mission_name']
+ else:
+ self.mission_name = 'samplemission'
+
+ if 'instance_name' in kwargs:
+ self.instance_name = kwargs['instance_name']
+ else:
+ self.instance_name = 'cpu1'
+
+ self.transport = transport
+
+ # jphfix TBD - multiple instances of this share the same controller and data model (maybe)
+ self.Controller = ControllerSync(self.mission_name)
+ self.DataModel = DataModelSync(self.mission_name)
+
+ def get_last_msg(self, topic_name:str):
+ last_msg = self.DataModel.get_last_entry(topic_name)
+ if last_msg:
+ last_msg = last_msg.get_msg_data()
+ return last_msg
+
+ def trigger_hk(self, app_name:str):
+ sendhk_name = f"{app_name}/Application/SEND_HK"
+ self.send_cmd(sendhk_name)
+
+ def get_last_seq(self, topic_name:str):
+ last_seq = None
+ last_entry = self.DataModel.get_last_entry(topic_name)
+ if last_entry:
+ last_seq = last_entry.get_msg_seq()
+ return last_seq
+
+ def process_traffic(self, expire:Timestamp=None, pkt_limit:int=None):
+
+ got_pkts = 0
+ while True:
+ if pkt_limit is not None and got_pkts >= pkt_limit:
+ break
+
+ raw_data, host = self.transport.receive(expire)
+ if raw_data is None:
+ break
+
+ try:
+ decoded_obj, topic_name = self.Controller.identify_datagram(raw_data)
+
+ msg_seq = self.Controller.get_sequence(topic_name, decoded_obj)
+ history_entry = DataModelSync.HistoryEntry(host,msg_seq,raw_data,decoded_obj)
+ self.DataModel.append_to_topic(topic_name, history_entry)
+ got_pkts += 1
+ except Exception as e:
+ print (f"Failed to identify and decode: {e}")
+
+ return got_pkts
+
+ def send_cmd(self, topic_name, cmd_name=None, **kwargs):
+ print (f"In TestrunnerSync.sendcmd({topic_name})")
+ msg_data = self.Controller.generate_message(topic_name, cmd_name)
+ if hasattr(msg_data, 'Payload'):
+ msg_data.Payload = kwargs
+ self.Controller.setup_header(msg_data, self.instance_name, topic_name)
+ encoded_obj = self.Controller.encode_datagram(msg_data)
+ msg_seq = self.Controller.get_sequence(topic_name, msg_data)
+ history_entry = DataModelSync.HistoryEntry(None,msg_seq,encoded_obj,msg_data)
+ self.DataModel.append_to_topic(topic_name, history_entry)
+ return self.transport.transmit(encoded_obj)
+
+ def get_msg_id_from_topic(self, topic_name:str):
+ return self.Controller.get_msg_id_from_topic(topic_name, self.instance_name)
diff --git a/cfecfs/testrunner/src/transports/transport_udp.py b/cfecfs/testrunner/src/transports/transport_udp.py
new file mode 100644
index 0000000..b5fcb52
--- /dev/null
+++ b/cfecfs/testrunner/src/transports/transport_udp.py
@@ -0,0 +1,84 @@
+'''
+Copyright (c) 2025 United States Government as represented by
+the Administrator of the National Aeronautics and Space Administration.
+All Rights Reserved.
+'''
+
+import ipaddress
+import socket
+import selectors
+import errno
+from testrunner.core.transport_base import TransportBase
+from testrunner.core.timestamp import Timestamp
+
+class Transport_UDP(TransportBase):
+
+ def __init__(self, remote_addr:tuple, local_addr:tuple=None):
+
+ try:
+ ipaddress.IPv4Address(remote_addr[0])
+ except ipaddress.AddressValueError as e:
+ print (f"remote IP value is not valid {e}")
+ raise
+
+ self.remote_addr = remote_addr
+ self.local_addr = local_addr if local_addr else ("127.0.0.1",2234)
+ self.socket = None
+ self.family = socket.AF_INET
+ self.type = socket.SOCK_DGRAM
+ self.usock = None
+ self.rdsel = None
+
+ def get_socket(self):
+ if self.usock is None:
+ print(f"Init socket bound to {self.local_addr[0]}:{self.local_addr[1]}")
+
+ try:
+ self.usock = socket.socket(self.family, self.type)
+ self.usock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self.usock.bind(self.local_addr)
+ self.usock.setblocking(False)
+ self.max_recv_bytes = 4096
+
+ except Exception as e:
+ print(f"socket initialization failed: {e}")
+ self.usock = None
+ raise
+
+ return self.usock
+
+ def wait_readable(self, timeout:Timestamp):
+ if self.rdsel is None:
+ self.rdsel = selectors.DefaultSelector()
+ self.rdsel.register(self.get_socket(), selectors.EVENT_READ)
+
+ remaining_sec = timeout.remaining_seconds()
+ if remaining_sec is not None and remaining_sec < 0:
+ remaining_sec = 0
+
+ return self.rdsel.select(remaining_sec)
+
+ def transmit(self, data:bytes):
+
+ try:
+ bytessent = self.get_socket().sendto(data, self.remote_addr)
+ except Exception as e:
+ print("socket.sendto() failed: {e}")
+ bytessent = 0
+
+ return (bytessent == len(data))
+
+ def receive(self, timeout:Timestamp):
+
+ # wait for the socket to be readable
+ self.wait_readable(timeout)
+
+ try:
+ (data, recv_host) = self.get_socket().recvfrom(self.max_recv_bytes)
+ except IOError as exception:
+ data = None
+ recv_host = None
+ if exception.errno == errno.EWOULDBLOCK:
+ pass
+
+ return (data, recv_host)
diff --git a/cfecfs/testrunner/stage_app_tests.cmake.in b/cfecfs/testrunner/stage_app_tests.cmake.in
new file mode 100644
index 0000000..3bbc806
--- /dev/null
+++ b/cfecfs/testrunner/stage_app_tests.cmake.in
@@ -0,0 +1,38 @@
+set(MAKE $ENV{_})
+set(STAGING_DIR_BASE $ENV{DESTDIR}@CMAKE_INSTALL_PREFIX@/lib/python)
+set(STAGING_DIR_TEST ${STAGING_DIR_BASE}/cfs_app_tests)
+if (@TESTRUNNER_INSTALL_SYMLINK@)
+ set(TESTRUNNER_INSTALL_SYMLINK "TESTRUNNER_INSTALL_SYMLINK=1")
+else()
+ set(TESTRUNNER_INSTALL_SYMLINK)
+endif()
+
+message(STATUS "Installing CFS app tests to: ${STAGING_DIR_TEST}")
+file(MAKE_DIRECTORY ${STAGING_DIR_TEST})
+execute_process(
+ COMMAND
+ make O=@CMAKE_BINARY_DIR@ ${TESTRUNNER_INSTALL_SYMLINK} -f @EDS_CFS_TESTRUNNER_SOURCE_DIR@/cfs_app_test_groups.mk __init__.py
+ WORKING_DIRECTORY
+ ${STAGING_DIR_TEST}
+ RESULT_VARIABLE
+ STATUS
+)
+
+if (NOT STATUS EQUAL 0)
+ message(FATAL_ERROR "${MAKE} returned status ${STATUS}")
+endif()
+
+if (TESTRUNNER_INSTALL_SYMLINK)
+ message(STATUS "Symlinking test library to: ${STAGING_DIR_BASE}")
+ execute_process(
+ COMMAND
+ ${CMAKE_COMMAND} -E create_symlink @EDS_CFS_TESTRUNNER_SOURCE_DIR@/src ${STAGING_DIR_BASE}/testrunner
+ RESULT_VARIABLE
+ STATUS
+ )
+
+ if (NOT STATUS EQUAL 0)
+ message(FATAL_ERROR "${CMAKE_COMMAND} returned status ${STATUS}")
+ endif()
+
+endif()
diff --git a/cfecfs/util/cmdUtil.c b/cfecfs/util/cmdUtil.c
index 411edf5..6269b74 100644
--- a/cfecfs/util/cmdUtil.c
+++ b/cfecfs/util/cmdUtil.c
@@ -18,18 +18,16 @@
* limitations under the License.
*/
-
/**
* \file cmdUtil.c
* \ingroup cfecfs
* \author joseph.p.hickey@nasa.gov
*
-** cmdUtil -- A CCSDS Command utility. This program will build a CCSDS Command packet
-** with variable parameters and send it on a UDP network socket.
-** this program is primarily used to command a cFE flight software system.
+ ** cmdUtil -- A CCSDS Command utility. This program will build a CCSDS Command packet
+ ** with variable parameters and send it on a UDP network socket.
+ ** this program is primarily used to command a cFE flight software system.
*/
-
/*
** System includes
*/
@@ -39,7 +37,7 @@
#include
#ifdef WIN32
-#pragma warning (disable:4786)
+#pragma warning(disable : 4786)
#include
#include
#include
@@ -52,7 +50,7 @@ typedef int socklen_t;
#include
#include
#include
-#define SOCKET int
+#define SOCKET int
#define closesocket(fd) close(fd)
#endif
@@ -68,25 +66,28 @@ typedef int socklen_t;
const char DEFAULT_COMPONENT[] = "Application";
-static const EdsLib_Id_t CFE_SB_TELECOMMAND_CMD_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telecommand_indication_DECLARATION);
+static const EdsLib_Id_t CFE_SB_TELECOMMAND_CMD_ID =
+ EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telecommand_indication_DECLARATION);
/*
** SendUdp
*/
-int SendUdp(char *hostname, unsigned short port, unsigned char *packetData, int packetSize) {
- SOCKET sd;
- int rc;
- unsigned int i;
- struct sockaddr_in cliAddr;
- struct sockaddr_in remoteServAddr;
- struct hostent *hostID;
-
- #ifdef WIN32
- WSADATA wsaData;
- WSAStartup(WINSOCK_VERSION, &wsaData);
- #endif
-
- if (hostname == NULL) {
+int SendUdp(char *hostname, unsigned short port, unsigned char *packetData, int packetSize)
+{
+ SOCKET sd;
+ int rc;
+ unsigned int i;
+ struct sockaddr_in cliAddr;
+ struct sockaddr_in remoteServAddr;
+ struct hostent *hostID;
+
+#ifdef WIN32
+ WSADATA wsaData;
+ WSAStartup(WINSOCK_VERSION, &wsaData);
+#endif
+
+ if (hostname == NULL)
+ {
return -1;
}
@@ -94,47 +95,53 @@ int SendUdp(char *hostname, unsigned short port, unsigned char *packetData, int
** get server IP address (no check if input is IP address or DNS name
*/
hostID = gethostbyname(hostname);
- if (hostID == NULL) {
+ if (hostID == NULL)
+ {
return -2;
}
- printf("sending data to '%s' (IP : %s); port %d\n", hostID->h_name,
- inet_ntoa(*(struct in_addr *)hostID->h_addr_list[0]), port);
+ printf("sending data to '%s' (IP : %s); port %d\n",
+ hostID->h_name,
+ inet_ntoa(*(struct in_addr *)hostID->h_addr_list[0]),
+ port);
/*
** Setup socket structures
*/
remoteServAddr.sin_family = hostID->h_addrtype;
- memcpy((char *) &remoteServAddr.sin_addr.s_addr,
- hostID->h_addr_list[0], hostID->h_length);
+ memcpy((char *)&remoteServAddr.sin_addr.s_addr, hostID->h_addr_list[0], hostID->h_length);
remoteServAddr.sin_port = htons(port);
/*
** Create Socket
*/
- sd = socket(AF_INET,SOCK_DGRAM,0);
- if (sd < 0) {
+ sd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sd < 0)
+ {
return -4;
}
/*
** bind any port
*/
- cliAddr.sin_family = AF_INET;
+ cliAddr.sin_family = AF_INET;
cliAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- cliAddr.sin_port = htons(0);
+ cliAddr.sin_port = htons(0);
- rc = bind(sd, (struct sockaddr *) &cliAddr, sizeof(cliAddr));
- if (rc < 0) {
+ rc = bind(sd, (struct sockaddr *)&cliAddr, sizeof(cliAddr));
+ if (rc < 0)
+ {
printf("%u: cannot bind port\n", port);
return -5;
}
printf("Data to send:\n");
i = 0;
- while (i < packetSize) {
+ while (i < packetSize)
+ {
printf("0x%02X ", packetData[i] & 0xFF);
- if (++i % 8 == 0) {
+ if (++i % 8 == 0)
+ {
puts("");
}
}
@@ -143,11 +150,10 @@ int SendUdp(char *hostname, unsigned short port, unsigned char *packetData, int
/*
** send the event
*/
- rc = sendto(sd, (char*)packetData, packetSize, 0,
- (struct sockaddr*)&remoteServAddr,
- sizeof(remoteServAddr));
+ rc = sendto(sd, (char *)packetData, packetSize, 0, (struct sockaddr *)&remoteServAddr, sizeof(remoteServAddr));
- if (rc < 0) {
+ if (rc < 0)
+ {
closesocket(sd);
return -6;
}
@@ -160,42 +166,42 @@ int SendUdp(char *hostname, unsigned short port, unsigned char *packetData, int
** Defines
*/
#define DEFAULT_HOSTNAME "127.0.0.1"
-#define OPTARG_SIZE 128
+#define OPTARG_SIZE 128
-#define DEFAULT_PORTNUM 1234
+#define DEFAULT_PORTNUM 1234
#define CONSTRAINT_BUFSIZE 20
/*
** Parameter datatype structure
*/
-typedef struct {
- char HostName[OPTARG_SIZE]; /* Hostname like "localhost" or "192.168.0.121" */
- char DestIntf[OPTARG_SIZE];
- char CmdName[OPTARG_SIZE];
- uint16_t PortNum; /* Portnum: Default "1234" */
+typedef struct
+{
+ char HostName[OPTARG_SIZE]; /* Hostname like "localhost" or "192.168.0.121" */
+ char DestIntf[OPTARG_SIZE];
+ char CmdName[OPTARG_SIZE];
+ uint16_t PortNum; /* Portnum: Default "1234" */
- int Verbose; /* Verbose option set? */
- int GotDestInfo;
- int GotUsageReq;
+ int Verbose; /* Verbose option set? */
+ int GotDestInfo;
+ int GotUsageReq;
EdsLib_Id_t IntfEdsId;
EdsLib_Id_t CmdEdsId;
- EdsLib_Id_t IntfArg;
- EdsLib_Id_t ActualArg;
- EdsComponent_CFE_SB_Listener_t Params;
- EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
+ EdsLib_Id_t IntfArg;
+ EdsLib_Id_t ActualArg;
+ EdsComponent_CFE_SB_Listener_t Params;
+ EdsLib_IntfDB_InterfaceInfo_t IntfInfo;
EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSub;
- uint16_t CommandCodeConstrIdx;
- EdsLib_DataTypeDB_EntityInfo_t CommandCodeInfo;
- EdsLib_DataTypeDB_TypeInfo_t EdsHeaderInfo;
- EdsLib_DataTypeDB_TypeInfo_t EdsTypeInfo;
- EdsLib_DataTypeDB_EntityInfo_t EdsPayloadInfo;
- EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
+ uint16_t CommandCodeConstrIdx;
+ EdsLib_DataTypeDB_EntityInfo_t CommandCodeInfo;
+ EdsLib_DataTypeDB_TypeInfo_t EdsHeaderInfo;
+ EdsLib_DataTypeDB_TypeInfo_t EdsTypeInfo;
+ EdsLib_DataTypeDB_EntityInfo_t EdsPayloadInfo;
+ EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
} CommandData_t;
-
-EdsNativeBuffer_CFE_HDR_CommandHeader_t CommandBuffer;
+EdsNativeBuffer_CFE_HDR_CommandHeader_t CommandBuffer;
static EdsPackedBuffer_CFE_HDR_CommandHeader_t PackedCommand;
/*
@@ -212,20 +218,20 @@ static const char *optString = "H:P:D:v?";
** getopts_long long form argument table
*/
static struct option longOpts[] = {
- { "host", required_argument, NULL, 'H' },
- { "port", required_argument, NULL, 'P' },
- { "dest", required_argument, NULL, 'D' },
- { "help", no_argument, NULL, '?' },
- { "verbose", no_argument, NULL, 'v' },
- { NULL, no_argument, NULL, 0 }
+ { "host", required_argument, NULL, 'H' },
+ { "port", required_argument, NULL, 'P' },
+ { "dest", required_argument, NULL, 'D' },
+ { "help", no_argument, NULL, '?' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, no_argument, NULL, 0 }
};
/*
** Display program usage, and exit.
*/
-void DisplayUsage(char *Name, CommandData_t *CommandData )
+void DisplayUsage(char *Name, CommandData_t *CommandData)
{
- printf("%s -- A CCSDS Command Client.\n",Name);
+ printf("%s -- A CCSDS Command Client.\n", Name);
printf(" The parameters are:\n");
printf(" --host / -H : The hostname or IP address to send the command to ( default = localhost )\n");
printf(" --port / -P : The UDP port to send the command to ( default = 1234 )\n");
@@ -235,55 +241,62 @@ void DisplayUsage(char *Name, CommandData_t *CommandData )
printf(" \n");
printf(" An example of using this is:\n");
printf(" \n");
- printf(" %s --host=localhost --port=1234 -D 1:CFE_ES/Application/CMD.QueryAllCmd Filename=MyFile.txt\n",Name);
+ printf(" %s --host=localhost --port=1234 -D 1:CFE_ES/Application/CMD.QueryAllCmd Filename=MyFile.txt\n", Name);
printf(" \n");
}
void ProcessParameterArgument(char *optarg, CommandData_t *CommandData)
{
- char *value;
- int32_t Result;
- EdsLib_EntityDescriptor_t Desc;
-
- value = strchr(optarg, '=');
- if (value == NULL)
- {
- fprintf(stderr,"Parameter Argument: '%s' rejected. Must be in the form: 'x=y' where x is the name and y is the value\n",optarg);
- return;
- }
-
- *value = 0;
- ++value;
-
-
- /* First determine the type of the given argument */
- memset(&Desc,0,sizeof(Desc));
- Desc.FullName = optarg;
- Result = EdsLib_DisplayDB_LocateSubEntity(&EDS_DATABASE, CommandData->EdsPayloadInfo.EdsId, Desc.FullName, &Desc.EntityInfo);
- if (Result != EDSLIB_SUCCESS)
- {
- fprintf(stderr,"Dest App Argument: '%s' rejected. Parameter not known.\n",optarg);
- return;
- }
-
- if (CommandData->Verbose) {
- printf("Parameter \'%s\' Located at payload offset %d\n",optarg,
- Desc.EntityInfo.Offset.Bytes);
- }
-
- Result = EdsLib_Scalar_FromString(&EDS_DATABASE, Desc.EntityInfo.EdsId,
- &CommandBuffer.Byte[CommandData->EdsPayloadInfo.Offset.Bytes + Desc.EntityInfo.Offset.Bytes],
- value);
- if (Result != 0)
- {
- fprintf(stderr,"Parameter Argument: Value '%s' rejected. Unable to parse.\n",value);
- return;
- }
+ char *value;
+ int32_t Result;
+ EdsLib_EntityDescriptor_t Desc;
+
+ value = strchr(optarg, '=');
+ if (value == NULL)
+ {
+ fprintf(
+ stderr,
+ "Parameter Argument: '%s' rejected. Must be in the form: 'x=y' where x is the name and y is the value\n",
+ optarg);
+ return;
+ }
+
+ *value = 0;
+ ++value;
+
+ /* First determine the type of the given argument */
+ memset(&Desc, 0, sizeof(Desc));
+ Desc.FullName = optarg;
+ Result = EdsLib_DisplayDB_LocateSubEntity(&EDS_DATABASE,
+ CommandData->EdsPayloadInfo.EdsId,
+ Desc.FullName,
+ &Desc.EntityInfo);
+ if (Result != EDSLIB_SUCCESS)
+ {
+ fprintf(stderr, "Dest App Argument: '%s' rejected. Parameter not known.\n", optarg);
+ return;
+ }
+
+ if (CommandData->Verbose)
+ {
+ printf("Parameter \'%s\' Located at payload offset %d\n", optarg, Desc.EntityInfo.Offset.Bytes);
+ }
+
+ Result = EdsLib_Scalar_FromString(
+ &EDS_DATABASE,
+ Desc.EntityInfo.EdsId,
+ &CommandBuffer.Byte[CommandData->EdsPayloadInfo.Offset.Bytes + Desc.EntityInfo.Offset.Bytes],
+ value);
+ if (Result != 0)
+ {
+ fprintf(stderr, "Parameter Argument: Value '%s' rejected. Unable to parse.\n", value);
+ return;
+ }
}
static void Enumerate_Topics_Usage_Callback(void *Arg, uint16_t TopicId, EdsLib_Id_t IntfEdsId)
{
- char NameBuffer[128];
+ char NameBuffer[128];
int32_t Status;
/* JPHFIX - check type */
@@ -295,67 +308,68 @@ static void Enumerate_Topics_Usage_Callback(void *Arg, uint16_t TopicId, EdsLib_
}
}
-static void Enumerate_Constraint_Callback(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo, EdsLib_GenericValueBuffer_t *ConstraintValue, void *Arg)
+static void Enumerate_Constraint_Callback(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
+ EdsLib_GenericValueBuffer_t *ConstraintValue,
+ void *Arg)
{
char *Buffer = Arg;
- switch(ConstraintValue->ValueType)
- {
- case EDSLIB_BASICTYPE_SIGNED_INT:
- snprintf(Buffer, CONSTRAINT_BUFSIZE, "%lld",
- (long long)ConstraintValue->Value.SignedInteger);
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- snprintf(Buffer, CONSTRAINT_BUFSIZE, "%llu",
- (unsigned long long)ConstraintValue->Value.SignedInteger);
- break;
- case EDSLIB_BASICTYPE_BINARY:
- strncpy(Buffer, ConstraintValue->Value.StringData, CONSTRAINT_BUFSIZE-1);
- Buffer[CONSTRAINT_BUFSIZE-1] = 0;
- break;
- default:
- break;
+ switch (ConstraintValue->ValueType)
+ {
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ snprintf(Buffer, CONSTRAINT_BUFSIZE, "%lld", (long long)ConstraintValue->Value.SignedInteger);
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ snprintf(Buffer, CONSTRAINT_BUFSIZE, "%llu", (unsigned long long)ConstraintValue->Value.SignedInteger);
+ break;
+ case EDSLIB_BASICTYPE_BINARY:
+ strncpy(Buffer, ConstraintValue->Value.StringData, CONSTRAINT_BUFSIZE - 1);
+ Buffer[CONSTRAINT_BUFSIZE - 1] = 0;
+ break;
+ default:
+ break;
}
}
static void Enumerate_Members_Usage_Callback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc)
{
- const char *Type;
+ const char *Type;
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- EdsLib_DisplayHint_t DisplayHint;
+ EdsLib_DisplayHint_t DisplayHint;
if (ParamDesc->FullName != NULL)
{
EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE, ParamDesc->EntityInfo.EdsId, &TypeInfo);
DisplayHint = EdsLib_DisplayDB_GetDisplayHint(&EDS_DATABASE, ParamDesc->EntityInfo.EdsId);
- switch(TypeInfo.ElemType)
+ switch (TypeInfo.ElemType)
{
- case EDSLIB_BASICTYPE_SIGNED_INT:
- Type = "int";
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- Type = "uint";
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- Type = "ieee";
- break;
- case EDSLIB_BASICTYPE_BINARY:
- Type = "binary";
- break;
- default:
- Type = "other";
- break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ Type = "int";
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ Type = "uint";
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ Type = "ieee";
+ break;
+ case EDSLIB_BASICTYPE_BINARY:
+ Type = "binary";
+ break;
+ default:
+ Type = "other";
+ break;
}
- switch(DisplayHint)
+ switch (DisplayHint)
{
- case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
- Type = "enum";
- break;
- case EDSLIB_DISPLAYHINT_STRING:
- Type = "string";
- break;
- default:
- break;
+ case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
+ Type = "enum";
+ break;
+ case EDSLIB_DISPLAYHINT_STRING:
+ Type = "string";
+ break;
+ default:
+ break;
}
printf(" %10s/%-4u %s\n", Type, TypeInfo.Size.Bits, ParamDesc->FullName);
}
@@ -364,14 +378,15 @@ static void Enumerate_Members_Usage_Callback(void *Arg, const EdsLib_EntityDescr
/*
** main function
*/
-int main(int argc, char *argv[]) {
- int opt = 0;
- int longIndex = 0;
- int retStat;
+int main(int argc, char *argv[])
+{
+ int opt = 0;
+ int longIndex = 0;
+ int retStat;
uint16_t Idx;
- int32_t EdsRc;
- char *Separator;
- char ConstraintBuffer[CONSTRAINT_BUFSIZE];
+ int32_t EdsRc;
+ char *Separator;
+ char ConstraintBuffer[CONSTRAINT_BUFSIZE];
EdsDataType_CFE_HDR_Message_t *MessagePtr = (EdsDataType_CFE_HDR_Message_t *)(void *)&CommandBuffer;
@@ -380,46 +395,46 @@ int main(int argc, char *argv[]) {
*/
memset(&(CommandData), 0, sizeof(CommandData_t));
- strncpy(CommandData.HostName, DEFAULT_HOSTNAME, OPTARG_SIZE-1);
- CommandData.PortNum = 0;
+ strncpy(CommandData.HostName, DEFAULT_HOSTNAME, OPTARG_SIZE - 1);
+ CommandData.PortNum = 0;
CommandData.Params.Telecommand.InstanceNumber = 1;
/*
** Process the arguments with getopt_long(), then
** Build the packet.
*/
- opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
- while( opt != -1 )
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ while (opt != -1)
{
- switch( opt )
+ switch (opt)
{
- case 'H':
- printf("Host: %s\n",(char *)optarg);
- strncpy(CommandData.HostName, optarg, OPTARG_SIZE-1);
- break;
+ case 'H':
+ printf("Host: %s\n", (char *)optarg);
+ strncpy(CommandData.HostName, optarg, OPTARG_SIZE - 1);
+ break;
- case 'P':
- CommandData.PortNum = atoi(optarg);
- break;
+ case 'P':
+ CommandData.PortNum = atoi(optarg);
+ break;
- case 'v':
- printf("Verbose messages on.\n");
- CommandData.Verbose = 1;
- break;
+ case 'v':
+ printf("Verbose messages on.\n");
+ CommandData.Verbose = 1;
+ break;
- case 'D':
- strncpy(CommandData.DestIntf, optarg, OPTARG_SIZE-1);
- break;
+ case 'D':
+ strncpy(CommandData.DestIntf, optarg, OPTARG_SIZE - 1);
+ break;
- case '?':
- CommandData.GotUsageReq = 1;
- break;
+ case '?':
+ CommandData.GotUsageReq = 1;
+ break;
- default:
- break;
+ default:
+ break;
}
- opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
}
if (CommandData.GotUsageReq)
@@ -427,12 +442,13 @@ int main(int argc, char *argv[]) {
DisplayUsage(argv[0], &CommandData);
}
- EdsRc = EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE,
- EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_CommandHeader_DATADICTIONARY),
- &CommandData.EdsHeaderInfo);
+ EdsRc = EdsLib_DataTypeDB_GetTypeInfo(
+ &EDS_DATABASE,
+ EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_CommandHeader_DATADICTIONARY),
+ &CommandData.EdsHeaderInfo);
if (EdsRc != EDSLIB_SUCCESS)
{
- fprintf(stderr,"CCSDS Primary Header lookup failed.\n");
+ fprintf(stderr, "CCSDS Primary Header lookup failed.\n");
return EXIT_FAILURE;
}
@@ -441,10 +457,10 @@ int main(int argc, char *argv[]) {
{
*Separator = 0;
CommandData.Params.Telecommand.InstanceNumber =
- CFE_MissionLib_GetInstanceNumber(&CFE_SOFTWAREBUS_INTERFACE, CommandData.DestIntf);
+ CFE_MissionLib_GetInstanceNumber(&CFE_SOFTWAREBUS_INTERFACE, CommandData.DestIntf);
if (CommandData.Params.Telecommand.InstanceNumber == 0)
{
- fprintf(stderr,"Instance specifier \'%s\' invalid.\n", CommandData.DestIntf);
+ fprintf(stderr, "Instance specifier \'%s\' invalid.\n", CommandData.DestIntf);
return EXIT_FAILURE;
}
++Separator;
@@ -467,8 +483,7 @@ int main(int argc, char *argv[]) {
strcpy(CommandData.CmdName, Separator + 1);
}
- EdsRc = EdsLib_IntfDB_FindComponentInterfaceByFullName(&EDS_DATABASE, CommandData.DestIntf,
- &CommandData.IntfEdsId);
+ EdsRc = EdsLib_IntfDB_FindComponentInterfaceByFullName(&EDS_DATABASE, CommandData.DestIntf, &CommandData.IntfEdsId);
if (EdsRc != EDSLIB_SUCCESS)
{
/*
@@ -477,27 +492,29 @@ int main(int argc, char *argv[]) {
* have named components at all, and it also reduces the amount that the user has
* to type since all top-level SB components are called "Application".
*/
- Separator = strrchr(CommandData.DestIntf, '/');
+ Separator = strrchr(CommandData.DestIntf, '/');
size_t FullLen = strlen(CommandData.DestIntf);
if (Separator != NULL && (FullLen + sizeof(DEFAULT_COMPONENT)) < sizeof(CommandData.DestIntf))
{
memmove(Separator + sizeof(DEFAULT_COMPONENT), Separator, 1 + FullLen - (Separator - CommandData.DestIntf));
- memcpy(Separator+1, DEFAULT_COMPONENT, sizeof(DEFAULT_COMPONENT) - 1);
+ memcpy(Separator + 1, DEFAULT_COMPONENT, sizeof(DEFAULT_COMPONENT) - 1);
Separator[0] = '/';
- EdsRc = EdsLib_IntfDB_FindComponentInterfaceByFullName(&EDS_DATABASE, CommandData.DestIntf,
- &CommandData.IntfEdsId);
+ EdsRc = EdsLib_IntfDB_FindComponentInterfaceByFullName(&EDS_DATABASE,
+ CommandData.DestIntf,
+ &CommandData.IntfEdsId);
}
}
if (EdsRc == EDSLIB_SUCCESS)
{
- EdsRc = CFE_MissionLib_FindTopicIdFromIntfId(&CFE_SOFTWAREBUS_INTERFACE, CommandData.IntfEdsId,
- &CommandData.Params.Telecommand.TopicId);
+ EdsRc = CFE_MissionLib_FindTopicIdFromIntfId(&CFE_SOFTWAREBUS_INTERFACE,
+ CommandData.IntfEdsId,
+ &CommandData.Params.Telecommand.TopicId);
}
if (EdsRc != CFE_MISSIONLIB_SUCCESS)
{
if (CommandData.DestIntf[0] != 0)
{
- fprintf(stderr,"Dest Interface Argument: '%s' rejected. Interface not known.\n", CommandData.DestIntf);
+ fprintf(stderr, "Dest Interface Argument: '%s' rejected. Interface not known.\n", CommandData.DestIntf);
}
if (CommandData.GotUsageReq)
{
@@ -511,7 +528,7 @@ int main(int argc, char *argv[]) {
EdsRc = EdsLib_IntfDB_GetComponentInterfaceInfo(&EDS_DATABASE, CommandData.IntfEdsId, &CommandData.IntfInfo);
if (EdsRc != EDSLIB_SUCCESS)
{
- fprintf(stderr,"Cannot lookup interface info for: '%s'\n", CommandData.DestIntf);
+ fprintf(stderr, "Cannot lookup interface info for: '%s'\n", CommandData.DestIntf);
return EXIT_FAILURE;
}
@@ -519,17 +536,22 @@ int main(int argc, char *argv[]) {
CFE_MissionLib_Set_PubSub_Parameters(MessagePtr, &CommandData.PubSub);
- EdsRc = EdsLib_IntfDB_FindAllArgumentTypes(&EDS_DATABASE, CFE_SB_TELECOMMAND_CMD_ID, CommandData.IntfEdsId, &CommandData.IntfArg, 1);
+ EdsRc = EdsLib_IntfDB_FindAllArgumentTypes(&EDS_DATABASE,
+ CFE_SB_TELECOMMAND_CMD_ID,
+ CommandData.IntfEdsId,
+ &CommandData.IntfArg,
+ 1);
if (EdsRc != EDSLIB_SUCCESS)
{
- fprintf(stderr,"Cannot lookup argument type for: '%s', rc=%d\n", CommandData.DestIntf, (int)EdsRc);
+ fprintf(stderr, "Cannot lookup argument type for: '%s', rc=%d\n", CommandData.DestIntf, (int)EdsRc);
return EXIT_FAILURE;
}
if (CommandData.Verbose)
{
- printf("Base Indication Argument EdsId=%x / %s\n", (unsigned int)CommandData.IntfArg,
- EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, CommandData.IntfArg));
+ printf("Base Indication Argument EdsId=%x / %s\n",
+ (unsigned int)CommandData.IntfArg,
+ EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, CommandData.IntfArg));
}
CommandData.ActualArg = CommandData.IntfArg;
@@ -544,7 +566,8 @@ int main(int argc, char *argv[]) {
EdsLib_Id_t PossibleId;
Idx = 0;
- while (EdsLib_DataTypeDB_GetDerivedTypeById(&EDS_DATABASE, CommandData.IntfArg, Idx, &PossibleId) == EDSLIB_SUCCESS)
+ while (EdsLib_DataTypeDB_GetDerivedTypeById(&EDS_DATABASE, CommandData.IntfArg, Idx, &PossibleId)
+ == EDSLIB_SUCCESS)
{
if (strcmp(EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, PossibleId), CommandData.CmdName) == 0)
{
@@ -558,22 +581,34 @@ int main(int argc, char *argv[]) {
{
if (CommandData.CmdName[0] == 0)
{
- fprintf(stderr,"Dest Interface requires a derivative specifier / command code: \'%s\'\n", CommandData.DestIntf);
+ fprintf(stderr,
+ "Dest Interface requires a derivative specifier / command code: \'%s\'\n",
+ CommandData.DestIntf);
}
else
{
- fprintf(stderr,"Command \'%s\' not found within interface \'%s\'\n", CommandData.CmdName, CommandData.DestIntf);
+ fprintf(stderr,
+ "Command \'%s\' not found within interface \'%s\'\n",
+ CommandData.CmdName,
+ CommandData.DestIntf);
}
if (CommandData.GotUsageReq)
{
printf("\nAvailable Command Codes:\n");
Idx = 0;
- while (EdsLib_DataTypeDB_GetDerivedTypeById(&EDS_DATABASE, CommandData.IntfArg, Idx, &PossibleId) == EDSLIB_SUCCESS)
+ while (EdsLib_DataTypeDB_GetDerivedTypeById(&EDS_DATABASE, CommandData.IntfArg, Idx, &PossibleId)
+ == EDSLIB_SUCCESS)
{
strcpy(ConstraintBuffer, "N/A");
- EdsLib_DataTypeDB_ConstraintIterator(&EDS_DATABASE, CommandData.IntfArg, PossibleId, Enumerate_Constraint_Callback, ConstraintBuffer);
-
- printf(" %-40s (%s)\n", EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, PossibleId), ConstraintBuffer);
+ EdsLib_DataTypeDB_ConstraintIterator(&EDS_DATABASE,
+ CommandData.IntfArg,
+ PossibleId,
+ Enumerate_Constraint_Callback,
+ ConstraintBuffer);
+
+ printf(" %-40s (%s)\n",
+ EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, PossibleId),
+ ConstraintBuffer);
++Idx;
}
}
@@ -582,19 +617,20 @@ int main(int argc, char *argv[]) {
}
else if (CommandData.CmdName[0] != 0)
{
- fprintf(stderr,"Dest Interface does not have command codes: \'%s\'\n", CommandData.DestIntf);
+ fprintf(stderr, "Dest Interface does not have command codes: \'%s\'\n", CommandData.DestIntf);
return EXIT_FAILURE;
}
if (CommandData.Verbose)
{
- printf("Actual Indication Argument EdsId=%x / %s\n", (unsigned int)CommandData.ActualArg,
- EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, CommandData.ActualArg));
+ printf("Actual Indication Argument EdsId=%x / %s\n",
+ (unsigned int)CommandData.ActualArg,
+ EdsLib_DisplayDB_GetBaseName(&EDS_DATABASE, CommandData.ActualArg));
}
if (EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE, CommandData.ActualArg, &CommandData.EdsTypeInfo) != EDSLIB_SUCCESS)
{
- fprintf(stderr,"Error retrieving info for code %x\n", (unsigned int)CommandData.ActualArg);
+ fprintf(stderr, "Error retrieving info for code %x\n", (unsigned int)CommandData.ActualArg);
return EXIT_FAILURE;
}
@@ -608,7 +644,10 @@ int main(int argc, char *argv[]) {
if (EdsLib_Is_Valid(CommandData.EdsPayloadInfo.EdsId))
{
printf("\nDefined Payload Fields (sizes in bits):\n");
- EdsLib_DisplayDB_IterateAllEntities(&EDS_DATABASE, CommandData.EdsPayloadInfo.EdsId, Enumerate_Members_Usage_Callback, NULL);
+ EdsLib_DisplayDB_IterateAllEntities(&EDS_DATABASE,
+ CommandData.EdsPayloadInfo.EdsId,
+ Enumerate_Members_Usage_Callback,
+ NULL);
}
else
{
@@ -629,8 +668,8 @@ int main(int argc, char *argv[]) {
*/
while (optind < argc)
{
- ProcessParameterArgument(argv[optind], &CommandData);
- ++optind;
+ ProcessParameterArgument(argv[optind], &CommandData);
+ ++optind;
}
/*
@@ -639,19 +678,26 @@ int main(int argc, char *argv[]) {
* Hardcoding the sequence number / flags field for now.
*/
MessagePtr->CCSDS.CommonHdr.SeqFlag = 0x3;
- EdsLib_DataTypeDB_PackCompleteObject(&EDS_DATABASE, &CommandData.ActualArg,
- PackedCommand, CommandBuffer.Byte,
- sizeof(PackedCommand) * 8, CommandData.EdsTypeInfo.Size.Bytes);
+ EdsLib_DataTypeDB_PackCompleteObject(&EDS_DATABASE,
+ &CommandData.ActualArg,
+ PackedCommand,
+ CommandBuffer.Byte,
+ sizeof(PackedCommand) * 8,
+ CommandData.EdsTypeInfo.Size.Bytes);
/*
** Send the packet
*/
- retStat = SendUdp(CommandData.HostName, CommandData.PortNum, PackedCommand, (CommandData.EdsTypeInfo.Size.Bits + 7) / 8);
+ retStat =
+ SendUdp(CommandData.HostName, CommandData.PortNum, PackedCommand, (CommandData.EdsTypeInfo.Size.Bits + 7) / 8);
- if (retStat < 0) {
- fprintf(stderr,"Problem sending UDP packet: %d\n", retStat);
- return ( retStat );
- } else if (CommandData.Verbose) {
+ if (retStat < 0)
+ {
+ fprintf(stderr, "Problem sending UDP packet: %d\n", retStat);
+ return (retStat);
+ }
+ else if (CommandData.Verbose)
+ {
printf("Command packet sent OK.\n");
}
diff --git a/cfecfs/util/tlm_decode.c b/cfecfs/util/tlm_decode.c
index cc7dc94..c055bfa 100644
--- a/cfecfs/util/tlm_decode.c
+++ b/cfecfs/util/tlm_decode.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file tlm_decode.c
* \ingroup cfecfs
@@ -48,187 +47,195 @@
#include "cfe_missionlib_runtime.h"
#include "cfe_missionlib_api.h"
-
#define BASE_SERVER_PORT 2234
-EdsNativeBuffer_CFE_HDR_TelemetryHeader_t LocalBuffer;
+EdsNativeBuffer_CFE_HDR_TelemetryHeader_t LocalBuffer;
EdsPackedBuffer_CFE_HDR_TelemetryHeader_t NetworkBuffer;
static const char *optString = "c:?";
-static const EdsLib_Id_t CFE_SB_TELEMETRY_CMD_ID = EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telemetry_indication_DECLARATION);
+static const EdsLib_Id_t CFE_SB_TELEMETRY_CMD_ID =
+ EDSLIB_INTF_ID(EDS_INDEX(CFE_SB), EdsCommand_CFE_SB_Telemetry_indication_DECLARATION);
/*
** getopts_long long form argument table
*/
static struct option longOpts[] = {
- { "cpu", required_argument, NULL, 'c' },
- { "help", no_argument, NULL, '?' },
- { NULL, no_argument, NULL, 0 }
+ { "cpu", required_argument, NULL, 'c' },
+ { "help", no_argument, NULL, '?' },
+ { NULL, no_argument, NULL, 0 }
};
-
-
void TlmUtilDisplay(void *Arg, const EdsLib_EntityDescriptor_t *Param)
{
- uint8_t *BasePtr;
- char OutputBuffer[256];
-
- BasePtr = (uint8_t *)Arg;
- BasePtr += Param->EntityInfo.Offset.Bytes;
- EdsLib_Scalar_ToString(&EDS_DATABASE, Param->EntityInfo.EdsId, OutputBuffer, sizeof(OutputBuffer), BasePtr);
- printf("%s(): Bit=%-4d %35s = %s\n",__func__,
- Param->EntityInfo.Offset.Bits, Param->FullName, OutputBuffer);
+ uint8_t *BasePtr;
+ char OutputBuffer[256];
+
+ BasePtr = (uint8_t *)Arg;
+ BasePtr += Param->EntityInfo.Offset.Bytes;
+ EdsLib_Scalar_ToString(&EDS_DATABASE, Param->EntityInfo.EdsId, OutputBuffer, sizeof(OutputBuffer), BasePtr);
+ printf("%s(): Bit=%-4d %35s = %s\n", __func__, Param->EntityInfo.Offset.Bits, Param->FullName, OutputBuffer);
}
int main(int argc, char *argv[])
{
- int opt = 0;
- int longIndex = 0;
- int sd, rc, n, cliLen;
- struct sockaddr_in cliAddr, servAddr;
- unsigned short Port;
- EdsLib_Id_t EdsId;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSubParams;
- EdsComponent_CFE_SB_Publisher_t PublisherParams;
- CFE_MissionLib_TopicInfo_t TopicInfo;
- char TempBuffer[64];
- int32_t Status;
-
- EdsDataType_CFE_HDR_Message_t *MessagePtr = (EdsDataType_CFE_HDR_Message_t *)(void *)&LocalBuffer;
-
-
- Port = BASE_SERVER_PORT;
- opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
- while( opt != -1 )
- {
- switch( opt )
- {
- case 'c':
- Port += atoi(optarg) - 1;
- break;
-
- case '?':
- break;
-
- default:
- break;
- }
-
- opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
- }
-
-
- /*
- ** socket creation
- */
- sd=socket(AF_INET, SOCK_DGRAM, 0);
- if(sd < 0)
- {
- printf("%s: cannot open socket \n",argv[0]);
- exit(1);
- }
-
- /*
- ** bind local server port
- */
- servAddr.sin_family = AF_INET;
- servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- servAddr.sin_port = htons(Port);
- rc = bind (sd, (struct sockaddr *) &servAddr,sizeof(servAddr));
- if(rc<0)
- {
- printf("%s: cannot bind port number %d \n",
- argv[0], Port);
- exit(1);
- }
-
- printf("%s: waiting for data on port UDP %u\n",
- argv[0],Port);
-
- /* server infinite loop */
- while(1)
- {
-
- /*
- ** receive message
- */
- cliLen = sizeof(cliAddr);
- n = recvfrom(sd, NetworkBuffer, sizeof(NetworkBuffer), 0,
- (struct sockaddr *) &cliAddr, (socklen_t *) &cliLen);
-
- if(n<0)
+ int opt = 0;
+ int longIndex = 0;
+ int sd, rc, n, cliLen;
+ struct sockaddr_in cliAddr, servAddr;
+ unsigned short Port;
+ EdsLib_Id_t EdsId;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ EdsInterface_CFE_SB_SoftwareBus_PubSub_t PubSubParams;
+ EdsComponent_CFE_SB_Publisher_t PublisherParams;
+ CFE_MissionLib_TopicInfo_t TopicInfo;
+ char TempBuffer[64];
+ int32_t Status;
+
+ EdsDataType_CFE_HDR_Message_t *MessagePtr = (EdsDataType_CFE_HDR_Message_t *)(void *)&LocalBuffer;
+
+ Port = BASE_SERVER_PORT;
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ while (opt != -1)
{
- printf("%s: cannot receive data \n",argv[0]);
- continue;
- }
-
- /*
- ** print received message
- */
+ switch (opt)
+ {
+ case 'c':
+ Port += atoi(optarg) - 1;
+ break;
- printf("Telemetry Packet From: %s:UDP%u, %u bits : \n",
- inet_ntoa(cliAddr.sin_addr),
- ntohs(cliAddr.sin_port),
- 8 * n);
+ case '?':
+ break;
- if (n > 0)
- {
- EdsLib_Generate_Hexdump(stdout, NetworkBuffer, 0, n);
- }
+ default:
+ break;
+ }
- EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_TelemetryHeader_DATADICTIONARY);
- Status = EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE, EdsId, &TypeInfo);
- if (Status != EDSLIB_SUCCESS)
- {
- return Status;
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
}
- Status = EdsLib_DataTypeDB_UnpackPartialObject(&EDS_DATABASE, &EdsId,
- LocalBuffer.Byte, NetworkBuffer, sizeof(LocalBuffer), 8 * n, 0);
- if (Status != EDSLIB_SUCCESS)
- {
- return Status;
- }
-
- CFE_MissionLib_Get_PubSub_Parameters(&PubSubParams, MessagePtr);
- CFE_MissionLib_UnmapPublisherComponent(&PublisherParams, &PubSubParams);
-
- Status = CFE_MissionLib_GetTopicInfo(&CFE_SOFTWAREBUS_INTERFACE, PublisherParams.Telemetry.TopicId, &TopicInfo);
- if (Status != CFE_MISSIONLIB_SUCCESS)
- {
- return Status;
- }
-
- Status = EdsLib_IntfDB_FindAllArgumentTypes(&EDS_DATABASE, CFE_SB_TELEMETRY_CMD_ID, TopicInfo.ParentIntfId, &EdsId, 1);
- if (Status != EDSLIB_SUCCESS)
+ /*
+ ** socket creation
+ */
+ sd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sd < 0)
{
- return Status;
+ printf("%s: cannot open socket \n", argv[0]);
+ exit(1);
}
- Status = EdsLib_DataTypeDB_UnpackPartialObject(&EDS_DATABASE, &EdsId, LocalBuffer.Byte, NetworkBuffer,
- sizeof(LocalBuffer), 8 * n, TypeInfo.Size.Bytes);
- if (Status != EDSLIB_SUCCESS)
+ /*
+ ** bind local server port
+ */
+ servAddr.sin_family = AF_INET;
+ servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ servAddr.sin_port = htons(Port);
+ rc = bind(sd, (struct sockaddr *)&servAddr, sizeof(servAddr));
+ if (rc < 0)
{
- return Status;
+ printf("%s: cannot bind port number %d \n", argv[0], Port);
+ exit(1);
}
- printf("Formatcode=%08lx / %s\n",(unsigned long)EdsId,
- EdsLib_DisplayDB_GetTypeName(&EDS_DATABASE, EdsId, TempBuffer, sizeof(TempBuffer)));
+ printf("%s: waiting for data on port UDP %u\n", argv[0], Port);
- Status = EdsLib_DataTypeDB_VerifyUnpackedObject(&EDS_DATABASE, EdsId, LocalBuffer.Byte,
- NetworkBuffer, EDSLIB_DATATYPEDB_RECOMPUTE_NONE);
- if (Status != EDSLIB_SUCCESS)
+ /* server infinite loop */
+ while (1)
{
- printf("NOTE - EDS VERIFICATION FAILED: code=%d\n", (int)Status);
- }
-
- EdsLib_DisplayDB_IterateAllEntities(&EDS_DATABASE, EdsId, TlmUtilDisplay, LocalBuffer.Byte);
- printf("\n");
-
- }/* end of server infinite loop */
-
- return 0;
-
+ /*
+ ** receive message
+ */
+ cliLen = sizeof(cliAddr);
+ n = recvfrom(sd, NetworkBuffer, sizeof(NetworkBuffer), 0, (struct sockaddr *)&cliAddr, (socklen_t *)&cliLen);
+
+ if (n < 0)
+ {
+ printf("%s: cannot receive data \n", argv[0]);
+ continue;
+ }
+
+ /*
+ ** print received message
+ */
+
+ printf("Telemetry Packet From: %s:UDP%u, %u bits : \n",
+ inet_ntoa(cliAddr.sin_addr),
+ ntohs(cliAddr.sin_port),
+ 8 * n);
+
+ if (n > 0)
+ {
+ EdsLib_Generate_Hexdump(stdout, NetworkBuffer, 0, n);
+ }
+
+ EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), EdsContainer_CFE_HDR_TelemetryHeader_DATADICTIONARY);
+ Status = EdsLib_DataTypeDB_GetTypeInfo(&EDS_DATABASE, EdsId, &TypeInfo);
+ if (Status != EDSLIB_SUCCESS)
+ {
+ return Status;
+ }
+
+ Status = EdsLib_DataTypeDB_UnpackPartialObject(&EDS_DATABASE,
+ &EdsId,
+ LocalBuffer.Byte,
+ NetworkBuffer,
+ sizeof(LocalBuffer),
+ 8 * n,
+ 0);
+ if (Status != EDSLIB_SUCCESS)
+ {
+ return Status;
+ }
+
+ CFE_MissionLib_Get_PubSub_Parameters(&PubSubParams, MessagePtr);
+ CFE_MissionLib_UnmapPublisherComponent(&PublisherParams, &PubSubParams);
+
+ Status = CFE_MissionLib_GetTopicInfo(&CFE_SOFTWAREBUS_INTERFACE, PublisherParams.Telemetry.TopicId, &TopicInfo);
+ if (Status != CFE_MISSIONLIB_SUCCESS)
+ {
+ return Status;
+ }
+
+ Status = EdsLib_IntfDB_FindAllArgumentTypes(&EDS_DATABASE,
+ CFE_SB_TELEMETRY_CMD_ID,
+ TopicInfo.ParentIntfId,
+ &EdsId,
+ 1);
+ if (Status != EDSLIB_SUCCESS)
+ {
+ return Status;
+ }
+
+ Status = EdsLib_DataTypeDB_UnpackPartialObject(&EDS_DATABASE,
+ &EdsId,
+ LocalBuffer.Byte,
+ NetworkBuffer,
+ sizeof(LocalBuffer),
+ 8 * n,
+ TypeInfo.Size.Bytes);
+ if (Status != EDSLIB_SUCCESS)
+ {
+ return Status;
+ }
+
+ printf("Formatcode=%08lx / %s\n",
+ (unsigned long)EdsId,
+ EdsLib_DisplayDB_GetTypeName(&EDS_DATABASE, EdsId, TempBuffer, sizeof(TempBuffer)));
+
+ Status = EdsLib_DataTypeDB_VerifyUnpackedObject(&EDS_DATABASE,
+ EdsId,
+ LocalBuffer.Byte,
+ NetworkBuffer,
+ EDSLIB_DATATYPEDB_RECOMPUTE_NONE);
+ if (Status != EDSLIB_SUCCESS)
+ {
+ printf("NOTE - EDS VERIFICATION FAILED: code=%d\n", (int)Status);
+ }
+
+ EdsLib_DisplayDB_IterateAllEntities(&EDS_DATABASE, EdsId, TlmUtilDisplay, LocalBuffer.Byte);
+ printf("\n");
+
+ } /* end of server infinite loop */
+
+ return 0;
}
diff --git a/edslib/configtest/edslib_longdouble.c b/edslib/configtest/edslib_longdouble.c
index 7b667a2..f31b82d 100644
--- a/edslib/configtest/edslib_longdouble.c
+++ b/edslib/configtest/edslib_longdouble.c
@@ -18,26 +18,25 @@
* limitations under the License.
*/
-
/**
* \file edslib_longdouble.c
* \ingroup edslib
* \author joseph.p.hickey@nasa.gov
*
-** This is a configuration test file used by the build system to determine
-** the level of floating point type support of the compiler and C library.
-**
-** For the Pack/Unpack routines in EdsLib it is beneficial to use the maximum
-** precision that is possible using the native FPU. C99 defined the "long double"
-** type and other systems may even have some form of quad type.
-**
-** On the other end of the spectrum, embedded microcontrollers may not even
-** support any sort of extended-precision type at all.
-**
-** At the moment this checks if we can compile a simple function that uses
-** the long double type. If this succeeds then it is assumed that the system
-** has a functional "long double" implementation. Otherwise a standard "double"
-** can be used instead.
+ ** This is a configuration test file used by the build system to determine
+ ** the level of floating point type support of the compiler and C library.
+ **
+ ** For the Pack/Unpack routines in EdsLib it is beneficial to use the maximum
+ ** precision that is possible using the native FPU. C99 defined the "long double"
+ ** type and other systems may even have some form of quad type.
+ **
+ ** On the other end of the spectrum, embedded microcontrollers may not even
+ ** support any sort of extended-precision type at all.
+ **
+ ** At the moment this checks if we can compile a simple function that uses
+ ** the long double type. If this succeeds then it is assumed that the system
+ ** has a functional "long double" implementation. Otherwise a standard "double"
+ ** can be used instead.
*/
#include
@@ -46,9 +45,9 @@
int main(void)
{
- long double x1,x2;
+ long double x1, x2;
long double y;
- int e;
+ int e;
x1 = 1234.0L;
@@ -60,13 +59,13 @@ int main(void)
* EdsLib uses some others beyond these two, but it is assumed if these
* two will build and link than the others will too.
*/
- y = frexpl(x1, &e);
+ y = frexpl(x1, &e);
x2 = ldexpl(y, e);
if (x1 != x2)
{
- return(EXIT_FAILURE);
+ return (EXIT_FAILURE);
}
- return(EXIT_SUCCESS);
+ return (EXIT_SUCCESS);
}
diff --git a/edslib/fsw/inc/edslib_api_types.h b/edslib/fsw/inc/edslib_api_types.h
index 18acd22..f414bb1 100644
--- a/edslib/fsw/inc/edslib_api_types.h
+++ b/edslib/fsw/inc/edslib_api_types.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_api_types.h
* \ingroup fsw
@@ -43,7 +42,6 @@
#ifndef _EDSLIB_API_TYPES_H_
#define _EDSLIB_API_TYPES_H_
-
/**
* Abstract pointer to a basic EDS object with minimal info on the member objects
* This is also referred to as the data dictionary since it has info on how to
@@ -52,7 +50,7 @@
* Note that these objects are always constant; the database objects are generated
* from the toolchain, compiled in and should never be modified at runtime.
*/
-typedef const struct EdsLib_App_DataTypeDB * EdsLib_DataTypeDB_t;
+typedef const struct EdsLib_App_DataTypeDB *EdsLib_DataTypeDB_t;
/**
* Abstract pointer to a full EDS object with detailed info on the member objects
@@ -62,7 +60,7 @@ typedef const struct EdsLib_App_DataTypeDB * EdsLib_DataTypeDB_t;
* Note that these objects are always constant; the database objects are generated
* from the toolchain, compiled in and should never be modified at runtime.
*/
-typedef const struct EdsLib_App_DisplayDB * EdsLib_DisplayDB_t;
+typedef const struct EdsLib_App_DisplayDB *EdsLib_DisplayDB_t;
/**
* Abstract pointer to a EDS object with interface information
@@ -70,7 +68,7 @@ typedef const struct EdsLib_App_DisplayDB * EdsLib_DisplayDB_t;
* Note that these objects are always constant; the database objects are generated
* from the toolchain, compiled in and should never be modified at runtime.
*/
-typedef const struct EdsLib_App_IntfDB * EdsLib_IntfDB_t;
+typedef const struct EdsLib_App_IntfDB *EdsLib_IntfDB_t;
/**
* An EDS runtime database object
@@ -85,14 +83,14 @@ typedef const struct EdsLib_App_IntfDB * EdsLib_IntfDB_t;
*/
struct EdsLib_DatabaseObject
{
- uint16_t AppTableSize; /**< Length of all the arrays (they should all match) */
- const char * const *AppName_Table;
- EdsLib_DataTypeDB_t *DataTypeDB_Table;
- EdsLib_DisplayDB_t *DisplayDB_Table;
- EdsLib_IntfDB_t *IntfDB_Table;
+ uint16_t AppTableSize; /**< Length of all the arrays (they should all match) */
+ const char *const *AppName_Table;
+ EdsLib_DataTypeDB_t *DataTypeDB_Table;
+ EdsLib_DisplayDB_t *DisplayDB_Table;
+ EdsLib_IntfDB_t *IntfDB_Table;
};
-typedef struct EdsLib_DatabaseObject EdsLib_DatabaseObject_t;
+typedef struct EdsLib_DatabaseObject EdsLib_DatabaseObject_t;
/**
* Indicates the fundamental nature of various elements within EDS basic data structures.
@@ -100,52 +98,54 @@ typedef struct EdsLib_DatabaseObject EdsLib_DatabaseObject_t;
*/
typedef enum
{
- EDSLIB_BASICTYPE_NONE = 0, /**< Reserved value, any content for this element should be ignored */
- EDSLIB_BASICTYPE_SIGNED_INT, /**< Interpret as a signed integer. Byte swapping applies. */
- EDSLIB_BASICTYPE_UNSIGNED_INT, /**< Interpret as an unsigned integer. Byte swapping applies. */
- EDSLIB_BASICTYPE_FLOAT, /**< Interpret as a floating point. Byte swapping applies. */
- EDSLIB_BASICTYPE_BINARY, /**< Pass-through data blob. No byte swapping. (char strings, etc) */
- EDSLIB_BASICTYPE_CONTAINER, /**< References to multiple other data blobs of heterogeneous types */
- EDSLIB_BASICTYPE_ARRAY, /**< References to multiple other data blobs of homogeneous type */
- EDSLIB_BASICTYPE_COMPONENT, /**< References to component entities */
- EDSLIB_BASICTYPE_ALIAS, /**< References to another EDS defined type */
- EDSLIB_BASICTYPE_GENERIC, /**< A generic type in an declared interface */
- EDSLIB_BASICTYPE_MAX /**< Reserved value, should always be last */
+ EDSLIB_BASICTYPE_NONE = 0, /**< Reserved value, any content for this element should be ignored */
+ EDSLIB_BASICTYPE_SIGNED_INT, /**< Interpret as a signed integer. Byte swapping applies. */
+ EDSLIB_BASICTYPE_UNSIGNED_INT, /**< Interpret as an unsigned integer. Byte swapping applies. */
+ EDSLIB_BASICTYPE_FLOAT, /**< Interpret as a floating point. Byte swapping applies. */
+ EDSLIB_BASICTYPE_BINARY, /**< Pass-through data blob. No byte swapping. (char strings, etc) */
+ EDSLIB_BASICTYPE_CONTAINER, /**< References to multiple other data blobs of heterogeneous types */
+ EDSLIB_BASICTYPE_ARRAY, /**< References to multiple other data blobs of homogeneous type */
+ EDSLIB_BASICTYPE_COMPONENT, /**< References to component entities */
+ EDSLIB_BASICTYPE_ALIAS, /**< References to another EDS defined type */
+ EDSLIB_BASICTYPE_GENERIC, /**< A generic type in an declared interface */
+ EDSLIB_BASICTYPE_MAX /**< Reserved value, should always be last */
} EdsLib_BasicType_t;
typedef enum
{
- EDSLIB_DISPLAYHINT_NONE = 0, /**< No extra display hints (use default) */
- EDSLIB_DISPLAYHINT_STRING, /**< indicates that the binary blob contains character string data */
- EDSLIB_DISPLAYHINT_REFERENCE_TYPE,
- EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE, /**< indicates that the binary blob contains sub elements, HintArg => Name Table */
- EDSLIB_DISPLAYHINT_ENUM_SYMTABLE, /**< indicates that the integer value has associated names for display, HintArg => Name Table */
- EDSLIB_DISPLAYHINT_ADDRESS, /**< indicates that the integer value represents a memory address */
- EDSLIB_DISPLAYHINT_BOOLEAN, /**< indicates that the field contains a true/false value */
- EDSLIB_DISPLAYHINT_BASE64, /**< indicates that the binary blob should use base64 for display */
- EDSLIB_DISPLAYHINT_MAX
+ EDSLIB_DISPLAYHINT_NONE = 0, /**< No extra display hints (use default) */
+ EDSLIB_DISPLAYHINT_STRING, /**< indicates that the binary blob contains character string data */
+ EDSLIB_DISPLAYHINT_REFERENCE_TYPE,
+ EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE, /**< indicates that the binary blob contains sub elements, HintArg => Name
+ Table */
+ EDSLIB_DISPLAYHINT_ENUM_SYMTABLE, /**< indicates that the integer value has associated names for display, HintArg =>
+ Name Table */
+ EDSLIB_DISPLAYHINT_ADDRESS, /**< indicates that the integer value represents a memory address */
+ EDSLIB_DISPLAYHINT_BOOLEAN, /**< indicates that the field contains a true/false value */
+ EDSLIB_DISPLAYHINT_BASE64, /**< indicates that the binary blob should use base64 for display */
+ EDSLIB_DISPLAYHINT_MAX
} EdsLib_DisplayHint_t;
/*
- * Definitions of flag values that may appear in the "Flags" member of
+ * Definitions of flag values that may appear in the "Flags" member of
* type and entity information structures.
*
* Note: The Packing Flags here correlate with the byte order check values
* in edslib_datatypedb_pack_unpack.c
*/
-#define EDSLIB_DATATYPE_FLAG_NONE 0x00
+#define EDSLIB_DATATYPE_FLAG_NONE 0x00
-#define EDSLIB_DATATYPE_FLAG_PACKED_BE 0x01 /**< Matches typical "big-endian" native representation */
-#define EDSLIB_DATATYPE_FLAG_PACKED_LE 0x02 /**< Matches typical "little-endian" native representation */
-#define EDSLIB_DATATYPE_FLAG_PACKED 0x03 /**< Mask indicating optimized packing characteristics */
+#define EDSLIB_DATATYPE_FLAG_PACKED_BE 0x01 /**< Matches typical "big-endian" native representation */
+#define EDSLIB_DATATYPE_FLAG_PACKED_LE 0x02 /**< Matches typical "little-endian" native representation */
+#define EDSLIB_DATATYPE_FLAG_PACKED 0x03 /**< Mask indicating optimized packing characteristics */
-#define EDSLIB_DATATYPE_FLAG_VARIABLE_SIZE 0x10 /**< Item can vary in its packed size */
-#define EDSLIB_DATATYPE_FLAG_VARIABLE_LOCATION 0x20 /**< Item can vary in its packed location */
-#define EDSLIB_DATATYPE_FLAG_VARIABLE 0x30 /**< Mask indicating variable packing characteristics */
+#define EDSLIB_DATATYPE_FLAG_VARIABLE_SIZE 0x10 /**< Item can vary in its packed size */
+#define EDSLIB_DATATYPE_FLAG_VARIABLE_LOCATION 0x20 /**< Item can vary in its packed location */
+#define EDSLIB_DATATYPE_FLAG_VARIABLE 0x30 /**< Mask indicating variable packing characteristics */
/**
* Structure for size and/or offset information
- *
+ *
* Sizes and offsets are given in both bits and bytes, where bits
* indicates the position or size in a packed representation and bytes
* indicates the position or size in a native representation, respectively.
@@ -158,17 +158,16 @@ typedef enum
* cannot be determined by database query.
*
* The "Bytes" value, on the other hand, is always fixed as these represent
- * offsets or sizes of the C structure representation, which is fixed at
+ * offsets or sizes of the C structure representation, which is fixed at
* compile time. However this size is platform-dependent and may not be the
* same on other systems.
*/
struct EdsLib_SizeInfo
{
- uint32_t Bits; /**< Offset/Size in packed structure (nominal, may vary) */
- uint32_t Bytes; /**< Offset/Size in native structure (fixed but platform-dependent) */
+ uint32_t Bits; /**< Offset/Size in packed structure (nominal, may vary) */
+ uint32_t Bytes; /**< Offset/Size in native structure (fixed but platform-dependent) */
};
typedef struct EdsLib_SizeInfo EdsLib_SizeInfo_t;
-
-#endif /* _EDSLIB_API_TYPES_H_ */
+#endif /* _EDSLIB_API_TYPES_H_ */
diff --git a/edslib/fsw/inc/edslib_binding_objects.h b/edslib/fsw/inc/edslib_binding_objects.h
index 2c12c54..e61e6d4 100644
--- a/edslib/fsw/inc/edslib_binding_objects.h
+++ b/edslib/fsw/inc/edslib_binding_objects.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_binding_objects.h
* \ingroup fsw
@@ -29,7 +28,6 @@
#ifndef _EDSLIB_BINDING_OBJECTS_H_
#define _EDSLIB_BINDING_OBJECTS_H_
-
#include
#include
@@ -38,121 +36,115 @@ extern "C"
{
#endif
-
-/*****************************************************************************
- * TYPE DEFINITIONS
- *****************************************************************************/
-
-typedef enum
-{
- EDSLIB_BINDING_COMPATIBILITY_NONE = 0,
- EDSLIB_BINDING_COMPATIBILITY_BASETYPE,
- EDSLIB_BINDING_COMPATIBILITY_EXACT
-} EdsLib_Binding_Compatibility_t;
-
-/**
- * A generic abstract buffer for holding any EDS object.
- *
- * This is a reference-counting buffer, so that many EDS descriptor objects can point
- * to the same instance.
- */
-typedef struct
-{
- /*
- * Note - the "Data" field is variably sized, and the MaxContentSize
- * indicates the actual number of bytes available here.
+ /*****************************************************************************
+ * TYPE DEFINITIONS
+ *****************************************************************************/
+
+ typedef enum
+ {
+ EDSLIB_BINDING_COMPATIBILITY_NONE = 0,
+ EDSLIB_BINDING_COMPATIBILITY_BASETYPE,
+ EDSLIB_BINDING_COMPATIBILITY_EXACT
+ } EdsLib_Binding_Compatibility_t;
+
+ /**
+ * A generic abstract buffer for holding any EDS object.
+ *
+ * This is a reference-counting buffer, so that many EDS descriptor objects can point
+ * to the same instance.
*/
- uint8_t *Data;
- bool IsManaged;
- size_t MaxContentSize; /**< The actual size of the "Data" field */
- uintmax_t ReferenceCount; /**< The number of references to this buffer */
-
-} EdsLib_Binding_Buffer_Content_t;
-
-
-/**
- * A runtime descriptor of an EDS object
- *
- * This object describes a piece of EDS data. It may or may not also contain an actual reference to the data
- * being described, depending on context.
- */
-struct EdsLib_Binding_DescriptorObject
-{
- const EdsLib_DatabaseObject_t *GD; /**< Handle to original database object which defines all EDS types */
- EdsLib_Id_t EdsId; /**< The EDS ID value representing the specific type of the data */
- uint32_t Offset; /**< Absolute Offset of member within the top-level parent structure */
- uint32_t Length; /**< Total allocated space for this object within parent structure */
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo; /**< Information about the component type (size, number of subcomponents, etc) */
- EdsLib_Binding_Buffer_Content_t *BufferPtr; /**< Pointer to a buffer holding the data (optional, may be NULL) */
-};
-
-typedef struct EdsLib_Binding_DescriptorObject EdsLib_Binding_DescriptorObject_t;
-
-/*****************************************************************************
- * FUNCTION PROTOTYPES
- *****************************************************************************/
-
-/**
- * EDS Binding API Initialization function.
- *
- * This should be called once during startup by applications
- * that wish to use the EDS Binding Object API before using
- * other API calls.
- */
-void EdsLib_Binding_Initialize(void);
-
-EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_AllocManagedBuffer(size_t MaxContentSize);
-EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Binding_Buffer_Content_t *ContentPtr, void *DataPtr, size_t MaxContentSize);
-
-void EdsLib_Binding_SetDescBuffer(EdsLib_Binding_DescriptorObject_t *DescrObj, EdsLib_Binding_Buffer_Content_t *TargetBuffer);
-
-static inline bool EdsLib_Binding_IsDescBufferValid(const EdsLib_Binding_DescriptorObject_t *DescrObj)
-{
- return (DescrObj->BufferPtr != NULL &&
- EdsLib_Is_Valid(DescrObj->EdsId) &&
- DescrObj->BufferPtr->MaxContentSize >= (DescrObj->Offset + DescrObj->TypeInfo.Size.Bytes));
-}
+ typedef struct
+ {
+ /*
+ * Note - the "Data" field is variably sized, and the MaxContentSize
+ * indicates the actual number of bytes available here.
+ */
+ uint8_t *Data;
+ bool IsManaged;
+ size_t MaxContentSize; /**< The actual size of the "Data" field */
+ uintmax_t ReferenceCount; /**< The number of references to this buffer */
+
+ } EdsLib_Binding_Buffer_Content_t;
+
+ /**
+ * A runtime descriptor of an EDS object
+ *
+ * This object describes a piece of EDS data. It may or may not also contain an actual reference to the data
+ * being described, depending on context.
+ */
+ struct EdsLib_Binding_DescriptorObject
+ {
+ const EdsLib_DatabaseObject_t *GD; /**< Handle to original database object which defines all EDS types */
+ EdsLib_Id_t EdsId; /**< The EDS ID value representing the specific type of the data */
+ uint32_t Offset; /**< Absolute Offset of member within the top-level parent structure */
+ uint32_t Length; /**< Total allocated space for this object within parent structure */
+ EdsLib_DataTypeDB_TypeInfo_t
+ TypeInfo; /**< Information about the component type (size, number of subcomponents, etc) */
+ EdsLib_Binding_Buffer_Content_t *BufferPtr; /**< Pointer to a buffer holding the data (optional, may be NULL) */
+ };
+
+ typedef struct EdsLib_Binding_DescriptorObject EdsLib_Binding_DescriptorObject_t;
+
+ /*****************************************************************************
+ * FUNCTION PROTOTYPES
+ *****************************************************************************/
+
+ /**
+ * EDS Binding API Initialization function.
+ *
+ * This should be called once during startup by applications
+ * that wish to use the EDS Binding Object API before using
+ * other API calls.
+ */
+ void EdsLib_Binding_Initialize(void);
+ EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_AllocManagedBuffer(size_t MaxContentSize);
+ EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Binding_Buffer_Content_t *ContentPtr,
+ void *DataPtr,
+ size_t MaxContentSize);
+ void EdsLib_Binding_SetDescBuffer(EdsLib_Binding_DescriptorObject_t *DescrObj,
+ EdsLib_Binding_Buffer_Content_t *TargetBuffer);
-void EdsLib_Binding_InitDescriptor(
- EdsLib_Binding_DescriptorObject_t *ObjectUserData,
- const EdsLib_DatabaseObject_t *EdsDB,
- EdsLib_Id_t EdsId);
+ static inline bool EdsLib_Binding_IsDescBufferValid(const EdsLib_Binding_DescriptorObject_t *DescrObj)
+ {
+ return (DescrObj->BufferPtr != NULL && EdsLib_Is_Valid(DescrObj->EdsId)
+ && DescrObj->BufferPtr->MaxContentSize >= (DescrObj->Offset + DescrObj->TypeInfo.Size.Bytes));
+ }
-void EdsLib_Binding_InitSubObject(
- EdsLib_Binding_DescriptorObject_t *SubObject,
- const EdsLib_Binding_DescriptorObject_t *ParentObj,
- const EdsLib_DataTypeDB_EntityInfo_t *Component);
+ void EdsLib_Binding_InitDescriptor(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ const EdsLib_DatabaseObject_t *EdsDB,
+ EdsLib_Id_t EdsId);
-void *EdsLib_Binding_GetNativeObject(const EdsLib_Binding_DescriptorObject_t *ObjectUserData);
-size_t EdsLib_Binding_GetNativeSize(const EdsLib_Binding_DescriptorObject_t *ObjectUserData);
-size_t EdsLib_Binding_GetBufferMaxSize(const EdsLib_Binding_DescriptorObject_t *ObjectUserData);
+ void EdsLib_Binding_InitSubObject(EdsLib_Binding_DescriptorObject_t *SubObject,
+ const EdsLib_Binding_DescriptorObject_t *ParentObj,
+ const EdsLib_DataTypeDB_EntityInfo_t *Component);
-EdsLib_Binding_Compatibility_t EdsLib_Binding_CheckEdsObjectsCompatible(
- EdsLib_Binding_DescriptorObject_t *DestObject,
- EdsLib_Binding_DescriptorObject_t *SrcObject);
+ void *EdsLib_Binding_GetNativeObject(const EdsLib_Binding_DescriptorObject_t *ObjectUserData);
+ size_t EdsLib_Binding_GetNativeSize(const EdsLib_Binding_DescriptorObject_t *ObjectUserData);
+ size_t EdsLib_Binding_GetBufferMaxSize(const EdsLib_Binding_DescriptorObject_t *ObjectUserData);
-void EdsLib_Binding_InitStaticFields(EdsLib_Binding_DescriptorObject_t *ObjectUserData);
+ EdsLib_Binding_Compatibility_t
+ EdsLib_Binding_CheckEdsObjectsCompatible(EdsLib_Binding_DescriptorObject_t *DestObject,
+ EdsLib_Binding_DescriptorObject_t *SrcObject);
-int32_t EdsLib_Binding_InitFromPackedBuffer(
- EdsLib_Binding_DescriptorObject_t *ObjectUserData,
- const void *PackedData,
- size_t PackedDataSize);
+ void EdsLib_Binding_InitStaticFields(EdsLib_Binding_DescriptorObject_t *ObjectUserData);
-int32_t EdsLib_Binding_ExportToPackedBuffer(
- EdsLib_Binding_DescriptorObject_t *ObjectUserData,
- void *PackedData,
- size_t PackedDataSize);
+ int32_t EdsLib_Binding_InitFromPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ const void *PackedData,
+ size_t PackedDataSize);
-int32_t EdsLib_Binding_LoadValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData, EdsLib_GenericValueBuffer_t *ValBuf);
-int32_t EdsLib_Binding_StoreValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData, EdsLib_GenericValueBuffer_t *ValBuf);
+ int32_t EdsLib_Binding_ExportToPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ void *PackedData,
+ size_t PackedDataSize);
+ int32_t EdsLib_Binding_LoadValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ EdsLib_GenericValueBuffer_t *ValBuf);
+ int32_t EdsLib_Binding_StoreValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ EdsLib_GenericValueBuffer_t *ValBuf);
#ifdef __cplusplus
-} /* extern "C" */
+} /* extern "C" */
#endif
-
-#endif /* _EDSLIB_BINDING_OBJECTS_H_ */
-
+#endif /* _EDSLIB_BINDING_OBJECTS_H_ */
diff --git a/edslib/fsw/inc/edslib_database_types.h b/edslib/fsw/inc/edslib_database_types.h
index 65d0104..df78956 100644
--- a/edslib/fsw/inc/edslib_database_types.h
+++ b/edslib/fsw/inc/edslib_database_types.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_database_types.h
* \ingroup fsw
@@ -39,7 +38,6 @@
#ifndef _EDSLIB_DATABASE_TYPES_H_
#define _EDSLIB_DATABASE_TYPES_H_
-
#ifndef _EDSLIB_BUILD_
#error "Do not include edslib_database_types.h from application code; use the edslib API instead"
#endif
@@ -48,13 +46,11 @@
#error "This file is not intended to be compiled with a C++ compiler"
#endif
-
#include
#include
#include
#include "edslib_api_types.h"
-
/*******************************************************
* BASIC DATA TYPE DATABASE COMPONENTS
*******************************************************/
@@ -77,8 +73,8 @@ enum EdsLib_DbRef_Qualifier
EdsLib_DbRef_Qualifier_USERDEF2, /**< Refers to an entry in user-defined DB #2 (placeholder) */
};
-#define EDSLIB_TYPEREF_C(app,idx) { .Qualifier = EdsLib_DbRef_Qualifier_DATATYPE, .AppIndex = app, .SubIndex = idx }
-#define EDSLIB_INTFREF_C(app,idx) { .Qualifier = EdsLib_DbRef_Qualifier_INTERFACE, .AppIndex = app, .SubIndex = idx }
+#define EDSLIB_TYPEREF_C(app, idx) { .Qualifier = EdsLib_DbRef_Qualifier_DATATYPE, .AppIndex = app, .SubIndex = idx }
+#define EDSLIB_INTFREF_C(app, idx) { .Qualifier = EdsLib_DbRef_Qualifier_INTERFACE, .AppIndex = app, .SubIndex = idx }
typedef intmax_t (*EdsLib_IntegerCalibratorFunc_t)(intmax_t x);
typedef double (*EdsLib_FloatingPointCalibratorFunc_t)(double x);
@@ -115,12 +111,12 @@ typedef struct EdsLib_FloatCalPair EdsLib_FloatCalPair_t;
union EdsLib_HandlerArgument
{
EdsLib_ErrorControlType_t ErrorControl;
- EdsLib_FloatCalPair_t FloatCalibrator;
- EdsLib_IntegerCalPair_t IntegerCalibrator;
- const char *FixedString;
- double FixedFloat;
- intmax_t FixedInteger;
- uintmax_t FixedUnsigned;
+ EdsLib_FloatCalPair_t FloatCalibrator;
+ EdsLib_IntegerCalPair_t IntegerCalibrator;
+ const char *FixedString;
+ double FixedFloat;
+ intmax_t FixedInteger;
+ uintmax_t FixedUnsigned;
};
typedef union EdsLib_HandlerArgument EdsLib_HandlerArgument_t;
@@ -143,7 +139,7 @@ typedef enum
struct EdsLib_DerivativeEntry
{
- uint16_t IdentSeqIdx;
+ uint16_t IdentSeqIdx;
EdsLib_DatabaseRef_t RefObj;
};
@@ -152,9 +148,9 @@ typedef struct EdsLib_DerivativeEntry EdsLib_DerivativeEntry_t;
union EdsLib_SingleValue
{
const char *String;
- intmax_t SignedInt;
- uintmax_t UnsignedInt;
- double FloatingPt;
+ intmax_t SignedInt;
+ uintmax_t UnsignedInt;
+ double FloatingPt;
};
typedef union EdsLib_SingleValue EdsLib_SingleValue_t;
@@ -167,11 +163,10 @@ struct EdsLib_ValuePair
typedef struct EdsLib_ValuePair EdsLib_ValuePair_t;
-
union EdsLib_RefValue
{
EdsLib_SingleValue_t Single;
- EdsLib_ValuePair_t Pair;
+ EdsLib_ValuePair_t Pair;
};
typedef union EdsLib_RefValue EdsLib_RefValue_t;
@@ -179,8 +174,8 @@ typedef union EdsLib_RefValue EdsLib_RefValue_t;
typedef enum
{
EDSLIB_VALUE_CONSTRAINTSTYLE_NONE,
- EDSLIB_VALUE_CONSTRAINTSTYLE_SINGLE_VALUE, /* Simple comparison on a single number */
- EDSLIB_VALUE_CONSTRAINTSTYLE_RANGE_VALUE /* value within range */
+ EDSLIB_VALUE_CONSTRAINTSTYLE_SINGLE_VALUE, /* Simple comparison on a single number */
+ EDSLIB_VALUE_CONSTRAINTSTYLE_RANGE_VALUE /* value within range */
} EdsLib_Value_ConstraintStyle_t;
typedef enum
@@ -201,9 +196,9 @@ typedef enum
struct EdsLib_ValueEntry
{
- uint8_t BasicType;
- uint8_t ConstraintStyle;
- uint8_t InclusionStyle;
+ uint8_t BasicType;
+ uint8_t ConstraintStyle;
+ uint8_t InclusionStyle;
EdsLib_RefValue_t RefValue;
};
@@ -211,7 +206,7 @@ typedef struct EdsLib_ValueEntry EdsLib_ValueEntry_t;
struct EdsLib_ConstraintEntity
{
- EdsLib_SizeInfo_t Offset;
+ EdsLib_SizeInfo_t Offset;
EdsLib_DatabaseRef_t RefObj;
};
@@ -238,22 +233,22 @@ typedef struct EdsLib_IdentSequenceEntry EdsLib_IdentSequenceEntry_t;
struct EdsLib_IdentityCheckSequence
{
- uint16_t ConstraintEntityListSize;
- uint16_t ValueListSize;
- uint16_t SequenceEntryIdx;
- const EdsLib_IdentSequenceEntry_t *SequenceList;
- const EdsLib_ValueEntry_t *ValueList;
- const EdsLib_ConstraintEntity_t *ConstraintEntityList;
+ uint16_t ConstraintEntityListSize;
+ uint16_t ValueListSize;
+ uint16_t SequenceEntryIdx;
+ const EdsLib_IdentSequenceEntry_t *SequenceList;
+ const EdsLib_ValueEntry_t *ValueList;
+ const EdsLib_ConstraintEntity_t *ConstraintEntityList;
};
typedef struct EdsLib_IdentityCheckSequence EdsLib_IdentityCheckSequence_t;
struct EdsLib_FieldDetailEntry
{
- uint16_t EntryType;
- EdsLib_SizeInfo_t Offset;
- EdsLib_DatabaseRef_t RefObj;
- EdsLib_HandlerArgument_t HandlerArg;
+ uint16_t EntryType;
+ EdsLib_SizeInfo_t Offset;
+ EdsLib_DatabaseRef_t RefObj;
+ EdsLib_HandlerArgument_t HandlerArg;
const EdsLib_IdentityCheckSequence_t *CheckSequence;
};
@@ -261,12 +256,12 @@ typedef struct EdsLib_FieldDetailEntry EdsLib_FieldDetailEntry_t;
struct EdsLib_ContainerDescriptor
{
- EdsLib_SizeInfo_t MaxSize;
- uint16_t DerivativeListSize;
+ EdsLib_SizeInfo_t MaxSize;
+ uint16_t DerivativeListSize;
const EdsLib_IdentityCheckSequence_t *CheckSequence;
- const EdsLib_FieldDetailEntry_t *EntryList;
- const EdsLib_FieldDetailEntry_t *TrailerEntryList;
- const EdsLib_DerivativeEntry_t *DerivativeList;
+ const EdsLib_FieldDetailEntry_t *EntryList;
+ const EdsLib_FieldDetailEntry_t *TrailerEntryList;
+ const EdsLib_DerivativeEntry_t *DerivativeList;
};
typedef struct EdsLib_ContainerDescriptor EdsLib_ContainerDescriptor_t;
@@ -338,68 +333,66 @@ typedef struct EdsLib_GenericDescriptor EdsLib_GenericDescriptor_t;
union EdsLib_ObjectDetailDescriptor
{
- const void *Ptr;
+ const void *Ptr;
const EdsLib_ContainerDescriptor_t *Container;
- const EdsLib_ArrayDescriptor_t *Array;
- const EdsLib_StringDescriptor_t String;
- const EdsLib_NumberDescriptor_t Number;
- const EdsLib_AliasDescriptor_t Alias;
- const EdsLib_GenericDescriptor_t GenericType;
+ const EdsLib_ArrayDescriptor_t *Array;
+ const EdsLib_StringDescriptor_t String;
+ const EdsLib_NumberDescriptor_t Number;
+ const EdsLib_AliasDescriptor_t Alias;
+ const EdsLib_GenericDescriptor_t GenericType;
};
typedef union EdsLib_ObjectDetailDescriptor EdsLib_ObjectDetailDescriptor_t;
struct EdsLib_DataTypeDB_Entry
{
- uint64_t Checksum;
- uint8_t BasicType;
- uint8_t Flags;
- uint16_t NumSubElements;
- EdsLib_SizeInfo_t SizeInfo;
+ uint64_t Checksum;
+ uint8_t BasicType;
+ uint8_t Flags;
+ uint16_t NumSubElements;
+ EdsLib_SizeInfo_t SizeInfo;
EdsLib_ObjectDetailDescriptor_t Detail;
};
typedef struct EdsLib_DataTypeDB_Entry EdsLib_DataTypeDB_Entry_t;
-
typedef enum
{
- EDSLIB_IDENT_SEQUENCE_INVALID = 0, /**< Reserved marker, processing should stop when encountered */
- EDSLIB_IDENT_SEQUENCE_ENTITY_LOCATION, /**< Load/Save entity from location */
- EDSLIB_IDENT_SEQUENCE_CHECK_CONDITION, /**< Set/Check current value using the value constraint table */
- EDSLIB_IDENT_SEQUENCE_REFOBJ_RESULT, /**< A positive identification entry that refers to an object type */
- EDSLIB_IDENT_SEQUENCE_BOOLEAN_RESULT /**< A positive identification entry that is a boolean */
+ EDSLIB_IDENT_SEQUENCE_INVALID = 0, /**< Reserved marker, processing should stop when encountered */
+ EDSLIB_IDENT_SEQUENCE_ENTITY_LOCATION, /**< Load/Save entity from location */
+ EDSLIB_IDENT_SEQUENCE_CHECK_CONDITION, /**< Set/Check current value using the value constraint table */
+ EDSLIB_IDENT_SEQUENCE_REFOBJ_RESULT, /**< A positive identification entry that refers to an object type */
+ EDSLIB_IDENT_SEQUENCE_BOOLEAN_RESULT /**< A positive identification entry that is a boolean */
} EdsLib_IdentSequence_Enum_t;
-
/*******************************************************
* DISPLAY DATABASE COMPONENTS (extends basic info above)
*******************************************************/
struct EdsLib_SymbolTableEntry
{
- intmax_t SymValue;
- const char *SymName;
+ intmax_t SymValue;
+ const char *SymName;
};
typedef struct EdsLib_SymbolTableEntry EdsLib_SymbolTableEntry_t;
union EdsLib_DisplayArg
{
- EdsLib_DatabaseRef_t RefObj;
- const char * const *NameTable;
+ EdsLib_DatabaseRef_t RefObj;
+ const char *const *NameTable;
const EdsLib_SymbolTableEntry_t *SymTable;
- void *ArgValue;
+ void *ArgValue;
};
typedef union EdsLib_DisplayArg EdsLib_DisplayArg_t;
struct EdsLib_DisplayDB_Entry
{
- uint16_t DisplayHint; /**< Type of display logic to apply */
- uint16_t DisplayArgTableSize;
+ uint16_t DisplayHint; /**< Type of display logic to apply */
+ uint16_t DisplayArgTableSize;
EdsLib_DisplayArg_t DisplayArg; /**< Optional extra data - typically the name table for enums or containers */
- const char *Name; /**< Friendly name of data type or component */
+ const char *Name; /**< Friendly name of data type or component */
};
typedef struct EdsLib_DisplayDB_Entry EdsLib_DisplayDB_Entry_t;
@@ -408,7 +401,7 @@ typedef struct EdsLib_DisplayDB_Entry EdsLib_DisplayDB_Entry_t;
* INTERFACE DATABASE COMPONENTS
*******************************************************/
- typedef enum EdsLib_ArgMode
+typedef enum EdsLib_ArgMode
{
EdsLib_ArgMode_UNDEFINED,
EdsLib_ArgMode_OUT,
@@ -418,59 +411,58 @@ typedef struct EdsLib_DisplayDB_Entry EdsLib_DisplayDB_Entry_t;
typedef struct EdsLib_IntfDB_GenericTypeInfo
{
- const char *Name;
+ const char *Name;
EdsLib_DatabaseRef_t BaseRefObj;
} EdsLib_IntfDB_GenericTypeInfo_t;
typedef struct EdsLib_IntfDB_ArgumentEntry
{
- const char *Name;
- EdsLib_DatabaseRef_t RefObj;
+ const char *Name;
+ EdsLib_DatabaseRef_t RefObj;
EdsLib_ArgMode_Enum_t Mode;
} EdsLib_IntfDB_ArgumentEntry_t;
typedef struct EdsLib_IntfDB_CommandEntry
{
- const char *Name;
+ const char *Name;
const EdsLib_IntfDB_ArgumentEntry_t *ArgumentList;
- uint16_t ParentIdx;
- uint16_t ArgumentCount;
+ uint16_t ParentIdx;
+ uint16_t ArgumentCount;
} EdsLib_IntfDB_CommandEntry_t;
typedef struct EdsLib_IntfDB_DeclIntfEntry
{
- const char *Name;
+ const char *Name;
const EdsLib_IntfDB_CommandEntry_t *CommandList;
- uint16_t FirstIdx;
- uint16_t CommandCount;
+ uint16_t FirstIdx;
+ uint16_t CommandCount;
} EdsLib_IntfDB_DeclIntfEntry_t;
typedef struct EdsLib_IntfDB_GenericTypeMapInfo
{
- EdsLib_DatabaseRef_t ActualTypeRef;
- EdsLib_DatabaseRef_t GenTypeRef;
+ EdsLib_DatabaseRef_t ActualTypeRef;
+ EdsLib_DatabaseRef_t GenTypeRef;
} EdsLib_IntfDB_GenericTypeMapInfo_t;
typedef struct EdsLib_IntfDB_InterfaceEntry
{
- const char *Name;
+ const char *Name;
const EdsLib_IntfDB_GenericTypeMapInfo_t *GenericTypeMapList;
- uint16_t ParentIdx;
- uint16_t GenericTypeMapCount;
- EdsLib_DatabaseRef_t IntfTypeRef;
+ uint16_t ParentIdx;
+ uint16_t GenericTypeMapCount;
+ EdsLib_DatabaseRef_t IntfTypeRef;
} EdsLib_IntfDB_InterfaceEntry_t;
typedef struct EdsLib_IntfDB_ComponentEntry
{
- const char *Name;
+ const char *Name;
const EdsLib_IntfDB_InterfaceEntry_t *RequiredIntfList;
const EdsLib_IntfDB_InterfaceEntry_t *ProvidedIntfList;
- uint16_t FirstIdx;
- uint16_t RequiredIntfCount;
- uint16_t ProvidedIntfCount;
+ uint16_t FirstIdx;
+ uint16_t RequiredIntfCount;
+ uint16_t ProvidedIntfCount;
} EdsLib_IntfDB_ComponentEntry_t;
-
/*******************************************************
* TOP LEVEL OBJECTS
*
@@ -481,24 +473,23 @@ typedef struct EdsLib_IntfDB_ComponentEntry
struct EdsLib_App_DataTypeDB
{
- uint16_t MissionIdx;
- uint16_t DataTypeTableSize;
- const EdsLib_DataTypeDB_Entry_t *DataTypeTable;
+ uint16_t MissionIdx;
+ uint16_t DataTypeTableSize;
+ const EdsLib_DataTypeDB_Entry_t *DataTypeTable;
};
struct EdsLib_App_DisplayDB
{
- const char *EdsName;
- const EdsLib_DisplayDB_Entry_t *DisplayInfoTable;
+ const char *EdsName;
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoTable;
};
struct EdsLib_App_IntfDB
{
- const EdsLib_IntfDB_ComponentEntry_t *ComponentListEntries;
- const EdsLib_IntfDB_DeclIntfEntry_t *DeclIntfListEntries;
- uint16_t ComponentListSize;
- uint16_t DeclIntfListSize;
+ const EdsLib_IntfDB_ComponentEntry_t *ComponentListEntries;
+ const EdsLib_IntfDB_DeclIntfEntry_t *DeclIntfListEntries;
+ uint16_t ComponentListSize;
+ uint16_t DeclIntfListSize;
};
-
-#endif /* _EDSLIB_DATABASE_TYPES_H_ */
+#endif /* _EDSLIB_DATABASE_TYPES_H_ */
diff --git a/edslib/fsw/inc/edslib_datatypedb.h b/edslib/fsw/inc/edslib_datatypedb.h
index 75b1a25..4e02571 100644
--- a/edslib/fsw/inc/edslib_datatypedb.h
+++ b/edslib/fsw/inc/edslib_datatypedb.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb.h
* \ingroup fsw
@@ -36,7 +35,6 @@
#ifndef _EDSLIB_DATATYPEDB_H_
#define _EDSLIB_DATATYPEDB_H_
-
/*
* The EDS library uses the fixed-width types from the C99 stdint.h header file,
* rather than the OSAL types. This allows use in applications that are not
@@ -63,15 +61,12 @@
* This also represents the maximum number of digits for "BCD" value encoding types
*
*/
-#define EDSLIB_VALUEBUFFER_MAX_BINARY_SIZE 32
-
-
+#define EDSLIB_VALUEBUFFER_MAX_BINARY_SIZE 32
/******************************
* TYPEDEFS
******************************/
-
/**
* Return codes for Edslib functions, packed into an int32_t type.
*
@@ -90,21 +85,21 @@
*/
enum
{
- EDSLIB_SUCCESS = 0, /**< Operation fully successful; all post-conditions are met */
- EDSLIB_FAILURE = -1, /**< Unspecified failure, operation not successful; post-conditions are not met */
- EDSLIB_NOT_IMPLEMENTED = -2, /**< Function is not implemented in this version of EdsLib */
- EDSLIB_INVALID_SIZE_OR_TYPE = -3, /**< The user has specified an invalid size or type */
- EDSLIB_NAME_NOT_FOUND = -4, /**< Element/Structure Name not found in database */
- EDSLIB_INCOMPLETE_DB_OBJECT = -5, /**< A database element required for the requested operation is missing */
- EDSLIB_BUFFER_SIZE_ERROR = -6, /**< A user-supplied buffer is insufficient for storing the requested object */
- EDSLIB_INVALID_INDEX = -7, /**< A user-supplied index value is invalid */
- EDSLIB_NO_MATCHING_VALUE = -8, /**< No matching values were found in the DB */
- EDSLIB_ERROR_CONTROL_MISMATCH = -9, /**< Error control field did not match */
- EDSLIB_FIELD_MISMATCH = -10, /**< Length or Fixed Value field did not match */
- EDSLIB_INSUFFICIENT_MEMORY = -11, /**< Internal structure sizes were insufficient for operation */
- EDSLIB_TYPE_MAP_FAILED = -12, /**< Cannot map a generic type to a real type */
- EDSLIB_INVALID_OFFSET = -13, /**< Given offset does not exist, exceeds size of object */
- EDSLIB_NOT_FIXED_SIZE = -14 /**< A variably sized object used with a fixed size API */
+ EDSLIB_SUCCESS = 0, /**< Operation fully successful; all post-conditions are met */
+ EDSLIB_FAILURE = -1, /**< Unspecified failure, operation not successful; post-conditions are not met */
+ EDSLIB_NOT_IMPLEMENTED = -2, /**< Function is not implemented in this version of EdsLib */
+ EDSLIB_INVALID_SIZE_OR_TYPE = -3, /**< The user has specified an invalid size or type */
+ EDSLIB_NAME_NOT_FOUND = -4, /**< Element/Structure Name not found in database */
+ EDSLIB_INCOMPLETE_DB_OBJECT = -5, /**< A database element required for the requested operation is missing */
+ EDSLIB_BUFFER_SIZE_ERROR = -6, /**< A user-supplied buffer is insufficient for storing the requested object */
+ EDSLIB_INVALID_INDEX = -7, /**< A user-supplied index value is invalid */
+ EDSLIB_NO_MATCHING_VALUE = -8, /**< No matching values were found in the DB */
+ EDSLIB_ERROR_CONTROL_MISMATCH = -9, /**< Error control field did not match */
+ EDSLIB_FIELD_MISMATCH = -10, /**< Length or Fixed Value field did not match */
+ EDSLIB_INSUFFICIENT_MEMORY = -11, /**< Internal structure sizes were insufficient for operation */
+ EDSLIB_TYPE_MAP_FAILED = -12, /**< Cannot map a generic type to a real type */
+ EDSLIB_INVALID_OFFSET = -13, /**< Given offset does not exist, exceeds size of object */
+ EDSLIB_NOT_FIXED_SIZE = -14 /**< A variably sized object used with a fixed size API */
};
/*
@@ -120,7 +115,7 @@ enum
* This is the largest width signed integer that the platform can handle. It
* may be passed to the C library printf() function using modifier %lld.
*/
-typedef long long int EdsLib_Generic_SignedInt_t;
+typedef long long int EdsLib_Generic_SignedInt_t;
/**
* Type for holding generic unsigned integer values of the maximum width supported on the platform
@@ -128,7 +123,7 @@ typedef long long int EdsLib_Generic_SignedInt_t;
* This is the largest width unsigned integer that the platform can handle. It
* may be passed to the C library printf() function using modifiers %llu or %llx.
*/
-typedef unsigned long long int EdsLib_Generic_UnsignedInt_t;
+typedef unsigned long long int EdsLib_Generic_UnsignedInt_t;
/**
* Type for holding generic floating point values of the maximum precision supported on the platform
@@ -136,7 +131,7 @@ typedef unsigned long long int EdsLib_Generic_UnsignedInt_t;
* This is the largest / highest precision floating point type that the platform can handle. It
* may be passed to the C library printf() function using modifiers %Lf or %Lg.
*/
-typedef long double EdsLib_Generic_FloatingPoint_t;
+typedef long double EdsLib_Generic_FloatingPoint_t;
/**
* General purpose union for storing a numeric data element of any standard width.
@@ -148,19 +143,19 @@ typedef long double EdsLib_Generic_FloatingPoint_t;
typedef union
{
/* Fixed-width integer numbers */
- int8_t i8;
- uint8_t u8;
- int16_t i16;
+ int8_t i8;
+ uint8_t u8;
+ int16_t i16;
uint16_t u16;
- int32_t i32;
+ int32_t i32;
uint32_t u32;
- int64_t i64;
+ int64_t i64;
uint64_t u64;
/* Floating point numbers */
- float fpsgl; /* single precision; probably 32 bits, but not guaranteed */
- double fpdbl; /* double precision; probably 64 bits, but not guaranteed */
- long double fpmax; /* extended precision, if supported. Might alias to double. */
+ float fpsgl; /* single precision; probably 32 bits, but not guaranteed */
+ double fpdbl; /* double precision; probably 64 bits, but not guaranteed */
+ long double fpmax; /* extended precision, if supported. Might alias to double. */
/*
* Buffer to hold a full IEEE-754 quad even if the
@@ -176,15 +171,14 @@ typedef union
/* member to allow data access as raw bytes */
uint8_t BinaryData[EDSLIB_VALUEBUFFER_MAX_BINARY_SIZE];
-
/*
* Also include members representing the longest standard C99 type.
* (these likely are aliases to other members already defined)
* This is necessary if passing the value to a C library function, such as printf()
*/
- bool Boolean;
- EdsLib_Generic_SignedInt_t SignedInteger;
- EdsLib_Generic_UnsignedInt_t UnsignedInteger;
+ bool Boolean;
+ EdsLib_Generic_SignedInt_t SignedInteger;
+ EdsLib_Generic_UnsignedInt_t UnsignedInteger;
EdsLib_Generic_FloatingPoint_t FloatingPoint;
} EdsLib_GenericValueUnion_t;
@@ -206,7 +200,7 @@ typedef struct
* EDSLIB_BASICTYPE_BINARY indicates that the BinaryData and/or StringData member is valid
*
*/
- EdsLib_BasicType_t ValueType;
+ EdsLib_BasicType_t ValueType;
EdsLib_GenericValueUnion_t Value;
} EdsLib_GenericValueBuffer_t;
@@ -216,19 +210,19 @@ typedef struct
*/
struct EdsLib_DataTypeDB_TypeInfo
{
- EdsLib_BasicType_t ElemType; /**< Type of element */
- uint16_t Flags; /**< Special handling indicators */
- uint16_t NumSubElements; /**< Number of sub-elements below this (0 for atomic entities) */
- EdsLib_SizeInfo_t Size; /**< Basic Size of object (base object only - not derived types) */
+ EdsLib_BasicType_t ElemType; /**< Type of element */
+ uint16_t Flags; /**< Special handling indicators */
+ uint16_t NumSubElements; /**< Number of sub-elements below this (0 for atomic entities) */
+ EdsLib_SizeInfo_t Size; /**< Basic Size of object (base object only - not derived types) */
};
typedef struct EdsLib_DataTypeDB_TypeInfo EdsLib_DataTypeDB_TypeInfo_t;
struct EdsLib_DataTypeDB_DerivedTypeInfo
{
- uint16_t NumDerivatives; /**< Number of defined derivative types for this type */
- uint16_t NumConstraints; /**< Number of elements in the object that have constraints */
- EdsLib_SizeInfo_t MaxSize; /**< Maximum Size of element (= size of largest derivative type) */
+ uint16_t NumDerivatives; /**< Number of defined derivative types for this type */
+ uint16_t NumConstraints; /**< Number of elements in the object that have constraints */
+ EdsLib_SizeInfo_t MaxSize; /**< Maximum Size of element (= size of largest derivative type) */
};
typedef struct EdsLib_DataTypeDB_DerivedTypeInfo EdsLib_DataTypeDB_DerivedTypeInfo_t;
@@ -236,7 +230,7 @@ typedef struct EdsLib_DataTypeDB_DerivedTypeInfo EdsLib_DataTypeDB_DerivedTypeIn
struct EdsLib_DataTypeDB_DerivativeObjectInfo
{
EdsLib_Id_t EdsId;
- uint16_t DerivativeTableIndex; /**< Index into the list of derived types */
+ uint16_t DerivativeTableIndex; /**< Index into the list of derived types */
};
typedef struct EdsLib_DataTypeDB_DerivativeObjectInfo EdsLib_DataTypeDB_DerivativeObjectInfo_t;
@@ -254,8 +248,8 @@ typedef struct EdsLib_DataTypeDB_DerivativeObjectInfo EdsLib_DataTypeDB_Derivati
*/
struct EdsLib_DataTypeDB_EntityInfo
{
- EdsLib_Id_t EdsId; /**< The EDS ID value representing the specific type of the data */
- uint16_t Flags; /**< Special handling indicators */
+ EdsLib_Id_t EdsId; /**< The EDS ID value representing the specific type of the data */
+ uint16_t Flags; /**< Special handling indicators */
EdsLib_SizeInfo_t Offset; /**< Absolute Offset of member within the top-level parent structure */
EdsLib_SizeInfo_t MaxSize; /**< Total allocated space for this object within parent structure */
};
@@ -270,12 +264,10 @@ typedef struct EdsLib_DataTypeDB_EntityInfo EdsLib_DataTypeDB_EntityInfo_t;
* @param ConstraintValue the value that should be in the field
* @param Arg opaque user argument
*/
-typedef void (*EdsLib_ConstraintCallback_t)(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
- EdsLib_GenericValueBuffer_t *ConstraintValue,
- void *Arg);
-
-
+typedef void (*EdsLib_ConstraintCallback_t)(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
+ EdsLib_GenericValueBuffer_t *ConstraintValue,
+ void *Arg);
/******************************
* API CALLS
@@ -286,666 +278,745 @@ extern "C"
{
#endif
-/**
- * Initialize the EdsLib DataTypeDB internal state
- *
- * This should be called once during initialization by
- * programs wishing to use the EDS DataTypeDB API calls.
- *
- * This function initializes all shared/global state information
- * internal to EdsLib. In particular this will generate lookup
- * tables that may be necessary for error control algorithms to
- * work correctly (e.g. CRC).
- */
-void EdsLib_DataTypeDB_Initialize(void);
-
-/**
- * Extract the AppIdx value from a dictionary structure
- *
- * The "DataTypeDB_t" type is abstract, so application code can only treat it as an opaque
- * object pointer and cannot directly access the fields inside.
- *
- * This function queries the "AppIdx" value from inside the dictionary object
- *
- * @param AppDict the application dictionary object
- * @return The associated index
- */
-uint16_t EdsLib_DataTypeDB_GetAppIdx(const EdsLib_DataTypeDB_t AppDict);
-
-/**
- * Register an application in a dynamic runtime EdsLib runtime database.
- *
- * NOTE: Multiple registrations of the same application have no effect, as only a single entry
- * ever exists for an individual application.
- *
- * @param GD the active EdsLib runtime database object
- * @param AppDict the application dictionary object
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_Register(EdsLib_DatabaseObject_t *GD, EdsLib_DataTypeDB_t AppDict);
+ /**
+ * Initialize the EdsLib DataTypeDB internal state
+ *
+ * This should be called once during initialization by
+ * programs wishing to use the EDS DataTypeDB API calls.
+ *
+ * This function initializes all shared/global state information
+ * internal to EdsLib. In particular this will generate lookup
+ * tables that may be necessary for error control algorithms to
+ * work correctly (e.g. CRC).
+ */
+ void EdsLib_DataTypeDB_Initialize(void);
-/**
- * Unregister an application in a dynamic runtime EdsLib runtime database.
- *
- * @param GD the active EdsLib runtime database object
- * @param AppIdx Application identifier as returned by EdsLib_DataTypeDB_Register()
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_Unregister(EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
+ /**
+ * Extract the AppIdx value from a dictionary structure
+ *
+ * The "DataTypeDB_t" type is abstract, so application code can only treat it as an opaque
+ * object pointer and cannot directly access the fields inside.
+ *
+ * This function queries the "AppIdx" value from inside the dictionary object
+ *
+ * @param AppDict the application dictionary object
+ * @return The associated index
+ */
+ uint16_t EdsLib_DataTypeDB_GetAppIdx(const EdsLib_DataTypeDB_t AppDict);
-/**
- * Given any global message identifier index, retrieve the basic details of that data type
- * The details are in reference to the local (native) representation not necessarily the packed representation
- *
- * @param GD the runtime database object
- * @param EdsId the message identifier word
- * @param TypeInfo Buffer for storing the member info
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_DataTypeDB_TypeInfo_t *TypeInfo);
+ /**
+ * Register an application in a dynamic runtime EdsLib runtime database.
+ *
+ * NOTE: Multiple registrations of the same application have no effect, as only a single entry
+ * ever exists for an individual application.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param AppDict the application dictionary object
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t EdsLib_DataTypeDB_Register(EdsLib_DatabaseObject_t *GD, EdsLib_DataTypeDB_t AppDict);
-/**
- * Given a type with sub-members (container, array, interface, etc), look up the identification and offset for
- * a given child index within that parent type
- *
- * SubMsgId will be set to an invalid identifier if the index is out of range, or the parent does not have any members
- *
- * @param GD the runtime database object
- * @param EdsId the parent message identifier word
- * @param SubIndex the sub-element number within the parent
- * @param MemberInfo Buffer to store the Component information
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t SubIndex, EdsLib_DataTypeDB_EntityInfo_t *MemberInfo);
+ /**
+ * Unregister an application in a dynamic runtime EdsLib runtime database.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param AppIdx Application identifier as returned by EdsLib_DataTypeDB_Register()
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t EdsLib_DataTypeDB_Unregister(EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
-/**
- * Given a type with sub-members (container, array, interface, etc), look up the identification and offset for
- * the immediate sub-member containing the item at the given offset. This only locates the _immediate_ subelement
- * containing the offset, which could be another container. This function may have to be called multiple times
- * to locate a single item.
- *
- * @param GD the runtime database object
- * @param EdsId the parent message identifier word
- * @param ByteOffset the sub-element number within the parent
- * @param MemberInfo Buffer to store the Component information
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint32_t ByteOffset, EdsLib_DataTypeDB_EntityInfo_t *MemberInfo);
+ /**
+ * Given any global message identifier index, retrieve the basic details of that data type
+ * The details are in reference to the local (native) representation not necessarily the packed representation
+ *
+ * @param GD the runtime database object
+ * @param EdsId the message identifier word
+ * @param TypeInfo Buffer for storing the member info
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_DataTypeDB_TypeInfo_t *TypeInfo);
-/**
- * Given a type with sub-members (container, array, interface, etc), look up the identification and offset for
- * the immediate sub-member containing the item at the given bit offset. This only locates the _immediate_ subelement
- * containing the offset, which could be another container. This function may have to be called multiple times
- * to locate a single item.
- *
- * @note This lookup is based on the nominal bit position, which is the position when _all_ fields are present,
- * even fields that might be exclusive to eachother. In actual packed objects, the bit position will vary if
- * a container has conditionally-encoded entities.
- *
- * @param GD the runtime database object
- * @param EdsId the parent message identifier word
- * @param BitOffset the sub-element bit offset within the parent
- * @param MemberInfo Buffer to store the Component information
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_GetMemberByPackedOffset(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint32_t BitOffset, EdsLib_DataTypeDB_EntityInfo_t *CompInfo);
+ /**
+ * Given a type with sub-members (container, array, interface, etc), look up the identification and offset for
+ * a given child index within that parent type
+ *
+ * SubMsgId will be set to an invalid identifier if the index is out of range, or the parent does not have any
+ * members
+ *
+ * @param GD the runtime database object
+ * @param EdsId the parent message identifier word
+ * @param SubIndex the sub-element number within the parent
+ * @param MemberInfo Buffer to store the Component information
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t SubIndex,
+ EdsLib_DataTypeDB_EntityInfo_t *MemberInfo);
-/**
- * Look up the derived type of the message identified by EdsId,
- * given a constraint entity and constraint value.
- *
- * @param GD the runtime database object
- * @param BaseId the message identifier word
- * @param ConstraintEntityIdx The entity index that the ConstraintValue refers to
- * @param ConstraintValue the actual constraint value to look up
- * @return The derived interface ID, or an invalid ID if an error occurs.
- */
-int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t DerivId, EdsLib_Id_t *DerivedEdsId);
+ /**
+ * Given a type with sub-members (container, array, interface, etc), look up the identification and offset for
+ * the immediate sub-member containing the item at the given offset. This only locates the _immediate_ subelement
+ * containing the offset, which could be another container. This function may have to be called multiple times
+ * to locate a single item.
+ *
+ * @param GD the runtime database object
+ * @param EdsId the parent message identifier word
+ * @param ByteOffset the sub-element number within the parent
+ * @param MemberInfo Buffer to store the Component information
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint32_t ByteOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *MemberInfo);
-/**
- * Look up the constraint entity corresponding to the given index
- *
- * @param GD the runtime database object
- * @param EdsId the message identifier word
- * @param ConstraintEntityIdx The constraint entity number
- * @param MemberInfo Buffer to store result (output)
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t ConstraintIdx, EdsLib_DataTypeDB_EntityInfo_t *MemberInfo);
+ /**
+ * Given a type with sub-members (container, array, interface, etc), look up the identification and offset for
+ * the immediate sub-member containing the item at the given bit offset. This only locates the _immediate_
+ * subelement containing the offset, which could be another container. This function may have to be called multiple
+ * times to locate a single item.
+ *
+ * @note This lookup is based on the nominal bit position, which is the position when _all_ fields are present,
+ * even fields that might be exclusive to eachother. In actual packed objects, the bit position will vary if
+ * a container has conditionally-encoded entities.
+ *
+ * @param GD the runtime database object
+ * @param EdsId the parent message identifier word
+ * @param BitOffset the sub-element bit offset within the parent
+ * @param MemberInfo Buffer to store the Component information
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_GetMemberByPackedOffset(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint32_t BitOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo);
-/**
- * Look up the details regarding types that are derived from the given type
- *
- * These details include:
- * - the maximum size of the largest derivative (for e.g. allocating a buffer)
- * - the number of member entities in the base type with constraints
- *
- * @param GD the runtime database object
- * @param EdsId the interface identifier word
- * @param DerivInfo buffer to hold the derivation information
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_DataTypeDB_DerivedTypeInfo_t *DerivInfo);
+ /**
+ * Look up the derived type of the message identified by EdsId,
+ * given a constraint entity and constraint value.
+ *
+ * @param GD the runtime database object
+ * @param BaseId the message identifier word
+ * @param ConstraintEntityIdx The entity index that the ConstraintValue refers to
+ * @param ConstraintValue the actual constraint value to look up
+ * @return The derived interface ID, or an invalid ID if an error occurs.
+ */
+ int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t DerivId,
+ EdsLib_Id_t *DerivedEdsId);
-/**
- * Find all required constraint value(s) to produce a specified derived message
- * from the given base type.
- *
- * As there may be an arbitrary number of constraints on fields on the base type, this
- * is implemented as an iterator with a user-supplied callback. The user callback will
- * be invoked for each constraint, indicating the required value and its location/offset
- * within the container.
- *
- * @note
- * If the indicated base type is not actually a base type for the indicated derived type,
- * the function will return an ERROR response. However, the user callback may be invoked
- * before the error is detected, so the caller is responsible for discarding any constraints
- * collected prior to the error.
- *
- * @param GD the runtime database object
- * @param BaseId the message identifier word of the base type
- * @param DerivedId the message identifier word of the derived/final type
- * @param Callback user-supplied function to invoke for each constraint
- * @param CbArg user-supplied argument to pass to the callback
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t BaseId, EdsLib_Id_t DerivedId, EdsLib_ConstraintCallback_t Callback, void *CbArg);
+ /**
+ * Look up the constraint entity corresponding to the given index
+ *
+ * @param GD the runtime database object
+ * @param EdsId the message identifier word
+ * @param ConstraintEntityIdx The constraint entity number
+ * @param MemberInfo Buffer to store result (output)
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t ConstraintIdx,
+ EdsLib_DataTypeDB_EntityInfo_t *MemberInfo);
-/**
- * Determine if a base type relationship exists between the two types
- *
- * Returns a successful response if the passed-in base ID is a base type for
- * the passed-in derived type ID.
- *
- * @param GD the runtime database object
- * @param BaseId the message identifier word of the base type
- * @param DerivedId the message identifier word of the derived/final type
- * @return EDS_SUCCESS if successful
- */
-int32_t EdsLib_DataTypeDB_BaseCheck(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t BaseId, EdsLib_Id_t DerivedId);
+ /**
+ * Look up the details regarding types that are derived from the given type
+ *
+ * These details include:
+ * - the maximum size of the largest derivative (for e.g. allocating a buffer)
+ * - the number of member entities in the base type with constraints
+ *
+ * @param GD the runtime database object
+ * @param EdsId the interface identifier word
+ * @param DerivInfo buffer to hold the derivation information
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_DataTypeDB_DerivedTypeInfo_t *DerivInfo);
+ /**
+ * Find all required constraint value(s) to produce a specified derived message
+ * from the given base type.
+ *
+ * As there may be an arbitrary number of constraints on fields on the base type, this
+ * is implemented as an iterator with a user-supplied callback. The user callback will
+ * be invoked for each constraint, indicating the required value and its location/offset
+ * within the container.
+ *
+ * @note
+ * If the indicated base type is not actually a base type for the indicated derived type,
+ * the function will return an ERROR response. However, the user callback may be invoked
+ * before the error is detected, so the caller is responsible for discarding any constraints
+ * collected prior to the error.
+ *
+ * @param GD the runtime database object
+ * @param BaseId the message identifier word of the base type
+ * @param DerivedId the message identifier word of the derived/final type
+ * @param Callback user-supplied function to invoke for each constraint
+ * @param CbArg user-supplied argument to pass to the callback
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t BaseId,
+ EdsLib_Id_t DerivedId,
+ EdsLib_ConstraintCallback_t Callback,
+ void *CbArg);
-/**
- * Perform conversion from a native/unpacked object to an EDS/packed bitstream
- *
- * This packs/encodes a single object type in one step. The object will be encoded
- * according to the object type supplied via the EdsId parameter. After encoding
- * the database will be checked for derived types matching the constraints, and
- * if a matching derived type is found, encoding continues for the derived type.
- * This process repeats until no further derivation is found.
- *
- * After encoding, all special fields in the object will be updated to the correct
- * values. Fixed value fields will be set, and Error control fields and Length fields
- * will be computed and set to the correct values per EDS specifications.
- *
- * @note This API relies on the packed size as indicated in the Database.
- * With the addition of variably-sized objects to the EDS specification, the packed
- * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
- * and will return an error code if used with a variably-sized object.
- *
- * @param GD the runtime database object
- * @param EdsId Buffer containing identifier for the top level encapsulation.
- * After encoding, this is set to the final encoded object type.
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param MaxPackedBitSize Maximum size of destination buffer, in bits
- * @param SourceByteSize Maximum size of source buffer, in bytes
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_PackPartialObject()
- * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxPackedBitSize, uint32_t SourceByteSize);
+ /**
+ * Determine if a base type relationship exists between the two types
+ *
+ * Returns a successful response if the passed-in base ID is a base type for
+ * the passed-in derived type ID.
+ *
+ * @param GD the runtime database object
+ * @param BaseId the message identifier word of the base type
+ * @param DerivedId the message identifier word of the derived/final type
+ * @return EDS_SUCCESS if successful
+ */
+ int32_t EdsLib_DataTypeDB_BaseCheck(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t BaseId, EdsLib_Id_t DerivedId);
-/**
- * Perform conversion from a native/unpacked object to an EDS/packed bitstream in stages
- *
- * This packs the output buffer in stages. The object will be encoded similar to the
- * EdsLib_DataTypeDB_PackCompleteObject(), with respect to derived object identification
- * and encoding. However, the object is not completed in that the values for special fields
- * (i.e. ErrorControl, Length, Fixed values) are not computed or set in the encoded object.
- *
- * This function should be used by applications that need to further process the content
- * or otherwise customize the procedure during the encoding process.
- *
- * To facilitate this, an additional parameter "StartingBit" is included, which allows
- * the application to specify the starting bit position for encoding. This allows
- * encoding to be resumed from a previous call. Bits prior to this starting bit will
- * not be re-encoded. On the first invocation, the StartingBit should be set 0. On
- * subsequent invocations, the StartingBit should be set to the end of the object
- * (in bits) from the previous invocation.
- *
- * The EdsLib_DataTypeDB_FinalizePackedObject() API call can be used at a later time
- * to compute the values for special fields within the encoded binary.
- *
- * @note This API relies on the packed size as indicated in the Database.
- * With the addition of variably-sized objects to the EDS specification, the packed
- * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
- * and will return an error code if used with a variably-sized object.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param MaxPackedBitSize Maximum size of destination buffer, in bits
- * @param SourceByteSize Maximum size of source buffer, in bytes
- * @param StartingBit Number of bits that are already encoded (i.e. from previous call)
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxPackedBitSize, uint32_t SourceByteSize, uint32_t StartingBit);
+ /**
+ * Perform conversion from a native/unpacked object to an EDS/packed bitstream
+ *
+ * This packs/encodes a single object type in one step. The object will be encoded
+ * according to the object type supplied via the EdsId parameter. After encoding
+ * the database will be checked for derived types matching the constraints, and
+ * if a matching derived type is found, encoding continues for the derived type.
+ * This process repeats until no further derivation is found.
+ *
+ * After encoding, all special fields in the object will be updated to the correct
+ * values. Fixed value fields will be set, and Error control fields and Length fields
+ * will be computed and set to the correct values per EDS specifications.
+ *
+ * @note This API relies on the packed size as indicated in the Database.
+ * With the addition of variably-sized objects to the EDS specification, the packed
+ * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
+ * and will return an error code if used with a variably-sized object.
+ *
+ * @param GD the runtime database object
+ * @param EdsId Buffer containing identifier for the top level encapsulation.
+ * After encoding, this is set to the final encoded object type.
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param MaxPackedBitSize Maximum size of destination buffer, in bits
+ * @param SourceByteSize Maximum size of source buffer, in bytes
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_PackPartialObject()
+ * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxPackedBitSize,
+ uint32_t SourceByteSize);
-/**
- * Perform conversion from a native/unpacked object to an EDS/packed bitstream
- *
- * This API is the same as EdsLib_DataTypeDB_PackCompleteObject() except the packed
- * bit size is passed as an input/output value, because the encoded form may have fewer
- * bits if the objects are variably sized.
- *
- * The PackedSize buffer should initially be set to the maximum size of the
- * input and output buffers, in bytes and bits, respectively. After encoding, it
- * these fields will be set to the actual size of encoded data.
- *
- * @param GD the runtime database object
- * @param EdsId Buffer containing identifier for the top level encapsulation.
- * After encoding, this is set to the final encoded object type.
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param PackedSize Size of destination buffer as input, final packed size as output
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, EdsLib_SizeInfo_t *PackedSize);
+ /**
+ * Perform conversion from a native/unpacked object to an EDS/packed bitstream in stages
+ *
+ * This packs the output buffer in stages. The object will be encoded similar to the
+ * EdsLib_DataTypeDB_PackCompleteObject(), with respect to derived object identification
+ * and encoding. However, the object is not completed in that the values for special fields
+ * (i.e. ErrorControl, Length, Fixed values) are not computed or set in the encoded object.
+ *
+ * This function should be used by applications that need to further process the content
+ * or otherwise customize the procedure during the encoding process.
+ *
+ * To facilitate this, an additional parameter "StartingBit" is included, which allows
+ * the application to specify the starting bit position for encoding. This allows
+ * encoding to be resumed from a previous call. Bits prior to this starting bit will
+ * not be re-encoded. On the first invocation, the StartingBit should be set 0. On
+ * subsequent invocations, the StartingBit should be set to the end of the object
+ * (in bits) from the previous invocation.
+ *
+ * The EdsLib_DataTypeDB_FinalizePackedObject() API call can be used at a later time
+ * to compute the values for special fields within the encoded binary.
+ *
+ * @note This API relies on the packed size as indicated in the Database.
+ * With the addition of variably-sized objects to the EDS specification, the packed
+ * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
+ * and will return an error code if used with a variably-sized object.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param MaxPackedBitSize Maximum size of destination buffer, in bits
+ * @param SourceByteSize Maximum size of source buffer, in bytes
+ * @param StartingBit Number of bits that are already encoded (i.e. from previous call)
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxPackedBitSize,
+ uint32_t SourceByteSize,
+ uint32_t StartingBit);
-/**
- * Perform conversion from a native/unpacked object to an EDS/packed bitstream in stages
- *
- * This packs the output buffer in stages. The object will be encoded similar to the
- * EdsLib_DataTypeDB_PackCompleteObject(), with respect to derived object identification
- * and encoding. However, the object is not completed in that the values for special fields
- * (i.e. ErrorControl, Length, Fixed values) are not computed or set in the encoded object.
- *
- * This function should be used by applications that need to further process the content
- * or otherwise customize the procedure during the encoding process.
- *
- * To facilitate this, an additional parameter "ProcessedSize" is included, which allows
- * the application to specify the starting position for encoding. This allows
- * encoding to be resumed from a previous call. Bits prior to this location will
- * not be re-encoded. On the first invocation, the ProcessedSize should be set 0. On
- * subsequent invocations, the ProcessedSize should be set to the end of the object
- * from the previous invocation. ProcessedSize will be updated to the point
- * where encoding left off in this call.
- *
- * The EdsLib_DataTypeDB_FinalizePackedObjectVarSize() API call can be used at a later time
- * to compute the values for special fields within the encoded binary.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param MaxSize Maximum size of buffers, in bits (dest) and bytes (source)
- * @param ProcessedSize Number of bits that are already encoded (i.e. from previous call)
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_PackCompleteObject()
- * \sa EdsLib_DataTypeDB_FinalizePackedObject()
- */
-int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, const EdsLib_SizeInfo_t *MaxSize, EdsLib_SizeInfo_t *ProcessedSize);
+ /**
+ * Perform conversion from a native/unpacked object to an EDS/packed bitstream
+ *
+ * This API is the same as EdsLib_DataTypeDB_PackCompleteObject() except the packed
+ * bit size is passed as an input/output value, because the encoded form may have fewer
+ * bits if the objects are variably sized.
+ *
+ * The PackedSize buffer should initially be set to the maximum size of the
+ * input and output buffers, in bytes and bits, respectively. After encoding, it
+ * these fields will be set to the actual size of encoded data.
+ *
+ * @param GD the runtime database object
+ * @param EdsId Buffer containing identifier for the top level encapsulation.
+ * After encoding, this is set to the final encoded object type.
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param PackedSize Size of destination buffer as input, final packed size as output
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ EdsLib_SizeInfo_t *PackedSize);
-/**
- * Perform conversion from an EDS/packed bitstream to a native/unpacked object
- *
- * This unpacks/decodes a single object type in one step. The object will be decoded
- * according to the object type supplied via the EdsId parameter. After decoding
- * the database will be checked for derived types matching the constraints, and
- * if a matching derived type is found, decoding continues for the derived type.
- * This process repeats until no further derivation is found.
- *
- * After decoding completes, any special fields within the object are verified
- * against the EDS specifications. Length entries, FixedValue entries, and ErrorControl
- * entries are checked against locally computed according to EDS specifications and
- * values within the decoded object are compared against the locally computed value.
- * Any mismatch will generate an error.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the packed object.
- * After decoding, this is set to the final decoded object type.
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param MaxNativeByteSize Maximum size of destination buffer, in bytes
- * @param SourceBitSize Maximum size of source buffer, in bits
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxNativeByteSize, uint32_t SourceBitSize);
+ /**
+ * Perform conversion from a native/unpacked object to an EDS/packed bitstream in stages
+ *
+ * This packs the output buffer in stages. The object will be encoded similar to the
+ * EdsLib_DataTypeDB_PackCompleteObject(), with respect to derived object identification
+ * and encoding. However, the object is not completed in that the values for special fields
+ * (i.e. ErrorControl, Length, Fixed values) are not computed or set in the encoded object.
+ *
+ * This function should be used by applications that need to further process the content
+ * or otherwise customize the procedure during the encoding process.
+ *
+ * To facilitate this, an additional parameter "ProcessedSize" is included, which allows
+ * the application to specify the starting position for encoding. This allows
+ * encoding to be resumed from a previous call. Bits prior to this location will
+ * not be re-encoded. On the first invocation, the ProcessedSize should be set 0. On
+ * subsequent invocations, the ProcessedSize should be set to the end of the object
+ * from the previous invocation. ProcessedSize will be updated to the point
+ * where encoding left off in this call.
+ *
+ * The EdsLib_DataTypeDB_FinalizePackedObjectVarSize() API call can be used at a later time
+ * to compute the values for special fields within the encoded binary.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param MaxSize Maximum size of buffers, in bits (dest) and bytes (source)
+ * @param ProcessedSize Number of bits that are already encoded (i.e. from previous call)
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_PackCompleteObject()
+ * \sa EdsLib_DataTypeDB_FinalizePackedObject()
+ */
+ int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ const EdsLib_SizeInfo_t *MaxSize,
+ EdsLib_SizeInfo_t *ProcessedSize);
-/**
- * Perform conversion from an EDS/packed bitstream to a native/unpacked object in stages.
- *
- * This unpacks the output buffer in stages. The object will be decoded similar to the
- * EdsLib_DataTypeDB_UnpackCompleteObject(), with respect to derived object identification
- * and decoding. However, the object is not verified in that the values for special fields
- * (i.e. ErrorControl, Length, Fixed values) are passed through and not checked.
- *
- * This function should be used by applications that need to further process the content
- * or otherwise customize the procedure during the decoding process.
- *
- * To facilitate this, an additional parameter "StartingByte" is included, which allows
- * the application to specify the starting byte position for decoding. This allows
- * decoding to be resumed from a previous call. Bytes prior to this starting byte will
- * not be re-decoded. On the first invocation, the StartingByte should be set 0. On
- * subsequent invocations, the StartingByte should be set to the end of the object
- * (in bytes) from the previous invocation.
- *
- * The EdsLib_DataTypeDB_VerifyUnpackedObject() API call can be used at a later time
- * to check the values for special fields within the decoded structure.
- *
- * @note This API relies on the packed size as indicated in the Database.
- * With the addition of variably-sized objects to the EDS specification, the packed
- * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
- * and will return an error code if used with a variably-sized object.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param MaxNativeByteSize Maximum size of destination buffer, in bytes
- * @param SourceBitSize Maximum size of source buffer, in bits
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxNativeByteSize, uint32_t SourceBitSize, uint32_t StartingByte);
+ /**
+ * Perform conversion from an EDS/packed bitstream to a native/unpacked object
+ *
+ * This unpacks/decodes a single object type in one step. The object will be decoded
+ * according to the object type supplied via the EdsId parameter. After decoding
+ * the database will be checked for derived types matching the constraints, and
+ * if a matching derived type is found, decoding continues for the derived type.
+ * This process repeats until no further derivation is found.
+ *
+ * After decoding completes, any special fields within the object are verified
+ * against the EDS specifications. Length entries, FixedValue entries, and ErrorControl
+ * entries are checked against locally computed according to EDS specifications and
+ * values within the decoded object are compared against the locally computed value.
+ * Any mismatch will generate an error.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the packed object.
+ * After decoding, this is set to the final decoded object type.
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param MaxNativeByteSize Maximum size of destination buffer, in bytes
+ * @param SourceBitSize Maximum size of source buffer, in bits
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxNativeByteSize,
+ uint32_t SourceBitSize);
-/**
- * Perform conversion from an EDS/packed bitstream to a native/unpacked object in stages.
- *
- * This unpacks the output buffer in stages. The object will be decoded similar to the
- * EdsLib_DataTypeDB_UnpackCompleteObject(), with respect to derived object identification
- * and decoding. However, the object is not verified in that the values for special fields
- * (i.e. ErrorControl, Length, Fixed values) are passed through and not checked.
- *
- * This function should be used by applications that need to further process the content
- * or otherwise customize the procedure during the decoding process.
- *
- * To facilitate this, an additional parameter "ProcessedSize" is included, which allows
- * the application to specify the starting byte position for decoding. This allows
- * decoding to be resumed from a previous call. Bytes prior to this starting byte will
- * not be re-decoded. On the first invocation, the ProcessedSize should be set 0. On
- * subsequent invocations, the ProcessedSize should be set to the end of the object
- * from the previous invocation.
- *
- * The EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize() API call can be used at a later time
- * to check the values for special fields within the decoded structure.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param DestBuffer Pointer to the destination buffer
- * @param SourceBuffer Pointer to the source buffer (not modified by this call)
- * @param MaxSize Maximum size of destination buffer (bytes) and source buffer (bits)
- * @param ProcessedSize Size of processed data
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_UnpackCompleteObject()
- * \sa EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, const EdsLib_SizeInfo_t *MaxSize, EdsLib_SizeInfo_t *ProcessedSize);
+ /**
+ * Perform conversion from an EDS/packed bitstream to a native/unpacked object in stages.
+ *
+ * This unpacks the output buffer in stages. The object will be decoded similar to the
+ * EdsLib_DataTypeDB_UnpackCompleteObject(), with respect to derived object identification
+ * and decoding. However, the object is not verified in that the values for special fields
+ * (i.e. ErrorControl, Length, Fixed values) are passed through and not checked.
+ *
+ * This function should be used by applications that need to further process the content
+ * or otherwise customize the procedure during the decoding process.
+ *
+ * To facilitate this, an additional parameter "StartingByte" is included, which allows
+ * the application to specify the starting byte position for decoding. This allows
+ * decoding to be resumed from a previous call. Bytes prior to this starting byte will
+ * not be re-decoded. On the first invocation, the StartingByte should be set 0. On
+ * subsequent invocations, the StartingByte should be set to the end of the object
+ * (in bytes) from the previous invocation.
+ *
+ * The EdsLib_DataTypeDB_VerifyUnpackedObject() API call can be used at a later time
+ * to check the values for special fields within the decoded structure.
+ *
+ * @note This API relies on the packed size as indicated in the Database.
+ * With the addition of variably-sized objects to the EDS specification, the packed
+ * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
+ * and will return an error code if used with a variably-sized object.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param MaxNativeByteSize Maximum size of destination buffer, in bytes
+ * @param SourceBitSize Maximum size of source buffer, in bits
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxNativeByteSize,
+ uint32_t SourceBitSize,
+ uint32_t StartingByte);
-/**
- * Compute values for special fields within a packed object.
- *
- * Special fields such as Error Control, Length Entries, and Fixed Values need
- * to be computed after encoding is complete. These cannot be computed
- * on-the-fly during encoding because they require the complete object to known.
- * For instance, a Length would reflect the complete length of the packet, and
- * an Error Control such as CRC-16 requires the Length to be set correctly prior
- * to calculation. Due to these interdependencies, the computation needs to be
- * deferred until the entire content is known.
- *
- * Note that the EdsLib_DataTypeDB_PackCompleteObject() API invokes this
- * function automatically. This only needs to be invoked by the application
- * when using the EdsLib_DataTypeDB_PackPartialObjectVarSize() API.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param PackedData Pointer to the encoded/packed buffer
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const void *NativeBuffer, void *PackedBuffer, const EdsLib_SizeInfo_t *ProcessedSize);
+ /**
+ * Perform conversion from an EDS/packed bitstream to a native/unpacked object in stages.
+ *
+ * This unpacks the output buffer in stages. The object will be decoded similar to the
+ * EdsLib_DataTypeDB_UnpackCompleteObject(), with respect to derived object identification
+ * and decoding. However, the object is not verified in that the values for special fields
+ * (i.e. ErrorControl, Length, Fixed values) are passed through and not checked.
+ *
+ * This function should be used by applications that need to further process the content
+ * or otherwise customize the procedure during the decoding process.
+ *
+ * To facilitate this, an additional parameter "ProcessedSize" is included, which allows
+ * the application to specify the starting byte position for decoding. This allows
+ * decoding to be resumed from a previous call. Bytes prior to this starting byte will
+ * not be re-decoded. On the first invocation, the ProcessedSize should be set 0. On
+ * subsequent invocations, the ProcessedSize should be set to the end of the object
+ * from the previous invocation.
+ *
+ * The EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize() API call can be used at a later time
+ * to check the values for special fields within the decoded structure.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param DestBuffer Pointer to the destination buffer
+ * @param SourceBuffer Pointer to the source buffer (not modified by this call)
+ * @param MaxSize Maximum size of destination buffer (bytes) and source buffer (bits)
+ * @param ProcessedSize Size of processed data
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_UnpackCompleteObject()
+ * \sa EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ const EdsLib_SizeInfo_t *MaxSize,
+ EdsLib_SizeInfo_t *ProcessedSize);
-/**
- * Compute values for special fields within a packed object.
- *
- * Special fields such as Error Control, Length Entries, and Fixed Values need
- * to be computed after encoding is complete. These cannot be computed
- * on-the-fly during encoding because they require the complete object to known.
- * For instance, a Length would reflect the complete length of the packet, and
- * an Error Control such as CRC-16 requires the Length to be set correctly prior
- * to calculation. Due to these interdependencies, the computation needs to be
- * deferred until the entire content is known.
- *
- * Note that the EdsLib_DataTypeDB_PackCompleteObject() API invokes this
- * function automatically. This only needs to be invoked by the application
- * when using the EdsLib_DataTypeDB_PackPartialObject() API.
- *
- * @note This API relies on the packed size as indicated in the Database.
- * With the addition of variably-sized objects to the EDS specification, the packed
- * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
- * and will return an error code if used with a variably-sized object.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param PackedData Pointer to the encoded/packed buffer
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_FinalizePackedObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_FinalizePackedObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *PackedData);
+ /**
+ * Compute values for special fields within a packed object.
+ *
+ * Special fields such as Error Control, Length Entries, and Fixed Values need
+ * to be computed after encoding is complete. These cannot be computed
+ * on-the-fly during encoding because they require the complete object to known.
+ * For instance, a Length would reflect the complete length of the packet, and
+ * an Error Control such as CRC-16 requires the Length to be set correctly prior
+ * to calculation. Due to these interdependencies, the computation needs to be
+ * deferred until the entire content is known.
+ *
+ * Note that the EdsLib_DataTypeDB_PackCompleteObject() API invokes this
+ * function automatically. This only needs to be invoked by the application
+ * when using the EdsLib_DataTypeDB_PackPartialObjectVarSize() API.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param PackedData Pointer to the encoded/packed buffer
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_PackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *NativeBuffer,
+ void *PackedBuffer,
+ const EdsLib_SizeInfo_t *ProcessedSize);
-/**
- * Constants for EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize() "RecomputeFields" parameter.
- *
- * These are bitmasks that can be OR'ed together to indicate which aspects to recompute
- * during the verification of a decoded object.
- */
-enum
-{
- EDSLIB_DATATYPEDB_RECOMPUTE_NONE = 0, /**< Do not recompute any fields (default) */
- EDSLIB_DATATYPEDB_RECOMPUTE_LENGTH = 0x01, /**< Recompute Length field of the native object */
- EDSLIB_DATATYPEDB_RECOMPUTE_ERRORCONTROL = 0x02, /**< Recompute Error Control field of the native object */
- EDSLIB_DATATYPEDB_RECOMPUTE_FIXEDVALUE = 0x04, /**< Recompute Fixed Value fields of the native object */
- EDSLIB_DATATYPEDB_RECOMPUTE_ALL = 0xFF /**< Recompute all relevant fields */
-};
+ /**
+ * Compute values for special fields within a packed object.
+ *
+ * Special fields such as Error Control, Length Entries, and Fixed Values need
+ * to be computed after encoding is complete. These cannot be computed
+ * on-the-fly during encoding because they require the complete object to known.
+ * For instance, a Length would reflect the complete length of the packet, and
+ * an Error Control such as CRC-16 requires the Length to be set correctly prior
+ * to calculation. Due to these interdependencies, the computation needs to be
+ * deferred until the entire content is known.
+ *
+ * Note that the EdsLib_DataTypeDB_PackCompleteObject() API invokes this
+ * function automatically. This only needs to be invoked by the application
+ * when using the EdsLib_DataTypeDB_PackPartialObject() API.
+ *
+ * @note This API relies on the packed size as indicated in the Database.
+ * With the addition of variably-sized objects to the EDS specification, the packed
+ * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
+ * and will return an error code if used with a variably-sized object.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param PackedData Pointer to the encoded/packed buffer
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_FinalizePackedObjectVarSize()
+ */
+ int32_t
+ EdsLib_DataTypeDB_FinalizePackedObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *PackedData);
-/**
- * Verify values for special fields within an unpacked (native) object.
- *
- * Special fields such as Error Control, Length Entries, and Fixed Values need
- * to be verified after decoding is complete. These cannot be computed
- * on-the-fly during encoding because they require the complete object to known.
- * For instance, a Length would reflect the complete length of the packet, and
- * an Error Control such as CRC-16 requires the entire content to be known
- * prior to verification. Due to these interdependencies, the computation needs
- * to be deferred until the entire content is known.
- *
- * Note that the EdsLib_DataTypeDB_UnpackCompleteObject() API invokes this
- * function automatically. This only needs to be invoked by the application
- * when using the EdsLib_DataTypeDB_UnpackPartialObjectVarSize() API.
- *
- * Note that in order to calculate an error control field such as a CRC, this
- * function needs a pointer to the raw (encoded) data in addition to the decoded
- * data. If this is set NULL, then the field(s) cannot be checked.
- *
- * In addition to verification of the original values from the encoded object,
- * this function can also update the values to match the decoded object if desired.
- * For instance, some historical code might assume that an embedded LengthEntry
- * field will be related to the "sizeof()" operator in C. However, the size of
- * an EDS object will not necessarily match the size of the corresponding C structure
- * due to native representation of values and alignment padding. To appease
- * older applications, the value of the Length field can be adjusted to match
- * the native structure instead of encoded object.
- *
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param UnpackedObj Pointer to the decoded/unpacked buffer which is to be checked.
- * @param PackedData Pointer to the encoded/packed buffer, for reference when verifying
- * fields. May be set NULL to skip verification (i.e. if recomputing fields).
- * @param RecomputeFields A bitmask indicating the fields to recompute. Should be
- * a bitwise OR of the flags defined in the respective enumeration.
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EDSLIB_DATATYPEDB_RECOMPUTE_NONE
- * \sa EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *NativeBuffer, const void *PackedBuffer, uint32_t RecomputeFields, const EdsLib_SizeInfo_t *ProcessedSize);
+ /**
+ * Constants for EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize() "RecomputeFields" parameter.
+ *
+ * These are bitmasks that can be OR'ed together to indicate which aspects to recompute
+ * during the verification of a decoded object.
+ */
+ enum
+ {
+ EDSLIB_DATATYPEDB_RECOMPUTE_NONE = 0, /**< Do not recompute any fields (default) */
+ EDSLIB_DATATYPEDB_RECOMPUTE_LENGTH = 0x01, /**< Recompute Length field of the native object */
+ EDSLIB_DATATYPEDB_RECOMPUTE_ERRORCONTROL = 0x02, /**< Recompute Error Control field of the native object */
+ EDSLIB_DATATYPEDB_RECOMPUTE_FIXEDVALUE = 0x04, /**< Recompute Fixed Value fields of the native object */
+ EDSLIB_DATATYPEDB_RECOMPUTE_ALL = 0xFF /**< Recompute all relevant fields */
+ };
-/**
- * Verify values for special fields within an unpacked (native) object.
- *
- * Special fields such as Error Control, Length Entries, and Fixed Values need
- * to be verified after decoding is complete. These cannot be computed
- * on-the-fly during encoding because they require the complete object to known.
- * For instance, a Length would reflect the complete length of the packet, and
- * an Error Control such as CRC-16 requires the entire content to be known
- * prior to verification. Due to these interdependencies, the computation needs
- * to be deferred until the entire content is known.
- *
- * Note that the EdsLib_DataTypeDB_UnpackCompleteObject() API invokes this
- * function automatically. This only needs to be invoked by the application
- * when using the EdsLib_DataTypeDB_UnpackPartialObject() API.
- *
- * Note that in order to calculate an error control field such as a CRC, this
- * function needs a pointer to the raw (encoded) data in addition to the decoded
- * data. If this is set NULL, then the field(s) cannot be checked.
- *
- * In addition to verification of the original values from the encoded object,
- * this function can also update the values to match the decoded object if desired.
- * For instance, some historical code might assume that an embedded LengthEntry
- * field will be related to the "sizeof()" operator in C. However, the size of
- * an EDS object will not necessarily match the size of the corresponding C structure
- * due to native representation of values and alignment padding. To appease
- * older applications, the value of the Length field can be adjusted to match
- * the native structure instead of encoded object.
- *
- * @note This API relies on the packed size as indicated in the Database.
- * With the addition of variably-sized objects to the EDS specification, the packed
- * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
- * and will return an error code if used with a variably-sized object.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param UnpackedObj Pointer to the decoded/unpacked buffer which is to be checked.
- * @param PackedData Pointer to the encoded/packed buffer, for reference when verifying
- * fields. May be set NULL to skip verification (i.e. if recomputing fields).
- * @param RecomputeFields A bitmask indicating the fields to recompute. Should be
- * a bitwise OR of the flags defined in the respective enumeration.
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- *
- * \sa EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize()
- */
-int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- void *UnpackedObj, const void *PackedObj, uint32_t RecomputeFields);
+ /**
+ * Verify values for special fields within an unpacked (native) object.
+ *
+ * Special fields such as Error Control, Length Entries, and Fixed Values need
+ * to be verified after decoding is complete. These cannot be computed
+ * on-the-fly during encoding because they require the complete object to known.
+ * For instance, a Length would reflect the complete length of the packet, and
+ * an Error Control such as CRC-16 requires the entire content to be known
+ * prior to verification. Due to these interdependencies, the computation needs
+ * to be deferred until the entire content is known.
+ *
+ * Note that the EdsLib_DataTypeDB_UnpackCompleteObject() API invokes this
+ * function automatically. This only needs to be invoked by the application
+ * when using the EdsLib_DataTypeDB_UnpackPartialObjectVarSize() API.
+ *
+ * Note that in order to calculate an error control field such as a CRC, this
+ * function needs a pointer to the raw (encoded) data in addition to the decoded
+ * data. If this is set NULL, then the field(s) cannot be checked.
+ *
+ * In addition to verification of the original values from the encoded object,
+ * this function can also update the values to match the decoded object if desired.
+ * For instance, some historical code might assume that an embedded LengthEntry
+ * field will be related to the "sizeof()" operator in C. However, the size of
+ * an EDS object will not necessarily match the size of the corresponding C structure
+ * due to native representation of values and alignment padding. To appease
+ * older applications, the value of the Length field can be adjusted to match
+ * the native structure instead of encoded object.
+ *
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param UnpackedObj Pointer to the decoded/unpacked buffer which is to be checked.
+ * @param PackedData Pointer to the encoded/packed buffer, for reference when verifying
+ * fields. May be set NULL to skip verification (i.e. if recomputing fields).
+ * @param RecomputeFields A bitmask indicating the fields to recompute. Should be
+ * a bitwise OR of the flags defined in the respective enumeration.
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EDSLIB_DATATYPEDB_RECOMPUTE_NONE
+ * \sa EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *NativeBuffer,
+ const void *PackedBuffer,
+ uint32_t RecomputeFields,
+ const EdsLib_SizeInfo_t *ProcessedSize);
-/**
- * Initialize fixed values within a newly-created unpacked (native) object.
- *
- * On derived containers, the EDS specifies Value constraints on fields within
- * the base container that are subsequently used for identification. This
- * function initializes those fields which are specified in the EDS for the
- * given container type.
- *
- * This function should be called whenever a new object is instantiated in
- * memory.
- *
- * @param GD the runtime database object
- * @param EdsId The identifier for the top level encapsulation
- * @param UnpackedObj Pointer to the decoded/unpacked buffer which is to be initialized.
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *UnpackedObj);
+ /**
+ * Verify values for special fields within an unpacked (native) object.
+ *
+ * Special fields such as Error Control, Length Entries, and Fixed Values need
+ * to be verified after decoding is complete. These cannot be computed
+ * on-the-fly during encoding because they require the complete object to known.
+ * For instance, a Length would reflect the complete length of the packet, and
+ * an Error Control such as CRC-16 requires the entire content to be known
+ * prior to verification. Due to these interdependencies, the computation needs
+ * to be deferred until the entire content is known.
+ *
+ * Note that the EdsLib_DataTypeDB_UnpackCompleteObject() API invokes this
+ * function automatically. This only needs to be invoked by the application
+ * when using the EdsLib_DataTypeDB_UnpackPartialObject() API.
+ *
+ * Note that in order to calculate an error control field such as a CRC, this
+ * function needs a pointer to the raw (encoded) data in addition to the decoded
+ * data. If this is set NULL, then the field(s) cannot be checked.
+ *
+ * In addition to verification of the original values from the encoded object,
+ * this function can also update the values to match the decoded object if desired.
+ * For instance, some historical code might assume that an embedded LengthEntry
+ * field will be related to the "sizeof()" operator in C. However, the size of
+ * an EDS object will not necessarily match the size of the corresponding C structure
+ * due to native representation of values and alignment padding. To appease
+ * older applications, the value of the Length field can be adjusted to match
+ * the native structure instead of encoded object.
+ *
+ * @note This API relies on the packed size as indicated in the Database.
+ * With the addition of variably-sized objects to the EDS specification, the packed
+ * size is no longer fixed. Thus thus API is only applicable to fixed-size objects,
+ * and will return an error code if used with a variably-sized object.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param UnpackedObj Pointer to the decoded/unpacked buffer which is to be checked.
+ * @param PackedData Pointer to the encoded/packed buffer, for reference when verifying
+ * fields. May be set NULL to skip verification (i.e. if recomputing fields).
+ * @param RecomputeFields A bitmask indicating the fields to recompute. Should be
+ * a bitwise OR of the flags defined in the respective enumeration.
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ *
+ * \sa EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize()
+ */
+ int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *UnpackedObj,
+ const void *PackedObj,
+ uint32_t RecomputeFields);
-/**
- * Given an unpacked/native buffer, extract a value using EDS-specified semantics.
- *
- * @param GD the runtime database object
- * @param SourceBuffer The message buffer (read-only, not modified by this call)
- * @param ComponentInfo The ID of the message and field (offset) within the message to extract
- * @param DestBuffer Buffer to store result information.
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_GenericValueBuffer_t *DestBuffer, const void *SrcPtr);
+ /**
+ * Initialize fixed values within a newly-created unpacked (native) object.
+ *
+ * On derived containers, the EDS specifies Value constraints on fields within
+ * the base container that are subsequently used for identification. This
+ * function initializes those fields which are specified in the EDS for the
+ * given container type.
+ *
+ * This function should be called whenever a new object is instantiated in
+ * memory.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The identifier for the top level encapsulation
+ * @param UnpackedObj Pointer to the decoded/unpacked buffer which is to be initialized.
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t
+ EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *UnpackedObj);
-/**
- * Given an unpacked (native byte order) message buffer, store a value using EDS-specified semantics.
- *
- * @param GD the runtime database object
- * @param DestBuffer The message buffer (modified by this call)
- * @param ComponentInfo The ID of the message and field (offset) within the message to write
- * @param SourceValue Value to store in the message.
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr, EdsLib_GenericValueBuffer_t *SrcBuffer);
+ /**
+ * Given an unpacked/native buffer, extract a value using EDS-specified semantics.
+ *
+ * @param GD the runtime database object
+ * @param SourceBuffer The message buffer (read-only, not modified by this call)
+ * @param ComponentInfo The ID of the message and field (offset) within the message to extract
+ * @param DestBuffer Buffer to store result information.
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_GenericValueBuffer_t *DestBuffer,
+ const void *SrcPtr);
-/**
- * Given an unpacked (native byte order) container, identify the derived contents using EDS-specified constraint values
- *
- * Reads the necessary field(s) from the encapsulation interface to determine the derived contents
- *
- * This version will not read fields beyond the given size parameter. As such it can be used with partial
- * objects or other buffers that may not be sized as expected. However, if the size does not
- * include the field(s) containing the constraints, then identification process will fail.
- *
- * @param GD the runtime database object
- * @param EdsId The ID of the encapsulation interface
- * @param BufferPtr The message buffer (read-only, not modified by this call)
- * @param BufferSize The known size of the message buffer (will not read beyond this point)
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const void *BufferPtr, size_t BufferSize, EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo);
+ /**
+ * Given an unpacked (native byte order) message buffer, store a value using EDS-specified semantics.
+ *
+ * @param GD the runtime database object
+ * @param DestBuffer The message buffer (modified by this call)
+ * @param ComponentInfo The ID of the message and field (offset) within the message to write
+ * @param SourceValue Value to store in the message.
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *DestPtr,
+ EdsLib_GenericValueBuffer_t *SrcBuffer);
-/**
- * Given an unpacked (native byte order) container, identify the derived contents using EDS-specified constraint values
- *
- * Reads the necessary field(s) from the encapsulation interface to determine the derived contents
- *
- * This version requires that the buffer points to a complete instance of the object, the size of the buffer is
- * assumed to be equal to or greater than the EDS-defined data type size.
- *
- * @param GD the runtime database object
- * @param EdsId The ID of the encapsulation interface
- * @param MessageBuffer The message buffer (read-only, not modified by this call)
- * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
- */
-int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const void *MessageBuffer, EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo);
+ /**
+ * Given an unpacked (native byte order) container, identify the derived contents using EDS-specified constraint
+ * values
+ *
+ * Reads the necessary field(s) from the encapsulation interface to determine the derived contents
+ *
+ * This version will not read fields beyond the given size parameter. As such it can be used with partial
+ * objects or other buffers that may not be sized as expected. However, if the size does not
+ * include the field(s) containing the constraints, then identification process will fail.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The ID of the encapsulation interface
+ * @param BufferPtr The message buffer (read-only, not modified by this call)
+ * @param BufferSize The known size of the message buffer (will not read beyond this point)
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *BufferPtr,
+ size_t BufferSize,
+ EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo);
-/**
- * Convert the numeric value representation from its current type into the desired type
- *
- * If the current type and desired type is equal, then no change is made. Otherwise, the value may be converted
- * as necessary to achieve the desired type. The value buffer is modified in place.
- *
- * @param ValueBuff An EdsLib value buffer object containing a numeric value
- * @param DesiredType The desired type of value
- */
-void EdsLib_DataTypeConvert(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_BasicType_t DesiredType);
+ /**
+ * Given an unpacked (native byte order) container, identify the derived contents using EDS-specified constraint
+ * values
+ *
+ * Reads the necessary field(s) from the encapsulation interface to determine the derived contents
+ *
+ * This version requires that the buffer points to a complete instance of the object, the size of the buffer is
+ * assumed to be equal to or greater than the EDS-defined data type size.
+ *
+ * @param GD the runtime database object
+ * @param EdsId The ID of the encapsulation interface
+ * @param MessageBuffer The message buffer (read-only, not modified by this call)
+ * @return EDSLIB_SUCCESS if successful, error code if unsuccessful
+ */
+ int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *MessageBuffer,
+ EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo);
+ /**
+ * Convert the numeric value representation from its current type into the desired type
+ *
+ * If the current type and desired type is equal, then no change is made. Otherwise, the value may be converted
+ * as necessary to achieve the desired type. The value buffer is modified in place.
+ *
+ * @param ValueBuff An EdsLib value buffer object containing a numeric value
+ * @param DesiredType The desired type of value
+ */
+ void EdsLib_DataTypeConvert(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_BasicType_t DesiredType);
#ifdef __cplusplus
-} /* extern C */
+} /* extern C */
#endif
-
-#endif /* _EDSLIB_DATATYPEDB_H_ */
+#endif /* _EDSLIB_DATATYPEDB_H_ */
diff --git a/edslib/fsw/inc/edslib_displaydb.h b/edslib/fsw/inc/edslib_displaydb.h
index ba22b13..b839ded 100644
--- a/edslib/fsw/inc/edslib_displaydb.h
+++ b/edslib/fsw/inc/edslib_displaydb.h
@@ -19,7 +19,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb.h
* \ingroup fsw
@@ -38,10 +37,8 @@
#ifndef _EDSLIB_DISPLAYDB_H_
#define _EDSLIB_DISPLAYDB_H_
-
#include "edslib_datatypedb.h"
-
/******************************
* TYPEDEFS
******************************/
@@ -54,9 +51,10 @@
*/
struct EdsLib_EntityDescriptor
{
- EdsLib_DataTypeDB_EntityInfo_t EntityInfo; /**< Information about the component itself (type ID, offset within parent) */
- const char *FullName; /**< Name of current element as obtained from name dictionary */
- uint16_t SeqNum;
+ EdsLib_DataTypeDB_EntityInfo_t
+ EntityInfo; /**< Information about the component itself (type ID, offset within parent) */
+ const char *FullName; /**< Name of current element as obtained from name dictionary */
+ uint16_t SeqNum;
};
typedef struct EdsLib_EntityDescriptor EdsLib_EntityDescriptor_t;
@@ -80,7 +78,6 @@ typedef void (*EdsLib_EntityCallback_t)(void *Arg, const EdsLib_EntityDescriptor
*/
typedef void (*EdsLib_SymbolCallback_t)(void *Arg, const char *SymbolName, int32_t SymbolValue);
-
/******************************
* API CALLS
******************************/
@@ -90,296 +87,328 @@ extern "C"
{
#endif
-/**
- * Initialize the DisplayDB subsystem
- *
- * This should be called once during initialization by
- * programs wishing to use the Display API calls.
- */
-void EdsLib_DisplayDB_Initialize(void);
-
-/**
- * Gets the printable name of the EDS associated with the given Message ID.
- *
- * \note
- * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
- * so it is safe to use in directly in printf()-style calls.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to look up
- * @returns a constant character string representing the application name
- */
-const char *EdsLib_DisplayDB_GetEdsName(const EdsLib_DatabaseObject_t *GD, uint16_t AppId);
-
-/**
- * Gets the base printable message/structure name associated with the given Message ID.
- *
- * This does NOT include any namespace qualifier. It returns only the base name of the object.
- *
- * \note
- * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
- * so it is safe to use in directly in printf()-style calls.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to look up
- * @returns a constant character string representing the message/structure name
- */
-const char *EdsLib_DisplayDB_GetBaseName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId);
-
-
-/**
- * Gets the base printable namespace name associated with the given Message ID.
- *
- * This is usually (by convention) the same as the EDS name but that is not required
- *
- * \note
- * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
- * so it is safe to use in directly in printf()-style calls.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to look up
- * @returns a constant character string representing the namespace name
- */
-const char *EdsLib_DisplayDB_GetNamespace(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId);
-
-/**
- * Gets the fully qualified message/structure name associated with the given Message ID.
- *
- * This includes a namespace qualifier i.e. NAME_SPACE/name format. This name is created by
- * concatenating the two so a storage buffer must be supplied by the user. The same buffer is
- * also returned by the function to ease use inside printf-style arguments.
- *
- * \note
- * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
- * so it is safe to use in directly in printf()-style calls. However in this case the user
- * buffer will be set to an empty string.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to look up
- * @param Buffer memory to store result string
- * @param BufferSize size of Buffer
- * @returns the user buffer that was passed in.
- */
-const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *Buffer, uint32_t BufferSize);
-
-/**
- * Gets details on how to display a given data type, if available.
- *
- * Returns a "DisplayHint" and associated argument if present in the database.
- * - For EDSLIB_DISPLAYHINT_ENUM_SYMTABLE, the argument is the symbolic name/value table
- * - For EDSLIB_DISPLAYHINT_SUBNAMES, the argument is a const char array of the names
- *
- * Other types/usage of the pointer argument may be added.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to look up
- * @return Display Hint type if successful
- */
-EdsLib_DisplayHint_t EdsLib_DisplayDB_GetDisplayHint(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId);
-
-
-/**
- * Parse a string and convert into an EDS identifier value
- *
- * @param GD the active EdsLib runtime database object
- * @param String The null-terminated string to parse as an EDS identifier
- * @returns The converted EdsLib_Id_t value
- *
- * \sa EdsLib_EdsId_ToString()
- */
-EdsLib_Id_t EdsLib_DisplayDB_LookupTypeName(const EdsLib_DatabaseObject_t *GD, const char *String);
-
-
-/**
- * Converts a named member entity into an integer index if possible
- *
- * Attempts to find a member identified by the Name parameter within the specified EDS object.
- * If found, the index/position of that name is stored in the SubIndex output buffer, which can
- * then be passed to the EdsLib_DataTypeDB_GetMemberByIndex() function to obtain further
- * information about the entity.
- *
- * This function only works on containers and array types that have sub entities; it does not
- * work on scalar types.
- *
- * @note This function is _not_ a substitute for a structure name lookup as done by the
- * locate function. In particular this API only operates at the given direct data type level
- * and it will not search inside any sub-objects to find a matching name. In particular
- * this function will not find anything that is not directly named within the given data type,
- * such as a base type objects which are "hidden".
- *
- * Other types/usage of the pointer argument may be added.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the ID of the data type to operate on
- * @param Name the subentity name to find
- * @param SubIndex buffer to store the index/position
- * @return EDSLIB_SUCCESS if successful, or appropriate error code if unsuccessful
- */
-int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *Name, uint16_t *SubIndex);
-
-/**
- * Converts an integer index into a member name if possible
- *
- * Looks up the display name of a sub entity at the given index. If there is no sub member
- * at the given index or it has no name associated with it in the database, then NULL is
- * returned.
- *
- * This function only works on containers and array types that have sub entities; it does not
- * work on scalar types. NULL will be returned in all those cases.
- *
- * In particular, this method can be used to check if an EDS index refers to a "base type"
- * of a container object. These are valid container indices that have no name associated,
- * and thus this function will return NULL.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the ID of the data type to operate on
- * @param SubIndex the index/position to look up
- * @return pointer to member name if successful, NULL if no name exists
- */
-const char *EdsLib_DisplayDB_GetNameByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t SubIndex);
-
-/**
- * Walk through the payload structure of a given message/structure ID and generate a callback for each
- * element within the structure with the detailed parameter information.
- *
- * This "ShortNames" variant will NOT descend into sub-structures within the parent structure given. The "FullName"
- * in the parameter descriptor will always be just a single (short) element name. An element that is a sub structure will have
- * the "SubStructureId" value set to a nonzero value and array elements will only get a single callback for the first
- * element of the array.
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to walk. This may be any known/valid ID (message ID or a bare structure ID).
- * @param Callback the callback function to invoke for each element in the message payload
- * @param Arg opaque argument that is passed directly to the callback function
- *
- * \sa EdsLib_Iterator_Payload_FullNames()
- */
-void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_EntityCallback_t Callback, void *Arg);
-void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_EntityCallback_t Callback, void *Arg);
-/**
- * Walk through the deep payload structure of a given message/structure ID and find an element name matching
- * the name supplied as the "FullName" value within the LocateDesc parameter. If found, the rest of the parameters
- * in LocateDesc will be set according to the found element.
- *
- * This version will descend into all sub structures and name matching is performed on the fully qualified name which should
- * be in C-style syntax. For instance:
- *
- * Member.SubMember.SubArray[ArrayIndex].Value
- *
- * @param GD the active EdsLib runtime database object
- * @param EdsId the message ID to walk. This may be any known/valid ID (message ID or a bare structure ID).
- * @param Name The parameter to locate.
- * @param CompInfo Output buffer representing member location.
- * @returns EDSLIB_SUCCESS if successful, error code if element name was not found.
- */
-int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *Name, EdsLib_DataTypeDB_EntityInfo_t *CompInfo);
-
-
-/**
- * Debugging utility function to write arbitrary data contents to the stdio stream as hexadecimal
- * The data is treated as a binary blob.
- *
- * @param output any valid STDIO output stream (e.g. stdout)
- * @param DataPtr pointer to the block of data
- * @param DisplayOffset the offset of the first byte in the data block. This is typically zero but may be nonzero if the data
- * should be viewed as a continuation of a previous display.
- * @param Count The number of bytes to display.
- */
-void EdsLib_Generate_Hexdump(void *output, const uint8_t *DataPtr, uint16_t DisplayOffset, uint16_t Count);
-
-
-/* **************************************************************************************
- * EDS BINARY <-> STRING CONVERTERS
- *
- * These functions convert between user-friendly string representations and the numeric
- * representations of EDS identifiers and EDS-defined datatypes.
- * **************************************************************************************/
-
-
-/**
- * Convert a binary/machine value into a printable string using the EdsLib_DisplayHint_t as guidelines for how to interpret the data.
- * - For character strings, printable chars (as indicated by isprint()) will copied to the output buffer and null termination is ensured.
- * - For integer numbers, these will be converted to symbolic constants if the "EnumNamespace" is set and a matching value is found.
- * - For numbers for which a symbolic constant is not defined, conversion will fall back to an appropriate sprintf-like behavior
- *
- * EdsLib_Scalar_FromString() will perform the reverse operation
- *
- * @param GD the active EdsLib runtime database object
- * @param OutputBuffer location to store the output string
- * @param BufferSize maximum size of the OutputBuffer
- * @param SrcPtr pointer to binary/machine data. Typically this is a pointer to a byte offset inside an "unpacked" message or structure,
- * retrieved via the "MemberAbsOffset" field as returned from a locate or walk routine.
- * @returns EDSLIB_SUCCESS if successful, error code if conversion failed.
- *
- * \sa EdsLib_Scalar_FromString()
- */
-int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *OutputBuffer, uint32_t BufferSize, const void *SrcPtr);
-
-
-/**
- * Convert string into binary/machine data using the EdsLib_DisplayHint_t as guidelines for how to interpret the data.
- * - For character strings, all chars will copied to the destination up to the size limit or the terminating NULL
- * - For integer numbers, these may be symbolic constants if the "EnumNamespace" is set and a matching value is found.
- * - For numbers for which a symbolic constant is not defined, conversion will fall back to an appropriate strtol/ul/d/f system call
- *
- * EdsLib_Scalar_ToString() will perform the reverse operation
- *
- * @param GD the active EdsLib runtime database object
- * @param DestPtr pointer to binary/machine data. Typically this is a pointer to a byte offset inside a message or structure, retrieved
- * via the "MemberAbsOffset" field as returned from a locate or walk routine.
- * @param SrcString The null-terminated string to convert into machine data
- * @returns EDSLIB_SUCCESS if successful, error code if conversion failed.
- *
- * \sa EdsLib_Scalar_ToString()
- */
-int32_t EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr, const char *SrcString);
-
-const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const EdsLib_GenericValueBuffer_t *ValueBuffer);
-void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *String, EdsLib_GenericValueBuffer_t *ValueBuffer);
-void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_SymbolCallback_t Callback, void *Arg);
-
-intmax_t EdsLib_DisplayDB_GetEnumValueByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t Index);
-const char *EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t Index, char *Buffer, uint32_t BufferSize);
-
-/**
- * Base64 encoding helper function
- *
- * Encodes the input using base64, where each character in the
- * output represents 6 bits of binary data. The resulting
- * string contains only normal printable characters, and can be
- * passed through terminals or any other transmission media that is
- * not 8-bit clean. Added whitespace, newlines, etc are not an issue.
- *
- * Input data will be padded with zero bits as necessary to make
- * the binary data size an exact multiple of 6 bits.
- *
- * Output data will be truncated at the last non-zero character.
- *
- * The original binary data can be reconstituted using the decode function.
- *
- * @note The Out buffer should be sized appropriately to store
- * exactly 1 char per 6 bits of input, plus 1 extra char
- * for null termination of the output string.
- */
-void EdsLib_DisplayDB_Base64Encode(char *Out, uint32_t OutputLenBytes, const uint8_t *In, uint32_t InputLenBits);
-
-/**
- * Base64 decoding helper function
- *
- * Decodes the input using base64, where each character in the
- * input represents 6 bits of binary data. This function will stop reading the
- * input stream when the first null character is encountered.
- *
- * In all cases the output will be zero-filled with bits to as necessary fill the field
- * width as specified in the OutputLenBits parameter.
- */
-void EdsLib_DisplayDB_Base64Decode(uint8_t *Out, uint32_t OutputLenBits, const char *In);
+ /**
+ * Initialize the DisplayDB subsystem
+ *
+ * This should be called once during initialization by
+ * programs wishing to use the Display API calls.
+ */
+ void EdsLib_DisplayDB_Initialize(void);
+
+ /**
+ * Gets the printable name of the EDS associated with the given Message ID.
+ *
+ * \note
+ * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
+ * so it is safe to use in directly in printf()-style calls.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to look up
+ * @returns a constant character string representing the application name
+ */
+ const char *EdsLib_DisplayDB_GetEdsName(const EdsLib_DatabaseObject_t *GD, uint16_t AppId);
+
+ /**
+ * Gets the base printable message/structure name associated with the given Message ID.
+ *
+ * This does NOT include any namespace qualifier. It returns only the base name of the object.
+ *
+ * \note
+ * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
+ * so it is safe to use in directly in printf()-style calls.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to look up
+ * @returns a constant character string representing the message/structure name
+ */
+ const char *EdsLib_DisplayDB_GetBaseName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId);
+
+ /**
+ * Gets the base printable namespace name associated with the given Message ID.
+ *
+ * This is usually (by convention) the same as the EDS name but that is not required
+ *
+ * \note
+ * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
+ * so it is safe to use in directly in printf()-style calls.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to look up
+ * @returns a constant character string representing the namespace name
+ */
+ const char *EdsLib_DisplayDB_GetNamespace(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId);
+
+ /**
+ * Gets the fully qualified message/structure name associated with the given Message ID.
+ *
+ * This includes a namespace qualifier i.e. NAME_SPACE/name format. This name is created by
+ * concatenating the two so a storage buffer must be supplied by the user. The same buffer is
+ * also returned by the function to ease use inside printf-style arguments.
+ *
+ * \note
+ * This function returns the constant string "UNDEF" instead of NULL if the lookup fails,
+ * so it is safe to use in directly in printf()-style calls. However in this case the user
+ * buffer will be set to an empty string.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to look up
+ * @param Buffer memory to store result string
+ * @param BufferSize size of Buffer
+ * @returns the user buffer that was passed in.
+ */
+ const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ char *Buffer,
+ uint32_t BufferSize);
+
+ /**
+ * Gets details on how to display a given data type, if available.
+ *
+ * Returns a "DisplayHint" and associated argument if present in the database.
+ * - For EDSLIB_DISPLAYHINT_ENUM_SYMTABLE, the argument is the symbolic name/value table
+ * - For EDSLIB_DISPLAYHINT_SUBNAMES, the argument is a const char array of the names
+ *
+ * Other types/usage of the pointer argument may be added.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to look up
+ * @return Display Hint type if successful
+ */
+ EdsLib_DisplayHint_t EdsLib_DisplayDB_GetDisplayHint(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId);
+
+ /**
+ * Parse a string and convert into an EDS identifier value
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param String The null-terminated string to parse as an EDS identifier
+ * @returns The converted EdsLib_Id_t value
+ *
+ * \sa EdsLib_EdsId_ToString()
+ */
+ EdsLib_Id_t EdsLib_DisplayDB_LookupTypeName(const EdsLib_DatabaseObject_t *GD, const char *String);
+
+ /**
+ * Converts a named member entity into an integer index if possible
+ *
+ * Attempts to find a member identified by the Name parameter within the specified EDS object.
+ * If found, the index/position of that name is stored in the SubIndex output buffer, which can
+ * then be passed to the EdsLib_DataTypeDB_GetMemberByIndex() function to obtain further
+ * information about the entity.
+ *
+ * This function only works on containers and array types that have sub entities; it does not
+ * work on scalar types.
+ *
+ * @note This function is _not_ a substitute for a structure name lookup as done by the
+ * locate function. In particular this API only operates at the given direct data type level
+ * and it will not search inside any sub-objects to find a matching name. In particular
+ * this function will not find anything that is not directly named within the given data type,
+ * such as a base type objects which are "hidden".
+ *
+ * Other types/usage of the pointer argument may be added.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the ID of the data type to operate on
+ * @param Name the subentity name to find
+ * @param SubIndex buffer to store the index/position
+ * @return EDSLIB_SUCCESS if successful, or appropriate error code if unsuccessful
+ */
+ int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *Name,
+ uint16_t *SubIndex);
+
+ /**
+ * Converts an integer index into a member name if possible
+ *
+ * Looks up the display name of a sub entity at the given index. If there is no sub member
+ * at the given index or it has no name associated with it in the database, then NULL is
+ * returned.
+ *
+ * This function only works on containers and array types that have sub entities; it does not
+ * work on scalar types. NULL will be returned in all those cases.
+ *
+ * In particular, this method can be used to check if an EDS index refers to a "base type"
+ * of a container object. These are valid container indices that have no name associated,
+ * and thus this function will return NULL.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the ID of the data type to operate on
+ * @param SubIndex the index/position to look up
+ * @return pointer to member name if successful, NULL if no name exists
+ */
+ const char *
+ EdsLib_DisplayDB_GetNameByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t SubIndex);
+
+ /**
+ * Walk through the payload structure of a given message/structure ID and generate a callback for each
+ * element within the structure with the detailed parameter information.
+ *
+ * This "ShortNames" variant will NOT descend into sub-structures within the parent structure given. The "FullName"
+ * in the parameter descriptor will always be just a single (short) element name. An element that is a sub
+ * structure will have the "SubStructureId" value set to a nonzero value and array elements will only get a single
+ * callback for the first element of the array.
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to walk. This may be any known/valid ID (message ID or a bare structure ID).
+ * @param Callback the callback function to invoke for each element in the message payload
+ * @param Arg opaque argument that is passed directly to the callback function
+ *
+ * \sa EdsLib_Iterator_Payload_FullNames()
+ */
+ void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_EntityCallback_t Callback,
+ void *Arg);
+ void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_EntityCallback_t Callback,
+ void *Arg);
+ /**
+ * Walk through the deep payload structure of a given message/structure ID and find an element name matching
+ * the name supplied as the "FullName" value within the LocateDesc parameter. If found, the rest of the parameters
+ * in LocateDesc will be set according to the found element.
+ *
+ * This version will descend into all sub structures and name matching is performed on the fully qualified name
+ * which should be in C-style syntax. For instance:
+ *
+ * Member.SubMember.SubArray[ArrayIndex].Value
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param EdsId the message ID to walk. This may be any known/valid ID (message ID or a bare structure ID).
+ * @param Name The parameter to locate.
+ * @param CompInfo Output buffer representing member location.
+ * @returns EDSLIB_SUCCESS if successful, error code if element name was not found.
+ */
+ int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *Name,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo);
+
+ /**
+ * Debugging utility function to write arbitrary data contents to the stdio stream as hexadecimal
+ * The data is treated as a binary blob.
+ *
+ * @param output any valid STDIO output stream (e.g. stdout)
+ * @param DataPtr pointer to the block of data
+ * @param DisplayOffset the offset of the first byte in the data block. This is typically zero but may be nonzero
+ * if the data should be viewed as a continuation of a previous display.
+ * @param Count The number of bytes to display.
+ */
+ void EdsLib_Generate_Hexdump(void *output, const uint8_t *DataPtr, uint16_t DisplayOffset, uint16_t Count);
+
+ /* **************************************************************************************
+ * EDS BINARY <-> STRING CONVERTERS
+ *
+ * These functions convert between user-friendly string representations and the numeric
+ * representations of EDS identifiers and EDS-defined datatypes.
+ * **************************************************************************************/
+
+ /**
+ * Convert a binary/machine value into a printable string using the EdsLib_DisplayHint_t as guidelines for how to
+ * interpret the data.
+ * - For character strings, printable chars (as indicated by isprint()) will copied to the output buffer and null
+ * termination is ensured.
+ * - For integer numbers, these will be converted to symbolic constants if the "EnumNamespace" is set and a
+ * matching value is found.
+ * - For numbers for which a symbolic constant is not defined, conversion will fall back to an appropriate
+ * sprintf-like behavior
+ *
+ * EdsLib_Scalar_FromString() will perform the reverse operation
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param OutputBuffer location to store the output string
+ * @param BufferSize maximum size of the OutputBuffer
+ * @param SrcPtr pointer to binary/machine data. Typically this is a pointer to a byte offset inside an "unpacked"
+ * message or structure, retrieved via the "MemberAbsOffset" field as returned from a locate or walk routine.
+ * @returns EDSLIB_SUCCESS if successful, error code if conversion failed.
+ *
+ * \sa EdsLib_Scalar_FromString()
+ */
+ int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ char *OutputBuffer,
+ uint32_t BufferSize,
+ const void *SrcPtr);
+
+ /**
+ * Convert string into binary/machine data using the EdsLib_DisplayHint_t as guidelines for how to interpret the
+ * data.
+ * - For character strings, all chars will copied to the destination up to the size limit or the terminating NULL
+ * - For integer numbers, these may be symbolic constants if the "EnumNamespace" is set and a matching value is
+ * found.
+ * - For numbers for which a symbolic constant is not defined, conversion will fall back to an appropriate
+ * strtol/ul/d/f system call
+ *
+ * EdsLib_Scalar_ToString() will perform the reverse operation
+ *
+ * @param GD the active EdsLib runtime database object
+ * @param DestPtr pointer to binary/machine data. Typically this is a pointer to a byte offset inside a message or
+ * structure, retrieved via the "MemberAbsOffset" field as returned from a locate or walk routine.
+ * @param SrcString The null-terminated string to convert into machine data
+ * @returns EDSLIB_SUCCESS if successful, error code if conversion failed.
+ *
+ * \sa EdsLib_Scalar_ToString()
+ */
+ int32_t EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *DestPtr,
+ const char *SrcString);
+
+ const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const EdsLib_GenericValueBuffer_t *ValueBuffer);
+ void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *String,
+ EdsLib_GenericValueBuffer_t *ValueBuffer);
+ void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_SymbolCallback_t Callback,
+ void *Arg);
+
+ intmax_t EdsLib_DisplayDB_GetEnumValueByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t Index);
+ const char *EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t Index,
+ char *Buffer,
+ uint32_t BufferSize);
+
+ /**
+ * Base64 encoding helper function
+ *
+ * Encodes the input using base64, where each character in the
+ * output represents 6 bits of binary data. The resulting
+ * string contains only normal printable characters, and can be
+ * passed through terminals or any other transmission media that is
+ * not 8-bit clean. Added whitespace, newlines, etc are not an issue.
+ *
+ * Input data will be padded with zero bits as necessary to make
+ * the binary data size an exact multiple of 6 bits.
+ *
+ * Output data will be truncated at the last non-zero character.
+ *
+ * The original binary data can be reconstituted using the decode function.
+ *
+ * @note The Out buffer should be sized appropriately to store
+ * exactly 1 char per 6 bits of input, plus 1 extra char
+ * for null termination of the output string.
+ */
+ void EdsLib_DisplayDB_Base64Encode(char *Out, uint32_t OutputLenBytes, const uint8_t *In, uint32_t InputLenBits);
+
+ /**
+ * Base64 decoding helper function
+ *
+ * Decodes the input using base64, where each character in the
+ * input represents 6 bits of binary data. This function will stop reading the
+ * input stream when the first null character is encountered.
+ *
+ * In all cases the output will be zero-filled with bits to as necessary fill the field
+ * width as specified in the OutputLenBits parameter.
+ */
+ void EdsLib_DisplayDB_Base64Decode(uint8_t *Out, uint32_t OutputLenBits, const char *In);
#ifdef __cplusplus
-} /* extern C */
+} /* extern C */
#endif
-
-
-#endif /* _EDSLIB_DISPLAYDB_H_ */
-
+#endif /* _EDSLIB_DISPLAYDB_H_ */
diff --git a/edslib/fsw/inc/edslib_global.h b/edslib/fsw/inc/edslib_global.h
index 46cc97b..c265d59 100644
--- a/edslib/fsw/inc/edslib_global.h
+++ b/edslib/fsw/inc/edslib_global.h
@@ -84,8 +84,10 @@ extern "C"
* @param[out] IdxOut output buffer for the Package/Application index value, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_FindPackageIdxBySubstring(const EdsLib_DatabaseObject_t *GD, const char *MatchString,
- size_t MatchLen, uint8_t *IdxOut);
+ int32_t EdsLib_FindPackageIdxBySubstring(const EdsLib_DatabaseObject_t *GD,
+ const char *MatchString,
+ size_t MatchLen,
+ uint8_t *IdxOut);
/**
* Find an EDS package index by name
diff --git a/edslib/fsw/inc/edslib_id.h b/edslib/fsw/inc/edslib_id.h
index ddc0d7c..cf93f22 100644
--- a/edslib/fsw/inc/edslib_id.h
+++ b/edslib/fsw/inc/edslib_id.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_id.h
* \ingroup fsw
@@ -45,13 +44,13 @@
* +-----------------+-----------------+-----------------+-----------------+
* | | CpuNum | AppId | | Format Identifier |
*
- * G = Genre Identifier (2 bit) => If (0), this refers to an EDS-defined data type and
+ * G = Genre Identifier (2 bit) => If (0), this refers to an EDS-defined data type and
* should be used with the EdsLib_DataTypeDB API. If (1) this refers to a interface and
* should be used with the EdsLib_IntfDB API. Values 2 and 3 are reserved for use in
* additional user-defined database(s).
* C = Cpu Number (5 bits) => Instance number in the range of 1-31. (0 = any)
* This field is ignored for data types, as data types are never instance-specific. The
- * field should be set 0 on all data type references. For interface/component references, 0 may be
+ * field should be set 0 on all data type references. For interface/component references, 0 may be
* used as a placeholder value to indicate "any". Valid instance numbers are in the
* range of 1-31.
* A = App Number (7 bits) => EDS APP number in the range of 1-127 (0 = reserved/invalid)
@@ -80,7 +79,7 @@ typedef uint32_t EdsLib_Id_t;
* Because the appid of 0 is reserved, a valid EdsLib_Id_t can
* never be all zero.
*/
-#define EDSLIB_ID_INVALID ((EdsLib_Id_t)0)
+#define EDSLIB_ID_INVALID ((EdsLib_Id_t)0)
/**
* Some constants for interpreting the uint32_t. User applications
@@ -89,23 +88,22 @@ typedef uint32_t EdsLib_Id_t;
*/
enum
{
- EDSLIB_ID_SHIFT_INDEX = 0,
- EDSLIB_ID_SHIFT_APP = 16,
- EDSLIB_ID_SHIFT_CPUNUM = 24,
- EDSLIB_ID_SHIFT_GENRE = 29,
-
- EDSLIB_ID_MASK_INDEX = 0x3FF,
- EDSLIB_ID_MASK_APP = 0x7F,
- EDSLIB_ID_MASK_CPUNUM = 0x1F,
- EDSLIB_ID_MASK_GENRE = 0x3,
-
- EDSLIB_ID_INDEX_BITS = EDSLIB_ID_MASK_INDEX << EDSLIB_ID_SHIFT_INDEX,
- EDSLIB_ID_APP_BITS = EDSLIB_ID_MASK_APP << EDSLIB_ID_SHIFT_APP,
- EDSLIB_ID_CPUNUM_BITS = EDSLIB_ID_MASK_CPUNUM << EDSLIB_ID_SHIFT_CPUNUM,
- EDSLIB_ID_GENRE_BITS = EDSLIB_ID_MASK_GENRE << EDSLIB_ID_SHIFT_GENRE,
+ EDSLIB_ID_SHIFT_INDEX = 0,
+ EDSLIB_ID_SHIFT_APP = 16,
+ EDSLIB_ID_SHIFT_CPUNUM = 24,
+ EDSLIB_ID_SHIFT_GENRE = 29,
+
+ EDSLIB_ID_MASK_INDEX = 0x3FF,
+ EDSLIB_ID_MASK_APP = 0x7F,
+ EDSLIB_ID_MASK_CPUNUM = 0x1F,
+ EDSLIB_ID_MASK_GENRE = 0x3,
+
+ EDSLIB_ID_INDEX_BITS = EDSLIB_ID_MASK_INDEX << EDSLIB_ID_SHIFT_INDEX,
+ EDSLIB_ID_APP_BITS = EDSLIB_ID_MASK_APP << EDSLIB_ID_SHIFT_APP,
+ EDSLIB_ID_CPUNUM_BITS = EDSLIB_ID_MASK_CPUNUM << EDSLIB_ID_SHIFT_CPUNUM,
+ EDSLIB_ID_GENRE_BITS = EDSLIB_ID_MASK_GENRE << EDSLIB_ID_SHIFT_GENRE,
};
-
/* Note, the bits for datatype are chosen so it will be the default if no genre is set */
/* The other possible values for Genre are reserved for use in derivative products (user-defined) */
#define EDSLIB_ID_GENRE_DATATYPE_BITS 0x0
@@ -113,7 +111,6 @@ enum
#define EDSLIB_ID_GENRE_USERDEF1_BITS 0x2
#define EDSLIB_ID_GENRE_USERDEF2_BITS 0x3
-
/***************************************************************************************
* INITIALIZERS
*
@@ -123,7 +120,7 @@ enum
/**
* Initialize an EdsLib_Id referring to a data type.
- *
+ *
* The CPU number will be set to 0 (any) and the format type will be set
* to indicate a generic data structure.
*
@@ -131,14 +128,14 @@ enum
* @param FormatIdx A value from the app-specific data dictionary enumeration. These
* are the values from the APP_eds_defines.h file.
*/
-#define EDSLIB_MAKE_ID(AppIdx, FormatIdx) \
- ((EDSLIB_ID_GENRE_DATATYPE_BITS << EDSLIB_ID_SHIFT_GENRE) | \
- ((uint32_t)((AppIdx) & EDSLIB_ID_MASK_APP) << EDSLIB_ID_SHIFT_APP) | \
- ((uint32_t)((FormatIdx) & EDSLIB_ID_MASK_INDEX) << EDSLIB_ID_SHIFT_INDEX))
+#define EDSLIB_MAKE_ID(AppIdx, FormatIdx) \
+ ((EDSLIB_ID_GENRE_DATATYPE_BITS << EDSLIB_ID_SHIFT_GENRE) \
+ | ((uint32_t)((AppIdx) & EDSLIB_ID_MASK_APP) << EDSLIB_ID_SHIFT_APP) \
+ | ((uint32_t)((FormatIdx) & EDSLIB_ID_MASK_INDEX) << EDSLIB_ID_SHIFT_INDEX))
/**
* Initialize an EdsLib_Id referring to an interface.
- *
+ *
* The CPU number will be set to 0 (any) and the format type will be set
* to the specified interface
*
@@ -146,12 +143,10 @@ enum
* @param IntfIdx A value from the app-specific interface enumeration. These
* are the values from the APP_eds_defines.h file.
*/
-#define EDSLIB_INTF_ID(AppIdx, IntfIdx) \
- ((EDSLIB_ID_GENRE_INTF_BITS << EDSLIB_ID_SHIFT_GENRE) | \
- ((uint32_t)((AppIdx) & EDSLIB_ID_MASK_APP) << EDSLIB_ID_SHIFT_APP) | \
- ((uint32_t)((IntfIdx) & EDSLIB_ID_MASK_INDEX) << EDSLIB_ID_SHIFT_INDEX))
-
-
+#define EDSLIB_INTF_ID(AppIdx, IntfIdx) \
+ ((EDSLIB_ID_GENRE_INTF_BITS << EDSLIB_ID_SHIFT_GENRE) \
+ | ((uint32_t)((AppIdx) & EDSLIB_ID_MASK_APP) << EDSLIB_ID_SHIFT_APP) \
+ | ((uint32_t)((IntfIdx) & EDSLIB_ID_MASK_INDEX) << EDSLIB_ID_SHIFT_INDEX))
/***************************************************************************************
* BASIC ACCESSORS
@@ -165,7 +160,7 @@ enum
*/
static inline uint8_t EdsLib_Get_Genre(EdsLib_Id_t EdsId)
{
- return (EdsId >> EDSLIB_ID_SHIFT_GENRE) & EDSLIB_ID_MASK_GENRE;
+ return (EdsId >> EDSLIB_ID_SHIFT_GENRE) & EDSLIB_ID_MASK_GENRE;
}
/**
@@ -173,8 +168,8 @@ static inline uint8_t EdsLib_Get_Genre(EdsLib_Id_t EdsId)
*/
static inline void EdsLib_Set_Genre(EdsLib_Id_t *EdsId, uint8_t Genre)
{
- *EdsId &= ~EDSLIB_ID_GENRE_BITS;
- *EdsId |= (Genre & EDSLIB_ID_MASK_GENRE) << EDSLIB_ID_SHIFT_GENRE;
+ *EdsId &= ~EDSLIB_ID_GENRE_BITS;
+ *EdsId |= (Genre & EDSLIB_ID_MASK_GENRE) << EDSLIB_ID_SHIFT_GENRE;
}
/**
@@ -182,7 +177,7 @@ static inline void EdsLib_Set_Genre(EdsLib_Id_t *EdsId, uint8_t Genre)
*/
static inline bool EdsLib_Is_DataType(EdsLib_Id_t EdsId)
{
- return EdsLib_Get_Genre(EdsId) == EDSLIB_ID_GENRE_DATATYPE_BITS;
+ return EdsLib_Get_Genre(EdsId) == EDSLIB_ID_GENRE_DATATYPE_BITS;
}
/**
@@ -190,7 +185,7 @@ static inline bool EdsLib_Is_DataType(EdsLib_Id_t EdsId)
*/
static inline bool EdsLib_Is_Interface(EdsLib_Id_t EdsId)
{
- return EdsLib_Get_Genre(EdsId) == EDSLIB_ID_GENRE_INTF_BITS;
+ return EdsLib_Get_Genre(EdsId) == EDSLIB_ID_GENRE_INTF_BITS;
}
/**
@@ -198,7 +193,7 @@ static inline bool EdsLib_Is_Interface(EdsLib_Id_t EdsId)
*/
static inline uint16_t EdsLib_Get_CpuNumber(EdsLib_Id_t EdsId)
{
- return (EdsId >> EDSLIB_ID_SHIFT_CPUNUM) & EDSLIB_ID_MASK_CPUNUM;
+ return (EdsId >> EDSLIB_ID_SHIFT_CPUNUM) & EDSLIB_ID_MASK_CPUNUM;
}
/**
@@ -206,8 +201,8 @@ static inline uint16_t EdsLib_Get_CpuNumber(EdsLib_Id_t EdsId)
*/
static inline void EdsLib_Set_CpuNumber(EdsLib_Id_t *EdsId, uint16_t CpuNum)
{
- *EdsId &= ~EDSLIB_ID_CPUNUM_BITS;
- *EdsId |= (CpuNum & EDSLIB_ID_MASK_CPUNUM) << EDSLIB_ID_SHIFT_CPUNUM;
+ *EdsId &= ~EDSLIB_ID_CPUNUM_BITS;
+ *EdsId |= (CpuNum & EDSLIB_ID_MASK_CPUNUM) << EDSLIB_ID_SHIFT_CPUNUM;
}
/**
@@ -215,7 +210,7 @@ static inline void EdsLib_Set_CpuNumber(EdsLib_Id_t *EdsId, uint16_t CpuNum)
*/
static inline uint16_t EdsLib_Get_AppIdx(EdsLib_Id_t EdsId)
{
- return (EdsId >> EDSLIB_ID_SHIFT_APP) & EDSLIB_ID_MASK_APP;
+ return (EdsId >> EDSLIB_ID_SHIFT_APP) & EDSLIB_ID_MASK_APP;
}
/**
@@ -223,8 +218,8 @@ static inline uint16_t EdsLib_Get_AppIdx(EdsLib_Id_t EdsId)
*/
static inline void EdsLib_Set_AppIdx(EdsLib_Id_t *EdsId, uint16_t AppIdx)
{
- *EdsId &= ~EDSLIB_ID_APP_BITS;
- *EdsId |= (AppIdx & EDSLIB_ID_MASK_APP) << EDSLIB_ID_SHIFT_APP;
+ *EdsId &= ~EDSLIB_ID_APP_BITS;
+ *EdsId |= (AppIdx & EDSLIB_ID_MASK_APP) << EDSLIB_ID_SHIFT_APP;
}
/**
@@ -232,7 +227,7 @@ static inline void EdsLib_Set_AppIdx(EdsLib_Id_t *EdsId, uint16_t AppIdx)
*/
static inline uint16_t EdsLib_Get_FormatIdx(EdsLib_Id_t EdsId)
{
- return ((EdsId >> EDSLIB_ID_SHIFT_INDEX) & EDSLIB_ID_MASK_INDEX);
+ return ((EdsId >> EDSLIB_ID_SHIFT_INDEX) & EDSLIB_ID_MASK_INDEX);
}
/**
@@ -240,8 +235,8 @@ static inline uint16_t EdsLib_Get_FormatIdx(EdsLib_Id_t EdsId)
*/
static inline void EdsLib_Set_FormatIdx(EdsLib_Id_t *EdsId, uint16_t FormatIdx)
{
- *EdsId &= ~EDSLIB_ID_INDEX_BITS;
- *EdsId |= ((FormatIdx & EDSLIB_ID_MASK_INDEX) << EDSLIB_ID_SHIFT_INDEX);
+ *EdsId &= ~EDSLIB_ID_INDEX_BITS;
+ *EdsId |= ((FormatIdx & EDSLIB_ID_MASK_INDEX) << EDSLIB_ID_SHIFT_INDEX);
}
/**
@@ -254,7 +249,7 @@ static inline void EdsLib_Set_FormatIdx(EdsLib_Id_t *EdsId, uint16_t FormatIdx)
*/
static inline bool EdsLib_Is_Valid(EdsLib_Id_t EdsId)
{
- return ((EdsId & (EDSLIB_ID_INDEX_BITS | EDSLIB_ID_APP_BITS)) != 0);
+ return ((EdsId & (EDSLIB_ID_INDEX_BITS | EDSLIB_ID_APP_BITS)) != 0);
}
/**
@@ -266,7 +261,7 @@ static inline bool EdsLib_Is_Valid(EdsLib_Id_t EdsId)
*/
static inline bool EdsLib_Is_Similar(EdsLib_Id_t EdsId1, EdsLib_Id_t EdsId2)
{
- return (((EdsId1 ^ EdsId2) & (EDSLIB_ID_GENRE_BITS | EDSLIB_ID_INDEX_BITS | EDSLIB_ID_APP_BITS)) == 0);
+ return (((EdsId1 ^ EdsId2) & (EDSLIB_ID_GENRE_BITS | EDSLIB_ID_INDEX_BITS | EDSLIB_ID_APP_BITS)) == 0);
}
/**
@@ -278,9 +273,7 @@ static inline bool EdsLib_Is_Similar(EdsLib_Id_t EdsId1, EdsLib_Id_t EdsId2)
*/
static inline bool EdsLib_Is_Match(EdsLib_Id_t EdsId1, EdsLib_Id_t EdsId2)
{
- return (EdsId1 == EdsId2);
+ return (EdsId1 == EdsId2);
}
-
-#endif /* _EDSLIB_ID_H_ */
-
+#endif /* _EDSLIB_ID_H_ */
diff --git a/edslib/fsw/inc/edslib_init.h b/edslib/fsw/inc/edslib_init.h
index 1a931e3..c6ca8f0 100644
--- a/edslib/fsw/inc/edslib_init.h
+++ b/edslib/fsw/inc/edslib_init.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_init.h
* \ingroup fsw
@@ -38,5 +37,4 @@
*/
void EdsLib_Initialize(void);
-#endif /* _EDSLIB_INIT_H_ */
-
+#endif /* _EDSLIB_INIT_H_ */
diff --git a/edslib/fsw/inc/edslib_intfdb.h b/edslib/fsw/inc/edslib_intfdb.h
index 8f3f75b..873ad07 100644
--- a/edslib/fsw/inc/edslib_intfdb.h
+++ b/edslib/fsw/inc/edslib_intfdb.h
@@ -106,8 +106,10 @@ extern "C"
* @param[out] IdBuffer output buffer for the Eds ID, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx,
- const char *CompName, EdsLib_Id_t *IdBuffer);
+ int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD,
+ uint16_t AppIdx,
+ const char *CompName,
+ EdsLib_Id_t *IdBuffer);
/**
* Find an EDS declared interface by name
@@ -120,8 +122,10 @@ extern "C"
* @param[out] IdBuffer output buffer for the Eds ID, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx,
- const char *IntfName, EdsLib_Id_t *IdBuffer);
+ int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD,
+ uint16_t AppIdx,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer);
/**
* Find an EDS declared interface by name
@@ -133,8 +137,9 @@ extern "C"
* @param[out] IdBuffer output buffer for the Eds ID, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- EdsLib_Id_t *IdBuffer);
+ int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer);
/**
* Find an EDS component (utilized) interface by its localized name
@@ -151,8 +156,10 @@ extern "C"
* @param[out] IdBuffer output buffer for the Eds ID, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t ComponentId,
- const char *IntfName, EdsLib_Id_t *IdBuffer);
+ int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t ComponentId,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer);
/**
* Find an EDS component (utilized) interface by fully qualified name
@@ -167,8 +174,9 @@ extern "C"
* @param[out] IdBuffer output buffer for the Eds ID, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- EdsLib_Id_t *IdBuffer);
+ int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer);
/**
* Find an EDS command by name
@@ -185,8 +193,10 @@ extern "C"
* @param[out] IdBuffer output buffer for the Eds ID, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId,
- const char *CmdName, EdsLib_Id_t *IdBuffer);
+ int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
+ const char *CmdName,
+ EdsLib_Id_t *IdBuffer);
/**
* Gets the EdsId for all EDS-defined commands within an interface
@@ -203,8 +213,10 @@ extern "C"
* @param[in] NumIdBufs the number of buffers in the IdBuffer array
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId, EdsLib_Id_t *IdBuffer,
- size_t NumIdBufs);
+ int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
+ EdsLib_Id_t *IdBuffer,
+ size_t NumIdBufs);
/**
* Map all command arguments to their actual data type
@@ -229,8 +241,11 @@ extern "C"
* @param[in] NumIdBufs the number of buffers in the IdBuffer array
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t CmdEdsId,
- EdsLib_Id_t CompIntfEdsId, EdsLib_Id_t *IdBuffer, size_t NumIdBufs);
+ int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t CmdEdsId,
+ EdsLib_Id_t CompIntfEdsId,
+ EdsLib_Id_t *IdBuffer,
+ size_t NumIdBufs);
/**
* Get details on an EDS declared interface
@@ -240,7 +255,8 @@ extern "C"
* @param[out] IntfInfoBuffer output buffer for the information, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId,
+ int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
EdsLib_IntfDB_InterfaceInfo_t *IntfInfoBuffer);
/**
@@ -251,7 +267,8 @@ extern "C"
* @param[out] CompInfoBuffer output buffer for the component information, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t ComponentId,
+ int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t ComponentId,
EdsLib_IntfDB_ComponentInfo_t *CompInfoBuffer);
/**
@@ -266,8 +283,8 @@ extern "C"
* @param[in] BufferLen length of the output buffer
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *BufferPtr,
- size_t BufferLen);
+ int32_t
+ EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *BufferPtr, size_t BufferLen);
/**
* Get details on an EDS command
@@ -277,8 +294,9 @@ extern "C"
* @param[out] CommandInfoBuffer output buffer for the component information, if successful
* @return EDSLIB_SUCCESS if successful, error code if unsuccessful
*/
- int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t CommandId,
- EdsLib_IntfDB_CommandInfo_t *CommandInfoBuffer);
+ int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t CommandId,
+ EdsLib_IntfDB_CommandInfo_t *CommandInfoBuffer);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/edslib/fsw/src/edslib_binding_objects.c b/edslib/fsw/src/edslib_binding_objects.c
index ebe7dae..7e43408 100644
--- a/edslib/fsw/src/edslib_binding_objects.c
+++ b/edslib/fsw/src/edslib_binding_objects.c
@@ -18,15 +18,14 @@
* limitations under the License.
*/
-
/**
* \file edslib_binding_objects.c
* \ingroup fsw
* \author joseph.p.hickey@nasa.gov
*
-** Generic high-level EDS "binding" objects.
-** This defines a descriptor type which wraps together all EDS metadata along
-** with an object pointer to get an all-inclusive, self contained "smart object".
+ ** Generic high-level EDS "binding" objects.
+ ** This defines a descriptor type which wraps together all EDS metadata along
+ ** with an object pointer to get an all-inclusive, self contained "smart object".
*/
#include
@@ -51,7 +50,7 @@
union EdsLib_Binding_AllocBuf
{
EdsLib_Binding_Buffer_Content_t Content;
- uint8_t RawData[4];
+ uint8_t RawData[4];
/*
* The next fields are not intended to be used directly,
@@ -60,15 +59,13 @@ union EdsLib_Binding_AllocBuf
* if deemed necessary. This should reflect the largest native machine
* types.
*/
- void *Ptr;
- intmax_t AlignInt;
+ void *Ptr;
+ intmax_t AlignInt;
long double AlignFloat;
-
};
typedef union EdsLib_Binding_AllocBuf EdsLib_Binding_AllocBuf_t;
-
/*
* Initialization routine placeholder.
*
@@ -89,7 +86,8 @@ void EdsLib_Binding_Initialize(void)
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_Binding_SetDescBuffer(EdsLib_Binding_DescriptorObject_t *DescrObj, EdsLib_Binding_Buffer_Content_t *TargetBuffer)
+void EdsLib_Binding_SetDescBuffer(EdsLib_Binding_DescriptorObject_t *DescrObj,
+ EdsLib_Binding_Buffer_Content_t *TargetBuffer)
{
EdsLib_Binding_Buffer_Content_t *PrevContentPtr = DescrObj->BufferPtr;
@@ -128,20 +126,20 @@ void EdsLib_Binding_SetDescBuffer(EdsLib_Binding_DescriptorObject_t *DescrObj, E
*-----------------------------------------------------------------*/
EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_AllocManagedBuffer(size_t MaxContentSize)
{
- EdsLib_Binding_AllocBuf_t *BufPtr;
+ EdsLib_Binding_AllocBuf_t *BufPtr;
EdsLib_Binding_Buffer_Content_t *ContentPtr;
- size_t ActualSize;
+ size_t ActualSize;
ActualSize = sizeof(EdsLib_Binding_AllocBuf_t) + MaxContentSize;
- BufPtr = malloc(ActualSize);
+ BufPtr = malloc(ActualSize);
if (BufPtr != NULL)
{
memset(BufPtr, 0, ActualSize);
- BufPtr->Content.Data = BufPtr[1].RawData;
+ BufPtr->Content.Data = BufPtr[1].RawData;
BufPtr->Content.MaxContentSize = MaxContentSize;
- BufPtr->Content.IsManaged = true; /* mark it as "managed", this means it will be auto deleted */
- ContentPtr = &BufPtr->Content;
+ BufPtr->Content.IsManaged = true; /* mark it as "managed", this means it will be auto deleted */
+ ContentPtr = &BufPtr->Content;
}
else
{
@@ -157,11 +155,12 @@ EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_AllocManagedBuffer(size_t MaxCon
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Binding_Buffer_Content_t *ContentPtr, void *DataPtr, size_t MaxContentSize)
+EdsLib_Binding_Buffer_Content_t *
+EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Binding_Buffer_Content_t *ContentPtr, void *DataPtr, size_t MaxContentSize)
{
- ContentPtr->Data = DataPtr;
+ ContentPtr->Data = DataPtr;
ContentPtr->MaxContentSize = MaxContentSize;
- ContentPtr->IsManaged = false; /* mark it as "not managed", so it will NOT be auto-deleted */
+ ContentPtr->IsManaged = false; /* mark it as "not managed", so it will NOT be auto-deleted */
ContentPtr->ReferenceCount = 0;
return ContentPtr;
@@ -174,13 +173,13 @@ EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Bindi
*
*-----------------------------------------------------------------*/
void EdsLib_Binding_InitDescriptor(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
- const EdsLib_DatabaseObject_t *EdsDB,
- EdsLib_Id_t EdsId)
+ const EdsLib_DatabaseObject_t *EdsDB,
+ EdsLib_Id_t EdsId)
{
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- memset(ObjectUserData,0,sizeof(*ObjectUserData));
- ObjectUserData->GD = EdsDB;
+ memset(ObjectUserData, 0, sizeof(*ObjectUserData));
+ ObjectUserData->GD = EdsDB;
ObjectUserData->EdsId = EdsId;
EdsLib_DataTypeDB_GetDerivedInfo(EdsDB, EdsId, &DerivInfo);
ObjectUserData->Length = DerivInfo.MaxSize.Bytes;
@@ -193,12 +192,14 @@ void EdsLib_Binding_InitDescriptor(EdsLib_Binding_DescriptorObject_t *ObjectUser
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_Binding_InitSubObject(EdsLib_Binding_DescriptorObject_t *SubObject, const EdsLib_Binding_DescriptorObject_t *ParentObj, const EdsLib_DataTypeDB_EntityInfo_t *Component)
+void EdsLib_Binding_InitSubObject(EdsLib_Binding_DescriptorObject_t *SubObject,
+ const EdsLib_Binding_DescriptorObject_t *ParentObj,
+ const EdsLib_DataTypeDB_EntityInfo_t *Component)
{
- memset(SubObject,0,sizeof(*SubObject));
+ memset(SubObject, 0, sizeof(*SubObject));
EdsLib_Binding_SetDescBuffer(SubObject, ParentObj->BufferPtr);
- SubObject->GD = ParentObj->GD;
- SubObject->EdsId = Component->EdsId;
+ SubObject->GD = ParentObj->GD;
+ SubObject->EdsId = Component->EdsId;
SubObject->Offset = Component->Offset.Bytes + ParentObj->Offset;
SubObject->Length = Component->MaxSize.Bytes;
EdsLib_DataTypeDB_GetTypeInfo(SubObject->GD, SubObject->EdsId, &SubObject->TypeInfo);
@@ -210,23 +211,20 @@ void EdsLib_Binding_InitSubObject(EdsLib_Binding_DescriptorObject_t *SubObject,
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-EdsLib_Binding_Compatibility_t EdsLib_Binding_CheckEdsObjectsCompatible(
- EdsLib_Binding_DescriptorObject_t *DestObject,
- EdsLib_Binding_DescriptorObject_t *SrcObject)
+EdsLib_Binding_Compatibility_t EdsLib_Binding_CheckEdsObjectsCompatible(EdsLib_Binding_DescriptorObject_t *DestObject,
+ EdsLib_Binding_DescriptorObject_t *SrcObject)
{
- EdsLib_Binding_Compatibility_t result =
- EDSLIB_BINDING_COMPATIBILITY_NONE;
+ EdsLib_Binding_Compatibility_t result = EDSLIB_BINDING_COMPATIBILITY_NONE;
/*
* Determine assignment compatibility...
* It is preferable to directly copy data from src to dest but
* this is only possible when the native objects are compatible.
*/
- if (DestObject->TypeInfo.NumSubElements == 0 &&
- SrcObject->TypeInfo.NumSubElements == 0)
+ if (DestObject->TypeInfo.NumSubElements == 0 && SrcObject->TypeInfo.NumSubElements == 0)
{
- if (SrcObject->TypeInfo.ElemType == DestObject->TypeInfo.ElemType &&
- SrcObject->TypeInfo.Size.Bytes == DestObject->TypeInfo.Size.Bytes)
+ if (SrcObject->TypeInfo.ElemType == DestObject->TypeInfo.ElemType
+ && SrcObject->TypeInfo.Size.Bytes == DestObject->TypeInfo.Size.Bytes)
{
/* Objects are both scalars of the same native type & size -- direct copy is possible
* note these could be from different databases -- should not matter */
@@ -243,8 +241,7 @@ EdsLib_Binding_Compatibility_t EdsLib_Binding_CheckEdsObjectsCompatible(
*/
result = EDSLIB_BINDING_COMPATIBILITY_EXACT;
}
- else if (EdsLib_DataTypeDB_BaseCheck(DestObject->GD, DestObject->EdsId,
- SrcObject->EdsId) == EDSLIB_SUCCESS)
+ else if (EdsLib_DataTypeDB_BaseCheck(DestObject->GD, DestObject->EdsId, SrcObject->EdsId) == EDSLIB_SUCCESS)
{
/*
* Source object is a derivative of the destination object.
@@ -337,8 +334,7 @@ void EdsLib_Binding_InitStaticFields(EdsLib_Binding_DescriptorObject_t *ObjectUs
if (ObjData != NULL)
{
- EdsLib_DataTypeDB_InitializeNativeObject(ObjectUserData->GD,
- ObjectUserData->EdsId, ObjData);
+ EdsLib_DataTypeDB_InitializeNativeObject(ObjectUserData->GD, ObjectUserData->EdsId, ObjData);
}
}
@@ -348,18 +344,18 @@ void EdsLib_Binding_InitStaticFields(EdsLib_Binding_DescriptorObject_t *ObjectUs
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_Binding_InitFromPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData, const void *PackedData, size_t PackedDataSize)
+int32_t EdsLib_Binding_InitFromPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ const void *PackedData,
+ size_t PackedDataSize)
{
- int32_t Status = EdsLib_DataTypeDB_UnpackCompleteObject(
- ObjectUserData->GD,
- &ObjectUserData->EdsId,
- EdsLib_Binding_GetNativeObject(ObjectUserData),
- PackedData,
- EdsLib_Binding_GetNativeSize(ObjectUserData),
- 8 * PackedDataSize);
+ int32_t Status = EdsLib_DataTypeDB_UnpackCompleteObject(ObjectUserData->GD,
+ &ObjectUserData->EdsId,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ PackedData,
+ EdsLib_Binding_GetNativeSize(ObjectUserData),
+ 8 * PackedDataSize);
- EdsLib_DataTypeDB_GetTypeInfo(ObjectUserData->GD, ObjectUserData->EdsId,
- &ObjectUserData->TypeInfo);
+ EdsLib_DataTypeDB_GetTypeInfo(ObjectUserData->GD, ObjectUserData->EdsId, &ObjectUserData->TypeInfo);
return Status;
}
@@ -370,33 +366,35 @@ int32_t EdsLib_Binding_InitFromPackedBuffer(EdsLib_Binding_DescriptorObject_t *O
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_Binding_ExportToPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData, void *PackedData, size_t PackedDataSize)
+int32_t EdsLib_Binding_ExportToPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ void *PackedData,
+ size_t PackedDataSize)
{
- int32_t Status = EdsLib_DataTypeDB_PackCompleteObject(
- ObjectUserData->GD,
- &ObjectUserData->EdsId,
- PackedData,
- EdsLib_Binding_GetNativeObject(ObjectUserData),
- 8 * PackedDataSize,
- EdsLib_Binding_GetNativeSize(ObjectUserData));
+ int32_t Status = EdsLib_DataTypeDB_PackCompleteObject(ObjectUserData->GD,
+ &ObjectUserData->EdsId,
+ PackedData,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ 8 * PackedDataSize,
+ EdsLib_Binding_GetNativeSize(ObjectUserData));
- EdsLib_DataTypeDB_GetTypeInfo(ObjectUserData->GD, ObjectUserData->EdsId,
- &ObjectUserData->TypeInfo);
+ EdsLib_DataTypeDB_GetTypeInfo(ObjectUserData->GD, ObjectUserData->EdsId, &ObjectUserData->TypeInfo);
return Status;
}
-
/*----------------------------------------------------------------
*
* EdsLib internal function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_Binding_LoadValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData, EdsLib_GenericValueBuffer_t *ValBuf)
+int32_t EdsLib_Binding_LoadValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ EdsLib_GenericValueBuffer_t *ValBuf)
{
- return EdsLib_DataTypeDB_LoadValue(ObjectUserData->GD, ObjectUserData->EdsId,
- ValBuf, EdsLib_Binding_GetNativeObject(ObjectUserData));
+ return EdsLib_DataTypeDB_LoadValue(ObjectUserData->GD,
+ ObjectUserData->EdsId,
+ ValBuf,
+ EdsLib_Binding_GetNativeObject(ObjectUserData));
}
/*----------------------------------------------------------------
@@ -405,8 +403,11 @@ int32_t EdsLib_Binding_LoadValue(const EdsLib_Binding_DescriptorObject_t *Object
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_Binding_StoreValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData, EdsLib_GenericValueBuffer_t *ValBuf)
+int32_t EdsLib_Binding_StoreValue(const EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ EdsLib_GenericValueBuffer_t *ValBuf)
{
- return EdsLib_DataTypeDB_StoreValue(ObjectUserData->GD, ObjectUserData->EdsId,
- EdsLib_Binding_GetNativeObject(ObjectUserData), ValBuf);
+ return EdsLib_DataTypeDB_StoreValue(ObjectUserData->GD,
+ ObjectUserData->EdsId,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ ValBuf);
}
diff --git a/edslib/fsw/src/edslib_database_ops.c b/edslib/fsw/src/edslib_database_ops.c
index 64b5599..a3f056d 100644
--- a/edslib/fsw/src/edslib_database_ops.c
+++ b/edslib/fsw/src/edslib_database_ops.c
@@ -127,6 +127,6 @@ EdsLib_Id_t EdsLib_Encode_StructId(const EdsLib_DatabaseRef_t *RefObj)
*-----------------------------------------------------------------*/
bool EdsLib_DatabaseRef_IsEqual(const EdsLib_DatabaseRef_t *RefObj1, const EdsLib_DatabaseRef_t *RefObj2)
{
- return (RefObj1->Qualifier == RefObj2->Qualifier && RefObj1->AppIndex == RefObj2->AppIndex &&
- RefObj1->SubIndex == RefObj2->SubIndex);
+ return (RefObj1->Qualifier == RefObj2->Qualifier && RefObj1->AppIndex == RefObj2->AppIndex
+ && RefObj1->SubIndex == RefObj2->SubIndex);
}
diff --git a/edslib/fsw/src/edslib_datatypedb_api.c b/edslib/fsw/src/edslib_datatypedb_api.c
index f0cdc73..794e58b 100644
--- a/edslib/fsw/src/edslib_datatypedb_api.c
+++ b/edslib/fsw/src/edslib_datatypedb_api.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_api.c
* \ingroup fsw
@@ -80,10 +79,8 @@ uint16_t EdsLib_DataTypeDB_GetAppIdx(const EdsLib_DataTypeDB_t AppDict)
*-----------------------------------------------------------------*/
int32_t EdsLib_DataTypeDB_Register(EdsLib_DatabaseObject_t *GD, EdsLib_DataTypeDB_t AppDict)
{
- if (GD == NULL ||
- GD->DataTypeDB_Table == NULL ||
- AppDict->MissionIdx >= GD->AppTableSize ||
- GD->DataTypeDB_Table[AppDict->MissionIdx] != NULL)
+ if (GD == NULL || GD->DataTypeDB_Table == NULL || AppDict->MissionIdx >= GD->AppTableSize
+ || GD->DataTypeDB_Table[AppDict->MissionIdx] != NULL)
{
return EDSLIB_FAILURE;
}
@@ -100,10 +97,8 @@ int32_t EdsLib_DataTypeDB_Register(EdsLib_DatabaseObject_t *GD, EdsLib_DataTypeD
*-----------------------------------------------------------------*/
int32_t EdsLib_DataTypeDB_Unregister(EdsLib_DatabaseObject_t *GD, uint16_t AppIdx)
{
- if (GD == NULL ||
- GD->DataTypeDB_Table == NULL ||
- AppIdx >= GD->AppTableSize ||
- GD->DataTypeDB_Table[AppIdx] == NULL)
+ if (GD == NULL || GD->DataTypeDB_Table == NULL || AppIdx >= GD->AppTableSize
+ || GD->DataTypeDB_Table[AppIdx] == NULL)
{
return EDSLIB_FAILURE;
}
@@ -112,7 +107,6 @@ int32_t EdsLib_DataTypeDB_Unregister(EdsLib_DatabaseObject_t *GD, uint16_t AppId
return EDSLIB_SUCCESS;
}
-
/*
* *************************************************************************************
* Datatype DB object lookup API calls
@@ -125,11 +119,13 @@ int32_t EdsLib_DataTypeDB_Unregister(EdsLib_DatabaseObject_t *GD, uint16_t AppId
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_DataTypeDB_TypeInfo_t *TypeInfo)
+int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_DataTypeDB_TypeInfo_t *TypeInfo)
{
- EdsLib_DatabaseRef_t TempRef;
+ EdsLib_DatabaseRef_t TempRef;
const EdsLib_DataTypeDB_Entry_t *DataDictEntry;
- int32_t Status;
+ int32_t Status;
EdsLib_Decode_StructId(&TempRef, EdsId);
DataDictEntry = EdsLib_DataTypeDB_GetEntry(GD, &TempRef);
@@ -160,15 +156,18 @@ int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t SubIndex, EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
+int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t SubIndex,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
{
const EdsLib_DataTypeDB_Entry_t *DataDict;
const EdsLib_FieldDetailEntry_t *MemberDetail;
const EdsLib_DataTypeDB_Entry_t *MemberDict;
- const EdsLib_DatabaseRef_t *RefObj;
- EdsLib_DatabaseRef_t TempRef;
- uint16_t Idx;
- int32_t Result;
+ const EdsLib_DatabaseRef_t *RefObj;
+ EdsLib_DatabaseRef_t TempRef;
+ uint16_t Idx;
+ int32_t Result;
RefObj = NULL;
@@ -182,74 +181,73 @@ int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD, Ed
if (DataDict != NULL && SubIndex < DataDict->NumSubElements)
{
- switch(DataDict->BasicType)
+ switch (DataDict->BasicType)
{
- case EDSLIB_BASICTYPE_CONTAINER:
- case EDSLIB_BASICTYPE_COMPONENT:
- {
- RefObj = &DataDict->Detail.Container->EntryList[SubIndex].RefObj;
-
- if (CompInfo != NULL)
+ case EDSLIB_BASICTYPE_CONTAINER:
+ case EDSLIB_BASICTYPE_COMPONENT:
{
- const EdsLib_SizeInfo_t *EndOffset;
+ RefObj = &DataDict->Detail.Container->EntryList[SubIndex].RefObj;
- /* check if the item could be at a variable location */
- if ((DataDict->Flags & EDSLIB_DATATYPE_FLAG_VARIABLE_SIZE) != 0)
+ if (CompInfo != NULL)
{
- for (Idx=0; Idx < SubIndex; ++Idx)
+ const EdsLib_SizeInfo_t *EndOffset;
+
+ /* check if the item could be at a variable location */
+ if ((DataDict->Flags & EDSLIB_DATATYPE_FLAG_VARIABLE_SIZE) != 0)
{
- MemberDetail = &DataDict->Detail.Container->EntryList[Idx];
- MemberDict = EdsLib_DataTypeDB_GetEntry(GD, &MemberDetail->RefObj);
- if (MemberDict != NULL && (MemberDict->Flags & EDSLIB_DATATYPE_FLAG_VARIABLE_SIZE) != 0)
+ for (Idx = 0; Idx < SubIndex; ++Idx)
{
- CompInfo->Flags |= EDSLIB_DATATYPE_FLAG_VARIABLE_LOCATION;
+ MemberDetail = &DataDict->Detail.Container->EntryList[Idx];
+ MemberDict = EdsLib_DataTypeDB_GetEntry(GD, &MemberDetail->RefObj);
+ if (MemberDict != NULL && (MemberDict->Flags & EDSLIB_DATATYPE_FLAG_VARIABLE_SIZE) != 0)
+ {
+ CompInfo->Flags |= EDSLIB_DATATYPE_FLAG_VARIABLE_LOCATION;
+ }
}
}
- }
- MemberDetail = &DataDict->Detail.Container->EntryList[SubIndex];
+ MemberDetail = &DataDict->Detail.Container->EntryList[SubIndex];
- if (SubIndex < (DataDict->NumSubElements - 1))
- {
- /* not the last entry in the container - peek to the next */
- EndOffset = &MemberDetail[1].Offset;
- }
- else
- {
- /* last element -- use the parent size */
- EndOffset = &DataDict->SizeInfo;
- }
+ if (SubIndex < (DataDict->NumSubElements - 1))
+ {
+ /* not the last entry in the container - peek to the next */
+ EndOffset = &MemberDetail[1].Offset;
+ }
+ else
+ {
+ /* last element -- use the parent size */
+ EndOffset = &DataDict->SizeInfo;
+ }
- CompInfo->Offset = MemberDetail->Offset;
- CompInfo->MaxSize.Bytes = (EndOffset->Bytes - CompInfo->Offset.Bytes);
- CompInfo->MaxSize.Bits = (EndOffset->Bits - CompInfo->Offset.Bits);
+ CompInfo->Offset = MemberDetail->Offset;
+ CompInfo->MaxSize.Bytes = (EndOffset->Bytes - CompInfo->Offset.Bytes);
+ CompInfo->MaxSize.Bits = (EndOffset->Bits - CompInfo->Offset.Bits);
+ }
+ break;
}
- break;
- }
- case EDSLIB_BASICTYPE_ARRAY:
- {
- RefObj = &DataDict->Detail.Array->ElementRefObj;
-
- if (CompInfo != NULL)
+ case EDSLIB_BASICTYPE_ARRAY:
{
- /*
- * Calculating the start offset this way, although it involves division,
- * does not require that we actually _have_ the definition of the array
- * element type loaded. The total byte size of the entire array _must_
- * be an integer multiple of the array length, by definition.
- */
-
- CompInfo->MaxSize.Bytes = (DataDict->SizeInfo.Bytes / DataDict->NumSubElements);
- CompInfo->MaxSize.Bits = (DataDict->SizeInfo.Bits / DataDict->NumSubElements);
- CompInfo->Offset.Bytes = CompInfo->MaxSize.Bytes * SubIndex;
- CompInfo->Offset.Bits = CompInfo->MaxSize.Bits * SubIndex;
+ RefObj = &DataDict->Detail.Array->ElementRefObj;
+
+ if (CompInfo != NULL)
+ {
+ /*
+ * Calculating the start offset this way, although it involves division,
+ * does not require that we actually _have_ the definition of the array
+ * element type loaded. The total byte size of the entire array _must_
+ * be an integer multiple of the array length, by definition.
+ */
+
+ CompInfo->MaxSize.Bytes = (DataDict->SizeInfo.Bytes / DataDict->NumSubElements);
+ CompInfo->MaxSize.Bits = (DataDict->SizeInfo.Bits / DataDict->NumSubElements);
+ CompInfo->Offset.Bytes = CompInfo->MaxSize.Bytes * SubIndex;
+ CompInfo->Offset.Bits = CompInfo->MaxSize.Bits * SubIndex;
+ }
+ break;
}
- break;
- }
- default:
- break;
+ default:
+ break;
}
-
}
if (RefObj != NULL)
@@ -274,11 +272,14 @@ int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD, Ed
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint32_t ByteOffset, EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
+int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint32_t ByteOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
{
const EdsLib_DataTypeDB_Entry_t *DataDict;
- EdsLib_DatabaseRef_t TempRef;
- int32_t Result;
+ EdsLib_DatabaseRef_t TempRef;
+ int32_t Result;
memset(CompInfo, 0, sizeof(*CompInfo));
EdsLib_Decode_StructId(&TempRef, EdsId);
@@ -299,23 +300,32 @@ int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t
}
Result = EDSLIB_SUCCESS;
}
- else switch(DataDict->BasicType)
- {
- case EDSLIB_BASICTYPE_CONTAINER:
- case EDSLIB_BASICTYPE_COMPONENT:
- {
- Result = EdsLib_DataTypeDB_FindContainerMember_Impl(GD, DataDict, &ByteOffset, EdsLib_OffsetCompareBytes, CompInfo);
- break;
- }
- case EDSLIB_BASICTYPE_ARRAY:
- {
- Result = EdsLib_DataTypeDB_FindArrayMember_Impl(GD, DataDict, &ByteOffset, EdsLib_GetArrayIdxFromBytes, CompInfo);
- break;
- }
- default:
- Result = EDSLIB_INVALID_SIZE_OR_TYPE;
- break;
- }
+ else
+ switch (DataDict->BasicType)
+ {
+ case EDSLIB_BASICTYPE_CONTAINER:
+ case EDSLIB_BASICTYPE_COMPONENT:
+ {
+ Result = EdsLib_DataTypeDB_FindContainerMember_Impl(GD,
+ DataDict,
+ &ByteOffset,
+ EdsLib_OffsetCompareBytes,
+ CompInfo);
+ break;
+ }
+ case EDSLIB_BASICTYPE_ARRAY:
+ {
+ Result = EdsLib_DataTypeDB_FindArrayMember_Impl(GD,
+ DataDict,
+ &ByteOffset,
+ EdsLib_GetArrayIdxFromBytes,
+ CompInfo);
+ break;
+ }
+ default:
+ Result = EDSLIB_INVALID_SIZE_OR_TYPE;
+ break;
+ }
return Result;
}
@@ -326,11 +336,14 @@ int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetMemberByPackedOffset(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint32_t BitOffset, EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
+int32_t EdsLib_DataTypeDB_GetMemberByPackedOffset(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint32_t BitOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
{
const EdsLib_DataTypeDB_Entry_t *DataDict;
- EdsLib_DatabaseRef_t TempRef;
- int32_t Result;
+ EdsLib_DatabaseRef_t TempRef;
+ int32_t Result;
memset(CompInfo, 0, sizeof(*CompInfo));
EdsLib_Decode_StructId(&TempRef, EdsId);
@@ -351,23 +364,32 @@ int32_t EdsLib_DataTypeDB_GetMemberByPackedOffset(const EdsLib_DatabaseObject_t
}
Result = EDSLIB_SUCCESS;
}
- else switch(DataDict->BasicType)
- {
- case EDSLIB_BASICTYPE_CONTAINER:
- case EDSLIB_BASICTYPE_COMPONENT:
- {
- Result = EdsLib_DataTypeDB_FindContainerMember_Impl(GD, DataDict, &BitOffset, EdsLib_OffsetCompareBits, CompInfo);
- break;
- }
- case EDSLIB_BASICTYPE_ARRAY:
- {
- Result = EdsLib_DataTypeDB_FindArrayMember_Impl(GD, DataDict, &BitOffset, EdsLib_GetArrayIdxFromBits, CompInfo);
- break;
- }
- default:
- Result = EDSLIB_INVALID_SIZE_OR_TYPE;
- break;
- }
+ else
+ switch (DataDict->BasicType)
+ {
+ case EDSLIB_BASICTYPE_CONTAINER:
+ case EDSLIB_BASICTYPE_COMPONENT:
+ {
+ Result = EdsLib_DataTypeDB_FindContainerMember_Impl(GD,
+ DataDict,
+ &BitOffset,
+ EdsLib_OffsetCompareBits,
+ CompInfo);
+ break;
+ }
+ case EDSLIB_BASICTYPE_ARRAY:
+ {
+ Result = EdsLib_DataTypeDB_FindArrayMember_Impl(GD,
+ DataDict,
+ &BitOffset,
+ EdsLib_GetArrayIdxFromBits,
+ CompInfo);
+ break;
+ }
+ default:
+ Result = EDSLIB_INVALID_SIZE_OR_TYPE;
+ break;
+ }
return Result;
}
@@ -378,10 +400,13 @@ int32_t EdsLib_DataTypeDB_GetMemberByPackedOffset(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t DerivId, EdsLib_Id_t *DerivedEdsId)
+int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t DerivId,
+ EdsLib_Id_t *DerivedEdsId)
{
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- EdsLib_DatabaseRef_t TempRef;
+ EdsLib_DatabaseRef_t TempRef;
EdsLib_Decode_StructId(&TempRef, EdsId);
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &TempRef);
@@ -407,19 +432,21 @@ int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD,
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t ConstraintIdx, EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
+int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t ConstraintIdx,
+ EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
{
- EdsLib_DatabaseRef_t ParentObjRef;
- const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- const EdsLib_ConstraintEntity_t *ConstraintEntityPtr;
+ EdsLib_DatabaseRef_t ParentObjRef;
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
+ const EdsLib_ConstraintEntity_t *ConstraintEntityPtr;
const EdsLib_IdentityCheckSequence_t *DerivativeCheck;
memset(MemberInfo, 0, sizeof(*MemberInfo));
EdsLib_Decode_StructId(&ParentObjRef, EdsId);
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &ParentObjRef);
- if (DataDictPtr == NULL ||
- DataDictPtr->BasicType != EDSLIB_BASICTYPE_CONTAINER ||
- DataDictPtr->Detail.Container == NULL)
+ if (DataDictPtr == NULL || DataDictPtr->BasicType != EDSLIB_BASICTYPE_CONTAINER
+ || DataDictPtr->Detail.Container == NULL)
{
return EDSLIB_FAILURE;
}
@@ -432,14 +459,14 @@ int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD,
}
ConstraintEntityPtr = &DerivativeCheck->ConstraintEntityList[ConstraintIdx];
- DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &ConstraintEntityPtr->RefObj);
+ DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &ConstraintEntityPtr->RefObj);
if (DataDictPtr == NULL)
{
return EDSLIB_FAILURE;
}
- MemberInfo->EdsId = EdsLib_Encode_StructId(&ConstraintEntityPtr->RefObj);
- MemberInfo->Offset = ConstraintEntityPtr->Offset;
+ MemberInfo->EdsId = EdsLib_Encode_StructId(&ConstraintEntityPtr->RefObj);
+ MemberInfo->Offset = ConstraintEntityPtr->Offset;
MemberInfo->MaxSize = DataDictPtr->SizeInfo;
return EDSLIB_SUCCESS;
@@ -451,13 +478,15 @@ int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD,
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_DataTypeDB_DerivedTypeInfo_t *DerivInfo)
+int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_DataTypeDB_DerivedTypeInfo_t *DerivInfo)
{
- const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
const EdsLib_IdentityCheckSequence_t *DerivativeCheck;
- EdsLib_DatabaseRef_t TempRef;
+ EdsLib_DatabaseRef_t TempRef;
- memset(DerivInfo,0,sizeof(*DerivInfo));
+ memset(DerivInfo, 0, sizeof(*DerivInfo));
EdsLib_Decode_StructId(&TempRef, EdsId);
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &TempRef);
@@ -466,8 +495,7 @@ int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD, EdsL
return EDSLIB_FAILURE;
}
- if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER &&
- DataDictPtr->Detail.Container != NULL)
+ if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER && DataDictPtr->Detail.Container != NULL)
{
DerivInfo->NumDerivatives = DataDictPtr->Detail.Container->DerivativeListSize;
if (DataDictPtr->Detail.Container->DerivativeListSize > 0)
@@ -499,22 +527,25 @@ int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD, EdsL
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t BaseId,
- EdsLib_Id_t DerivedId, EdsLib_ConstraintCallback_t Callback, void *CbArg)
+int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t BaseId,
+ EdsLib_Id_t DerivedId,
+ EdsLib_ConstraintCallback_t Callback,
+ void *CbArg)
{
- EdsLib_DataTypeDB_EntityInfo_t BaseInfo;
+ EdsLib_DataTypeDB_EntityInfo_t BaseInfo;
EdsLib_ConstraintIterator_ControlBlock_t CtlBlock;
- EdsLib_DatabaseRef_t BaseRef;
- uint32_t NumDerivs = 0;
- int32_t Status = EDSLIB_FAILURE;
+ EdsLib_DatabaseRef_t BaseRef;
+ uint32_t NumDerivs = 0;
+ int32_t Status = EDSLIB_FAILURE;
memset(&CtlBlock, 0, sizeof(CtlBlock));
CtlBlock.UserCallback = Callback;
- CtlBlock.CbArg = CbArg;
+ CtlBlock.CbArg = CbArg;
memset(&BaseInfo, 0, sizeof(BaseInfo));
BaseInfo.EdsId = DerivedId;
- while(BaseInfo.EdsId != BaseId)
+ while (BaseInfo.EdsId != BaseId)
{
EdsLib_Decode_StructId(&CtlBlock.TargetRef, BaseInfo.EdsId);
@@ -594,17 +625,21 @@ int32_t EdsLib_DataTypeDB_BaseCheck(const EdsLib_DatabaseObject_t *GD, EdsLib_Id
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, const EdsLib_SizeInfo_t *MaxSize, EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ const EdsLib_SizeInfo_t *MaxSize,
+ EdsLib_SizeInfo_t *ProcessedSize)
{
EdsLib_DataTypePack_State_t PackState;
- int32_t Status;
+ int32_t Status;
memset(&PackState, 0, sizeof(PackState));
- PackState.Common.HandleMember = EdsLib_DataTypePack_HandleMember;
+ PackState.Common.HandleMember = EdsLib_DataTypePack_HandleMember;
PackState.Common.NativeBufferPtr = SourceBuffer;
- PackState.Common.MaxSize = *MaxSize;
+ PackState.Common.MaxSize = *MaxSize;
EdsLib_Decode_StructId(&PackState.Common.RefObj, *EdsId);
PackState.PackedDstPtr = DestBuffer;
PackState.NativeSrcPtr = SourceBuffer;
@@ -624,7 +659,7 @@ int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t
if (ProcessedSize != NULL)
{
- ProcessedSize->Bits = PackState.Common.LastActualTailBitPos;
+ ProcessedSize->Bits = PackState.Common.LastActualTailBitPos;
ProcessedSize->Bytes = PackState.Common.LastNominalTail.Bytes;
}
@@ -637,15 +672,20 @@ int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxPackedBitSize, uint32_t SourceByteSize, uint32_t StartingBit)
+int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxPackedBitSize,
+ uint32_t SourceByteSize,
+ uint32_t StartingBit)
{
- EdsLib_SizeInfo_t MaxSize;
- EdsLib_SizeInfo_t ProcessedSize;
+ EdsLib_SizeInfo_t MaxSize;
+ EdsLib_SizeInfo_t ProcessedSize;
EdsLib_DataTypeDB_EntityInfo_t EntityInfo;
- int32_t Status;
+ int32_t Status;
- MaxSize.Bits = MaxPackedBitSize;
+ MaxSize.Bits = MaxPackedBitSize;
MaxSize.Bytes = SourceByteSize;
memset(&ProcessedSize, 0, sizeof(ProcessedSize));
@@ -675,8 +715,8 @@ int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD, E
if (Status == EDSLIB_SUCCESS)
{
- Status = EdsLib_DataTypeDB_PackPartialObjectVarSize(GD, EdsId,
- DestBuffer, SourceBuffer, &MaxSize, &ProcessedSize);
+ Status =
+ EdsLib_DataTypeDB_PackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, &MaxSize, &ProcessedSize);
}
return Status;
@@ -688,16 +728,20 @@ int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD, E
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const void *NativeBuffer, void *PackedBuffer, const EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *NativeBuffer,
+ void *PackedBuffer,
+ const EdsLib_SizeInfo_t *ProcessedSize)
{
EdsLib_PackedPostProc_ControlBlock_t CtlBlock;
memset(&CtlBlock, 0, sizeof(CtlBlock));
- CtlBlock.Pack.Common.HandleMember = EdsLib_PackedObject_PostProc_Callback;
+ CtlBlock.Pack.Common.HandleMember = EdsLib_PackedObject_PostProc_Callback;
CtlBlock.Pack.Common.NativeBufferPtr = NativeBuffer;
- CtlBlock.Pack.Common.MaxSize = *ProcessedSize;
- CtlBlock.Pack.Common.MaxPasses = 1;
+ CtlBlock.Pack.Common.MaxSize = *ProcessedSize;
+ CtlBlock.Pack.Common.MaxPasses = 1;
EdsLib_Decode_StructId(&CtlBlock.Pack.Common.RefObj, EdsId);
CtlBlock.Pack.NativeSrcPtr = NativeBuffer;
@@ -721,7 +765,7 @@ int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObjec
int32_t EdsLib_DataTypeDB_FinalizePackedObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *PackedData)
{
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- int32_t Status;
+ int32_t Status;
/*
* This API gets the size from the DB, it is not passed via arguments. Thus
@@ -747,15 +791,19 @@ int32_t EdsLib_DataTypeDB_FinalizePackedObject(const EdsLib_DatabaseObject_t *GD
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, EdsLib_SizeInfo_t *PackedSize)
+int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ EdsLib_SizeInfo_t *PackedSize)
{
- int32_t Status;
+ int32_t Status;
EdsLib_SizeInfo_t ProcessedSize;
memset(&ProcessedSize, 0, sizeof(ProcessedSize));
- Status = EdsLib_DataTypeDB_PackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, PackedSize, &ProcessedSize);
+ Status =
+ EdsLib_DataTypeDB_PackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, PackedSize, &ProcessedSize);
if (Status == EDSLIB_SUCCESS)
{
Status = EdsLib_DataTypeDB_FinalizePackedObjectVarSize(GD, *EdsId, SourceBuffer, DestBuffer, &ProcessedSize);
@@ -774,14 +822,18 @@ int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxPackedBitSize, uint32_t SourceByteSize)
+int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxPackedBitSize,
+ uint32_t SourceByteSize)
{
- int32_t Status;
- EdsLib_SizeInfo_t TotalPackedSize;
+ int32_t Status;
+ EdsLib_SizeInfo_t TotalPackedSize;
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- TotalPackedSize.Bits = MaxPackedBitSize;
+ TotalPackedSize.Bits = MaxPackedBitSize;
TotalPackedSize.Bytes = SourceByteSize;
Status = EdsLib_DataTypeDB_PackCompleteObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, &TotalPackedSize);
@@ -800,7 +852,6 @@ int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD,
}
}
-
return Status;
}
@@ -810,17 +861,21 @@ int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD,
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, const EdsLib_SizeInfo_t *MaxSize, EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ const EdsLib_SizeInfo_t *MaxSize,
+ EdsLib_SizeInfo_t *ProcessedSize)
{
EdsLib_DataTypeUnpack_State_t UnpackState;
- int32_t Status;
+ int32_t Status;
memset(&UnpackState, 0, sizeof(UnpackState));
- UnpackState.Common.HandleMember = EdsLib_DataTypeUnpack_HandleMember;
+ UnpackState.Common.HandleMember = EdsLib_DataTypeUnpack_HandleMember;
UnpackState.Common.NativeBufferPtr = DestBuffer;
- UnpackState.Common.MaxSize = *MaxSize;
+ UnpackState.Common.MaxSize = *MaxSize;
EdsLib_Decode_StructId(&UnpackState.Common.RefObj, *EdsId);
UnpackState.NativeDstPtr = DestBuffer;
@@ -841,7 +896,7 @@ int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject
if (ProcessedSize != NULL)
{
- ProcessedSize->Bits = UnpackState.Common.LastActualTailBitPos;
+ ProcessedSize->Bits = UnpackState.Common.LastActualTailBitPos;
ProcessedSize->Bytes = UnpackState.Common.LastNominalTail.Bytes;
}
@@ -854,15 +909,20 @@ int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxNativeByteSize, uint32_t SourceBitSize, uint32_t StartingByte)
+int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxNativeByteSize,
+ uint32_t SourceBitSize,
+ uint32_t StartingByte)
{
- EdsLib_SizeInfo_t MaxSize;
- EdsLib_SizeInfo_t ProcessedSize;
+ EdsLib_SizeInfo_t MaxSize;
+ EdsLib_SizeInfo_t ProcessedSize;
EdsLib_DataTypeDB_EntityInfo_t EntityInfo;
- int32_t Status;
+ int32_t Status;
- MaxSize.Bits = SourceBitSize;
+ MaxSize.Bits = SourceBitSize;
MaxSize.Bytes = MaxNativeByteSize;
memset(&ProcessedSize, 0, sizeof(ProcessedSize));
@@ -892,35 +952,40 @@ int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD,
if (Status == EDSLIB_SUCCESS)
{
- Status = EdsLib_DataTypeDB_UnpackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, &MaxSize, &ProcessedSize);
+ Status =
+ EdsLib_DataTypeDB_UnpackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, &MaxSize, &ProcessedSize);
}
return Status;
}
-
/*----------------------------------------------------------------
*
* EdsLib public API function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *NativeBuffer, const void *PackedBuffer, uint32_t RecomputeFields, const EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *NativeBuffer,
+ const void *PackedBuffer,
+ uint32_t RecomputeFields,
+ const EdsLib_SizeInfo_t *ProcessedSize)
{
EdsLib_NativePostProc_ControlBlock_t CtlBlock;
memset(&CtlBlock, 0, sizeof(CtlBlock));
- CtlBlock.Unpack.Common.HandleMember = EdsLib_NativeObject_PostProc_Callback;
+ CtlBlock.Unpack.Common.HandleMember = EdsLib_NativeObject_PostProc_Callback;
CtlBlock.Unpack.Common.NativeBufferPtr = NativeBuffer;
- CtlBlock.Unpack.Common.MaxSize = *ProcessedSize;
- CtlBlock.Unpack.Common.MaxPasses = 1;
+ CtlBlock.Unpack.Common.MaxSize = *ProcessedSize;
+ CtlBlock.Unpack.Common.MaxPasses = 1;
EdsLib_Decode_StructId(&CtlBlock.Unpack.Common.RefObj, EdsId);
CtlBlock.Unpack.NativeDstPtr = NativeBuffer;
CtlBlock.Unpack.PackedSrcPtr = PackedBuffer;
- CtlBlock.RecomputeFields = RecomputeFields;
- CtlBlock.CheckFields = EDSLIB_DATATYPEDB_RECOMPUTE_ALL;
+ CtlBlock.RecomputeFields = RecomputeFields;
+ CtlBlock.CheckFields = EDSLIB_DATATYPEDB_RECOMPUTE_ALL;
EdsLib_DataTypePackUnpack_Impl(GD, &CtlBlock.Unpack.Common);
@@ -933,11 +998,14 @@ int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObjec
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- void *UnpackedObj, const void *PackedObj, uint32_t RecomputeFields)
+int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *UnpackedObj,
+ const void *PackedObj,
+ uint32_t RecomputeFields)
{
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- int32_t Status;
+ int32_t Status;
/*
* This API gets the size from the DB, it is not passed via arguments. Thus
@@ -951,7 +1019,12 @@ int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD
}
else
{
- Status = EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(GD, EdsId, UnpackedObj, PackedObj, RecomputeFields, &TypeInfo.Size);
+ Status = EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(GD,
+ EdsId,
+ UnpackedObj,
+ PackedObj,
+ RecomputeFields,
+ &TypeInfo.Size);
}
return Status;
@@ -963,13 +1036,14 @@ int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-static void EdsLib_NativeObject_ConstraintInitCallback(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo, EdsLib_GenericValueBuffer_t *ConstraintValue, void *Arg)
+static void EdsLib_NativeObject_ConstraintInitCallback(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
+ EdsLib_GenericValueBuffer_t *ConstraintValue,
+ void *Arg)
{
uint8_t *DataBuf = Arg;
- EdsLib_DataTypeDB_StoreValue(GD, MemberInfo->EdsId,
- &DataBuf[MemberInfo->Offset.Bytes],
- ConstraintValue);
+ EdsLib_DataTypeDB_StoreValue(GD, MemberInfo->EdsId, &DataBuf[MemberInfo->Offset.Bytes], ConstraintValue);
}
/*----------------------------------------------------------------
@@ -978,23 +1052,24 @@ static void EdsLib_NativeObject_ConstraintInitCallback(const EdsLib_DatabaseObje
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *UnpackedObj)
+int32_t
+EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *UnpackedObj)
{
EdsLib_NativePostProc_ControlBlock_t CtlBlock;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- int32_t Status;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ int32_t Status;
memset(&CtlBlock, 0, sizeof(CtlBlock));
EdsLib_DataTypeDB_GetTypeInfo(GD, EdsId, &TypeInfo);
- CtlBlock.Unpack.Common.HandleMember = EdsLib_NativeObject_PostProc_Callback;
+ CtlBlock.Unpack.Common.HandleMember = EdsLib_NativeObject_PostProc_Callback;
CtlBlock.Unpack.Common.NativeBufferPtr = UnpackedObj;
- CtlBlock.Unpack.Common.MaxSize = TypeInfo.Size;
- CtlBlock.Unpack.Common.MaxPasses = 1;
+ CtlBlock.Unpack.Common.MaxSize = TypeInfo.Size;
+ CtlBlock.Unpack.Common.MaxPasses = 1;
EdsLib_Decode_StructId(&CtlBlock.Unpack.Common.RefObj, EdsId);
CtlBlock.Unpack.NativeDstPtr = UnpackedObj;
- CtlBlock.RecomputeFields = EDSLIB_DATATYPEDB_RECOMPUTE_FIXEDVALUE | EDSLIB_DATATYPEDB_RECOMPUTE_LENGTH;
+ CtlBlock.RecomputeFields = EDSLIB_DATATYPEDB_RECOMPUTE_FIXEDVALUE | EDSLIB_DATATYPEDB_RECOMPUTE_LENGTH;
EdsLib_DataTypePackUnpack_Impl(GD, &CtlBlock.Unpack.Common);
@@ -1002,8 +1077,11 @@ int32_t EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *
if (Status == EDSLIB_SUCCESS)
{
- Status = EdsLib_DataTypeDB_ConstraintIterator(GD, EDSLIB_ID_INVALID, EdsId,
- EdsLib_NativeObject_ConstraintInitCallback, UnpackedObj);
+ Status = EdsLib_DataTypeDB_ConstraintIterator(GD,
+ EDSLIB_ID_INVALID,
+ EdsId,
+ EdsLib_NativeObject_ConstraintInitCallback,
+ UnpackedObj);
}
return Status;
@@ -1015,23 +1093,31 @@ int32_t EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer, uint32_t MaxNativeByteSize, uint32_t SourceBitSize)
+int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxNativeByteSize,
+ uint32_t SourceBitSize)
{
- int32_t Status;
+ int32_t Status;
EdsLib_SizeInfo_t MaxSize;
EdsLib_SizeInfo_t ProcessedSize;
- MaxSize.Bits = SourceBitSize;
+ MaxSize.Bits = SourceBitSize;
MaxSize.Bytes = MaxNativeByteSize;
memset(&ProcessedSize, 0, sizeof(ProcessedSize));
- Status = EdsLib_DataTypeDB_UnpackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer,
- &MaxSize, &ProcessedSize);
+ Status =
+ EdsLib_DataTypeDB_UnpackPartialObjectVarSize(GD, EdsId, DestBuffer, SourceBuffer, &MaxSize, &ProcessedSize);
if (Status == EDSLIB_SUCCESS)
{
- Status = EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(GD, *EdsId, DestBuffer,
- SourceBuffer, EDSLIB_DATATYPEDB_RECOMPUTE_NONE, &ProcessedSize);
+ Status = EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(GD,
+ *EdsId,
+ DestBuffer,
+ SourceBuffer,
+ EDSLIB_DATATYPEDB_RECOMPUTE_NONE,
+ &ProcessedSize);
}
return Status;
@@ -1043,11 +1129,14 @@ int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_GenericValueBuffer_t *DestBuffer, const void *SrcPtr)
+int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_GenericValueBuffer_t *DestBuffer,
+ const void *SrcPtr)
{
- EdsLib_DatabaseRef_t TempRef;
+ EdsLib_DatabaseRef_t TempRef;
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- EdsLib_ConstPtr_t Src = { .Ptr = SrcPtr };
+ EdsLib_ConstPtr_t Src = { .Ptr = SrcPtr };
DestBuffer->ValueType = EDSLIB_BASICTYPE_NONE;
EdsLib_Decode_StructId(&TempRef, EdsId);
@@ -1070,11 +1159,14 @@ int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr, EdsLib_GenericValueBuffer_t *SrcBuffer)
+int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *DestPtr,
+ EdsLib_GenericValueBuffer_t *SrcBuffer)
{
- EdsLib_DatabaseRef_t TempRef;
+ EdsLib_DatabaseRef_t TempRef;
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- EdsLib_Ptr_t Dest = { .Ptr = DestPtr };
+ EdsLib_Ptr_t Dest = { .Ptr = DestPtr };
EdsLib_Decode_StructId(&TempRef, EdsId);
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &TempRef);
@@ -1096,12 +1188,15 @@ int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD, EdsLib_I
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const void *BufferPtr,
- size_t BufferSize, EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo)
+int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *BufferPtr,
+ size_t BufferSize,
+ EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo)
{
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- EdsLib_DatabaseRef_t ActualRef;
- int32_t Status;
+ EdsLib_DatabaseRef_t ActualRef;
+ int32_t Status;
EdsLib_Decode_StructId(&ActualRef, EdsId);
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &ActualRef);
@@ -1112,8 +1207,12 @@ int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *
}
else
{
- Status = EdsLib_DataTypeIdentifyBuffer_Impl(GD, DataDictPtr, BufferPtr, BufferSize,
- &DerivObjInfo->DerivativeTableIndex, &ActualRef);
+ Status = EdsLib_DataTypeIdentifyBuffer_Impl(GD,
+ DataDictPtr,
+ BufferPtr,
+ BufferSize,
+ &DerivObjInfo->DerivativeTableIndex,
+ &ActualRef);
}
if (Status == EDSLIB_SUCCESS)
@@ -1135,12 +1234,14 @@ int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const void *BufferPtr,
- EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo)
+int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *BufferPtr,
+ EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo)
{
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- EdsLib_DatabaseRef_t ActualRef;
- int32_t Status;
+ EdsLib_DatabaseRef_t ActualRef;
+ int32_t Status;
EdsLib_Decode_StructId(&ActualRef, EdsId);
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &ActualRef);
@@ -1151,8 +1252,12 @@ int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD, EdsL
}
else
{
- Status = EdsLib_DataTypeIdentifyBuffer_Impl(GD, DataDictPtr, BufferPtr, DataDictPtr->SizeInfo.Bytes,
- &DerivObjInfo->DerivativeTableIndex, &ActualRef);
+ Status = EdsLib_DataTypeIdentifyBuffer_Impl(GD,
+ DataDictPtr,
+ BufferPtr,
+ DataDictPtr->SizeInfo.Bytes,
+ &DerivObjInfo->DerivativeTableIndex,
+ &ActualRef);
}
if (Status == EDSLIB_SUCCESS)
diff --git a/edslib/fsw/src/edslib_datatypedb_constraints.c b/edslib/fsw/src/edslib_datatypedb_constraints.c
index 44c809c..052b672 100644
--- a/edslib/fsw/src/edslib_datatypedb_constraints.c
+++ b/edslib/fsw/src/edslib_datatypedb_constraints.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_constraints.c
* \ingroup fsw
@@ -48,20 +47,21 @@
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t *GD,
- EdsLib_ConstraintIterator_ControlBlock_t *CtlBlock, const EdsLib_DatabaseRef_t *BaseRef)
+int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_ConstraintIterator_ControlBlock_t *CtlBlock,
+ const EdsLib_DatabaseRef_t *BaseRef)
{
- const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- const EdsLib_ContainerDescriptor_t *DerivDescPtr;
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
+ const EdsLib_ContainerDescriptor_t *DerivDescPtr;
const EdsLib_IdentityCheckSequence_t *DerivativeCheck;
- const EdsLib_IdentSequenceEntry_t *IdentSequencePtr;
- const EdsLib_DerivativeEntry_t *DerivEntryPtr;
- const EdsLib_ValueEntry_t *SelectedEntry;
- const EdsLib_ConstraintEntity_t *SelectedLocation;
- uint16_t DerivIdx;
- int32_t Status;
-
- SelectedEntry = NULL;
+ const EdsLib_IdentSequenceEntry_t *IdentSequencePtr;
+ const EdsLib_DerivativeEntry_t *DerivEntryPtr;
+ const EdsLib_ValueEntry_t *SelectedEntry;
+ const EdsLib_ConstraintEntity_t *SelectedLocation;
+ uint16_t DerivIdx;
+ int32_t Status;
+
+ SelectedEntry = NULL;
SelectedLocation = NULL;
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, BaseRef);
@@ -85,9 +85,9 @@ int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t
return EDSLIB_NO_MATCHING_VALUE;
}
- Status = EDSLIB_NO_MATCHING_VALUE;
+ Status = EDSLIB_NO_MATCHING_VALUE;
DerivEntryPtr = DerivDescPtr->DerivativeList;
- for (DerivIdx=0; DerivIdx < DerivDescPtr->DerivativeListSize; ++DerivIdx)
+ for (DerivIdx = 0; DerivIdx < DerivDescPtr->DerivativeListSize; ++DerivIdx)
{
if (EdsLib_DatabaseRef_IsEqual(&DerivEntryPtr->RefObj, &CtlBlock->TargetRef))
{
@@ -114,7 +114,7 @@ int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t
* start at the result (the derivative) and follow the ParentOperation
* links, which reveal the conditions required on the base type.
*/
- IdentSequencePtr = &DerivativeCheck->SequenceList[DerivEntryPtr->IdentSeqIdx];
+ IdentSequencePtr = &DerivativeCheck->SequenceList[DerivEntryPtr->IdentSeqIdx];
CtlBlock->TempConstraintValue.ValueType = EDSLIB_BASICTYPE_NONE;
while (IdentSequencePtr->EntryType != EDSLIB_IDENT_SEQUENCE_INVALID)
{
@@ -133,34 +133,39 @@ int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t
if (SelectedEntry->BasicType == EDSLIB_BASICTYPE_SIGNED_INT)
{
CtlBlock->TempConstraintValue.Value.SignedInteger = SelectedEntry->RefValue.Single.SignedInt;
- CtlBlock->TempConstraintValue.ValueType = SelectedEntry->BasicType;
+ CtlBlock->TempConstraintValue.ValueType = SelectedEntry->BasicType;
}
else if (SelectedEntry->BasicType == EDSLIB_BASICTYPE_UNSIGNED_INT)
{
- CtlBlock->TempConstraintValue.Value.UnsignedInteger = SelectedEntry->RefValue.Single.UnsignedInt;
+ CtlBlock->TempConstraintValue.Value.UnsignedInteger =
+ SelectedEntry->RefValue.Single.UnsignedInt;
CtlBlock->TempConstraintValue.ValueType = SelectedEntry->BasicType;
}
else if (SelectedEntry->BasicType == EDSLIB_BASICTYPE_FLOAT)
{
CtlBlock->TempConstraintValue.Value.FloatingPoint = SelectedEntry->RefValue.Single.FloatingPt;
- CtlBlock->TempConstraintValue.ValueType = SelectedEntry->BasicType;
+ CtlBlock->TempConstraintValue.ValueType = SelectedEntry->BasicType;
}
else if (SelectedEntry->BasicType == EDSLIB_BASICTYPE_BINARY)
{
- strncpy(CtlBlock->TempConstraintValue.Value.StringData, SelectedEntry->RefValue.Single.String,
+ strncpy(CtlBlock->TempConstraintValue.Value.StringData,
+ SelectedEntry->RefValue.Single.String,
sizeof(CtlBlock->TempConstraintValue.Value.StringData));
CtlBlock->TempConstraintValue.ValueType = SelectedEntry->BasicType;
}
}
if (CtlBlock->TempConstraintValue.ValueType != EDSLIB_BASICTYPE_NONE)
{
- CtlBlock->TempMemberInfo.EdsId = EdsLib_Encode_StructId(&SelectedLocation->RefObj);
- CtlBlock->TempMemberInfo.Offset = SelectedLocation->Offset;
+ CtlBlock->TempMemberInfo.EdsId = EdsLib_Encode_StructId(&SelectedLocation->RefObj);
+ CtlBlock->TempMemberInfo.Offset = SelectedLocation->Offset;
CtlBlock->TempMemberInfo.MaxSize = DataDictPtr->SizeInfo;
- CtlBlock->UserCallback(GD, &CtlBlock->TempMemberInfo, &CtlBlock->TempConstraintValue, CtlBlock->CbArg);
+ CtlBlock->UserCallback(GD,
+ &CtlBlock->TempMemberInfo,
+ &CtlBlock->TempConstraintValue,
+ CtlBlock->CbArg);
}
CtlBlock->TempConstraintValue.ValueType = EDSLIB_BASICTYPE_NONE;
- SelectedEntry = NULL;
+ SelectedEntry = NULL;
}
}
IdentSequencePtr = &DerivativeCheck->SequenceList[IdentSequencePtr->ParentOperation];
@@ -259,7 +264,7 @@ int8_t EdsLib_DataType_CompareGeneric(const EdsLib_GenericValueBuffer_t *Value1,
/* ensure the data is consistently typed - value2 will be coerced into whatever type value1 is */
EdsLib_DataTypeConvert(Value2, Value1->ValueType);
- switch(Value1->ValueType)
+ switch (Value1->ValueType)
{
case EDSLIB_BASICTYPE_UNSIGNED_INT:
Result = EdsLib_DataType_CompareUnsignedInt(Value1->Value.UnsignedInteger, Value2->Value.UnsignedInteger);
@@ -287,10 +292,12 @@ int8_t EdsLib_DataType_CompareGeneric(const EdsLib_GenericValueBuffer_t *Value1,
* Load a reference value from the DB
*
*-----------------------------------------------------------------*/
-void EdsLib_DataType_IdentLoadReference(EdsLib_GenericValueBuffer_t *ValuePtr, EdsLib_BasicType_t RefType, const EdsLib_SingleValue_t *RefValPtr)
+void EdsLib_DataType_IdentLoadReference(EdsLib_GenericValueBuffer_t *ValuePtr,
+ EdsLib_BasicType_t RefType,
+ const EdsLib_SingleValue_t *RefValPtr)
{
ValuePtr->ValueType = RefType;
- switch(RefType)
+ switch (RefType)
{
case EDSLIB_BASICTYPE_UNSIGNED_INT:
ValuePtr->Value.UnsignedInteger = RefValPtr->UnsignedInt;
@@ -316,7 +323,8 @@ void EdsLib_DataType_IdentLoadReference(EdsLib_GenericValueBuffer_t *ValuePtr, E
* Implement single value check
*
*-----------------------------------------------------------------*/
-int8_t EdsLib_DataType_IdentValueCheckSingle(const EdsLib_ValueEntry_t *SelectedEntry, const EdsLib_GenericValueBuffer_t *ValuePtr)
+int8_t EdsLib_DataType_IdentValueCheckSingle(const EdsLib_ValueEntry_t *SelectedEntry,
+ const EdsLib_GenericValueBuffer_t *ValuePtr)
{
EdsLib_GenericValueBuffer_t RefValue;
@@ -331,16 +339,17 @@ int8_t EdsLib_DataType_IdentValueCheckSingle(const EdsLib_ValueEntry_t *Selected
* Implement range value check
*
*-----------------------------------------------------------------*/
-int8_t EdsLib_DataType_IdentValueCheckRange(const EdsLib_ValueEntry_t *SelectedEntry, const EdsLib_GenericValueBuffer_t *ValuePtr)
+int8_t EdsLib_DataType_IdentValueCheckRange(const EdsLib_ValueEntry_t *SelectedEntry,
+ const EdsLib_GenericValueBuffer_t *ValuePtr)
{
EdsLib_GenericValueBuffer_t RefTemp;
- int8_t MinResult;
- int8_t MaxResult;
- int8_t MinReq;
- int8_t MaxReq;
+ int8_t MinResult;
+ int8_t MaxResult;
+ int8_t MinReq;
+ int8_t MaxReq;
/* load the minimum, if applicable */
- switch(SelectedEntry->InclusionStyle)
+ switch (SelectedEntry->InclusionStyle)
{
case EDSLIB_VALUE_INCLUSIONSTYLE_NONE:
MinResult = -1;
@@ -362,7 +371,7 @@ int8_t EdsLib_DataType_IdentValueCheckRange(const EdsLib_ValueEntry_t *SelectedE
}
/* load the maximum, if applicable */
- switch(SelectedEntry->InclusionStyle)
+ switch (SelectedEntry->InclusionStyle)
{
case EDSLIB_VALUE_INCLUSIONSTYLE_NONE:
MaxResult = 1;
@@ -383,7 +392,7 @@ int8_t EdsLib_DataType_IdentValueCheckRange(const EdsLib_ValueEntry_t *SelectedE
break;
}
- switch(SelectedEntry->InclusionStyle)
+ switch (SelectedEntry->InclusionStyle)
{
case EDSLIB_VALUE_INCLUSIONSTYLE_INCLUSIVE_MIN_INCLUSIVE_MAX:
case EDSLIB_VALUE_INCLUSIONSTYLE_INCLUSIVE_MIN_EXCLUSIVE_MAX:
@@ -396,7 +405,7 @@ int8_t EdsLib_DataType_IdentValueCheckRange(const EdsLib_ValueEntry_t *SelectedE
break;
}
- switch(SelectedEntry->InclusionStyle)
+ switch (SelectedEntry->InclusionStyle)
{
case EDSLIB_VALUE_INCLUSIONSTYLE_INCLUSIVE_MIN_INCLUSIVE_MAX:
case EDSLIB_VALUE_INCLUSIONSTYLE_EXCLUSIVE_MIN_INCLUSIVE_MAX:
@@ -429,7 +438,8 @@ int8_t EdsLib_DataType_IdentValueCheckRange(const EdsLib_ValueEntry_t *SelectedE
* Implement value check supporting both single and range
*
*-----------------------------------------------------------------*/
-int8_t EdsLib_DataType_IdentValueCheck(const EdsLib_ValueEntry_t *SelectedEntry, const EdsLib_GenericValueBuffer_t *ValuePtr)
+int8_t EdsLib_DataType_IdentValueCheck(const EdsLib_ValueEntry_t *SelectedEntry,
+ const EdsLib_GenericValueBuffer_t *ValuePtr)
{
int8_t Result;
@@ -455,25 +465,28 @@ int8_t EdsLib_DataType_IdentValueCheck(const EdsLib_ValueEntry_t *SelectedEntry,
}
return Result;
- }
+}
- /*----------------------------------------------------------------
+/*----------------------------------------------------------------
*
* EdsLib internal function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const EdsLib_IdentSequenceEntry_t *EdsLib_DataTypeExecuteConstraintSequence_Impl(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_IdentityCheckSequence_t *CheckSequence, const void *Buffer, size_t MaxOffset)
+const EdsLib_IdentSequenceEntry_t *
+EdsLib_DataTypeExecuteConstraintSequence_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_IdentityCheckSequence_t *CheckSequence,
+ const void *Buffer,
+ size_t MaxOffset)
{
- const EdsLib_ValueEntry_t *SelectedValue;
- const EdsLib_ConstraintEntity_t *SelectedConstraint;
+ const EdsLib_ValueEntry_t *SelectedValue;
+ const EdsLib_ConstraintEntity_t *SelectedConstraint;
const EdsLib_IdentSequenceEntry_t *IdentSequencePtr;
- const EdsLib_DataTypeDB_Entry_t *DataTypePtr;
- EdsLib_ConstPtr_t SrcPtr;
- EdsLib_GenericValueBuffer_t ValueBuff;
- int8_t CompareResult;
- uint16_t CurrSeqPos;
+ const EdsLib_DataTypeDB_Entry_t *DataTypePtr;
+ EdsLib_ConstPtr_t SrcPtr;
+ EdsLib_GenericValueBuffer_t ValueBuff;
+ int8_t CompareResult;
+ uint16_t CurrSeqPos;
CurrSeqPos = CheckSequence->SequenceEntryIdx;
do
@@ -493,7 +506,7 @@ const EdsLib_IdentSequenceEntry_t *EdsLib_DataTypeExecuteConstraintSequence_Impl
else if (IdentSequencePtr->EntryType == EDSLIB_IDENT_SEQUENCE_ENTITY_LOCATION)
{
SelectedConstraint = &CheckSequence->ConstraintEntityList[IdentSequencePtr->Datum];
- DataTypePtr = EdsLib_DataTypeDB_GetEntry(GD, &SelectedConstraint->RefObj);
+ DataTypePtr = EdsLib_DataTypeDB_GetEntry(GD, &SelectedConstraint->RefObj);
if (DataTypePtr != NULL && (SelectedConstraint->Offset.Bytes + DataTypePtr->SizeInfo.Bytes) <= MaxOffset)
{
SrcPtr.Ptr = (const uint8_t *)Buffer + SelectedConstraint->Offset.Bytes;
@@ -540,8 +553,7 @@ const EdsLib_IdentSequenceEntry_t *EdsLib_DataTypeExecuteConstraintSequence_Impl
/* a "match" means simply move to the next item */
--CurrSeqPos;
}
- }
- while (true);
+ } while (true);
return IdentSequencePtr;
}
@@ -552,11 +564,16 @@ const EdsLib_IdentSequenceEntry_t *EdsLib_DataTypeExecuteConstraintSequence_Impl
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeIdentifyBuffer_Impl(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_Entry_t *DataDictPtr, const void *Buffer, size_t MaxOffset, uint16_t *DerivTableIndex, EdsLib_DatabaseRef_t *ActualObj)
+int32_t EdsLib_DataTypeIdentifyBuffer_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ const void *Buffer,
+ size_t MaxOffset,
+ uint16_t *DerivTableIndex,
+ EdsLib_DatabaseRef_t *ActualObj)
{
const EdsLib_ContainerDescriptor_t *DerivedContainerDesc;
- const EdsLib_IdentSequenceEntry_t *IdentSequencePtr;
- int32_t Status;
+ const EdsLib_IdentSequenceEntry_t *IdentSequencePtr;
+ int32_t Status;
if (DataDictPtr == NULL || DataDictPtr->BasicType != EDSLIB_BASICTYPE_CONTAINER)
{
@@ -568,8 +585,8 @@ int32_t EdsLib_DataTypeIdentifyBuffer_Impl(const EdsLib_DatabaseObject_t *GD, co
Status = EDSLIB_NO_MATCHING_VALUE;
if (DerivedContainerDesc->CheckSequence != NULL)
{
- IdentSequencePtr = EdsLib_DataTypeExecuteConstraintSequence_Impl(GD,
- DerivedContainerDesc->CheckSequence, Buffer, MaxOffset);
+ IdentSequencePtr =
+ EdsLib_DataTypeExecuteConstraintSequence_Impl(GD, DerivedContainerDesc->CheckSequence, Buffer, MaxOffset);
if (IdentSequencePtr != NULL && IdentSequencePtr->EntryType == EDSLIB_IDENT_SEQUENCE_REFOBJ_RESULT)
{
diff --git a/edslib/fsw/src/edslib_datatypedb_errorcontrol.c b/edslib/fsw/src/edslib_datatypedb_errorcontrol.c
index 924b7cb..facf431 100644
--- a/edslib/fsw/src/edslib_datatypedb_errorcontrol.c
+++ b/edslib/fsw/src/edslib_datatypedb_errorcontrol.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_errorcontrol.c
* \ingroup fsw
@@ -44,7 +43,7 @@
* Output Reflection: False
* XOR Output: 0x0000
*/
-#define EDSLIB_CRC16_CCITT_POLY 0x1021 /* x^16 + x^12 + x^5 + 1 */
+#define EDSLIB_CRC16_CCITT_POLY 0x1021 /* x^16 + x^12 + x^5 + 1 */
/*
* CRC Algorithm: CRC-8
@@ -54,35 +53,31 @@
* Output Reflection: False
* XOR Output: 0x00
*/
-#define EDSLIB_CRC8_POLY 0x07 /* x^8 + x^2 + x^1 + 1 */
-
+#define EDSLIB_CRC8_POLY 0x07 /* x^8 + x^2 + x^1 + 1 */
typedef uintmax_t (*EdsLib_ErrorControlImpl_t)(const void *Buffer, uint32_t BufferSizeBytes, uint32_t ErrCtlBitPos);
static uintmax_t EdsLib_ErrorControlAlgorithm_ZERO(const void *Base, uint32_t Size, uint32_t ErrCtlBitPos);
-static uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL(const void *Base, uint32_t Size, uint32_t ErrCtlBitPos);
+static uintmax_t
+EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL(const void *Base, uint32_t Size, uint32_t ErrCtlBitPos);
static uintmax_t EdsLib_ErrorControlAlgorithm_CRC16_CCITT(const void *Base, uint32_t Size, uint32_t ErrCtlBitPos);
static uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t Size, uint32_t ErrCtlBitPos);
static uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM(const void *Base, uint32_t Size, uint32_t ErrCtlBitPos);
-
-static const EdsLib_ErrorControlImpl_t EDSLIB_ERRCTL_DISPATCH[EdsLib_ErrorControlType_MAX] =
-{
- [EdsLib_ErrorControlType_INVALID] = EdsLib_ErrorControlAlgorithm_ZERO,
- [EdsLib_ErrorControlType_ALWAYS_ZERO] = EdsLib_ErrorControlAlgorithm_ZERO,
- [EdsLib_ErrorControlType_CHECKSUM] = EdsLib_ErrorControlAlgorithm_CHECKSUM,
- [EdsLib_ErrorControlType_CHECKSUM_LONGITUDINAL] = EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL,
- [EdsLib_ErrorControlType_CRC8] = EdsLib_ErrorControlAlgorithm_CRC8,
- [EdsLib_ErrorControlType_CRC16_CCITT] = EdsLib_ErrorControlAlgorithm_CRC16_CCITT,
- [EdsLib_ErrorControlType_CRC32] = EdsLib_ErrorControlAlgorithm_ZERO, /* placeholder; not implemented yet */
- [EdsLib_ErrorControlType_CRC32C] = EdsLib_ErrorControlAlgorithm_ZERO /* placeholder; not implemented yet */
+static const EdsLib_ErrorControlImpl_t EDSLIB_ERRCTL_DISPATCH[EdsLib_ErrorControlType_MAX] = {
+ [EdsLib_ErrorControlType_INVALID] = EdsLib_ErrorControlAlgorithm_ZERO,
+ [EdsLib_ErrorControlType_ALWAYS_ZERO] = EdsLib_ErrorControlAlgorithm_ZERO,
+ [EdsLib_ErrorControlType_CHECKSUM] = EdsLib_ErrorControlAlgorithm_CHECKSUM,
+ [EdsLib_ErrorControlType_CHECKSUM_LONGITUDINAL] = EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL,
+ [EdsLib_ErrorControlType_CRC8] = EdsLib_ErrorControlAlgorithm_CRC8,
+ [EdsLib_ErrorControlType_CRC16_CCITT] = EdsLib_ErrorControlAlgorithm_CRC16_CCITT,
+ [EdsLib_ErrorControlType_CRC32] = EdsLib_ErrorControlAlgorithm_ZERO, /* placeholder; not implemented yet */
+ [EdsLib_ErrorControlType_CRC32C] = EdsLib_ErrorControlAlgorithm_ZERO /* placeholder; not implemented yet */
};
-
static uint16_t EDSLIB_CRC16_CCITT_TABLE[256];
static uint8_t EDSLIB_CRC8_TABLE[256];
-
/*----------------------------------------------------------------
*
* EdsLib internal function
@@ -107,7 +102,7 @@ void EdsLib_ErrorControl_Initialize(void)
for (i = 0; i < 256; ++i)
{
crc16_shiftreg = i << 8;
- crc8_shiftreg = 0;
+ crc8_shiftreg = 0;
for (bit = 0; bit < 8; ++bit)
{
@@ -120,7 +115,7 @@ void EdsLib_ErrorControl_Initialize(void)
for (bit = 0; bit < 8; ++bit)
{
crc16_shiftreg <<= 1;
- crc8_shiftreg <<= 1;
+ crc8_shiftreg <<= 1;
if (crc16_shiftreg & 0x10000)
{
crc16_shiftreg ^= EDSLIB_CRC16_CCITT_POLY;
@@ -154,28 +149,28 @@ uintmax_t EdsLib_ErrorControlAlgorithm_ZERO(const void *Base, uint32_t TotalBitS
return 0;
}
-
/*----------------------------------------------------------------
*
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL(const void *Base, uint32_t TotalBitSize, uint32_t ErrCtlBitPos)
+uintmax_t
+EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL(const void *Base, uint32_t TotalBitSize, uint32_t ErrCtlBitPos)
{
const uint8_t *SrcPtr;
- uint32_t ErrCtlByte;
- uint32_t CurrByte;
- uint32_t TotalByte;
- uint8_t NextMask;
- uint8_t Byte;
- uint8_t Checksum;
-
- NextMask = 0xFF;
- Checksum = 0xFF;
- TotalByte = (TotalBitSize + 7) >> 3;
+ uint32_t ErrCtlByte;
+ uint32_t CurrByte;
+ uint32_t TotalByte;
+ uint8_t NextMask;
+ uint8_t Byte;
+ uint8_t Checksum;
+
+ NextMask = 0xFF;
+ Checksum = 0xFF;
+ TotalByte = (TotalBitSize + 7) >> 3;
ErrCtlByte = ErrCtlBitPos >> 3;
- CurrByte = 0;
- SrcPtr = Base;
+ CurrByte = 0;
+ SrcPtr = Base;
while (CurrByte < TotalByte)
{
Byte = *SrcPtr;
@@ -183,13 +178,13 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL(const void *Base, u
if (CurrByte == ErrCtlByte)
{
- NextMask = (0x100 >> (ErrCtlBitPos & 0x07)) - 1;
- Byte &= ~NextMask;
+ NextMask = (0x100 >> (ErrCtlBitPos & 0x07)) - 1;
+ Byte &= ~NextMask;
}
else
{
- Byte &= NextMask;
- NextMask = 0xFF;
+ Byte &= NextMask;
+ NextMask = 0xFF;
}
Checksum ^= Byte;
@@ -207,15 +202,15 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM_LONGITUDINAL(const void *Base, u
uintmax_t EdsLib_ErrorControlAlgorithm_CRC16_CCITT(const void *Base, uint32_t TotalBitSize, uint32_t ErrCtlBitPos)
{
const uint8_t *SrcPtr;
- uint32_t NextBitPos;
- uint32_t CurrBitPos;
- uint32_t BreakpointBitPos;
- uint32_t CurrShift;
- uint16_t crc;
- uint8_t byte;
-
- crc = 0xFFFF;
- SrcPtr = Base;
+ uint32_t NextBitPos;
+ uint32_t CurrBitPos;
+ uint32_t BreakpointBitPos;
+ uint32_t CurrShift;
+ uint16_t crc;
+ uint8_t byte;
+
+ crc = 0xFFFF;
+ SrcPtr = Base;
CurrBitPos = 0;
if (ErrCtlBitPos < TotalBitSize)
{
@@ -227,18 +222,17 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC16_CCITT(const void *Base, uint32_t To
}
CurrShift = 0;
- while(CurrBitPos < TotalBitSize)
+ while (CurrBitPos < TotalBitSize)
{
- byte = SrcPtr[CurrBitPos >> 3];
+ byte = SrcPtr[CurrBitPos >> 3];
NextBitPos = CurrBitPos + 8;
if (CurrShift == 0 && NextBitPos <= BreakpointBitPos)
{
- crc = EDSLIB_CRC16_CCITT_TABLE[(byte ^ (crc >> 8)) & 0xff] ^
- (crc << 8);
+ crc = EDSLIB_CRC16_CCITT_TABLE[(byte ^ (crc >> 8)) & 0xff] ^ (crc << 8);
}
else
{
- byte = byte << CurrShift;
+ byte = byte << CurrShift;
NextBitPos -= CurrShift;
if (NextBitPos > BreakpointBitPos)
@@ -246,7 +240,7 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC16_CCITT(const void *Base, uint32_t To
NextBitPos = BreakpointBitPos;
}
- while(CurrBitPos < NextBitPos)
+ while (CurrBitPos < NextBitPos)
{
if (byte & 0x80)
{
@@ -268,7 +262,6 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC16_CCITT(const void *Base, uint32_t To
CurrBitPos = NextBitPos;
}
-
return crc;
}
@@ -280,15 +273,15 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC16_CCITT(const void *Base, uint32_t To
uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t TotalBitSize, uint32_t ErrCtlBitPos)
{
const uint8_t *SrcPtr;
- uint32_t NextBitPos;
- uint32_t CurrBitPos;
- uint32_t BreakpointBitPos;
- uint32_t CurrShift;
- uint8_t crc;
- uint8_t byte;
-
- crc = 0;
- SrcPtr = Base;
+ uint32_t NextBitPos;
+ uint32_t CurrBitPos;
+ uint32_t BreakpointBitPos;
+ uint32_t CurrShift;
+ uint8_t crc;
+ uint8_t byte;
+
+ crc = 0;
+ SrcPtr = Base;
CurrBitPos = 0;
if (ErrCtlBitPos < TotalBitSize)
{
@@ -300,9 +293,9 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t TotalBitS
}
CurrShift = 0;
- while(CurrBitPos < TotalBitSize)
+ while (CurrBitPos < TotalBitSize)
{
- byte = SrcPtr[CurrBitPos >> 3];
+ byte = SrcPtr[CurrBitPos >> 3];
NextBitPos = CurrBitPos + 8;
if (CurrShift == 0 && NextBitPos <= BreakpointBitPos)
{
@@ -310,7 +303,7 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t TotalBitS
}
else
{
- byte = byte << CurrShift;
+ byte = byte << CurrShift;
NextBitPos -= CurrShift;
if (NextBitPos > BreakpointBitPos)
@@ -318,7 +311,7 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t TotalBitS
NextBitPos = BreakpointBitPos;
}
- while(CurrBitPos < NextBitPos)
+ while (CurrBitPos < NextBitPos)
{
if (byte & 0x80)
{
@@ -333,13 +326,12 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t TotalBitS
NextBitPos = CurrBitPos + 8;
}
- CurrShift = (0 - NextBitPos) & 0x7;
+ CurrShift = (0 - NextBitPos) & 0x7;
BreakpointBitPos = TotalBitSize;
}
CurrBitPos = NextBitPos;
}
-
return crc;
}
@@ -351,13 +343,13 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CRC8(const void *Base, uint32_t TotalBitS
uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM(const void *Base, uint32_t TotalBitSize, uint32_t ErrCtlBitPos)
{
const uint8_t *SrcPtr;
- uint32_t sum = 0;
- uint32_t NextMask = 0xFFFFFFFF;
- uint32_t offset = 0;
- uint32_t intermediate = 0;
+ uint32_t sum = 0;
+ uint32_t NextMask = 0xFFFFFFFF;
+ uint32_t offset = 0;
+ uint32_t intermediate = 0;
SrcPtr = Base;
- for (offset=0; offset < TotalBitSize; offset += 8)
+ for (offset = 0; offset < TotalBitSize; offset += 8)
{
intermediate = (intermediate << 8) | *SrcPtr;
if ((offset & 0x18) == 0x18)
@@ -365,13 +357,13 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM(const void *Base, uint32_t Total
/* mask out bits that are part of the error control field itself */
if ((offset >> 5) == (ErrCtlBitPos >> 5))
{
- NextMask = (UINT32_C(1) << (32-(ErrCtlBitPos & 0x1F))) - 1;
+ NextMask = (UINT32_C(1) << (32 - (ErrCtlBitPos & 0x1F))) - 1;
intermediate &= ~NextMask;
}
else
{
intermediate &= NextMask;
- NextMask = 0xFFFFFFFF;
+ NextMask = 0xFFFFFFFF;
}
sum += intermediate;
@@ -382,18 +374,20 @@ uintmax_t EdsLib_ErrorControlAlgorithm_CHECKSUM(const void *Base, uint32_t Total
if ((offset & 0x1F) != 0)
{
intermediate <<= 32 - (offset & 0x1F);
- intermediate &= NextMask;
- sum += intermediate;
+ intermediate &= NextMask;
+ sum += intermediate;
}
return sum;
}
-
/*******************************************************
* MAIN ERROR CONTROL IMPLEMENTATION FUNCTION
*******************************************************/
-uintmax_t EdsLib_ErrorControlCompute(EdsLib_ErrorControlType_t Algorithm, const void *Buffer, uint32_t BufferSizeBits, uint32_t ErrCtlBitPos)
+uintmax_t EdsLib_ErrorControlCompute(EdsLib_ErrorControlType_t Algorithm,
+ const void *Buffer,
+ uint32_t BufferSizeBits,
+ uint32_t ErrCtlBitPos)
{
uint32_t Idx;
diff --git a/edslib/fsw/src/edslib_datatypedb_iterator.c b/edslib/fsw/src/edslib_datatypedb_iterator.c
index 5f5d1e1..ca27a11 100644
--- a/edslib/fsw/src/edslib_datatypedb_iterator.c
+++ b/edslib/fsw/src/edslib_datatypedb_iterator.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_iterator.c
* \ingroup fsw
@@ -41,19 +40,19 @@
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
- EdsLib_DataTypeIterator_ControlBlock_t *StateInfo)
+int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DataTypeIterator_ControlBlock_t *StateInfo)
{
EdsLib_DataTypeIterator_StackEntry_t *CurrLev;
EdsLib_DataTypeIterator_StackEntry_t *ParentLev;
- EdsLib_Iterator_Rc_t NextAction;
- int32_t Status;
- uint16_t TopDepth;
+ EdsLib_Iterator_Rc_t NextAction;
+ int32_t Status;
+ uint16_t TopDepth;
- TopDepth = 1;
+ TopDepth = 1;
ParentLev = NULL;
- CurrLev = StateInfo->StackBase;
- Status = EDSLIB_SUCCESS;
+ CurrLev = StateInfo->StackBase;
+ Status = EDSLIB_SUCCESS;
/*
* Set up the first entry in the state stack
@@ -66,9 +65,9 @@ int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
return EDSLIB_INCOMPLETE_DB_OBJECT;
}
- CurrLev->CurrDepth = TopDepth;
- CurrLev->EndOffset = CurrLev->DataDictPtr->SizeInfo;
- CurrLev->EndOffset.Bits += CurrLev->StartOffset.Bits;
+ CurrLev->CurrDepth = TopDepth;
+ CurrLev->EndOffset = CurrLev->DataDictPtr->SizeInfo;
+ CurrLev->EndOffset.Bits += CurrLev->StartOffset.Bits;
CurrLev->EndOffset.Bytes += CurrLev->StartOffset.Bytes;
if (CurrLev->DataDictPtr->NumSubElements == 0)
{
@@ -84,7 +83,7 @@ int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
NextAction = EDSLIB_ITERATOR_RC_DESCEND;
}
- while(NextAction != EDSLIB_ITERATOR_RC_STOP)
+ while (NextAction != EDSLIB_ITERATOR_RC_STOP)
{
/*
* Perform the user callback based on the current requested action.
@@ -92,165 +91,163 @@ int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
*/
switch (NextAction)
{
- case EDSLIB_ITERATOR_RC_DESCEND:
- if (CurrLev->DataDictPtr == NULL)
- {
- Status = EDSLIB_INCOMPLETE_DB_OBJECT;
- NextAction = EDSLIB_ITERATOR_RC_ASCEND;
- }
- else if (TopDepth < StateInfo->StackSize)
- {
- /* Give indication to the user application that an object is being started */
- NextAction = StateInfo->Callback(GD, EDSLIB_ITERATOR_CBTYPE_START, CurrLev, StateInfo->CallbackArg);
- ParentLev = CurrLev;
- ++CurrLev;
- ++TopDepth;
- memset(CurrLev, 0, sizeof(*CurrLev));
- CurrLev->CurrDepth = TopDepth;
- }
-
- /* It is never valid to descend twice (must "continue" at least once to get the 1st element) */
- if (NextAction == EDSLIB_ITERATOR_RC_DESCEND)
- {
- NextAction = EDSLIB_ITERATOR_RC_CONTINUE;
- }
- break;
- case EDSLIB_ITERATOR_RC_ASCEND:
- --CurrLev;
- --TopDepth;
+ case EDSLIB_ITERATOR_RC_DESCEND:
+ if (CurrLev->DataDictPtr == NULL)
+ {
+ Status = EDSLIB_INCOMPLETE_DB_OBJECT;
+ NextAction = EDSLIB_ITERATOR_RC_ASCEND;
+ }
+ else if (TopDepth < StateInfo->StackSize)
+ {
+ /* Give indication to the user application that an object is being started */
+ NextAction = StateInfo->Callback(GD, EDSLIB_ITERATOR_CBTYPE_START, CurrLev, StateInfo->CallbackArg);
+ ParentLev = CurrLev;
+ ++CurrLev;
+ ++TopDepth;
+ memset(CurrLev, 0, sizeof(*CurrLev));
+ CurrLev->CurrDepth = TopDepth;
+ }
- if (TopDepth > 1)
- {
- --ParentLev;
+ /* It is never valid to descend twice (must "continue" at least once to get the 1st element) */
+ if (NextAction == EDSLIB_ITERATOR_RC_DESCEND)
+ {
+ NextAction = EDSLIB_ITERATOR_RC_CONTINUE;
+ }
+ break;
+ case EDSLIB_ITERATOR_RC_ASCEND:
+ --CurrLev;
+ --TopDepth;
- /* Give indication to the user application that an object is finished */
- NextAction = StateInfo->Callback(GD, EDSLIB_ITERATOR_CBTYPE_END, CurrLev, StateInfo->CallbackArg);
- }
- else
- {
- ParentLev = NULL;
- NextAction = EDSLIB_ITERATOR_RC_STOP;
- }
- break;
- case EDSLIB_ITERATOR_RC_CONTINUE:
- if (ParentLev == NULL)
- {
- NextAction = EDSLIB_ITERATOR_RC_STOP;
- }
- else if (CurrLev->CurrIndex >= ParentLev->DataDictPtr->NumSubElements)
- {
- /*
- * Advance to the next element in the parent container, if we have not gotten to the end.
- */
- NextAction = EDSLIB_ITERATOR_RC_ASCEND;
- }
- else if (ParentLev->DataDictPtr->BasicType == EDSLIB_BASICTYPE_ARRAY)
- {
- /*
- * Because structure elements might contain padding,
- * we reset the "AbsOffset" every time through, recalculate
- * by taking the parent AbsOffset and adding the start offset to the
- * current element.
- */
- if (CurrLev->CurrIndex == 0)
+ if (TopDepth > 1)
{
- /* Lookup the actual array type. Unlike containers, this only needs to be
- * done on the first time since all entries are of the same type.
- *
- * This calculates the END offset of this element based on the parent size. Doing
- * it this way accounts for (potential) extra padding between elements, such as
- * cases where we have an array of base type containers. This would not be accounted
- * for when using the "SizeInfo" of the current level directly, as this would only be
- * the size of the base type.
- */
- CurrLev->Details.RefObj = ParentLev->DataDictPtr->Detail.Array->ElementRefObj;
- CurrLev->DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &CurrLev->Details.RefObj);
- CurrLev->Details.EntryType = EDSLIB_ENTRYTYPE_ARRAY_ELEMENT;
- CurrLev->StartOffset = ParentLev->StartOffset;
- CurrLev->EndOffset.Bytes = (ParentLev->EndOffset.Bytes - ParentLev->StartOffset.Bytes);
- CurrLev->EndOffset.Bits = (ParentLev->EndOffset.Bits - ParentLev->StartOffset.Bits);
- CurrLev->EndOffset.Bytes /= ParentLev->DataDictPtr->NumSubElements;
- CurrLev->EndOffset.Bits /= ParentLev->DataDictPtr->NumSubElements;
- CurrLev->EndOffset.Bytes += CurrLev->StartOffset.Bytes;
- CurrLev->EndOffset.Bits += CurrLev->StartOffset.Bits;
+ --ParentLev;
+
+ /* Give indication to the user application that an object is finished */
+ NextAction = StateInfo->Callback(GD, EDSLIB_ITERATOR_CBTYPE_END, CurrLev, StateInfo->CallbackArg);
}
else
{
- /*
- * Adjust the start/end offsets to the next element
- */
- EdsLib_SizeInfo_t ElementSize;
- ElementSize.Bytes = CurrLev->EndOffset.Bytes - CurrLev->StartOffset.Bytes;
- ElementSize.Bits = CurrLev->EndOffset.Bits - CurrLev->StartOffset.Bits;
- CurrLev->StartOffset = CurrLev->EndOffset;
- CurrLev->EndOffset.Bytes += ElementSize.Bytes;
- CurrLev->EndOffset.Bits += ElementSize.Bits;
+ ParentLev = NULL;
+ NextAction = EDSLIB_ITERATOR_RC_STOP;
}
- }
- else if (ParentLev->DataDictPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER ||
- ParentLev->DataDictPtr->BasicType == EDSLIB_BASICTYPE_COMPONENT)
- {
- /* Copy the entry details directly from the DB */
- CurrLev->Details = ParentLev->DataDictPtr->Detail.Container->
- EntryList[CurrLev->CurrIndex];
-
- /*
- * Current level is a structure container, all sub-elements are a different type;
- * so structure ID and type info must be reinitialized for each member
- */
- if (CurrLev->CurrIndex == 0)
+ break;
+ case EDSLIB_ITERATOR_RC_CONTINUE:
+ if (ParentLev == NULL)
+ {
+ NextAction = EDSLIB_ITERATOR_RC_STOP;
+ }
+ else if (CurrLev->CurrIndex >= ParentLev->DataDictPtr->NumSubElements)
{
/*
- * Usually the offset of the first entry is zero, except in case
- * where there is leading padding in a container. So it must be
- * added now.
+ * Advance to the next element in the parent container, if we have not gotten to the end.
*/
- CurrLev->StartOffset.Bytes = ParentLev->StartOffset.Bytes +
- CurrLev->Details.Offset.Bytes;
- CurrLev->StartOffset.Bits = ParentLev->StartOffset.Bits +
- CurrLev->Details.Offset.Bits;
+ NextAction = EDSLIB_ITERATOR_RC_ASCEND;
}
- else
+ else if (ParentLev->DataDictPtr->BasicType == EDSLIB_BASICTYPE_ARRAY)
{
- /* The start of the current element is the end of the previous one */
- CurrLev->StartOffset = CurrLev->EndOffset;
+ /*
+ * Because structure elements might contain padding,
+ * we reset the "AbsOffset" every time through, recalculate
+ * by taking the parent AbsOffset and adding the start offset to the
+ * current element.
+ */
+ if (CurrLev->CurrIndex == 0)
+ {
+ /* Lookup the actual array type. Unlike containers, this only needs to be
+ * done on the first time since all entries are of the same type.
+ *
+ * This calculates the END offset of this element based on the parent size. Doing
+ * it this way accounts for (potential) extra padding between elements, such as
+ * cases where we have an array of base type containers. This would not be accounted
+ * for when using the "SizeInfo" of the current level directly, as this would only be
+ * the size of the base type.
+ */
+ CurrLev->Details.RefObj = ParentLev->DataDictPtr->Detail.Array->ElementRefObj;
+ CurrLev->DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &CurrLev->Details.RefObj);
+ CurrLev->Details.EntryType = EDSLIB_ENTRYTYPE_ARRAY_ELEMENT;
+ CurrLev->StartOffset = ParentLev->StartOffset;
+ CurrLev->EndOffset.Bytes = (ParentLev->EndOffset.Bytes - ParentLev->StartOffset.Bytes);
+ CurrLev->EndOffset.Bits = (ParentLev->EndOffset.Bits - ParentLev->StartOffset.Bits);
+ CurrLev->EndOffset.Bytes /= ParentLev->DataDictPtr->NumSubElements;
+ CurrLev->EndOffset.Bits /= ParentLev->DataDictPtr->NumSubElements;
+ CurrLev->EndOffset.Bytes += CurrLev->StartOffset.Bytes;
+ CurrLev->EndOffset.Bits += CurrLev->StartOffset.Bits;
+ }
+ else
+ {
+ /*
+ * Adjust the start/end offsets to the next element
+ */
+ EdsLib_SizeInfo_t ElementSize;
+ ElementSize.Bytes = CurrLev->EndOffset.Bytes - CurrLev->StartOffset.Bytes;
+ ElementSize.Bits = CurrLev->EndOffset.Bits - CurrLev->StartOffset.Bits;
+ CurrLev->StartOffset = CurrLev->EndOffset;
+ CurrLev->EndOffset.Bytes += ElementSize.Bytes;
+ CurrLev->EndOffset.Bits += ElementSize.Bits;
+ }
}
- if (CurrLev->CurrIndex < (ParentLev->DataDictPtr->NumSubElements-1))
+ else if (ParentLev->DataDictPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER
+ || ParentLev->DataDictPtr->BasicType == EDSLIB_BASICTYPE_COMPONENT)
{
- /* peek ahead to the offset of the _next_ entry. This is done
- * for the same reason as the array entries - to include for padding/buffer
- * space between elements in case an entry is actually a base type */
- CurrLev->EndOffset = ParentLev->DataDictPtr->Detail.Container->
- EntryList[1+CurrLev->CurrIndex].Offset;
- CurrLev->EndOffset.Bytes += ParentLev->StartOffset.Bytes;
- CurrLev->EndOffset.Bits += ParentLev->StartOffset.Bits;
+ /* Copy the entry details directly from the DB */
+ CurrLev->Details = ParentLev->DataDictPtr->Detail.Container->EntryList[CurrLev->CurrIndex];
+
+ /*
+ * Current level is a structure container, all sub-elements are a different type;
+ * so structure ID and type info must be reinitialized for each member
+ */
+ if (CurrLev->CurrIndex == 0)
+ {
+ /*
+ * Usually the offset of the first entry is zero, except in case
+ * where there is leading padding in a container. So it must be
+ * added now.
+ */
+ CurrLev->StartOffset.Bytes = ParentLev->StartOffset.Bytes + CurrLev->Details.Offset.Bytes;
+ CurrLev->StartOffset.Bits = ParentLev->StartOffset.Bits + CurrLev->Details.Offset.Bits;
+ }
+ else
+ {
+ /* The start of the current element is the end of the previous one */
+ CurrLev->StartOffset = CurrLev->EndOffset;
+ }
+ if (CurrLev->CurrIndex < (ParentLev->DataDictPtr->NumSubElements - 1))
+ {
+ /* peek ahead to the offset of the _next_ entry. This is done
+ * for the same reason as the array entries - to include for padding/buffer
+ * space between elements in case an entry is actually a base type */
+ CurrLev->EndOffset =
+ ParentLev->DataDictPtr->Detail.Container->EntryList[1 + CurrLev->CurrIndex].Offset;
+ CurrLev->EndOffset.Bytes += ParentLev->StartOffset.Bytes;
+ CurrLev->EndOffset.Bits += ParentLev->StartOffset.Bits;
+ }
+ else
+ {
+ /* use the parent end offset */
+ CurrLev->EndOffset = ParentLev->EndOffset;
+ }
+ CurrLev->DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &CurrLev->Details.RefObj);
}
else
{
- /* use the parent end offset */
- CurrLev->EndOffset = ParentLev->EndOffset;
+ /* Should not get here; bug in database? */
+ NextAction = EDSLIB_ITERATOR_RC_ASCEND;
}
- CurrLev->DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &CurrLev->Details.RefObj);
- }
- else
- {
- /* Should not get here; bug in database? */
- NextAction = EDSLIB_ITERATOR_RC_ASCEND;
- }
- if (NextAction == EDSLIB_ITERATOR_RC_CONTINUE)
- {
- NextAction = StateInfo->Callback(GD, EDSLIB_ITERATOR_CBTYPE_MEMBER, CurrLev, StateInfo->CallbackArg);
- ++CurrLev->CurrIndex;
- }
- break;
+ if (NextAction == EDSLIB_ITERATOR_RC_CONTINUE)
+ {
+ NextAction =
+ StateInfo->Callback(GD, EDSLIB_ITERATOR_CBTYPE_MEMBER, CurrLev, StateInfo->CallbackArg);
+ ++CurrLev->CurrIndex;
+ }
+ break;
- case EDSLIB_ITERATOR_RC_STOP:
- break;
+ case EDSLIB_ITERATOR_RC_STOP:
+ break;
- default:
- NextAction = EDSLIB_ITERATOR_RC_CONTINUE;
- break;
+ default:
+ NextAction = EDSLIB_ITERATOR_RC_CONTINUE;
+ break;
}
}
diff --git a/edslib/fsw/src/edslib_datatypedb_load_store.c b/edslib/fsw/src/edslib_datatypedb_load_store.c
index 28485e8..b8dbbeb 100644
--- a/edslib/fsw/src/edslib_datatypedb_load_store.c
+++ b/edslib/fsw/src/edslib_datatypedb_load_store.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_load_store.c
* \ingroup fsw
@@ -39,10 +38,12 @@
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DataTypeLoad_Impl(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_ConstPtr_t SrcPtr, const EdsLib_DataTypeDB_Entry_t *DictEntryPtr)
+void EdsLib_DataTypeLoad_Impl(EdsLib_GenericValueBuffer_t *ValueBuff,
+ EdsLib_ConstPtr_t SrcPtr,
+ const EdsLib_DataTypeDB_Entry_t *DictEntryPtr)
{
EdsLib_BasicType_t SubjectType;
- uint32_t SubjectSize;
+ uint32_t SubjectSize;
/*
* In keeping with existing paradigms in other internal API calls, this should deal with
@@ -60,66 +61,66 @@ void EdsLib_DataTypeLoad_Impl(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_Con
}
ValueBuff->ValueType = SubjectType;
- switch(EDSLIB_TYPE_AND_SIZE(SubjectSize, SubjectType))
+ switch (EDSLIB_TYPE_AND_SIZE(SubjectSize, SubjectType))
{
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i8), EDSLIB_BASICTYPE_SIGNED_INT):
- ValueBuff->Value.SignedInteger = SrcPtr.u->i8;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u8), EDSLIB_BASICTYPE_UNSIGNED_INT):
- ValueBuff->Value.UnsignedInteger = SrcPtr.u->u8;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i16), EDSLIB_BASICTYPE_SIGNED_INT):
- ValueBuff->Value.SignedInteger = SrcPtr.u->i16;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u16), EDSLIB_BASICTYPE_UNSIGNED_INT):
- ValueBuff->Value.UnsignedInteger = SrcPtr.u->u16;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i32), EDSLIB_BASICTYPE_SIGNED_INT):
- ValueBuff->Value.SignedInteger = SrcPtr.u->i32;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u32), EDSLIB_BASICTYPE_UNSIGNED_INT):
- ValueBuff->Value.UnsignedInteger = SrcPtr.u->u32;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i64), EDSLIB_BASICTYPE_SIGNED_INT):
- ValueBuff->Value.SignedInteger = SrcPtr.u->i64;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u64), EDSLIB_BASICTYPE_UNSIGNED_INT):
- ValueBuff->Value.UnsignedInteger = SrcPtr.u->u64;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.fpsgl), EDSLIB_BASICTYPE_FLOAT):
- ValueBuff->Value.FloatingPoint = SrcPtr.u->fpsgl;
- break;
- default:
- if (SubjectType == EDSLIB_BASICTYPE_FLOAT)
- {
- /* NOTE - this check for max-precision float is done in the default case because
- * on some machines that do not have a long double, it is identical to double.
- * this avoids a potential "duplicate case" error on those machines.
- * Other machines might have float and double as the same width. */
- if (SubjectSize == sizeof(ValueBuff->Value.fpmax))
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i8), EDSLIB_BASICTYPE_SIGNED_INT):
+ ValueBuff->Value.SignedInteger = SrcPtr.u->i8;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u8), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ ValueBuff->Value.UnsignedInteger = SrcPtr.u->u8;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i16), EDSLIB_BASICTYPE_SIGNED_INT):
+ ValueBuff->Value.SignedInteger = SrcPtr.u->i16;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u16), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ ValueBuff->Value.UnsignedInteger = SrcPtr.u->u16;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i32), EDSLIB_BASICTYPE_SIGNED_INT):
+ ValueBuff->Value.SignedInteger = SrcPtr.u->i32;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u32), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ ValueBuff->Value.UnsignedInteger = SrcPtr.u->u32;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.i64), EDSLIB_BASICTYPE_SIGNED_INT):
+ ValueBuff->Value.SignedInteger = SrcPtr.u->i64;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.u64), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ ValueBuff->Value.UnsignedInteger = SrcPtr.u->u64;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(ValueBuff->Value.fpsgl), EDSLIB_BASICTYPE_FLOAT):
+ ValueBuff->Value.FloatingPoint = SrcPtr.u->fpsgl;
+ break;
+ default:
+ if (SubjectType == EDSLIB_BASICTYPE_FLOAT)
{
- ValueBuff->Value.FloatingPoint = SrcPtr.u->fpmax;
+ /* NOTE - this check for max-precision float is done in the default case because
+ * on some machines that do not have a long double, it is identical to double.
+ * this avoids a potential "duplicate case" error on those machines.
+ * Other machines might have float and double as the same width. */
+ if (SubjectSize == sizeof(ValueBuff->Value.fpmax))
+ {
+ ValueBuff->Value.FloatingPoint = SrcPtr.u->fpmax;
+ }
+ else if (SubjectSize == sizeof(ValueBuff->Value.fpdbl))
+ {
+ ValueBuff->Value.FloatingPoint = SrcPtr.u->fpdbl;
+ }
+ else
+ {
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
+ ValueBuff->Value.UnsignedInteger = 0;
+ }
}
- else if (SubjectSize == sizeof(ValueBuff->Value.fpdbl))
+ else if (SubjectType == EDSLIB_BASICTYPE_BINARY && SubjectSize <= sizeof(ValueBuff->Value.StringData))
{
- ValueBuff->Value.FloatingPoint = SrcPtr.u->fpdbl;
+ strncpy(ValueBuff->Value.StringData, SrcPtr.Ptr, SubjectSize);
}
else
{
- ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
ValueBuff->Value.UnsignedInteger = 0;
}
- }
- else if (SubjectType == EDSLIB_BASICTYPE_BINARY && SubjectSize <= sizeof(ValueBuff->Value.StringData))
- {
- strncpy(ValueBuff->Value.StringData, SrcPtr.Ptr, SubjectSize);
- }
- else
- {
- ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
- ValueBuff->Value.UnsignedInteger = 0;
- }
- break;
+ break;
}
}
@@ -131,46 +132,46 @@ void EdsLib_DataTypeLoad_Impl(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_Con
*-----------------------------------------------------------------*/
void EdsLib_DataTypeConvert(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_BasicType_t DesiredType)
{
- switch(EDSLIB_TYPE_AND_SIZE(DesiredType, ValueBuff->ValueType))
+ switch (EDSLIB_TYPE_AND_SIZE(DesiredType, ValueBuff->ValueType))
{
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_SIGNED_INT, EDSLIB_BASICTYPE_UNSIGNED_INT):
- ValueBuff->Value.SignedInteger = ValueBuff->Value.UnsignedInteger;
- ValueBuff->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
- break;
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_FLOAT, EDSLIB_BASICTYPE_UNSIGNED_INT):
- ValueBuff->Value.FloatingPoint = ValueBuff->Value.UnsignedInteger;
- ValueBuff->ValueType = EDSLIB_BASICTYPE_FLOAT;
- break;
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_UNSIGNED_INT, EDSLIB_BASICTYPE_SIGNED_INT):
- ValueBuff->Value.UnsignedInteger = ValueBuff->Value.SignedInteger;
- ValueBuff->ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
- break;
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_FLOAT, EDSLIB_BASICTYPE_SIGNED_INT):
- ValueBuff->Value.FloatingPoint = ValueBuff->Value.SignedInteger;
- ValueBuff->ValueType = EDSLIB_BASICTYPE_FLOAT;
- break;
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_SIGNED_INT, EDSLIB_BASICTYPE_FLOAT):
- ValueBuff->Value.SignedInteger = ValueBuff->Value.FloatingPoint;
- ValueBuff->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
- break;
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_UNSIGNED_INT, EDSLIB_BASICTYPE_FLOAT):
- ValueBuff->Value.UnsignedInteger = ValueBuff->Value.FloatingPoint;
- ValueBuff->ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
- break;
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_FLOAT, EDSLIB_BASICTYPE_FLOAT):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_SIGNED_INT, EDSLIB_BASICTYPE_SIGNED_INT):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_UNSIGNED_INT, EDSLIB_BASICTYPE_UNSIGNED_INT):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_BINARY, EDSLIB_BASICTYPE_BINARY):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_ARRAY, EDSLIB_BASICTYPE_ARRAY):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_CONTAINER, EDSLIB_BASICTYPE_CONTAINER):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_COMPONENT, EDSLIB_BASICTYPE_COMPONENT):
- case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_GENERIC, EDSLIB_BASICTYPE_GENERIC):
- /* No changes to ValueBuff */
- break;
- default:
- /* Invalid */
- ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
- break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_SIGNED_INT, EDSLIB_BASICTYPE_UNSIGNED_INT):
+ ValueBuff->Value.SignedInteger = ValueBuff->Value.UnsignedInteger;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_FLOAT, EDSLIB_BASICTYPE_UNSIGNED_INT):
+ ValueBuff->Value.FloatingPoint = ValueBuff->Value.UnsignedInteger;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_FLOAT;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_UNSIGNED_INT, EDSLIB_BASICTYPE_SIGNED_INT):
+ ValueBuff->Value.UnsignedInteger = ValueBuff->Value.SignedInteger;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_FLOAT, EDSLIB_BASICTYPE_SIGNED_INT):
+ ValueBuff->Value.FloatingPoint = ValueBuff->Value.SignedInteger;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_FLOAT;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_SIGNED_INT, EDSLIB_BASICTYPE_FLOAT):
+ ValueBuff->Value.SignedInteger = ValueBuff->Value.FloatingPoint;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_UNSIGNED_INT, EDSLIB_BASICTYPE_FLOAT):
+ ValueBuff->Value.UnsignedInteger = ValueBuff->Value.FloatingPoint;
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_FLOAT, EDSLIB_BASICTYPE_FLOAT):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_SIGNED_INT, EDSLIB_BASICTYPE_SIGNED_INT):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_UNSIGNED_INT, EDSLIB_BASICTYPE_UNSIGNED_INT):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_BINARY, EDSLIB_BASICTYPE_BINARY):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_ARRAY, EDSLIB_BASICTYPE_ARRAY):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_CONTAINER, EDSLIB_BASICTYPE_CONTAINER):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_COMPONENT, EDSLIB_BASICTYPE_COMPONENT):
+ case EDSLIB_TYPE_AND_SIZE(EDSLIB_BASICTYPE_GENERIC, EDSLIB_BASICTYPE_GENERIC):
+ /* No changes to ValueBuff */
+ break;
+ default:
+ /* Invalid */
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
+ break;
}
}
@@ -180,10 +181,12 @@ void EdsLib_DataTypeConvert(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_Basic
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DataTypeStore_Impl(EdsLib_Ptr_t DstPtr, EdsLib_GenericValueBuffer_t *ValueBuff, const EdsLib_DataTypeDB_Entry_t *DictEntryPtr)
+void EdsLib_DataTypeStore_Impl(EdsLib_Ptr_t DstPtr,
+ EdsLib_GenericValueBuffer_t *ValueBuff,
+ const EdsLib_DataTypeDB_Entry_t *DictEntryPtr)
{
EdsLib_BasicType_t SubjectType;
- uint32_t SubjectSize;
+ uint32_t SubjectSize;
/*
* In keeping with existing paradigms in other internal API calls, this should deal with
@@ -202,65 +205,63 @@ void EdsLib_DataTypeStore_Impl(EdsLib_Ptr_t DstPtr, EdsLib_GenericValueBuffer_t
EdsLib_DataTypeConvert(ValueBuff, SubjectType);
- switch(EDSLIB_TYPE_AND_SIZE(SubjectSize, ValueBuff->ValueType))
+ switch (EDSLIB_TYPE_AND_SIZE(SubjectSize, ValueBuff->ValueType))
{
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i8), EDSLIB_BASICTYPE_SIGNED_INT):
- DstPtr.u->i8 = ValueBuff->Value.SignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u8), EDSLIB_BASICTYPE_UNSIGNED_INT):
- DstPtr.u->u8 = ValueBuff->Value.UnsignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i16), EDSLIB_BASICTYPE_SIGNED_INT):
- DstPtr.u->i16 = ValueBuff->Value.SignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u16), EDSLIB_BASICTYPE_UNSIGNED_INT):
- DstPtr.u->u16 = ValueBuff->Value.UnsignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i32), EDSLIB_BASICTYPE_SIGNED_INT):
- DstPtr.u->i32 = ValueBuff->Value.SignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u32), EDSLIB_BASICTYPE_UNSIGNED_INT):
- DstPtr.u->u32 = ValueBuff->Value.UnsignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i64), EDSLIB_BASICTYPE_SIGNED_INT):
- DstPtr.u->i64 = ValueBuff->Value.SignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u64), EDSLIB_BASICTYPE_UNSIGNED_INT):
- DstPtr.u->u64 = ValueBuff->Value.UnsignedInteger;
- break;
- case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->fpsgl), EDSLIB_BASICTYPE_FLOAT):
- DstPtr.u->fpsgl = ValueBuff->Value.FloatingPoint;
- break;
- default:
- if (SubjectType == EDSLIB_BASICTYPE_FLOAT)
- {
- /* floating point sizes checked here, since on some machines
- * the size of double/long double might be the same.
- * This would result in a duplicate case value */
- if (SubjectSize == sizeof(ValueBuff->Value.fpmax))
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i8), EDSLIB_BASICTYPE_SIGNED_INT):
+ DstPtr.u->i8 = ValueBuff->Value.SignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u8), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ DstPtr.u->u8 = ValueBuff->Value.UnsignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i16), EDSLIB_BASICTYPE_SIGNED_INT):
+ DstPtr.u->i16 = ValueBuff->Value.SignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u16), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ DstPtr.u->u16 = ValueBuff->Value.UnsignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i32), EDSLIB_BASICTYPE_SIGNED_INT):
+ DstPtr.u->i32 = ValueBuff->Value.SignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u32), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ DstPtr.u->u32 = ValueBuff->Value.UnsignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->i64), EDSLIB_BASICTYPE_SIGNED_INT):
+ DstPtr.u->i64 = ValueBuff->Value.SignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->u64), EDSLIB_BASICTYPE_UNSIGNED_INT):
+ DstPtr.u->u64 = ValueBuff->Value.UnsignedInteger;
+ break;
+ case EDSLIB_TYPE_AND_SIZE(sizeof(DstPtr.u->fpsgl), EDSLIB_BASICTYPE_FLOAT):
+ DstPtr.u->fpsgl = ValueBuff->Value.FloatingPoint;
+ break;
+ default:
+ if (SubjectType == EDSLIB_BASICTYPE_FLOAT)
{
- DstPtr.u->fpmax = ValueBuff->Value.FloatingPoint;
+ /* floating point sizes checked here, since on some machines
+ * the size of double/long double might be the same.
+ * This would result in a duplicate case value */
+ if (SubjectSize == sizeof(ValueBuff->Value.fpmax))
+ {
+ DstPtr.u->fpmax = ValueBuff->Value.FloatingPoint;
+ }
+ else if (SubjectSize == sizeof(ValueBuff->Value.fpdbl))
+ {
+ DstPtr.u->fpdbl = ValueBuff->Value.FloatingPoint;
+ }
+ else
+ {
+ /* invalid size */
+ ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
+ }
}
- else if (SubjectSize == sizeof(ValueBuff->Value.fpdbl))
+ else if (SubjectType == EDSLIB_BASICTYPE_BINARY && SubjectSize <= sizeof(ValueBuff->Value.StringData))
{
- DstPtr.u->fpdbl = ValueBuff->Value.FloatingPoint;
+ strncpy(DstPtr.Ptr, ValueBuff->Value.StringData, SubjectSize);
}
else
{
- /* invalid size */
ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
}
- }
- else if (SubjectType == EDSLIB_BASICTYPE_BINARY &&
- SubjectSize <= sizeof(ValueBuff->Value.StringData))
- {
- strncpy(DstPtr.Ptr, ValueBuff->Value.StringData, SubjectSize);
- }
- else
- {
- ValueBuff->ValueType = EDSLIB_BASICTYPE_NONE;
- }
- break;
+ break;
}
}
-
diff --git a/edslib/fsw/src/edslib_datatypedb_lookup.c b/edslib/fsw/src/edslib_datatypedb_lookup.c
index e360897..8aa31ae 100644
--- a/edslib/fsw/src/edslib_datatypedb_lookup.c
+++ b/edslib/fsw/src/edslib_datatypedb_lookup.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_lookup.c
* \ingroup fsw
@@ -53,12 +52,12 @@ EdsLib_DataTypeDB_t EdsLib_DataTypeDB_GetTopLevel(const EdsLib_DatabaseObject_t
{
if (GD == NULL || GD->DataTypeDB_Table == NULL)
{
- return NULL;
+ return NULL;
}
if (AppIdx >= GD->AppTableSize)
{
- return NULL;
+ return NULL;
}
return GD->DataTypeDB_Table[AppIdx];
@@ -70,14 +69,15 @@ EdsLib_DataTypeDB_t EdsLib_DataTypeDB_GetTopLevel(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const EdsLib_DataTypeDB_Entry_t *EdsLib_DataTypeDB_GetEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj)
+const EdsLib_DataTypeDB_Entry_t *EdsLib_DataTypeDB_GetEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj)
{
- EdsLib_DataTypeDB_t Dict;
+ EdsLib_DataTypeDB_t Dict;
const EdsLib_DataTypeDB_Entry_t *DataDictEntry;
- const EdsLib_DatabaseRef_t *CurrRef;
+ const EdsLib_DatabaseRef_t *CurrRef;
DataDictEntry = NULL;
- CurrRef = RefObj;
+ CurrRef = RefObj;
while (true)
{
@@ -116,14 +116,15 @@ const EdsLib_DataTypeDB_Entry_t *EdsLib_DataTypeDB_GetEntry(const EdsLib_Databas
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DataTypeDB_CopyTypeInfo(const EdsLib_DataTypeDB_Entry_t *DataDictEntry, EdsLib_DataTypeDB_TypeInfo_t *TypeInfo)
+void EdsLib_DataTypeDB_CopyTypeInfo(const EdsLib_DataTypeDB_Entry_t *DataDictEntry,
+ EdsLib_DataTypeDB_TypeInfo_t *TypeInfo)
{
memset(TypeInfo, 0, sizeof(*TypeInfo));
if (DataDictEntry != NULL)
{
- TypeInfo->Size = DataDictEntry->SizeInfo;
- TypeInfo->Flags = DataDictEntry->Flags;
- TypeInfo->ElemType = DataDictEntry->BasicType;
+ TypeInfo->Size = DataDictEntry->SizeInfo;
+ TypeInfo->Flags = DataDictEntry->Flags;
+ TypeInfo->ElemType = DataDictEntry->BasicType;
TypeInfo->NumSubElements = DataDictEntry->NumSubElements;
}
}
@@ -200,26 +201,28 @@ uint16_t EdsLib_GetArrayIdxFromBits(const void *SubjectPtr, const EdsLib_SizeInf
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_DataTypeDB_Entry_t *BaseDict, const void *CompareArg, EdsLib_EntryCompareFunc_t CompFunc,
- EdsLib_DataTypeDB_EntityInfo_t *EntInfo)
+int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_Entry_t *BaseDict,
+ const void *CompareArg,
+ EdsLib_EntryCompareFunc_t CompFunc,
+ EdsLib_DataTypeDB_EntityInfo_t *EntInfo)
{
const EdsLib_FieldDetailEntry_t *ContEntry;
const EdsLib_FieldDetailEntry_t *NextEntry;
const EdsLib_DataTypeDB_Entry_t *MemberDict;
- uint32_t Flags;
- int32_t Result;
- uint16_t Idx;
+ uint32_t Flags;
+ int32_t Result;
+ uint16_t Idx;
ContEntry = BaseDict->Detail.Container->EntryList;
NextEntry = NULL;
- Flags = 0;
+ Flags = 0;
/*
* Locate the entry _prior_ to the one where the offset exceeds
* the specified offset
*/
- for (Idx=1; Idx < BaseDict->NumSubElements; ++Idx)
+ for (Idx = 1; Idx < BaseDict->NumSubElements; ++Idx)
{
/* Note, This is peeking at the start of the NEXT entry */
NextEntry = &ContEntry[Idx];
@@ -248,9 +251,9 @@ int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t
Flags |= MemberDict->Flags;
}
- EntInfo->EdsId = EdsLib_Encode_StructId(&ContEntry->RefObj);
+ EntInfo->EdsId = EdsLib_Encode_StructId(&ContEntry->RefObj);
EntInfo->Offset = ContEntry->Offset;
- EntInfo->Flags = Flags;
+ EntInfo->Flags = Flags;
if (NextEntry != NULL)
{
/* Not last element, peek at offset of _next_ element to get max size */
@@ -262,7 +265,7 @@ int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t
EntInfo->MaxSize = BaseDict->SizeInfo;
}
EntInfo->MaxSize.Bytes -= EntInfo->Offset.Bytes;
- EntInfo->MaxSize.Bits -= EntInfo->Offset.Bits;
+ EntInfo->MaxSize.Bits -= EntInfo->Offset.Bits;
Result = EDSLIB_SUCCESS;
}
@@ -280,30 +283,32 @@ int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_FindArrayMember_Impl(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_DataTypeDB_Entry_t *BaseDict, const void *GetIdxArg, EdsLib_GetArrayIdxFunc_t GetIdxFunc,
- EdsLib_DataTypeDB_EntityInfo_t *EntInfo)
+int32_t EdsLib_DataTypeDB_FindArrayMember_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_Entry_t *BaseDict,
+ const void *GetIdxArg,
+ EdsLib_GetArrayIdxFunc_t GetIdxFunc,
+ EdsLib_DataTypeDB_EntityInfo_t *EntInfo)
{
EdsLib_SizeInfo_t ElementSize;
- int32_t Result;
- uint16_t SubIndex;
+ int32_t Result;
+ uint16_t SubIndex;
/*
- * Calculating the start offset this way, although it involves division,
- * does not require that we actually _have_ the definition of the array
- * element type loaded. The total byte size of the entire array _must_
- * be an integer multiple of the array length, by definition.
- */
+ * Calculating the start offset this way, although it involves division,
+ * does not require that we actually _have_ the definition of the array
+ * element type loaded. The total byte size of the entire array _must_
+ * be an integer multiple of the array length, by definition.
+ */
ElementSize.Bytes = BaseDict->SizeInfo.Bytes / BaseDict->NumSubElements;
- ElementSize.Bits = BaseDict->SizeInfo.Bits / BaseDict->NumSubElements;
- SubIndex = GetIdxFunc(GetIdxArg, &ElementSize);
+ ElementSize.Bits = BaseDict->SizeInfo.Bits / BaseDict->NumSubElements;
+ SubIndex = GetIdxFunc(GetIdxArg, &ElementSize);
if (SubIndex < BaseDict->NumSubElements)
{
- EntInfo->EdsId = EdsLib_Encode_StructId(&BaseDict->Detail.Array->ElementRefObj);
- EntInfo->MaxSize = ElementSize;
+ EntInfo->EdsId = EdsLib_Encode_StructId(&BaseDict->Detail.Array->ElementRefObj);
+ EntInfo->MaxSize = ElementSize;
EntInfo->Offset.Bytes = ElementSize.Bytes * SubIndex;
- EntInfo->Offset.Bits = ElementSize.Bits * SubIndex;
+ EntInfo->Offset.Bits = ElementSize.Bits * SubIndex;
Result = EDSLIB_SUCCESS;
}
diff --git a/edslib/fsw/src/edslib_datatypedb_pack_unpack.c b/edslib/fsw/src/edslib_datatypedb_pack_unpack.c
index f090f10..009c1db 100644
--- a/edslib/fsw/src/edslib_datatypedb_pack_unpack.c
+++ b/edslib/fsw/src/edslib_datatypedb_pack_unpack.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_datatypedb_pack_unpack.c
* \ingroup fsw
@@ -69,17 +68,17 @@
* Use "long double" internally during encode/decode
* to minimize loss of precision
*/
-typedef long double EdsLib_Internal_Float_t;
+typedef long double EdsLib_Internal_Float_t;
/*
* Use the math library calls with an "l" suffix
* These should operate on long doubles
*/
-#define EDSLIB_FABS fabsl
-#define EDSLIB_LDEXP ldexpl
-#define EDSLIB_FREXP frexpl
-#define EDSLIB_MODF modfl
-#define EDSLIB_FLOAT_C(x) (x ## L)
+#define EDSLIB_FABS fabsl
+#define EDSLIB_LDEXP ldexpl
+#define EDSLIB_FREXP frexpl
+#define EDSLIB_MODF modfl
+#define EDSLIB_FLOAT_C(x) (x##L)
#else
@@ -88,17 +87,17 @@ typedef long double EdsLib_Internal_Float_t;
* Use "double" internally, may lose some precision
* but should have wider C library support
*/
-typedef double EdsLib_Internal_Float_t;
+typedef double EdsLib_Internal_Float_t;
/*
* Use the math library calls without the "l" suffix
* These should operate on regular doubles
*/
-#define EDSLIB_FABS fabs
-#define EDSLIB_LDEXP ldexp
-#define EDSLIB_FREXP frexp
-#define EDSLIB_MODF modf
-#define EDSLIB_FLOAT_C(x) (x)
+#define EDSLIB_FABS fabs
+#define EDSLIB_LDEXP ldexp
+#define EDSLIB_FREXP frexp
+#define EDSLIB_MODF modf
+#define EDSLIB_FLOAT_C(x) (x)
#endif
/**
@@ -118,41 +117,45 @@ typedef double EdsLib_Internal_Float_t;
*/
typedef enum
{
- LEADING_PAD_UNDEFINED = 0, /**< Unknown or no leading invalid bits */
- LEADING_PAD_MSB, /**< MSB from leading byte(s) are invalid */
- LEADING_PAD_LSB /**< LSB From leading byte(s) are invalid */
+ LEADING_PAD_UNDEFINED = 0, /**< Unknown or no leading invalid bits */
+ LEADING_PAD_MSB, /**< MSB from leading byte(s) are invalid */
+ LEADING_PAD_LSB /**< LSB From leading byte(s) are invalid */
} EdsLib_BitPackLeadingPad_Enum_t;
-
typedef struct
{
EdsLib_NumberByteOrder_Enum_t ByteOrder;
- EdsLib_BasicType_t IntermediateType;
- size_t IntermediateSize;
- ptrdiff_t MemStride;
- ptrdiff_t LeadingPadBits;
- ptrdiff_t TrailingPadBits;
- int32_t IntermediateShift;
- bool Invert;
+ EdsLib_BasicType_t IntermediateType;
+ size_t IntermediateSize;
+ ptrdiff_t MemStride;
+ ptrdiff_t LeadingPadBits;
+ ptrdiff_t TrailingPadBits;
+ int32_t IntermediateShift;
+ bool Invert;
} EdsLib_Internal_PackStyleInfo_t;
-typedef size_t (*EdsLib_Internal_PackFunc_t)(EdsLib_GenericValueBuffer_t *ValBuf, const uint8_t *SrcPtr, size_t SrcSizeBytes, EdsLib_NumberEncoding_Enum_t EncodingStyle, uint32_t EncodingBits);
-typedef void (*EdsLib_Internal_UnpackFunc_t)(uint8_t *DstPtr, size_t DstSizeBytes, EdsLib_GenericValueBuffer_t *ValBuf, EdsLib_NumberEncoding_Enum_t EncodingStyle, uint32_t EncodingBits);
-
+typedef size_t (*EdsLib_Internal_PackFunc_t)(EdsLib_GenericValueBuffer_t *ValBuf,
+ const uint8_t *SrcPtr,
+ size_t SrcSizeBytes,
+ EdsLib_NumberEncoding_Enum_t EncodingStyle,
+ uint32_t EncodingBits);
+typedef void (*EdsLib_Internal_UnpackFunc_t)(uint8_t *DstPtr,
+ size_t DstSizeBytes,
+ EdsLib_GenericValueBuffer_t *ValBuf,
+ EdsLib_NumberEncoding_Enum_t EncodingStyle,
+ uint32_t EncodingBits);
static const union
{
- uint16_t Value;
- int8_t Bytes[2];
-} EDSLIB_NATIVE_BYTEORDER = { 0x0102 };
+ uint16_t Value;
+ int8_t Bytes[2];
+} EDSLIB_NATIVE_BYTEORDER = { 0x0102 };
/* An expression that evaluates to 1 on big endian and -1 on little endian */
-#define EDSLIB_BIG_ENDIAN_STRIDE \
- (EDSLIB_NATIVE_BYTEORDER.Bytes[1] - EDSLIB_NATIVE_BYTEORDER.Bytes[0])
+#define EDSLIB_BIG_ENDIAN_STRIDE (EDSLIB_NATIVE_BYTEORDER.Bytes[1] - EDSLIB_NATIVE_BYTEORDER.Bytes[0])
/* An expression that evaluates to 1 on little endian and -1 on big endian */
-#define EDSLIB_LITTLE_ENDIAN_STRIDE \
- (EDSLIB_NATIVE_BYTEORDER.Bytes[0] - EDSLIB_NATIVE_BYTEORDER.Bytes[1])
+#define EDSLIB_LITTLE_ENDIAN_STRIDE (EDSLIB_NATIVE_BYTEORDER.Bytes[0] - EDSLIB_NATIVE_BYTEORDER.Bytes[1])
/*
* An expression that evaluates to 1 on big endian and 2 on little endian machines
@@ -160,33 +163,33 @@ static const union
* EDSLIB_DATATYPE_FLAG_PACKED_BE
* EDSLIB_DATATYPE_FLAG_PACKED_LE
*/
-#define EDSLIB_NATIVE_BYTE_PACK (EDSLIB_NATIVE_BYTEORDER.Bytes[0])
+#define EDSLIB_NATIVE_BYTE_PACK (EDSLIB_NATIVE_BYTEORDER.Bytes[0])
/*----------------------------------------------------------------
*
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackStyle, const EdsLib_DataTypeDB_Entry_t *DataDictPtr)
+static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackStyle,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr)
{
- bool IsValid = true;
+ bool IsValid = true;
EdsLib_BasicType_t RefType;
- size_t RefSize;
- ptrdiff_t PadBits;
+ size_t RefSize;
+ ptrdiff_t PadBits;
memset(PackStyle, 0, sizeof(*PackStyle));
- if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_SIGNED_INT ||
- DataDictPtr->BasicType == EDSLIB_BASICTYPE_UNSIGNED_INT ||
- DataDictPtr->BasicType == EDSLIB_BASICTYPE_FLOAT)
+ if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_SIGNED_INT || DataDictPtr->BasicType == EDSLIB_BASICTYPE_UNSIGNED_INT
+ || DataDictPtr->BasicType == EDSLIB_BASICTYPE_FLOAT)
{
- PackStyle->Invert = (DataDictPtr->Detail.Number.BitInvertFlag != 0);
+ PackStyle->Invert = (DataDictPtr->Detail.Number.BitInvertFlag != 0);
PackStyle->ByteOrder = DataDictPtr->Detail.Number.ByteOrder;
if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_SIGNED_INT)
{
- if (DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_BCD_OCTET ||
- DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_BCD_PACKED)
+ if (DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_BCD_OCTET
+ || DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_BCD_PACKED)
{
PackStyle->IntermediateType = EDSLIB_BASICTYPE_BINARY; /* anticipated intermediate */
PackStyle->IntermediateSize = EdsLib_BITS_TO_OCTETS(DataDictPtr->SizeInfo.Bits);
@@ -195,8 +198,8 @@ static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackSt
IsValid = false;
}
}
- else if (DataDictPtr->Detail.Number.Encoding != EDSLIB_NUMBERENCODING_TWOS_COMPLEMENT &&
- DataDictPtr->Detail.Number.Encoding != EDSLIB_NUMBERENCODING_UNDEFINED)
+ else if (DataDictPtr->Detail.Number.Encoding != EDSLIB_NUMBERENCODING_TWOS_COMPLEMENT
+ && DataDictPtr->Detail.Number.Encoding != EDSLIB_NUMBERENCODING_UNDEFINED)
{
PackStyle->IntermediateType = EDSLIB_BASICTYPE_UNSIGNED_INT; /* anticipated intermediate */
PackStyle->IntermediateSize = sizeof(EdsLib_Generic_UnsignedInt_t);
@@ -228,8 +231,8 @@ static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackSt
IsValid = false;
}
}
- else if (DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_IEEE_754 ||
- DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_UNDEFINED)
+ else if (DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_IEEE_754
+ || DataDictPtr->Detail.Number.Encoding == EDSLIB_NUMBERENCODING_UNDEFINED)
{
/*
* IEEE-754 supports encodings of 32, 64, or 128 bits.
@@ -341,7 +344,7 @@ static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackSt
* This shift also helps when unpacking, as it can be used to
* sign-extend twos complement data as needed.
*/
- PackStyle->MemStride = EDSLIB_LITTLE_ENDIAN_STRIDE;
+ PackStyle->MemStride = EDSLIB_LITTLE_ENDIAN_STRIDE;
PackStyle->IntermediateShift = PadBits;
}
@@ -372,7 +375,7 @@ static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackSt
* can be used to sign-extend twos complement data. This
* puts extra bits into the last byte LSB instead.
*/
- PackStyle->MemStride = EDSLIB_BIG_ENDIAN_STRIDE;
+ PackStyle->MemStride = EDSLIB_BIG_ENDIAN_STRIDE;
PackStyle->IntermediateShift = PadBits;
}
@@ -389,137 +392,139 @@ static bool EdsLib_Internal_GetPackStyle(EdsLib_Internal_PackStyleInfo_t *PackSt
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static size_t EdsLib_Internal_DoSignedIntPack(EdsLib_GenericValueUnion_t *ValBuf, const uint8_t *SrcPtr, size_t SrcSizeBytes, EdsLib_NumberEncoding_Enum_t EncodingStyle, uint32_t EncodingBits)
+static size_t EdsLib_Internal_DoSignedIntPack(EdsLib_GenericValueUnion_t *ValBuf,
+ const uint8_t *SrcPtr,
+ size_t SrcSizeBytes,
+ EdsLib_NumberEncoding_Enum_t EncodingStyle,
+ uint32_t EncodingBits)
{
- EdsLib_ConstPtr_t TempSrc = { .Addr = SrcPtr };
+ EdsLib_ConstPtr_t TempSrc = { .Addr = SrcPtr };
EdsLib_Generic_UnsignedInt_t TempUnsigned;
- size_t ConvSize;
+ size_t ConvSize;
- switch(SrcSizeBytes)
+ switch (SrcSizeBytes)
{
- case sizeof(TempSrc.u->i8):
- ValBuf->SignedInteger = TempSrc.u->i8;
- break;
- case sizeof(TempSrc.u->i16):
- ValBuf->SignedInteger = TempSrc.u->i16;
- break;
- case sizeof(TempSrc.u->i32):
- ValBuf->SignedInteger = TempSrc.u->i32;
- break;
- case sizeof(TempSrc.u->i64):
- ValBuf->SignedInteger = TempSrc.u->i64;
- break;
- default:
- /* should never happen, but avoid leaving garbage data into the output */
- ValBuf->SignedInteger = 0;
- break;
+ case sizeof(TempSrc.u->i8):
+ ValBuf->SignedInteger = TempSrc.u->i8;
+ break;
+ case sizeof(TempSrc.u->i16):
+ ValBuf->SignedInteger = TempSrc.u->i16;
+ break;
+ case sizeof(TempSrc.u->i32):
+ ValBuf->SignedInteger = TempSrc.u->i32;
+ break;
+ case sizeof(TempSrc.u->i64):
+ ValBuf->SignedInteger = TempSrc.u->i64;
+ break;
+ default:
+ /* should never happen, but avoid leaving garbage data into the output */
+ ValBuf->SignedInteger = 0;
+ break;
}
- switch(EncodingStyle)
+ switch (EncodingStyle)
{
- case EDSLIB_NUMBERENCODING_SIGN_MAGNITUDE:
- {
- if (ValBuf->SignedInteger < 0)
- {
- /* convert to a positive unsigned, and set the sign bit */
- TempUnsigned = -ValBuf->SignedInteger;
- TempUnsigned |= 1ULL << (EncodingBits-1);
- }
- else
+ case EDSLIB_NUMBERENCODING_SIGN_MAGNITUDE:
{
- TempUnsigned = ValBuf->SignedInteger;
+ if (ValBuf->SignedInteger < 0)
+ {
+ /* convert to a positive unsigned, and set the sign bit */
+ TempUnsigned = -ValBuf->SignedInteger;
+ TempUnsigned |= 1ULL << (EncodingBits - 1);
+ }
+ else
+ {
+ TempUnsigned = ValBuf->SignedInteger;
+ }
+ ValBuf->UnsignedInteger = TempUnsigned;
+ ConvSize = sizeof(ValBuf->UnsignedInteger);
+ break;
}
- ValBuf->UnsignedInteger = TempUnsigned;
- ConvSize = sizeof(ValBuf->UnsignedInteger);
- break;
- }
- case EDSLIB_NUMBERENCODING_ONES_COMPLEMENT:
- {
- if (ValBuf->SignedInteger < 0)
+ case EDSLIB_NUMBERENCODING_ONES_COMPLEMENT:
{
- /* convert to a positive unsigned, and invert all bits */
- TempUnsigned = -ValBuf->SignedInteger;
- TempUnsigned = ~TempUnsigned;
+ if (ValBuf->SignedInteger < 0)
+ {
+ /* convert to a positive unsigned, and invert all bits */
+ TempUnsigned = -ValBuf->SignedInteger;
+ TempUnsigned = ~TempUnsigned;
+ }
+ else
+ {
+ TempUnsigned = ValBuf->SignedInteger;
+ }
+ ValBuf->UnsignedInteger = TempUnsigned;
+ ConvSize = sizeof(ValBuf->UnsignedInteger);
+ break;
}
- else
+ case EDSLIB_NUMBERENCODING_BCD_OCTET:
{
- TempUnsigned = ValBuf->SignedInteger;
- }
- ValBuf->UnsignedInteger = TempUnsigned;
- ConvSize = sizeof(ValBuf->UnsignedInteger);
- break;
- }
- case EDSLIB_NUMBERENCODING_BCD_OCTET:
- {
- char *p = ValBuf->StringData;
- uint8_t *q = ValBuf->BinaryData;
- size_t len = sizeof(ValBuf->StringData);
+ char *p = ValBuf->StringData;
+ uint8_t *q = ValBuf->BinaryData;
+ size_t len = sizeof(ValBuf->StringData);
- snprintf(p, len, "%0*lld",
- (int)(EncodingBits / 8), ValBuf->SignedInteger);
- len = strlen(p);
- ConvSize = len;
+ snprintf(p, len, "%0*lld", (int)(EncodingBits / 8), ValBuf->SignedInteger);
+ len = strlen(p);
+ ConvSize = len;
- while(len > 0)
- {
- if (isdigit((int)*p))
+ while (len > 0)
{
- *q = (unsigned int)(*p - '0');
+ if (isdigit((int)*p))
+ {
+ *q = (unsigned int)(*p - '0');
+ }
+ ++p;
+ ++q;
+ --len;
}
- ++p;
- ++q;
- --len;
+ break;
}
- break;
- }
- case EDSLIB_NUMBERENCODING_BCD_PACKED:
- {
- char *p = ValBuf->StringData;
- uint8_t *q = ValBuf->BinaryData;
- size_t len = sizeof(ValBuf->StringData);
- uint8_t out;
+ case EDSLIB_NUMBERENCODING_BCD_PACKED:
+ {
+ char *p = ValBuf->StringData;
+ uint8_t *q = ValBuf->BinaryData;
+ size_t len = sizeof(ValBuf->StringData);
+ uint8_t out;
- snprintf(p, len, "%0*lld",
- (int)(EncodingBits / 4), ValBuf->SignedInteger);
- len = (strlen(p) + 1) / 2;
- ConvSize = len;
+ snprintf(p, len, "%0*lld", (int)(EncodingBits / 4), ValBuf->SignedInteger);
+ len = (strlen(p) + 1) / 2;
+ ConvSize = len;
- /*
- * NOTE: This doesn't handle negative values properly.
- * The SOIS Red Book is not exactly clear on this.
- */
- while(len > 0)
- {
- out = 0;
- if (isdigit((int)p[0]))
- {
- out |= (unsigned int)(p[0] - '0') << 4;
- }
- if (isdigit((int)p[1]))
+ /*
+ * NOTE: This doesn't handle negative values properly.
+ * The SOIS Red Book is not exactly clear on this.
+ */
+ while (len > 0)
{
- out |= (unsigned int)(p[1] - '0');
+ out = 0;
+ if (isdigit((int)p[0]))
+ {
+ out |= (unsigned int)(p[0] - '0') << 4;
+ }
+ if (isdigit((int)p[1]))
+ {
+ out |= (unsigned int)(p[1] - '0');
+ }
+ *q = out;
+ p += 2;
+ ++q;
+ --len;
}
- *q = out;
- p += 2;
- ++q;
- --len;
+ break;
+ }
+ case EDSLIB_NUMBERENCODING_TWOS_COMPLEMENT:
+ case EDSLIB_NUMBERENCODING_UNDEFINED:
+ {
+ /* default encoding type is a pass thru
+ * This should work on twos complement machines,
+ * which is basically everything. */
+ ConvSize = sizeof(ValBuf->SignedInteger);
+ break;
+ }
+ default:
+ {
+ ConvSize = 0;
+ break;
}
- break;
- }
- case EDSLIB_NUMBERENCODING_TWOS_COMPLEMENT:
- case EDSLIB_NUMBERENCODING_UNDEFINED:
- {
- /* default encoding type is a pass thru
- * This should work on twos complement machines,
- * which is basically everything. */
- ConvSize = sizeof(ValBuf->SignedInteger);
- break;
- }
- default:
- {
- ConvSize = 0;
- break;
- }
}
return ConvSize;
@@ -531,9 +536,12 @@ static size_t EdsLib_Internal_DoSignedIntPack(EdsLib_GenericValueUnion_t *ValBuf
* Packs a float value according to MIL-STD-1750A
*
*-----------------------------------------------------------------*/
-static size_t EdsLib_Internal_DoFloatPack_MilStd1750A(EdsLib_GenericValueUnion_t *ValBuf, uint32_t EncodingBits, EdsLib_Internal_Float_t Significand, int32_t Exponent)
+static size_t EdsLib_Internal_DoFloatPack_MilStd1750A(EdsLib_GenericValueUnion_t *ValBuf,
+ uint32_t EncodingBits,
+ EdsLib_Internal_Float_t Significand,
+ int32_t Exponent)
{
- size_t ConvSize;
+ size_t ConvSize;
uint64_t MantissaBits;
uint32_t Temp32;
@@ -551,7 +559,7 @@ static size_t EdsLib_Internal_DoFloatPack_MilStd1750A(EdsLib_GenericValueUnion_t
{
/* Zero is represented by all fields set to zero */
MantissaBits = 0;
- Exponent = 0;
+ Exponent = 0;
}
else if (Significand == EDSLIB_FLOAT_C(-0.5))
{
@@ -561,16 +569,16 @@ static size_t EdsLib_Internal_DoFloatPack_MilStd1750A(EdsLib_GenericValueUnion_t
}
/* Get 40 bits worth of mantissa (signed twos complement) */
- MantissaBits = EDSLIB_LDEXP(Significand,39);
+ MantissaBits = EDSLIB_LDEXP(Significand, 39);
/* Pack into the uint32, filling all 32 bits of it */
- Temp32 = (uint32_t)(MantissaBits >> 8) & 0xFFFFFF00;
+ Temp32 = (uint32_t)(MantissaBits >> 8) & 0xFFFFFF00;
Temp32 |= (uint32_t)Exponent & 0xFF;
if (EncodingBits == 32)
{
ValBuf->u32 = Temp32;
- ConvSize = sizeof(ValBuf->u32);
+ ConvSize = sizeof(ValBuf->u32);
}
else if (EncodingBits == 48)
{
@@ -580,9 +588,9 @@ static size_t EdsLib_Internal_DoFloatPack_MilStd1750A(EdsLib_GenericValueUnion_t
*
* This will be held in the uint64_t value, with 48 bits valid.
*/
- ValBuf->u64 = Temp32; /* extend to 64 bits first */
+ ValBuf->u64 = Temp32; /* extend to 64 bits first */
ValBuf->u64 = (ValBuf->u64 << 16) | (MantissaBits & 0xFFFF);
- ConvSize = sizeof(ValBuf->u64);
+ ConvSize = sizeof(ValBuf->u64);
}
else
{
@@ -599,10 +607,13 @@ static size_t EdsLib_Internal_DoFloatPack_MilStd1750A(EdsLib_GenericValueUnion_t
* Packs a float value according to IEEE-754
*
*-----------------------------------------------------------------*/
-static size_t EdsLib_Internal_DoFloatPack_Ieee754(EdsLib_GenericValueUnion_t *ValBuf, uint32_t EncodingBits, EdsLib_Internal_Float_t Significand, int32_t Exponent)
+static size_t EdsLib_Internal_DoFloatPack_Ieee754(EdsLib_GenericValueUnion_t *ValBuf,
+ uint32_t EncodingBits,
+ EdsLib_Internal_Float_t Significand,
+ int32_t Exponent)
{
- size_t ConvSize;
- size_t x;
+ size_t ConvSize;
+ size_t x;
EdsLib_Internal_Float_t Frac;
EdsLib_Internal_Float_t Whole;
@@ -635,9 +646,9 @@ static size_t EdsLib_Internal_DoFloatPack_Ieee754(EdsLib_GenericValueUnion_t *Va
/* Fill all bits of mantissa value from MSB to LSB. */
Frac *= EDSLIB_FLOAT_C(2.0);
- for (x=2; x < 16; ++x)
+ for (x = 2; x < 16; ++x)
{
- Frac = EDSLIB_MODF(EDSLIB_LDEXP(Frac, 8), &Whole);
+ Frac = EDSLIB_MODF(EDSLIB_LDEXP(Frac, 8), &Whole);
ValBuf->BinaryData[x] = ((uint8_t)Whole) & 0xFF;
}
}
@@ -654,7 +665,7 @@ static size_t EdsLib_Internal_DoFloatPack_Ieee754(EdsLib_GenericValueUnion_t *Va
}
else
{
- ValBuf->u64 = EDSLIB_LDEXP(Frac,53);
+ ValBuf->u64 = EDSLIB_LDEXP(Frac, 53);
ValBuf->u64 &= UINT64_C(0xFFFFFFFFFFFFF);
ValBuf->u64 |= ((uint64_t)((Exponent + 1022) & 0x7FF)) << 52;
@@ -677,7 +688,7 @@ static size_t EdsLib_Internal_DoFloatPack_Ieee754(EdsLib_GenericValueUnion_t *Va
}
else
{
- ValBuf->u32 = EDSLIB_LDEXP(Frac,24);
+ ValBuf->u32 = EDSLIB_LDEXP(Frac, 24);
ValBuf->u32 &= UINT32_C(0x7FFFFF);
ValBuf->u32 |= (uint32_t)((Exponent + 126) & 0xFF) << 23;
@@ -703,7 +714,11 @@ static size_t EdsLib_Internal_DoFloatPack_Ieee754(EdsLib_GenericValueUnion_t *Va
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static size_t EdsLib_Internal_DoFloatPack(EdsLib_GenericValueUnion_t *ValBuf, const uint8_t *SrcPtr, size_t SrcSizeBytes, EdsLib_NumberEncoding_Enum_t EncodingStyle, uint32_t EncodingBits)
+static size_t EdsLib_Internal_DoFloatPack(EdsLib_GenericValueUnion_t *ValBuf,
+ const uint8_t *SrcPtr,
+ size_t SrcSizeBytes,
+ EdsLib_NumberEncoding_Enum_t EncodingStyle,
+ uint32_t EncodingBits)
{
/*
* All floating point notations (including the less common ones) express
@@ -719,9 +734,9 @@ static size_t EdsLib_Internal_DoFloatPack(EdsLib_GenericValueUnion_t *ValBuf, co
* in a future version if there is a need for these exception values).
*/
EdsLib_ConstPtr_t TempSrc = { .Addr = SrcPtr };
- size_t ConvSize;
+ size_t ConvSize;
- int Exponent = 0;
+ int Exponent = 0;
EdsLib_Internal_Float_t Significand = EDSLIB_FLOAT_C(0.0);
/* the base-2 exponent/mantissa can be extracted using the
@@ -743,8 +758,7 @@ static size_t EdsLib_Internal_DoFloatPack(EdsLib_GenericValueUnion_t *ValBuf, co
{
ConvSize = EdsLib_Internal_DoFloatPack_MilStd1750A(ValBuf, EncodingBits, Significand, Exponent);
}
- else if (EncodingStyle == EDSLIB_NUMBERENCODING_IEEE_754 ||
- EncodingStyle == EDSLIB_NUMBERENCODING_UNDEFINED)
+ else if (EncodingStyle == EDSLIB_NUMBERENCODING_IEEE_754 || EncodingStyle == EDSLIB_NUMBERENCODING_UNDEFINED)
{
ConvSize = EdsLib_Internal_DoFloatPack_Ieee754(ValBuf, EncodingBits, Significand, Exponent);
}
@@ -762,15 +776,18 @@ static size_t EdsLib_Internal_DoFloatPack(EdsLib_GenericValueUnion_t *ValBuf, co
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr, const EdsLib_DataTypeDB_Entry_t *DataDictPtr, uint32_t DstBitOffset)
+static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr,
+ const uint8_t *SrcPtr,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ uint32_t DstBitOffset)
{
- uint32_t ShiftRegister;
- uint32_t HighBitPos;
- uint32_t TotalBits;
- EdsLib_GenericValueUnion_t NumBuf;
- const uint8_t *LoadPtr;
+ uint32_t ShiftRegister;
+ uint32_t HighBitPos;
+ uint32_t TotalBits;
+ EdsLib_GenericValueUnion_t NumBuf;
+ const uint8_t *LoadPtr;
EdsLib_Internal_PackStyleInfo_t Pack;
- size_t ConvSize;
+ size_t ConvSize;
LoadPtr = NULL;
@@ -811,23 +828,28 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
}
/* Do conversion to intermediate type, if indicated */
- if (Pack.IntermediateType == EDSLIB_BASICTYPE_NONE ||
- Pack.IntermediateSize == 0)
+ if (Pack.IntermediateType == EDSLIB_BASICTYPE_NONE || Pack.IntermediateSize == 0)
{
- LoadPtr = SrcPtr;
+ LoadPtr = SrcPtr;
ConvSize = DataDictPtr->SizeInfo.Bytes;
}
else
{
if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_SIGNED_INT)
{
- ConvSize = EdsLib_Internal_DoSignedIntPack(&NumBuf, SrcPtr, DataDictPtr->SizeInfo.Bytes,
- DataDictPtr->Detail.Number.Encoding, DataDictPtr->SizeInfo.Bits);
+ ConvSize = EdsLib_Internal_DoSignedIntPack(&NumBuf,
+ SrcPtr,
+ DataDictPtr->SizeInfo.Bytes,
+ DataDictPtr->Detail.Number.Encoding,
+ DataDictPtr->SizeInfo.Bits);
}
else if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_FLOAT)
{
- ConvSize = EdsLib_Internal_DoFloatPack(&NumBuf, SrcPtr, DataDictPtr->SizeInfo.Bytes,
- DataDictPtr->Detail.Number.Encoding, DataDictPtr->SizeInfo.Bits);
+ ConvSize = EdsLib_Internal_DoFloatPack(&NumBuf,
+ SrcPtr,
+ DataDictPtr->SizeInfo.Bytes,
+ DataDictPtr->Detail.Number.Encoding,
+ DataDictPtr->SizeInfo.Bits);
}
else
{
@@ -840,7 +862,7 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
/* error: pack routine did not output
* expected size object */
NumBuf.BinaryData[0] = 0xFF;
- Pack.MemStride = 0;
+ Pack.MemStride = 0;
}
}
@@ -848,51 +870,50 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
{
EdsLib_ConstPtr_t Src = { .Addr = LoadPtr };
- switch(ConvSize)
+ switch (ConvSize)
{
- case sizeof(Src.u->u8):
- NumBuf.u8 = Src.u->u8 << Pack.IntermediateShift;
- break;
- case sizeof(Src.u->u16):
- NumBuf.u16 = Src.u->u16 << Pack.IntermediateShift;
- break;
- case sizeof(Src.u->u32):
- NumBuf.u32 = Src.u->u32 << Pack.IntermediateShift;
- break;
- case sizeof(Src.u->u64):
- NumBuf.u64 = Src.u->u64 << Pack.IntermediateShift;
- break;
- default:
- /* error/invalid */
- break;
- }
-
- LoadPtr = NumBuf.BinaryData;
-
- if (Pack.Invert)
- {
- switch(ConvSize)
- {
case sizeof(Src.u->u8):
- NumBuf.u8 ^= UINT8_C(0xFF);
+ NumBuf.u8 = Src.u->u8 << Pack.IntermediateShift;
break;
case sizeof(Src.u->u16):
- NumBuf.u16 ^= UINT16_C(0xFFFF);
+ NumBuf.u16 = Src.u->u16 << Pack.IntermediateShift;
break;
case sizeof(Src.u->u32):
- NumBuf.u32 ^= UINT32_C(0xFFFFFFFF);
+ NumBuf.u32 = Src.u->u32 << Pack.IntermediateShift;
break;
case sizeof(Src.u->u64):
- NumBuf.u64 ^= UINT64_C(0xFFFFFFFFFFFFFFFF);
+ NumBuf.u64 = Src.u->u64 << Pack.IntermediateShift;
break;
default:
/* error/invalid */
break;
+ }
+
+ LoadPtr = NumBuf.BinaryData;
+
+ if (Pack.Invert)
+ {
+ switch (ConvSize)
+ {
+ case sizeof(Src.u->u8):
+ NumBuf.u8 ^= UINT8_C(0xFF);
+ break;
+ case sizeof(Src.u->u16):
+ NumBuf.u16 ^= UINT16_C(0xFFFF);
+ break;
+ case sizeof(Src.u->u32):
+ NumBuf.u32 ^= UINT32_C(0xFFFFFFFF);
+ break;
+ case sizeof(Src.u->u64):
+ NumBuf.u64 ^= UINT64_C(0xFFFFFFFFFFFFFFFF);
+ break;
+ default:
+ /* error/invalid */
+ break;
}
}
}
-
/*
* Prepare to copy the encoded value to the output buffer.
*
@@ -963,11 +984,11 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
{
/* preload ShiftRegister with exiting bits in output buffer
* This avoids clobbering any partial byte that was already packed */
- ShiftRegister = *DstPtr;
+ ShiftRegister = *DstPtr;
ShiftRegister >>= 8 - DstBitOffset;
}
HighBitPos = DstBitOffset;
- TotalBits = HighBitPos + DataDictPtr->SizeInfo.Bits;
+ TotalBits = HighBitPos + DataDictPtr->SizeInfo.Bits;
/*
* If the first octet is not a whole octet,
@@ -981,39 +1002,39 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
LoadPtr += (Pack.LeadingPadBits / 8) * Pack.MemStride; /* skip whole bytes */
/* Load the entire byte, then right-shift out the padding */
- ShiftRegister = (ShiftRegister << 8) | *LoadPtr;
+ ShiftRegister = (ShiftRegister << 8) | *LoadPtr;
ShiftRegister >>= RemainderBits;
- HighBitPos += 8 - RemainderBits; /* add number of REAL bits */
+ HighBitPos += 8 - RemainderBits; /* add number of REAL bits */
- LoadPtr += Pack.MemStride; /* account for leading byte just loaded */
+ LoadPtr += Pack.MemStride; /* account for leading byte just loaded */
}
/* Now load entire bytes into the shift register */
- while(TotalBits > HighBitPos)
+ while (TotalBits > HighBitPos)
{
if (HighBitPos < 24)
{
/* Read 8 more bits of data from source into bottom of Shift Register */
- ShiftRegister = (ShiftRegister << 8) | *LoadPtr;
- HighBitPos += 8;
- LoadPtr += Pack.MemStride;
+ ShiftRegister = (ShiftRegister << 8) | *LoadPtr;
+ HighBitPos += 8;
+ LoadPtr += Pack.MemStride;
}
else
{
/* Output 8 bits of data from top of shift register to destination */
HighBitPos -= 8;
- TotalBits -= 8;
- *DstPtr = ShiftRegister >> HighBitPos;
+ TotalBits -= 8;
+ *DstPtr = ShiftRegister >> HighBitPos;
++DstPtr;
}
}
/* Output any remaining full octets */
- while(TotalBits >= 8)
+ while (TotalBits >= 8)
{
HighBitPos -= 8;
- TotalBits -= 8;
- *DstPtr = ShiftRegister >> HighBitPos;
+ TotalBits -= 8;
+ *DstPtr = ShiftRegister >> HighBitPos;
++DstPtr;
}
@@ -1032,8 +1053,8 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
* This is important when updating a field in the middle of
* a packet, such as a CRC/Checksum. */
ShiftRegister |= *DstPtr & ((1U << (8 - TotalBits)) - 1);
- *DstPtr = ShiftRegister;
- HighBitPos = 0;
+ *DstPtr = ShiftRegister;
+ HighBitPos = 0;
}
}
@@ -1042,117 +1063,121 @@ static void EdsLib_Internal_DoBitwisePack(uint8_t *DstPtr, const uint8_t *SrcPtr
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static void EdsLib_Internal_DoSignedIntUnpack(uint8_t *DstPtr, size_t DstSizeBytes, EdsLib_GenericValueUnion_t *ValBuf, EdsLib_NumberEncoding_Enum_t EncodingStyle, uint32_t EncodingBits)
+static void EdsLib_Internal_DoSignedIntUnpack(uint8_t *DstPtr,
+ size_t DstSizeBytes,
+ EdsLib_GenericValueUnion_t *ValBuf,
+ EdsLib_NumberEncoding_Enum_t EncodingStyle,
+ uint32_t EncodingBits)
{
- EdsLib_Ptr_t TempDst = { .Addr = DstPtr };
- EdsLib_Generic_SignedInt_t TempSigned;
+ EdsLib_Ptr_t TempDst = { .Addr = DstPtr };
+ EdsLib_Generic_SignedInt_t TempSigned;
EdsLib_Generic_UnsignedInt_t SignBit;
- uint32_t count;
- uint8_t digit;
+ uint32_t count;
+ uint8_t digit;
TempSigned = 0;
- switch(EncodingStyle)
- {
- case EDSLIB_NUMBERENCODING_SIGN_MAGNITUDE:
- {
- SignBit = ((EdsLib_Generic_UnsignedInt_t)1) << (EncodingBits-1);
- if (ValBuf->UnsignedInteger & SignBit)
- {
- /* convert to a negative signed */
- TempSigned = 0 - (ValBuf->UnsignedInteger & (SignBit - 1));
- }
- else
- {
- TempSigned = ValBuf->UnsignedInteger;
- }
- break;
- }
- case EDSLIB_NUMBERENCODING_ONES_COMPLEMENT:
- {
- SignBit = ((EdsLib_Generic_UnsignedInt_t)1) << (EncodingBits-1);
- if (ValBuf->UnsignedInteger & SignBit)
- {
- /* convert to a negative signed, and invert all bits */
- TempSigned = 0 - (~ValBuf->UnsignedInteger & (SignBit - 1));
- }
- else
- {
- TempSigned = ValBuf->UnsignedInteger;
- }
- break;
- }
- case EDSLIB_NUMBERENCODING_BCD_OCTET:
+ switch (EncodingStyle)
{
- count = 0;
- while(count < EncodingBits)
+ case EDSLIB_NUMBERENCODING_SIGN_MAGNITUDE:
{
- digit = ValBuf->BinaryData[count >> 3];
- if (digit < 10)
+ SignBit = ((EdsLib_Generic_UnsignedInt_t)1) << (EncodingBits - 1);
+ if (ValBuf->UnsignedInteger & SignBit)
{
- TempSigned = (TempSigned * 10) + digit;
+ /* convert to a negative signed */
+ TempSigned = 0 - (ValBuf->UnsignedInteger & (SignBit - 1));
}
- count += 8;
+ else
+ {
+ TempSigned = ValBuf->UnsignedInteger;
+ }
+ break;
}
- if (ValBuf->StringData[0] == '-')
+ case EDSLIB_NUMBERENCODING_ONES_COMPLEMENT:
{
- TempSigned = -TempSigned;
- }
- break;
- }
- case EDSLIB_NUMBERENCODING_BCD_PACKED:
- {
- count = 0;
- while(count < EncodingBits)
- {
- digit = ValBuf->BinaryData[count >> 3];
- if (digit == '-')
+ SignBit = ((EdsLib_Generic_UnsignedInt_t)1) << (EncodingBits - 1);
+ if (ValBuf->UnsignedInteger & SignBit)
{
- count += 8;
+ /* convert to a negative signed, and invert all bits */
+ TempSigned = 0 - (~ValBuf->UnsignedInteger & (SignBit - 1));
}
else
{
- digit >>= (~count & 4);
- digit &= 0x0F;
+ TempSigned = ValBuf->UnsignedInteger;
+ }
+ break;
+ }
+ case EDSLIB_NUMBERENCODING_BCD_OCTET:
+ {
+ count = 0;
+ while (count < EncodingBits)
+ {
+ digit = ValBuf->BinaryData[count >> 3];
if (digit < 10)
{
TempSigned = (TempSigned * 10) + digit;
}
- count += 4;
+ count += 8;
+ }
+ if (ValBuf->StringData[0] == '-')
+ {
+ TempSigned = -TempSigned;
+ }
+ break;
+ }
+ case EDSLIB_NUMBERENCODING_BCD_PACKED:
+ {
+ count = 0;
+ while (count < EncodingBits)
+ {
+ digit = ValBuf->BinaryData[count >> 3];
+ if (digit == '-')
+ {
+ count += 8;
+ }
+ else
+ {
+ digit >>= (~count & 4);
+ digit &= 0x0F;
+ if (digit < 10)
+ {
+ TempSigned = (TempSigned * 10) + digit;
+ }
+ count += 4;
+ }
}
+ if (ValBuf->StringData[0] == '-')
+ {
+ TempSigned = -TempSigned;
+ }
+ break;
}
- if (ValBuf->StringData[0] == '-')
+ default:
{
- TempSigned = -TempSigned;
+ /* default encoding type is a pass thru.
+ * This should work on twos complement machines */
+ break;
}
- break;
- }
- default:
- {
- /* default encoding type is a pass thru.
- * This should work on twos complement machines */
- break;
- }
}
- switch(DstSizeBytes)
+ switch (DstSizeBytes)
{
- case sizeof(TempDst.u->i8):
- TempDst.u->i8 = TempSigned;
- break;
- case sizeof(TempDst.u->i16):
- TempDst.u->i16 = TempSigned;
- break;
- case sizeof(TempDst.u->i32):
- TempDst.u->i32 = TempSigned;
- break;
- case sizeof(TempDst.u->i64):
- TempDst.u->i64 = TempSigned;
- break;
- default:
- /* should never happen, but avoid leaving garbage data into the output */
- memset(TempDst.Ptr, 0, DstSizeBytes);
- break;
+ case sizeof(TempDst.u->i8):
+ TempDst.u->i8 = TempSigned;
+ break;
+ case sizeof(TempDst.u->i16):
+ TempDst.u->i16 = TempSigned;
+ break;
+ case sizeof(TempDst.u->i32):
+ TempDst.u->i32 = TempSigned;
+ break;
+ case sizeof(TempDst.u->i64):
+ TempDst.u->i64 = TempSigned;
+ break;
+ default:
+ /* should never happen, but avoid leaving garbage data into the output */
+ memset(TempDst.Ptr, 0, DstSizeBytes);
+ break;
}
}
@@ -1161,7 +1186,11 @@ static void EdsLib_Internal_DoSignedIntUnpack(uint8_t *DstPtr, size_t DstSizeByt
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes, EdsLib_GenericValueUnion_t *ValBuf, EdsLib_NumberEncoding_Enum_t EncodingStyle, uint32_t EncodingBits)
+static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr,
+ size_t DstSizeBytes,
+ EdsLib_GenericValueUnion_t *ValBuf,
+ EdsLib_NumberEncoding_Enum_t EncodingStyle,
+ uint32_t EncodingBits)
{
/*
* All floating point notations (including the less common ones) express
@@ -1176,11 +1205,11 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
* like NaN or Infinity it will currently encode a zero. (this could be fixed
* in a future version if there is a need for these exception values).
*/
- EdsLib_Ptr_t TempDst = { .Addr = DstPtr };
- size_t x;
- int Exponent = -1;
- int64_t MantissaBits = 0;
- EdsLib_Internal_Float_t Value = EDSLIB_FLOAT_C(0.0);
+ EdsLib_Ptr_t TempDst = { .Addr = DstPtr };
+ size_t x;
+ int Exponent = -1;
+ int64_t MantissaBits = 0;
+ EdsLib_Internal_Float_t Value = EDSLIB_FLOAT_C(0.0);
if (EncodingStyle == EDSLIB_NUMBERENCODING_MILSTD_1750A)
{
@@ -1189,7 +1218,7 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
if (EncodingBits == 32 && ValBuf->u32 != 0)
{
/* 24 bits of mantissa as sign bit + 23 bits, 8 bits of exponent */
- Exponent = (ValBuf->u32 & UINT32_C(0x000000FF));
+ Exponent = (ValBuf->u32 & UINT32_C(0x000000FF));
MantissaBits = (ValBuf->u32 & UINT32_C(0xFFFFFF00));
/* Interpolate mantissa to 64 bits -
@@ -1199,8 +1228,8 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
else if (EncodingBits == 48 && ValBuf->u64 != 0)
{
/* 40 actual bits of mantissa, split between sign bit, 23 bits and 16 bits */
- Exponent = (ValBuf->u64 & UINT64_C(0x000000FF0000)) >> 16;
- MantissaBits = (ValBuf->u64 & UINT64_C(0xFFFFFF000000)) >> 8;
+ Exponent = (ValBuf->u64 & UINT64_C(0x000000FF0000)) >> 16;
+ MantissaBits = (ValBuf->u64 & UINT64_C(0xFFFFFF000000)) >> 8;
MantissaBits |= (ValBuf->u64 & UINT64_C(0x00000000FFFF));
/* Interpolate mantissa to 64 bits -
@@ -1211,7 +1240,7 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
if (Exponent >= 0)
{
Exponent -= (Exponent & 0x80) << 1; /* sign extend */
- Value = EDSLIB_LDEXP(MantissaBits, Exponent - 63);
+ Value = EDSLIB_LDEXP(MantissaBits, Exponent - 63);
}
}
else if (EncodingStyle == EDSLIB_NUMBERENCODING_IEEE_754)
@@ -1219,13 +1248,12 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
if (EncodingBits == 128)
{
/* The first two bytes are the sign and exponent */
- Exponent = ((ValBuf->BinaryData[0] & 0x7F) << 8) +
- (ValBuf->BinaryData[1] & 0xFF);
+ Exponent = ((ValBuf->BinaryData[0] & 0x7F) << 8) + (ValBuf->BinaryData[1] & 0xFF);
- for (x=15; x >= 2; --x)
+ for (x = 15; x >= 2; --x)
{
Value += ValBuf->BinaryData[x];
- Value = EDSLIB_LDEXP(Value,-8);
+ Value = EDSLIB_LDEXP(Value, -8);
}
if (Value != EDSLIB_FLOAT_C(0.0) || Exponent != 0)
@@ -1242,7 +1270,7 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
{
/* Interpret as uint64, mask out bits for IEEE double */
MantissaBits = (ValBuf->u64 & UINT64_C(0xFFFFFFFFFFFFF));
- Exponent = (ValBuf->u64 >> 52) & 0x7FF;
+ Exponent = (ValBuf->u64 >> 52) & 0x7FF;
if (MantissaBits != 0 || Exponent != 0)
{
@@ -1254,7 +1282,7 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
{
/* Interpret as uint32, mask out bits for IEEE single */
MantissaBits = (ValBuf->u32 & UINT32_C(0x7FFFFF));
- Exponent = (ValBuf->u32 >> 23) & 0xFF;
+ Exponent = (ValBuf->u32 >> 23) & 0xFF;
if (MantissaBits != 0 || Exponent != 0)
{
@@ -1284,17 +1312,19 @@ static void EdsLib_Internal_DoFloatUnpack(uint8_t *DstPtr, size_t DstSizeBytes,
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcPtr, const EdsLib_DataTypeDB_Entry_t *DataDictPtr, uint32_t SrcBitOffset)
+static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr,
+ const uint8_t *SrcPtr,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ uint32_t SrcBitOffset)
{
- uint32_t ShiftRegister;
- uint32_t LowBitPos;
- uint32_t TotalBits;
- EdsLib_GenericValueUnion_t NumBuf;
- size_t FillBits;
- uint8_t *StorePtr;
+ uint32_t ShiftRegister;
+ uint32_t LowBitPos;
+ uint32_t TotalBits;
+ EdsLib_GenericValueUnion_t NumBuf;
+ size_t FillBits;
+ uint8_t *StorePtr;
EdsLib_Internal_PackStyleInfo_t Pack;
- size_t ConvSize;
-
+ size_t ConvSize;
/*
* General process of unpacking ints/floats
@@ -1345,8 +1375,7 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
}
/* Do conversion to intermediate type, if indicated */
- if (Pack.IntermediateType != EDSLIB_BASICTYPE_NONE &&
- Pack.IntermediateSize != 0)
+ if (Pack.IntermediateType != EDSLIB_BASICTYPE_NONE && Pack.IntermediateSize != 0)
{
StorePtr = NumBuf.BinaryData;
ConvSize = Pack.IntermediateSize;
@@ -1365,10 +1394,9 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
ConvSize = DataDictPtr->SizeInfo.Bytes;
}
-
ShiftRegister = 0;
- LowBitPos = 24 + SrcBitOffset;
- TotalBits = SrcBitOffset + DataDictPtr->SizeInfo.Bits;
+ LowBitPos = 24 + SrcBitOffset;
+ TotalBits = SrcBitOffset + DataDictPtr->SizeInfo.Bits;
/*
* When reading in reverse order,
@@ -1382,9 +1410,9 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
FillBits = 0;
while ((FillBits + 8) <= Pack.LeadingPadBits)
{
- *StorePtr = 0;
- StorePtr += Pack.MemStride;
- FillBits += 8;
+ *StorePtr = 0;
+ StorePtr += Pack.MemStride;
+ FillBits += 8;
}
ConvSize *= 8;
@@ -1403,8 +1431,8 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
/* This could have gotten some extra bits beyond the last valid bit
* if so, clear them out of the shift register here */
ShiftRegister &= ~((UINT32_C(1) << (LowBitPos - TotalBits)) - 1);
- TotalBits = 0;
- LowBitPos = 0;
+ TotalBits = 0;
+ LowBitPos = 0;
}
else
{
@@ -1424,20 +1452,19 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
{
/* store a partial octet -
* the valid bits aligned to the MSB, and clear any LSBs */
- *StorePtr = (ShiftRegister >> 16) &
- (((UINT32_C(1) << (Pack.LeadingPadBits - FillBits)) - 1) ^ 0xFF);
+ *StorePtr = (ShiftRegister >> 16) & (((UINT32_C(1) << (Pack.LeadingPadBits - FillBits)) - 1) ^ 0xFF);
- FillBits += 8;
+ FillBits += 8;
ShiftRegister <<= (FillBits - Pack.LeadingPadBits);
- LowBitPos += (FillBits - Pack.LeadingPadBits);
+ LowBitPos += (FillBits - Pack.LeadingPadBits);
}
else
{
/* store a whole octet */
- *StorePtr = ShiftRegister >> 16;
+ *StorePtr = ShiftRegister >> 16;
ShiftRegister <<= 8;
- LowBitPos += 8;
- FillBits += 8;
+ LowBitPos += 8;
+ FillBits += 8;
}
StorePtr += Pack.MemStride;
}
@@ -1446,38 +1473,38 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
/* Un-shift the numeric data if indicated */
if (Pack.Invert || Pack.IntermediateShift > 0)
{
- EdsLib_Ptr_t ShiftDst;
+ EdsLib_Ptr_t ShiftDst;
EdsLib_BasicType_t ShiftType;
if (Pack.IntermediateType != EDSLIB_BASICTYPE_NONE)
{
ShiftDst.u = &NumBuf;
- ShiftType = Pack.IntermediateType;
+ ShiftType = Pack.IntermediateType;
}
else
{
- ShiftType = DataDictPtr->BasicType;
+ ShiftType = DataDictPtr->BasicType;
ShiftDst.Addr = DstPtr;
}
if (Pack.Invert)
{
- switch(ConvSize)
+ switch (ConvSize)
{
- case 8:
- NumBuf.u8 = ~NumBuf.u8;
- break;
- case 16:
- NumBuf.u16 = ~NumBuf.u16;
- break;
- case 32:
- NumBuf.u32 = ~NumBuf.u32;
- break;
- case 64:
- NumBuf.u64 = ~NumBuf.u64;
- break;
- default:
- break;
+ case 8:
+ NumBuf.u8 = ~NumBuf.u8;
+ break;
+ case 16:
+ NumBuf.u16 = ~NumBuf.u16;
+ break;
+ case 32:
+ NumBuf.u32 = ~NumBuf.u32;
+ break;
+ case 64:
+ NumBuf.u64 = ~NumBuf.u64;
+ break;
+ default:
+ break;
}
}
@@ -1495,41 +1522,42 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
* But every machine should implement this correctly.
* The alternative is to divide by 1<i8 = NumBuf.i8 >> Pack.IntermediateShift;
- break;
- case 16:
- ShiftDst.u->i16 = NumBuf.i16 >> Pack.IntermediateShift;
- break;
- case 32:
- ShiftDst.u->i32 = NumBuf.i32 >> Pack.IntermediateShift;
- break;
- case 64:
- ShiftDst.u->i64 = NumBuf.i64 >> Pack.IntermediateShift;
- break;
- default:
- break;
+ case 8:
+ ShiftDst.u->i8 = NumBuf.i8 >> Pack.IntermediateShift;
+ break;
+ case 16:
+ ShiftDst.u->i16 = NumBuf.i16 >> Pack.IntermediateShift;
+ break;
+ case 32:
+ ShiftDst.u->i32 = NumBuf.i32 >> Pack.IntermediateShift;
+ break;
+ case 64:
+ ShiftDst.u->i64 = NumBuf.i64 >> Pack.IntermediateShift;
+ break;
+ default:
+ break;
}
}
- else switch(ConvSize) /* anything else is unsigned shift */
- {
- case 8:
- ShiftDst.u->u8 = NumBuf.u8 >> Pack.IntermediateShift;
- break;
- case 16:
- ShiftDst.u->u16 = NumBuf.u16 >> Pack.IntermediateShift;
- break;
- case 32:
- ShiftDst.u->u32 = NumBuf.u32 >> Pack.IntermediateShift;
- break;
- case 64:
- ShiftDst.u->u64 = NumBuf.u64 >> Pack.IntermediateShift;
- break;
- default:
- break;
- }
+ else
+ switch (ConvSize) /* anything else is unsigned shift */
+ {
+ case 8:
+ ShiftDst.u->u8 = NumBuf.u8 >> Pack.IntermediateShift;
+ break;
+ case 16:
+ ShiftDst.u->u16 = NumBuf.u16 >> Pack.IntermediateShift;
+ break;
+ case 32:
+ ShiftDst.u->u32 = NumBuf.u32 >> Pack.IntermediateShift;
+ break;
+ case 64:
+ ShiftDst.u->u64 = NumBuf.u64 >> Pack.IntermediateShift;
+ break;
+ default:
+ break;
+ }
}
/*
@@ -1541,13 +1569,19 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
{
if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_SIGNED_INT)
{
- EdsLib_Internal_DoSignedIntUnpack(DstPtr, DataDictPtr->SizeInfo.Bytes, &NumBuf,
- DataDictPtr->Detail.Number.Encoding, DataDictPtr->SizeInfo.Bits);
+ EdsLib_Internal_DoSignedIntUnpack(DstPtr,
+ DataDictPtr->SizeInfo.Bytes,
+ &NumBuf,
+ DataDictPtr->Detail.Number.Encoding,
+ DataDictPtr->SizeInfo.Bits);
}
else if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_FLOAT)
{
- EdsLib_Internal_DoFloatUnpack(DstPtr, DataDictPtr->SizeInfo.Bytes, &NumBuf,
- DataDictPtr->Detail.Number.Encoding, DataDictPtr->SizeInfo.Bits);
+ EdsLib_Internal_DoFloatUnpack(DstPtr,
+ DataDictPtr->SizeInfo.Bytes,
+ &NumBuf,
+ DataDictPtr->Detail.Number.Encoding,
+ DataDictPtr->SizeInfo.Bits);
}
}
}
@@ -1557,11 +1591,14 @@ static void EdsLib_Internal_DoBitwiseUnpack(uint8_t *DstPtr, const uint8_t *SrcP
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static int32_t EdsLib_DataTypePackUnpack_CheckPresence(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_IdentityCheckSequence_t *Presence, const void *Buffer, size_t MaxOffset, bool *Result)
+static int32_t EdsLib_DataTypePackUnpack_CheckPresence(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_IdentityCheckSequence_t *Presence,
+ const void *Buffer,
+ size_t MaxOffset,
+ bool *Result)
{
const EdsLib_IdentSequenceEntry_t *IdentResultPtr;
- int32_t RetCode;
+ int32_t RetCode;
RetCode = EDSLIB_SUCCESS;
@@ -1572,13 +1609,12 @@ static int32_t EdsLib_DataTypePackUnpack_CheckPresence(const EdsLib_DatabaseObje
else if (Buffer == NULL)
{
/* buffer is needed because object is not fixed size */
- RetCode = EDSLIB_NOT_FIXED_SIZE;
+ RetCode = EDSLIB_NOT_FIXED_SIZE;
IdentResultPtr = NULL;
}
else
{
- IdentResultPtr = EdsLib_DataTypeExecuteConstraintSequence_Impl(GD,
- Presence, Buffer, MaxOffset);
+ IdentResultPtr = EdsLib_DataTypeExecuteConstraintSequence_Impl(GD, Presence, Buffer, MaxOffset);
}
if (IdentResultPtr == NULL)
@@ -1605,45 +1641,45 @@ static int32_t EdsLib_DataTypePackUnpack_CheckPresence(const EdsLib_DatabaseObje
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static EdsLib_PackAction_t EdsLib_DataTypePackUnpack_GetPackAction(
- const EdsLib_DataTypeDB_Entry_t *DataDictPtr, bool IsByteAligned)
+static EdsLib_PackAction_t EdsLib_DataTypePackUnpack_GetPackAction(const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ bool IsByteAligned)
{
EdsLib_PackAction_t PackAction;
- bool IsPacked;
- bool IsByteOrderMatch;
+ bool IsPacked;
+ bool IsByteOrderMatch;
PackAction = EDSLIB_PACKACTION_NONE;
/*
- * Determine if this field is a candidate for optimized handling, i.e. direct copy.
- *
- * If the data type is exactly equivalent to a C type with no embedded padding
- * or unused bits, and (in the case of structures) has no special element types,
- * then this flag should be set. This was determined by the EDS tool at compile time.
- */
+ * Determine if this field is a candidate for optimized handling, i.e. direct copy.
+ *
+ * If the data type is exactly equivalent to a C type with no embedded padding
+ * or unused bits, and (in the case of structures) has no special element types,
+ * then this flag should be set. This was determined by the EDS tool at compile time.
+ */
IsPacked = (DataDictPtr->Flags & EDSLIB_DATATYPE_FLAG_PACKED) != 0;
/*
- * Determine if the native byte-ordering matches that of the message format (typically big-endian)
- * This determines if resulting bytes need to be inverted in memory or if they can be copied in-order
- */
+ * Determine if the native byte-ordering matches that of the message format (typically big-endian)
+ * This determines if resulting bytes need to be inverted in memory or if they can be copied in-order
+ */
IsByteOrderMatch = (DataDictPtr->Flags & EDSLIB_DATATYPE_FLAG_PACKED) == EDSLIB_NATIVE_BYTE_PACK;
- switch(DataDictPtr->BasicType)
+ switch (DataDictPtr->BasicType)
{
case EDSLIB_BASICTYPE_CONTAINER:
case EDSLIB_BASICTYPE_COMPONENT:
case EDSLIB_BASICTYPE_ARRAY:
{
/*
- * Optimization:
- * 1) if the machine encoding is the same as the packed encoding
- * 2) if the entire sub-structure does not contain any padding
- * 3) The packed bits start on a byte boundary (so no shifting is required)
- *
- * THEN -- this can be a simple byte-wise memory copy operation, which will
- * be much more efficient than iterating over all the sub-structure contents
- */
+ * Optimization:
+ * 1) if the machine encoding is the same as the packed encoding
+ * 2) if the entire sub-structure does not contain any padding
+ * 3) The packed bits start on a byte boundary (so no shifting is required)
+ *
+ * THEN -- this can be a simple byte-wise memory copy operation, which will
+ * be much more efficient than iterating over all the sub-structure contents
+ */
if (IsByteOrderMatch && IsPacked && IsByteAligned)
{
PackAction = EDSLIB_PACKACTION_BYTECOPY_STRAIGHT;
@@ -1702,7 +1738,7 @@ static void EdsLib_DataTypePack_ByteSwapCopy(uint8_t *DstPtr, const uint8_t *Src
{
/* need to invert byte order while copying, so use custom routine */
DstPtr += Size;
- while(Size > 0)
+ while (Size > 0)
{
--DstPtr;
*DstPtr = *SrcPtr;
@@ -1716,22 +1752,21 @@ static void EdsLib_DataTypePack_ByteSwapCopy(uint8_t *DstPtr, const uint8_t *Src
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypePack_HandleMember(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction)
+int32_t EdsLib_DataTypePack_HandleMember(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction)
{
EdsLib_DataTypePack_State_t *PackState = (EdsLib_DataTypePack_State_t *)Parent;
- int32_t StatusCode;
- const uint8_t *SrcPtr;
- uint8_t *DstPtr;
- size_t UnitSize;
+ int32_t StatusCode;
+ const uint8_t *SrcPtr;
+ uint8_t *DstPtr;
+ size_t UnitSize;
StatusCode = EDSLIB_SUCCESS;
- UnitSize = 0;
- SrcPtr = PackState->NativeSrcPtr;
- DstPtr = PackState->PackedDstPtr;
+ UnitSize = 0;
+ SrcPtr = PackState->NativeSrcPtr;
+ DstPtr = PackState->PackedDstPtr;
if (PackAction == EDSLIB_PACKACTION_PREPARE)
{
@@ -1746,35 +1781,34 @@ int32_t EdsLib_DataTypePack_HandleMember(
* object being handled, all other START callbacks will be for sub-objects
* inside this.
*/
- if (EdsLib_DatabaseRef_IsEqual(&PackState->Common.RefObj, &CbInfo->Details.RefObj) &&
- PackState->Common.MaxSize.Bits > PackState->Common.LastActualTailBitPos)
+ if (EdsLib_DatabaseRef_IsEqual(&PackState->Common.RefObj, &CbInfo->Details.RefObj)
+ && PackState->Common.MaxSize.Bits > PackState->Common.LastActualTailBitPos)
{
- UnitSize = EdsLib_BITS_TO_OCTETS(PackState->Common.LastActualTailBitPos);
- DstPtr += UnitSize;
- UnitSize = EdsLib_BITS_TO_OCTETS(PackState->Common.MaxSize.Bits) - UnitSize;
+ UnitSize = EdsLib_BITS_TO_OCTETS(PackState->Common.LastActualTailBitPos);
+ DstPtr += UnitSize;
+ UnitSize = EdsLib_BITS_TO_OCTETS(PackState->Common.MaxSize.Bits) - UnitSize;
}
else
{
PackAction = EDSLIB_PACKACTION_NONE;
}
-
}
- else if (CbInfo->StartOffset.Bytes < PackState->Common.LastNominalTail.Bytes ||
- CbInfo->Details.EntryType == EDSLIB_ENTRYTYPE_CONTAINER_ERROR_CONTROL_ENTRY ||
- CbInfo->Details.EntryType == EDSLIB_ENTRYTYPE_CONTAINER_LENGTH_ENTRY ||
- CbInfo->Details.EntryType == EDSLIB_ENTRYTYPE_CONTAINER_FIXED_VALUE_ENTRY)
+ else if (CbInfo->StartOffset.Bytes < PackState->Common.LastNominalTail.Bytes
+ || CbInfo->Details.EntryType == EDSLIB_ENTRYTYPE_CONTAINER_ERROR_CONTROL_ENTRY
+ || CbInfo->Details.EntryType == EDSLIB_ENTRYTYPE_CONTAINER_LENGTH_ENTRY
+ || CbInfo->Details.EntryType == EDSLIB_ENTRYTYPE_CONTAINER_FIXED_VALUE_ENTRY)
{
/* nothing to do here, it was either already handled, or will be handled later */
PackAction = EDSLIB_PACKACTION_NONE;
}
else
{
- SrcPtr += CbInfo->StartOffset.Bytes;
- DstPtr += (BitPosition / 8);
- UnitSize = CbInfo->DataDictPtr->SizeInfo.Bytes;
+ SrcPtr += CbInfo->StartOffset.Bytes;
+ DstPtr += (BitPosition / 8);
+ UnitSize = CbInfo->DataDictPtr->SizeInfo.Bytes;
}
- switch(PackAction)
+ switch (PackAction)
{
case EDSLIB_PACKACTION_PREPARE:
{
@@ -1812,22 +1846,21 @@ int32_t EdsLib_DataTypePack_HandleMember(
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeUnpack_HandleMember(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction)
+int32_t EdsLib_DataTypeUnpack_HandleMember(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction)
{
EdsLib_DataTypeUnpack_State_t *UnpackState = (EdsLib_DataTypeUnpack_State_t *)Parent;
- int32_t StatusCode;
- const uint8_t *SrcPtr;
- uint8_t *DstPtr;
- size_t UnitSize;
+ int32_t StatusCode;
+ const uint8_t *SrcPtr;
+ uint8_t *DstPtr;
+ size_t UnitSize;
StatusCode = EDSLIB_SUCCESS;
- UnitSize = 0;
- DstPtr = UnpackState->NativeDstPtr;
- SrcPtr = UnpackState->PackedSrcPtr;
+ UnitSize = 0;
+ DstPtr = UnpackState->NativeDstPtr;
+ SrcPtr = UnpackState->PackedSrcPtr;
if (PackAction == EDSLIB_PACKACTION_PREPARE)
{
@@ -1842,17 +1875,16 @@ int32_t EdsLib_DataTypeUnpack_HandleMember(
* object being handled, all other START callbacks will be for sub-objects
* inside this.
*/
- if (EdsLib_DatabaseRef_IsEqual(&UnpackState->Common.RefObj, &CbInfo->Details.RefObj) &&
- UnpackState->Common.MaxSize.Bytes > UnpackState->Common.LastNominalTail.Bytes)
+ if (EdsLib_DatabaseRef_IsEqual(&UnpackState->Common.RefObj, &CbInfo->Details.RefObj)
+ && UnpackState->Common.MaxSize.Bytes > UnpackState->Common.LastNominalTail.Bytes)
{
- DstPtr += UnpackState->Common.LastNominalTail.Bytes;
- UnitSize = UnpackState->Common.MaxSize.Bytes - UnpackState->Common.LastNominalTail.Bytes;
+ DstPtr += UnpackState->Common.LastNominalTail.Bytes;
+ UnitSize = UnpackState->Common.MaxSize.Bytes - UnpackState->Common.LastNominalTail.Bytes;
}
else
{
PackAction = EDSLIB_PACKACTION_NONE;
}
-
}
else if (CbInfo->StartOffset.Bytes >= UnpackState->Common.LastNominalTail.Bytes)
{
@@ -1867,7 +1899,7 @@ int32_t EdsLib_DataTypeUnpack_HandleMember(
PackAction = EDSLIB_PACKACTION_NONE;
}
- switch(PackAction)
+ switch (PackAction)
{
case EDSLIB_PACKACTION_PREPARE:
{
@@ -1905,20 +1937,20 @@ int32_t EdsLib_DataTypeUnpack_HandleMember(
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- void *OpaqueArg)
+static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ void *OpaqueArg)
{
EdsLib_DataTypePackUnpack_ControlBlock_t *Base = (EdsLib_DataTypePackUnpack_ControlBlock_t *)OpaqueArg;
- EdsLib_Iterator_Rc_t RetCode;
- bool HasBits;
- uint32_t ActualBitPosition;
- EdsLib_PackAction_t PackAction;
+ EdsLib_Iterator_Rc_t RetCode;
+ bool HasBits;
+ uint32_t ActualBitPosition;
+ EdsLib_PackAction_t PackAction;
- RetCode = EDSLIB_ITERATOR_RC_CONTINUE;
+ RetCode = EDSLIB_ITERATOR_RC_CONTINUE;
PackAction = EDSLIB_PACKACTION_NONE;
- HasBits = false;
+ HasBits = false;
if (CbInfo->EndOffset.Bits <= Base->LastNominalTail.Bits)
{
@@ -1939,8 +1971,8 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
/* Padding entries just show as a gap between the nominal bit position of members,
* they do not have their own entry in the tables. So if the start of this member
* is not the same as the end of the previous, then there is padding */
- if (CbInfo->StartOffset.Bytes == Base->LastNominalTail.Bytes &&
- CbInfo->StartOffset.Bits > Base->LastNominalTail.Bits)
+ if (CbInfo->StartOffset.Bytes == Base->LastNominalTail.Bytes
+ && CbInfo->StartOffset.Bits > Base->LastNominalTail.Bits)
{
/* add the padding to the output */
Base->LastActualTailBitPos += CbInfo->StartOffset.Bits - Base->LastNominalTail.Bits;
@@ -1955,7 +1987,11 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
else if (CbType == EDSLIB_ITERATOR_CBTYPE_MEMBER)
{
/* If this has a presence tag, check if should be packed or skipped */
- Base->Status = EdsLib_DataTypePackUnpack_CheckPresence(GD, CbInfo->Details.CheckSequence, Base->NativeBufferPtr, Base->MaxSize.Bytes, &HasBits);
+ Base->Status = EdsLib_DataTypePackUnpack_CheckPresence(GD,
+ CbInfo->Details.CheckSequence,
+ Base->NativeBufferPtr,
+ Base->MaxSize.Bytes,
+ &HasBits);
if (Base->Status != EDSLIB_SUCCESS)
{
PackAction = EDSLIB_PACKACTION_FAULT;
@@ -1966,7 +2002,7 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
}
}
- switch(PackAction)
+ switch (PackAction)
{
case EDSLIB_PACKACTION_BYTECOPY_STRAIGHT:
case EDSLIB_PACKACTION_BYTECOPY_INVERT:
@@ -1974,8 +2010,8 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
case EDSLIB_PACKACTION_PREPARE:
{
/* if this will have actual bits in the final object, ensure there is space for them */
- if ((HasBits && (ActualBitPosition + CbInfo->DataDictPtr->SizeInfo.Bits) > Base->MaxSize.Bits) ||
- CbInfo->EndOffset.Bytes > Base->MaxSize.Bytes)
+ if ((HasBits && (ActualBitPosition + CbInfo->DataDictPtr->SizeInfo.Bits) > Base->MaxSize.Bits)
+ || CbInfo->EndOffset.Bytes > Base->MaxSize.Bytes)
{
/* No data for this object, stop here */
Base->Status = EDSLIB_BUFFER_SIZE_ERROR;
@@ -1988,10 +2024,10 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
case EDSLIB_PACKACTION_SUBCOMPONENTS:
{
/*
- * If the structure contains sub-components then the iterator
- * must dig down into the sub-components. The bits will be
- * accounted for when processing the sub-components.
- */
+ * If the structure contains sub-components then the iterator
+ * must dig down into the sub-components. The bits will be
+ * accounted for when processing the sub-components.
+ */
RetCode = EDSLIB_ITERATOR_RC_DESCEND;
HasBits = false; /* the bits will be accounted later */
break;
@@ -2024,7 +2060,6 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
Base->LastNominalTail = CbInfo->EndOffset;
}
-
return RetCode;
}
@@ -2033,16 +2068,18 @@ static EdsLib_Iterator_Rc_t EdsLib_DataTypePackUnpack_Callback(const EdsLib_Data
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- const EdsLib_SizeInfo_t *TargetOffset, EdsLib_DataTypeDB_EntityInfo_t *ResultInfo)
+int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const EdsLib_SizeInfo_t *TargetOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *ResultInfo)
{
- EdsLib_SizeInfo_t CurrentOffset;
+ EdsLib_SizeInfo_t CurrentOffset;
EdsLib_DataTypeDB_EntityInfo_t TempInfo;
- int32_t Status;
+ int32_t Status;
memset(ResultInfo, 0, sizeof(*ResultInfo));
memset(&TempInfo, 0, sizeof(TempInfo));
- CurrentOffset = *TargetOffset;
+ CurrentOffset = *TargetOffset;
TempInfo.EdsId = EdsId;
do
{
@@ -2065,12 +2102,12 @@ int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t
break;
}
- ResultInfo->EdsId = TempInfo.EdsId;
- ResultInfo->Flags &= ~EDSLIB_DATATYPE_FLAG_VARIABLE;
- ResultInfo->Flags |= TempInfo.Flags;
+ ResultInfo->EdsId = TempInfo.EdsId;
+ ResultInfo->Flags &= ~EDSLIB_DATATYPE_FLAG_VARIABLE;
+ ResultInfo->Flags |= TempInfo.Flags;
ResultInfo->Offset.Bytes += TempInfo.Offset.Bytes;
- ResultInfo->Offset.Bits += TempInfo.Offset.Bits;
- ResultInfo->MaxSize = TempInfo.MaxSize;
+ ResultInfo->Offset.Bits += TempInfo.Offset.Bits;
+ ResultInfo->MaxSize = TempInfo.MaxSize;
if (TargetOffset->Bytes != 0 && ResultInfo->Offset.Bytes >= TargetOffset->Bytes)
{
@@ -2092,8 +2129,7 @@ int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t
{
CurrentOffset.Bits -= TempInfo.Offset.Bits;
}
- }
- while(true);
+ } while (true);
return Status;
}
@@ -2104,11 +2140,13 @@ int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DataTypeDB_PackUnpackFindTail(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- const EdsLib_SizeInfo_t *InputPtr, EdsLib_DataTypePackUnpack_ControlBlock_t *CbPtr)
+int32_t EdsLib_DataTypeDB_PackUnpackFindTail(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const EdsLib_SizeInfo_t *InputPtr,
+ EdsLib_DataTypePackUnpack_ControlBlock_t *CbPtr)
{
EdsLib_DataTypeDB_EntityInfo_t EntityInfo;
- int32_t Status;
+ int32_t Status;
memset(&CbPtr->LastNominalTail, 0, sizeof(CbPtr->LastNominalTail));
@@ -2120,7 +2158,7 @@ int32_t EdsLib_DataTypeDB_PackUnpackFindTail(const EdsLib_DatabaseObject_t *GD,
}
else
{
- CbPtr->LastActualTailBitPos = InputPtr->Bits;
+ CbPtr->LastActualTailBitPos = InputPtr->Bits;
CbPtr->LastNominalTail.Bytes = InputPtr->Bytes;
Status = EdsLib_DataTypeDB_PackUnpackFindTailEntity(GD, EdsId, &CbPtr->LastNominalTail, &EntityInfo);
if (Status == EDSLIB_SUCCESS)
@@ -2138,23 +2176,24 @@ int32_t EdsLib_DataTypeDB_PackUnpackFindTail(const EdsLib_DatabaseObject_t *GD,
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DataTypePackUnpack_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_DataTypePackUnpack_ControlBlock_t *PackState)
+void EdsLib_DataTypePackUnpack_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DataTypePackUnpack_ControlBlock_t *PackState)
{
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
- EdsLib_DatabaseRef_t NextBaseObj;
- uint32_t PassCount;
- int32_t Status;
+ EdsLib_DatabaseRef_t NextBaseObj;
+ uint32_t PassCount;
+ int32_t Status;
EDSLIB_DECLARE_ITERATOR_CB(IteratorState,
- EDSLIB_ITERATOR_MAX_DEEP_DEPTH,
- EdsLib_DataTypePackUnpack_Callback,
- PackState);
+ EDSLIB_ITERATOR_MAX_DEEP_DEPTH,
+ EdsLib_DataTypePackUnpack_Callback,
+ PackState);
- Status = EDSLIB_SUCCESS;
+ Status = EDSLIB_SUCCESS;
PassCount = 0;
NextBaseObj = PackState->RefObj;
- while(1)
+ while (1)
{
DataDictPtr = EdsLib_DataTypeDB_GetEntry(GD, &NextBaseObj);
if (DataDictPtr == NULL)
@@ -2195,7 +2234,12 @@ void EdsLib_DataTypePackUnpack_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_Da
* Note this must use the "native" representation, so the buffer which contains
* native data will be the source when packing or destination when unpacking
*/
- Status = EdsLib_DataTypeIdentifyBuffer_Impl(GD, DataDictPtr, PackState->NativeBufferPtr, DataDictPtr->SizeInfo.Bytes, NULL, &NextBaseObj);
+ Status = EdsLib_DataTypeIdentifyBuffer_Impl(GD,
+ DataDictPtr,
+ PackState->NativeBufferPtr,
+ DataDictPtr->SizeInfo.Bytes,
+ NULL,
+ &NextBaseObj);
if (Status != EDSLIB_SUCCESS)
{
/* Not further derived; normal stop condition */
@@ -2216,10 +2260,13 @@ void EdsLib_DataTypePackUnpack_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_Da
* Local Helper function
*
*-----------------------------------------------------------------*/
-void EdsLib_PackedObject_UpdateSingleField(void *PackedObject, uint32_t BitPosition, const EdsLib_DataTypeDB_Entry_t *DataDictPtr, EdsLib_GenericValueBuffer_t *ValBuf)
+void EdsLib_PackedObject_UpdateSingleField(void *PackedObject,
+ uint32_t BitPosition,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ EdsLib_GenericValueBuffer_t *ValBuf)
{
EdsLib_ConstPtr_t TempSrc;
- EdsLib_Ptr_t TempDst;
+ EdsLib_Ptr_t TempDst;
if (DataDictPtr->BasicType != EDSLIB_BASICTYPE_BINARY)
{
@@ -2228,8 +2275,8 @@ void EdsLib_PackedObject_UpdateSingleField(void *PackedObject, uint32_t BitPosit
EdsLib_DataTypeStore_Impl(TempDst, ValBuf, DataDictPtr);
}
- TempSrc.u = &ValBuf->Value;
- TempDst.Ptr = PackedObject;
+ TempSrc.u = &ValBuf->Value;
+ TempDst.Ptr = PackedObject;
TempDst.Addr += BitPosition / 8;
EdsLib_Internal_DoBitwisePack(TempDst.Addr, TempSrc.Addr, DataDictPtr, BitPosition % 0x08);
}
@@ -2239,10 +2286,9 @@ void EdsLib_PackedObject_UpdateSingleField(void *PackedObject, uint32_t BitPosit
* Local Helper function
*
*-----------------------------------------------------------------*/
-void EdsLib_PackUnpack_GetFixedValueRef(
- EdsLib_GenericValueBuffer_t *ScratchBuf,
- const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
- const EdsLib_HandlerArgument_t *HandlerArg)
+void EdsLib_PackUnpack_GetFixedValueRef(EdsLib_GenericValueBuffer_t *ScratchBuf,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ const EdsLib_HandlerArgument_t *HandlerArg)
{
if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_BINARY)
{
@@ -2255,17 +2301,17 @@ void EdsLib_PackUnpack_GetFixedValueRef(
else if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_SIGNED_INT)
{
ScratchBuf->Value.SignedInteger = HandlerArg->FixedInteger;
- ScratchBuf->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ScratchBuf->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
}
else if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_UNSIGNED_INT)
{
ScratchBuf->Value.UnsignedInteger = HandlerArg->FixedUnsigned;
- ScratchBuf->ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ScratchBuf->ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
else if (DataDictPtr->BasicType == EDSLIB_BASICTYPE_FLOAT)
{
ScratchBuf->Value.FloatingPoint = HandlerArg->FixedFloat;
- ScratchBuf->ValueType = EDSLIB_BASICTYPE_FLOAT;
+ ScratchBuf->ValueType = EDSLIB_BASICTYPE_FLOAT;
}
}
@@ -2275,36 +2321,35 @@ void EdsLib_PackUnpack_GetFixedValueRef(
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_PackedObject_PostProc_Callback(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction)
+int32_t EdsLib_PackedObject_PostProc_Callback(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction)
{
- EdsLib_PackedPostProc_ControlBlock_t *Base = (EdsLib_PackedPostProc_ControlBlock_t *)Parent;
+ EdsLib_PackedPostProc_ControlBlock_t *Base = (EdsLib_PackedPostProc_ControlBlock_t *)Parent;
EdsLib_PackedPostProc_DeferredField_t *DeferredFieldPtr;
- EdsLib_GenericValueBuffer_t ScratchBuf;
- int32_t StatusCode;
+ EdsLib_GenericValueBuffer_t ScratchBuf;
+ int32_t StatusCode;
- DeferredFieldPtr = NULL;
- StatusCode = EDSLIB_SUCCESS;
+ DeferredFieldPtr = NULL;
+ StatusCode = EDSLIB_SUCCESS;
ScratchBuf.ValueType = EDSLIB_BASICTYPE_NONE;
switch (CbInfo->Details.EntryType)
{
case EDSLIB_ENTRYTYPE_CONTAINER_ERROR_CONTROL_ENTRY:
/*
- * Error control fields still cannot be handled yet --
- * the correct value is not known at the moment, and other special fields
- * may affect its value (e.g. length needs to be populated before error control)
- */
+ * Error control fields still cannot be handled yet --
+ * the correct value is not known at the moment, and other special fields
+ * may affect its value (e.g. length needs to be populated before error control)
+ */
if (Base->DeferredFieldCount < EDSLIB_PACKEDPOSTPROC_MAX_DEFERRED_FIELDS)
{
DeferredFieldPtr = &Base->DeferredFields[Base->DeferredFieldCount];
- DeferredFieldPtr->DictPtr = CbInfo->DataDictPtr;
- DeferredFieldPtr->EntryType = CbInfo->Details.EntryType;
- DeferredFieldPtr->HandlerArg = CbInfo->Details.HandlerArg;
+ DeferredFieldPtr->DictPtr = CbInfo->DataDictPtr;
+ DeferredFieldPtr->EntryType = CbInfo->Details.EntryType;
+ DeferredFieldPtr->HandlerArg = CbInfo->Details.HandlerArg;
DeferredFieldPtr->PackedBitOffset = BitPosition;
++Base->DeferredFieldCount;
@@ -2317,11 +2362,11 @@ int32_t EdsLib_PackedObject_PostProc_Callback(
case EDSLIB_ENTRYTYPE_CONTAINER_LENGTH_ENTRY:
ScratchBuf.Value.SignedInteger = EdsLib_BITS_TO_OCTETS(Base->Pack.Common.MaxSize.Bits);
- ScratchBuf.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ScratchBuf.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
if (CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse)
{
ScratchBuf.Value.SignedInteger =
- CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse(ScratchBuf.Value.SignedInteger);
+ CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse(ScratchBuf.Value.SignedInteger);
}
break;
@@ -2348,8 +2393,8 @@ int32_t EdsLib_PackedObject_PostProc_Callback(
*-----------------------------------------------------------------*/
void EdsLib_PackedObject_PostProc_Deferred(EdsLib_PackedPostProc_ControlBlock_t *Base)
{
- EdsLib_GenericValueBuffer_t ScratchBuf;
- uint32_t i;
+ EdsLib_GenericValueBuffer_t ScratchBuf;
+ uint32_t i;
EdsLib_PackedPostProc_DeferredField_t *DeferredFieldPtr;
/* error control MUST be calculated last, since
@@ -2362,16 +2407,21 @@ void EdsLib_PackedObject_PostProc_Deferred(EdsLib_PackedPostProc_ControlBlock_t
* this actually has to be the case since the contents of one would affect
* the validity of the other.
*/
- for (i=0; i < Base->DeferredFieldCount; ++i)
+ for (i = 0; i < Base->DeferredFieldCount; ++i)
{
DeferredFieldPtr = &Base->DeferredFields[i];
if (DeferredFieldPtr->EntryType == EDSLIB_ENTRYTYPE_CONTAINER_ERROR_CONTROL_ENTRY)
{
- ScratchBuf.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ScratchBuf.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
ScratchBuf.Value.UnsignedInteger = EdsLib_ErrorControlCompute(DeferredFieldPtr->HandlerArg.ErrorControl,
- Base->Pack.PackedDstPtr, Base->Pack.Common.MaxSize.Bits, DeferredFieldPtr->PackedBitOffset);
+ Base->Pack.PackedDstPtr,
+ Base->Pack.Common.MaxSize.Bits,
+ DeferredFieldPtr->PackedBitOffset);
- EdsLib_PackedObject_UpdateSingleField(Base->Pack.PackedDstPtr, DeferredFieldPtr->PackedBitOffset, DeferredFieldPtr->DictPtr, &ScratchBuf);
+ EdsLib_PackedObject_UpdateSingleField(Base->Pack.PackedDstPtr,
+ DeferredFieldPtr->PackedBitOffset,
+ DeferredFieldPtr->DictPtr,
+ &ScratchBuf);
}
}
}
@@ -2382,25 +2432,24 @@ void EdsLib_PackedObject_PostProc_Deferred(EdsLib_PackedPostProc_ControlBlock_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_NativeObject_PostProc_Callback(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction)
+int32_t EdsLib_NativeObject_PostProc_Callback(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction)
{
EdsLib_NativePostProc_ControlBlock_t *Base = (EdsLib_NativePostProc_ControlBlock_t *)Parent;
- EdsLib_GenericValueBuffer_t ActualValue;
- EdsLib_GenericValueBuffer_t ExpectedValue;
- EdsLib_GenericValueBuffer_t InitValue;
- bool CompareResult;
- EdsLib_ConstPtr_t TempSrc;
- EdsLib_Ptr_t TempDst;
- int32_t RetCode;
-
- RetCode = EDSLIB_SUCCESS;
- ActualValue.ValueType = EDSLIB_BASICTYPE_NONE;
+ EdsLib_GenericValueBuffer_t ActualValue;
+ EdsLib_GenericValueBuffer_t ExpectedValue;
+ EdsLib_GenericValueBuffer_t InitValue;
+ bool CompareResult;
+ EdsLib_ConstPtr_t TempSrc;
+ EdsLib_Ptr_t TempDst;
+ int32_t RetCode;
+
+ RetCode = EDSLIB_SUCCESS;
+ ActualValue.ValueType = EDSLIB_BASICTYPE_NONE;
ExpectedValue.ValueType = EDSLIB_BASICTYPE_NONE;
- InitValue.ValueType = EDSLIB_BASICTYPE_NONE;
+ InitValue.ValueType = EDSLIB_BASICTYPE_NONE;
switch (CbInfo->Details.EntryType)
{
@@ -2410,36 +2459,36 @@ int32_t EdsLib_NativeObject_PostProc_Callback(
{
/* verify value in existing field */
ExpectedValue.Value.UnsignedInteger = EdsLib_BITS_TO_OCTETS(Base->Unpack.Common.MaxSize.Bits);
- ExpectedValue.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ExpectedValue.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
if (CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse)
{
EdsLib_DataTypeConvert(&ExpectedValue, EDSLIB_BASICTYPE_SIGNED_INT);
ExpectedValue.Value.SignedInteger =
- CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse(ExpectedValue.Value.SignedInteger);
+ CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse(ExpectedValue.Value.SignedInteger);
}
}
/*
- * Initialization value for native object:
- *
- * Many historical applications assume that the length field
- * in the native struct will be based on sizeof(struct).
- *
- * But In the EDS world the encoded and decoded sizes may
- * be different.
- *
- * So in this case the InitValue for the native object is different than
- * the ExpectedValue in a packed object.
- */
+ * Initialization value for native object:
+ *
+ * Many historical applications assume that the length field
+ * in the native struct will be based on sizeof(struct).
+ *
+ * But In the EDS world the encoded and decoded sizes may
+ * be different.
+ *
+ * So in this case the InitValue for the native object is different than
+ * the ExpectedValue in a packed object.
+ */
if ((Base->RecomputeFields & EDSLIB_DATATYPEDB_RECOMPUTE_LENGTH) != 0)
{
- InitValue.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ InitValue.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
InitValue.Value.SignedInteger = Base->Unpack.Common.MaxSize.Bytes;
if (CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse)
{
InitValue.Value.SignedInteger =
- CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse(InitValue.Value.SignedInteger);
+ CbInfo->Details.HandlerArg.IntegerCalibrator.Reverse(InitValue.Value.SignedInteger);
}
}
break;
@@ -2450,18 +2499,21 @@ int32_t EdsLib_NativeObject_PostProc_Callback(
/* If PackedPtr is supplied, will verify value in existing field */
if (Base->CheckFields & EDSLIB_DATATYPEDB_RECOMPUTE_ERRORCONTROL)
{
- ExpectedValue.Value.UnsignedInteger = EdsLib_ErrorControlCompute(
- CbInfo->Details.HandlerArg.ErrorControl, Base->Unpack.PackedSrcPtr,
- Base->Unpack.Common.MaxSize.Bits, BitPosition);
+ ExpectedValue.Value.UnsignedInteger =
+ EdsLib_ErrorControlCompute(CbInfo->Details.HandlerArg.ErrorControl,
+ Base->Unpack.PackedSrcPtr,
+ Base->Unpack.Common.MaxSize.Bits,
+ BitPosition);
ExpectedValue.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
if (Base->RecomputeFields & EDSLIB_DATATYPEDB_RECOMPUTE_ERRORCONTROL)
{
- InitValue.Value.UnsignedInteger = EdsLib_ErrorControlCompute(
- CbInfo->Details.HandlerArg.ErrorControl, Base->Unpack.NativeDstPtr,
- EdsLib_OCTETS_TO_BITS(Base->Unpack.Common.MaxSize.Bytes),
- EdsLib_OCTETS_TO_BITS(CbInfo->StartOffset.Bytes));
+ InitValue.Value.UnsignedInteger =
+ EdsLib_ErrorControlCompute(CbInfo->Details.HandlerArg.ErrorControl,
+ Base->Unpack.NativeDstPtr,
+ EdsLib_OCTETS_TO_BITS(Base->Unpack.Common.MaxSize.Bytes),
+ EdsLib_OCTETS_TO_BITS(CbInfo->StartOffset.Bytes));
InitValue.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
break;
@@ -2488,7 +2540,6 @@ int32_t EdsLib_NativeObject_PostProc_Callback(
break;
}
-
if (ExpectedValue.ValueType != EDSLIB_BASICTYPE_NONE)
{
TempSrc.Ptr = Base->Unpack.NativeDstPtr + CbInfo->StartOffset.Bytes;
@@ -2499,25 +2550,28 @@ int32_t EdsLib_NativeObject_PostProc_Callback(
{
CompareResult = false;
}
- else switch(ExpectedValue.ValueType)
- {
- case EDSLIB_BASICTYPE_SIGNED_INT:
- CompareResult = (ActualValue.Value.SignedInteger == ExpectedValue.Value.SignedInteger);
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- CompareResult = (ActualValue.Value.UnsignedInteger == ExpectedValue.Value.UnsignedInteger);
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- CompareResult = (ActualValue.Value.FloatingPoint == ExpectedValue.Value.FloatingPoint);
- break;
- case EDSLIB_BASICTYPE_BINARY:
- CompareResult = memcmp(ActualValue.Value.BinaryData,
- ExpectedValue.Value.BinaryData, CbInfo->DataDictPtr->SizeInfo.Bytes) == 0;
- break;
- default:
- CompareResult = false;
- break;
- }
+ else
+ switch (ExpectedValue.ValueType)
+ {
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ CompareResult = (ActualValue.Value.SignedInteger == ExpectedValue.Value.SignedInteger);
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ CompareResult = (ActualValue.Value.UnsignedInteger == ExpectedValue.Value.UnsignedInteger);
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ CompareResult = (ActualValue.Value.FloatingPoint == ExpectedValue.Value.FloatingPoint);
+ break;
+ case EDSLIB_BASICTYPE_BINARY:
+ CompareResult = memcmp(ActualValue.Value.BinaryData,
+ ExpectedValue.Value.BinaryData,
+ CbInfo->DataDictPtr->SizeInfo.Bytes)
+ == 0;
+ break;
+ default:
+ CompareResult = false;
+ break;
+ }
if (!CompareResult)
{
diff --git a/edslib/fsw/src/edslib_displaydb_api.c b/edslib/fsw/src/edslib_displaydb_api.c
index 6f855c6..8c8ead9 100644
--- a/edslib/fsw/src/edslib_displaydb_api.c
+++ b/edslib/fsw/src/edslib_displaydb_api.c
@@ -19,7 +19,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb_api.c
* \ingroup fsw
@@ -73,7 +72,7 @@ void EdsLib_DisplayDB_Initialize(void)
const char *EdsLib_DisplayDB_GetEdsName(const EdsLib_DatabaseObject_t *GD, uint16_t AppId)
{
EdsLib_DisplayDB_t DisplayDBPtr;
- const char *Result;
+ const char *Result;
DisplayDBPtr = EdsLib_DisplayDB_GetTopLevel(GD, AppId);
if (DisplayDBPtr != NULL)
@@ -103,8 +102,8 @@ const char *EdsLib_DisplayDB_GetEdsName(const EdsLib_DatabaseObject_t *GD, uint1
const char *EdsLib_DisplayDB_GetBaseName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId)
{
const EdsLib_DisplayDB_Entry_t *DispInfo;
- EdsLib_DatabaseRef_t TempRef;
- const char *Result;
+ EdsLib_DatabaseRef_t TempRef;
+ const char *Result;
EdsLib_Decode_StructId(&TempRef, EdsId);
DispInfo = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
@@ -133,12 +132,13 @@ const char *EdsLib_DisplayDB_GetBaseName(const EdsLib_DatabaseObject_t *GD, EdsL
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *Buffer, uint32_t BufferSize)
+const char *
+EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *Buffer, uint32_t BufferSize)
{
const EdsLib_DisplayDB_Entry_t *DispInfo;
- EdsLib_DatabaseRef_t TempRef;
- const char *Result;
- const char *Namespace;
+ EdsLib_DatabaseRef_t TempRef;
+ const char *Result;
+ const char *Namespace;
/* Should not return NULL, which allows safe use in printf() statements */
if (Buffer == NULL || BufferSize == 0)
@@ -147,7 +147,7 @@ const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsL
}
EdsLib_Decode_StructId(&TempRef, EdsId);
- DispInfo = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
+ DispInfo = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
Buffer[0] = 0;
if (DispInfo != NULL)
@@ -156,11 +156,11 @@ const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsL
if (Namespace != NULL && DispInfo->Name != NULL)
{
- snprintf(Buffer,BufferSize,"%s/%s", Namespace, DispInfo->Name);
+ snprintf(Buffer, BufferSize, "%s/%s", Namespace, DispInfo->Name);
}
else if (DispInfo->Name != NULL)
{
- snprintf(Buffer,BufferSize,"%s", DispInfo->Name);
+ snprintf(Buffer, BufferSize, "%s", DispInfo->Name);
}
}
@@ -185,7 +185,7 @@ const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsL
const char *EdsLib_DisplayDB_GetNamespace(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId)
{
EdsLib_DatabaseRef_t TempRef;
- const char *Result;
+ const char *Result;
EdsLib_Decode_StructId(&TempRef, EdsId);
@@ -211,8 +211,8 @@ const char *EdsLib_DisplayDB_GetNamespace(const EdsLib_DatabaseObject_t *GD, Eds
EdsLib_DisplayHint_t EdsLib_DisplayDB_GetDisplayHint(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId)
{
const EdsLib_DisplayDB_Entry_t *DisplayInf;
- EdsLib_DatabaseRef_t TempRef;
- EdsLib_DisplayHint_t HintType;
+ EdsLib_DatabaseRef_t TempRef;
+ EdsLib_DisplayHint_t HintType;
EdsLib_Decode_StructId(&TempRef, EdsId);
DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
@@ -238,12 +238,15 @@ EdsLib_DisplayHint_t EdsLib_DisplayDB_GetDisplayHint(const EdsLib_DatabaseObject
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *Name, uint16_t *SubIndex)
+int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *Name,
+ uint16_t *SubIndex)
{
- const EdsLib_DisplayDB_Entry_t *DisplayInf;
+ const EdsLib_DisplayDB_Entry_t *DisplayInf;
const EdsLib_DataTypeDB_Entry_t *DataTypeInf;
- EdsLib_DatabaseRef_t TempRef;
- int32_t Status;
+ EdsLib_DatabaseRef_t TempRef;
+ int32_t Status;
EdsLib_Decode_StructId(&TempRef, EdsId);
DataTypeInf = EdsLib_DataTypeDB_GetEntry(GD, &TempRef);
@@ -271,41 +274,43 @@ int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD, EdsLi
else
{
Status = EDSLIB_NAME_NOT_FOUND;
- switch(DisplayInf->DisplayHint)
- {
- case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
+ switch (DisplayInf->DisplayHint)
{
- const EdsLib_SymbolTableEntry_t *EnumSym =
- EdsLib_DisplaySymbolLookup_GetByName(DisplayInf->DisplayArg.SymTable,
- DisplayInf->DisplayArgTableSize, Name, strlen(Name));
- if (EnumSym != NULL)
+ case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
{
- *SubIndex = EnumSym->SymValue;
- Status = EDSLIB_SUCCESS;
+ const EdsLib_SymbolTableEntry_t *EnumSym =
+ EdsLib_DisplaySymbolLookup_GetByName(DisplayInf->DisplayArg.SymTable,
+ DisplayInf->DisplayArgTableSize,
+ Name,
+ strlen(Name));
+ if (EnumSym != NULL)
+ {
+ *SubIndex = EnumSym->SymValue;
+ Status = EDSLIB_SUCCESS;
+ }
+ break;
}
- break;
- }
- case EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE:
- {
- const char * const *NameTable = DisplayInf->DisplayArg.NameTable;
- uint16_t Idx;
- for (Idx = 0; Idx < DisplayInf->DisplayArgTableSize; ++Idx)
+ case EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE:
{
- if (*NameTable != NULL)
+ const char *const *NameTable = DisplayInf->DisplayArg.NameTable;
+ uint16_t Idx;
+ for (Idx = 0; Idx < DisplayInf->DisplayArgTableSize; ++Idx)
{
- if(strcmp(*NameTable, Name) == 0)
+ if (*NameTable != NULL)
{
- *SubIndex = Idx;
- Status = EDSLIB_SUCCESS;
- break;
+ if (strcmp(*NameTable, Name) == 0)
+ {
+ *SubIndex = Idx;
+ Status = EDSLIB_SUCCESS;
+ break;
+ }
}
+ ++NameTable;
}
- ++NameTable;
+ break;
}
- break;
- }
- default:
- break;
+ default:
+ break;
}
}
}
@@ -321,10 +326,10 @@ int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD, EdsLi
*-----------------------------------------------------------------*/
const char *EdsLib_DisplayDB_GetNameByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t SubIndex)
{
- const EdsLib_DisplayDB_Entry_t *DisplayInf;
+ const EdsLib_DisplayDB_Entry_t *DisplayInf;
const EdsLib_DataTypeDB_Entry_t *DataTypeInf;
- EdsLib_DatabaseRef_t TempRef;
- const char *result;
+ EdsLib_DatabaseRef_t TempRef;
+ const char *result;
result = NULL;
EdsLib_Decode_StructId(&TempRef, EdsId);
@@ -340,30 +345,31 @@ const char *EdsLib_DisplayDB_GetNameByIndex(const EdsLib_DatabaseObject_t *GD, E
if (DisplayInf != NULL)
{
- switch(DisplayInf->DisplayHint)
+ switch (DisplayInf->DisplayHint)
{
- case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
- {
- const EdsLib_SymbolTableEntry_t *EnumSym =
- EdsLib_DisplaySymbolLookup_GetByValue(DisplayInf->DisplayArg.SymTable,
- DisplayInf->DisplayArgTableSize, SubIndex);
- if (EnumSym != NULL)
+ case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
{
- result = EnumSym->SymName;
+ const EdsLib_SymbolTableEntry_t *EnumSym =
+ EdsLib_DisplaySymbolLookup_GetByValue(DisplayInf->DisplayArg.SymTable,
+ DisplayInf->DisplayArgTableSize,
+ SubIndex);
+ if (EnumSym != NULL)
+ {
+ result = EnumSym->SymName;
+ }
+ break;
}
- break;
- }
- case EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE:
- {
- /* direct lookup */
- if (SubIndex < DisplayInf->DisplayArgTableSize)
+ case EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE:
{
- result = DisplayInf->DisplayArg.NameTable[SubIndex];
+ /* direct lookup */
+ if (SubIndex < DisplayInf->DisplayArgTableSize)
+ {
+ result = DisplayInf->DisplayArg.NameTable[SubIndex];
+ }
+ break;
}
- break;
- }
- default:
- break;
+ default:
+ break;
}
}
}
@@ -377,23 +383,26 @@ const char *EdsLib_DisplayDB_GetNameByIndex(const EdsLib_DatabaseObject_t *GD, E
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_EntityCallback_t Callback, void *Arg)
+void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_EntityCallback_t Callback,
+ void *Arg)
{
- EdsLib_DisplayUserIterator_FullName_StackEntry_t NameStack[EDSLIB_ITERATOR_MAX_DEEP_DEPTH];
+ EdsLib_DisplayUserIterator_FullName_StackEntry_t NameStack[EDSLIB_ITERATOR_MAX_DEEP_DEPTH];
EdsLib_DisplayUserIterator_FullName_ControlBlock_t CtrlBlock;
EDSLIB_DECLARE_DISPLAY_ITERATOR_CB(IteratorState,
- EDSLIB_ITERATOR_MAX_DEEP_DEPTH,
- EdsLib_DisplayUserIterator_FullName_Callback,
- &CtrlBlock);
+ EDSLIB_ITERATOR_MAX_DEEP_DEPTH,
+ EdsLib_DisplayUserIterator_FullName_Callback,
+ &CtrlBlock);
EDSLIB_RESET_DISPLAY_ITERATOR_FROM_EDSID(IteratorState, EdsId);
memset(&CtrlBlock, 0, sizeof(CtrlBlock));
- CtrlBlock.NextEntry = NameStack;
+ CtrlBlock.NextEntry = NameStack;
CtrlBlock.ScratchNameBuffer[0] = 0;
- CtrlBlock.Base.UserCallback = Callback;
- CtrlBlock.Base.UserArg = Arg;
+ CtrlBlock.Base.UserCallback = Callback;
+ CtrlBlock.Base.UserArg = Arg;
EdsLib_DataTypeIterator_Impl(GD, &IteratorState.BaseIter.Cb);
}
@@ -404,20 +413,23 @@ void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD, EdsL
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_EntityCallback_t Callback, void *Arg)
+void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_EntityCallback_t Callback,
+ void *Arg)
{
EdsLib_DisplayUserIterator_BaseName_ControlBlock_t CtrlBlock;
EDSLIB_DECLARE_DISPLAY_ITERATOR_CB(IteratorState,
- EDSLIB_ITERATOR_MAX_BASETYPE_DEPTH,
- EdsLib_DisplayUserIterator_BaseName_Callback,
- &CtrlBlock);
+ EDSLIB_ITERATOR_MAX_BASETYPE_DEPTH,
+ EdsLib_DisplayUserIterator_BaseName_Callback,
+ &CtrlBlock);
EDSLIB_RESET_DISPLAY_ITERATOR_FROM_EDSID(IteratorState, EdsId);
memset(&CtrlBlock, 0, sizeof(CtrlBlock));
CtrlBlock.UserCallback = Callback;
- CtrlBlock.UserArg = Arg;
+ CtrlBlock.UserArg = Arg;
EdsLib_DataTypeIterator_Impl(GD, &IteratorState.BaseIter.Cb);
}
@@ -427,23 +439,26 @@ void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD, Eds
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *Name, EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
+int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *Name,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
{
EdsLib_DisplayLocateMember_ControlBlock_t CtrlBlock;
- const char *CurrTokenPos;
- int32_t Status;
+ const char *CurrTokenPos;
+ int32_t Status;
memset(CompInfo, 0, sizeof(*CompInfo));
memset(&CtrlBlock, 0, sizeof(CtrlBlock));
EdsLib_Decode_StructId(&CtrlBlock.RefObj, EdsId);
CurrTokenPos = Name;
- Status = EDSLIB_FAILURE;
+ Status = EDSLIB_FAILURE;
while (1)
{
- CtrlBlock.ContentPos = CurrTokenPos;
- CtrlBlock.NextTokenPos = NULL;
- CtrlBlock.MatchQuality = EDSLIB_MATCHQUALITY_NONE;
+ CtrlBlock.ContentPos = CurrTokenPos;
+ CtrlBlock.NextTokenPos = NULL;
+ CtrlBlock.MatchQuality = EDSLIB_MATCHQUALITY_NONE;
CtrlBlock.ContentLength = 0;
EdsLib_DisplayLocateMember_Impl(GD, &CtrlBlock);
@@ -461,10 +476,10 @@ int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD, EdsL
if (*CurrTokenPos == 0)
{
- Status = EDSLIB_SUCCESS;
- CompInfo->Offset = CtrlBlock.StartOffset;
+ Status = EDSLIB_SUCCESS;
+ CompInfo->Offset = CtrlBlock.StartOffset;
CompInfo->MaxSize = CtrlBlock.MaxSize;
- CompInfo->EdsId = EdsLib_Encode_StructId(&CtrlBlock.RefObj);
+ CompInfo->EdsId = EdsLib_Encode_StructId(&CtrlBlock.RefObj);
break;
}
}
@@ -480,40 +495,40 @@ int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD, EdsL
*-----------------------------------------------------------------*/
void EdsLib_Generate_Hexdump(void *output, const uint8_t *DataPtr, uint16_t DisplayOffset, uint16_t Count)
{
- uint16_t i;
- char display[20];
- FILE *fp = output;
-
- fprintf(fp, "Data Segment Length=%u:",Count);
- memset(display,0,sizeof(display));
- for (i = 0; i < Count; ++i)
- {
- if ((i & 0x0F) == 0)
- {
- fprintf(fp, " %s\n %03x:",display,DisplayOffset);
- memset(display,0,sizeof(display));
- }
- fprintf(fp, " %02x",*DataPtr);
- if (isprint(*DataPtr))
- {
- display[i & 0x0F] = *DataPtr;
- }
- else
- {
- display[i & 0x0F] = '.';
- }
- ++DataPtr;
- ++DisplayOffset;
- }
- if (i > 0)
- {
- while (i & 0xF)
- {
- fprintf(fp, " ");
- ++i;
- }
- }
- fprintf(fp, " %s\n", display);
+ uint16_t i;
+ char display[20];
+ FILE *fp = output;
+
+ fprintf(fp, "Data Segment Length=%u:", Count);
+ memset(display, 0, sizeof(display));
+ for (i = 0; i < Count; ++i)
+ {
+ if ((i & 0x0F) == 0)
+ {
+ fprintf(fp, " %s\n %03x:", display, DisplayOffset);
+ memset(display, 0, sizeof(display));
+ }
+ fprintf(fp, " %02x", *DataPtr);
+ if (isprint(*DataPtr))
+ {
+ display[i & 0x0F] = *DataPtr;
+ }
+ else
+ {
+ display[i & 0x0F] = '.';
+ }
+ ++DataPtr;
+ ++DisplayOffset;
+ }
+ if (i > 0)
+ {
+ while (i & 0xF)
+ {
+ fprintf(fp, " ");
+ ++i;
+ }
+ }
+ fprintf(fp, " %s\n", display);
}
/*----------------------------------------------------------------
@@ -522,14 +537,21 @@ void EdsLib_Generate_Hexdump(void *output, const uint8_t *DataPtr, uint16_t Disp
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *OutputBuffer, uint32_t BufferSize, const void *SrcPtr)
+int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ char *OutputBuffer,
+ uint32_t BufferSize,
+ const void *SrcPtr)
{
EdsLib_DatabaseRef_t TempRef;
EdsLib_Decode_StructId(&TempRef, EdsId);
- return EdsLib_DisplayScalarConv_ToString_Impl(EdsLib_DataTypeDB_GetEntry(GD, &TempRef), EdsLib_DisplayDB_GetEntry(GD, &TempRef),
- OutputBuffer, BufferSize, SrcPtr);
+ return EdsLib_DisplayScalarConv_ToString_Impl(EdsLib_DataTypeDB_GetEntry(GD, &TempRef),
+ EdsLib_DisplayDB_GetEntry(GD, &TempRef),
+ OutputBuffer,
+ BufferSize,
+ SrcPtr);
}
/*----------------------------------------------------------------
@@ -538,14 +560,17 @@ int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t Ed
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr, const char *SrcString)
+int32_t
+EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr, const char *SrcString)
{
EdsLib_DatabaseRef_t TempRef;
EdsLib_Decode_StructId(&TempRef, EdsId);
- return EdsLib_DisplayScalarConv_FromString_Impl(EdsLib_DataTypeDB_GetEntry(GD, &TempRef), EdsLib_DisplayDB_GetEntry(GD, &TempRef),
- DestPtr, SrcString);
+ return EdsLib_DisplayScalarConv_FromString_Impl(EdsLib_DataTypeDB_GetEntry(GD, &TempRef),
+ EdsLib_DisplayDB_GetEntry(GD, &TempRef),
+ DestPtr,
+ SrcString);
}
/*----------------------------------------------------------------
@@ -554,28 +579,32 @@ int32_t EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const EdsLib_GenericValueBuffer_t *ValueBuffer)
+const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const EdsLib_GenericValueBuffer_t *ValueBuffer)
{
- EdsLib_DatabaseRef_t TempRef;
- const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
+ EdsLib_DatabaseRef_t TempRef;
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
const EdsLib_SymbolTableEntry_t *TableEnt;
TableEnt = NULL;
EdsLib_Decode_StructId(&TempRef, EdsId);
DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
- if (ValueBuffer != NULL && DisplayInfoPtr != NULL &&
- DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
+ if (ValueBuffer != NULL && DisplayInfoPtr != NULL
+ && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
{
if (ValueBuffer->ValueType == EDSLIB_BASICTYPE_SIGNED_INT)
{
TableEnt = EdsLib_DisplaySymbolLookup_GetByValue(DisplayInfoPtr->DisplayArg.SymTable,
- DisplayInfoPtr->DisplayArgTableSize, ValueBuffer->Value.SignedInteger);
+ DisplayInfoPtr->DisplayArgTableSize,
+ ValueBuffer->Value.SignedInteger);
}
else if (ValueBuffer->ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
{
TableEnt = EdsLib_DisplaySymbolLookup_GetByValue(DisplayInfoPtr->DisplayArg.SymTable,
- DisplayInfoPtr->DisplayArgTableSize, ValueBuffer->Value.UnsignedInteger);
+ DisplayInfoPtr->DisplayArgTableSize,
+ ValueBuffer->Value.UnsignedInteger);
}
}
@@ -593,37 +622,41 @@ const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD, Eds
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *String, EdsLib_GenericValueBuffer_t *ValueBuffer)
+void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *String,
+ EdsLib_GenericValueBuffer_t *ValueBuffer)
{
- EdsLib_DatabaseRef_t TempRef;
- const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
+ EdsLib_DatabaseRef_t TempRef;
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
const EdsLib_SymbolTableEntry_t *Symbol;
EdsLib_Decode_StructId(&TempRef, EdsId);
- Symbol = NULL;
+ Symbol = NULL;
DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
if (DisplayInfoPtr != NULL && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
{
Symbol = EdsLib_DisplaySymbolLookup_GetByName(DisplayInfoPtr->DisplayArg.SymTable,
- DisplayInfoPtr->DisplayArgTableSize, String, strlen(String));
+ DisplayInfoPtr->DisplayArgTableSize,
+ String,
+ strlen(String));
}
else
{
Symbol = NULL;
}
-
if (ValueBuffer != NULL)
{
if (Symbol == NULL)
{
- ValueBuffer->ValueType = EDSLIB_BASICTYPE_NONE;
+ ValueBuffer->ValueType = EDSLIB_BASICTYPE_NONE;
ValueBuffer->Value.SignedInteger = 0;
}
else
{
- ValueBuffer->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ValueBuffer->ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
ValueBuffer->Value.SignedInteger = Symbol->SymValue;
}
}
@@ -635,28 +668,31 @@ void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, EdsLib_SymbolCallback_t Callback, void *Arg)
+void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_SymbolCallback_t Callback,
+ void *Arg)
{
- EdsLib_DatabaseRef_t TempRef;
- const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
+ EdsLib_DatabaseRef_t TempRef;
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
const EdsLib_SymbolTableEntry_t *Symbol;
- uint16_t SymbolCount;
+ uint16_t SymbolCount;
EdsLib_Decode_StructId(&TempRef, EdsId);
DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
if (DisplayInfoPtr != NULL && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
{
- Symbol = DisplayInfoPtr->DisplayArg.SymTable;
+ Symbol = DisplayInfoPtr->DisplayArg.SymTable;
SymbolCount = DisplayInfoPtr->DisplayArgTableSize;
}
else
{
- Symbol = NULL;
+ Symbol = NULL;
SymbolCount = 0;
}
- while(Symbol != NULL && SymbolCount > 0)
+ while (Symbol != NULL && SymbolCount > 0)
{
Callback(Arg, Symbol->SymName, Symbol->SymValue);
++Symbol;
@@ -670,40 +706,44 @@ void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD, EdsLi
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const char * EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t Index, char *Buffer, uint32_t BufferSize)
+const char *EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t Index,
+ char *Buffer,
+ uint32_t BufferSize)
{
- EdsLib_DatabaseRef_t TempRef;
- const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
- const EdsLib_SymbolTableEntry_t *Symbol;
- uint16_t SymbolCount;
- const char * Result;
-
- EdsLib_Decode_StructId(&TempRef, EdsId);
- DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
-
- if (DisplayInfoPtr != NULL && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
- {
- Symbol = DisplayInfoPtr->DisplayArg.SymTable;
- SymbolCount = DisplayInfoPtr->DisplayArgTableSize;
- }
+ EdsLib_DatabaseRef_t TempRef;
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
+ const EdsLib_SymbolTableEntry_t *Symbol;
+ uint16_t SymbolCount;
+ const char *Result;
+
+ EdsLib_Decode_StructId(&TempRef, EdsId);
+ DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
+
+ if (DisplayInfoPtr != NULL && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
+ {
+ Symbol = DisplayInfoPtr->DisplayArg.SymTable;
+ SymbolCount = DisplayInfoPtr->DisplayArgTableSize;
+ }
else
{
- Symbol = NULL;
+ Symbol = NULL;
SymbolCount = 0;
}
- if (Symbol != NULL && Index < SymbolCount)
- {
- Symbol = Symbol + Index;
- snprintf(Buffer, BufferSize,"%s", Symbol->SymName);
+ if (Symbol != NULL && Index < SymbolCount)
+ {
+ Symbol = Symbol + Index;
+ snprintf(Buffer, BufferSize, "%s", Symbol->SymName);
Result = Buffer;
- }
- else
- {
- Result = UNDEF_STRING;
- }
+ }
+ else
+ {
+ Result = UNDEF_STRING;
+ }
- return Result;
+ return Result;
}
/*----------------------------------------------------------------
@@ -714,37 +754,37 @@ const char * EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t
*-----------------------------------------------------------------*/
intmax_t EdsLib_DisplayDB_GetEnumValueByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t Index)
{
- EdsLib_DatabaseRef_t TempRef;
- const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
- const EdsLib_SymbolTableEntry_t *Symbol;
- uint16_t SymbolCount;
- intmax_t Result;
-
- EdsLib_Decode_StructId(&TempRef, EdsId);
- DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
-
- if (DisplayInfoPtr != NULL && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
- {
- Symbol = DisplayInfoPtr->DisplayArg.SymTable;
- SymbolCount = DisplayInfoPtr->DisplayArgTableSize;
- }
+ EdsLib_DatabaseRef_t TempRef;
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr;
+ const EdsLib_SymbolTableEntry_t *Symbol;
+ uint16_t SymbolCount;
+ intmax_t Result;
+
+ EdsLib_Decode_StructId(&TempRef, EdsId);
+ DisplayInfoPtr = EdsLib_DisplayDB_GetEntry(GD, &TempRef);
+
+ if (DisplayInfoPtr != NULL && DisplayInfoPtr->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
+ {
+ Symbol = DisplayInfoPtr->DisplayArg.SymTable;
+ SymbolCount = DisplayInfoPtr->DisplayArgTableSize;
+ }
else
{
- Symbol = NULL;
+ Symbol = NULL;
SymbolCount = 0;
}
- if (Symbol != NULL && Index < SymbolCount)
- {
- Symbol = Symbol + Index;
- Result = Symbol->SymValue;
- }
- else
- {
- Result = (intmax_t) EDSLIB_FAILURE;
- }
+ if (Symbol != NULL && Index < SymbolCount)
+ {
+ Symbol = Symbol + Index;
+ Result = Symbol->SymValue;
+ }
+ else
+ {
+ Result = (intmax_t)EDSLIB_FAILURE;
+ }
- return Result;
+ return Result;
}
/*----------------------------------------------------------------
@@ -755,16 +795,16 @@ intmax_t EdsLib_DisplayDB_GetEnumValueByIndex(const EdsLib_DatabaseObject_t *GD,
*-----------------------------------------------------------------*/
EdsLib_Id_t EdsLib_DisplayDB_LookupTypeName(const EdsLib_DatabaseObject_t *GD, const char *String)
{
- EdsLib_DisplayDB_t NameDict;
- EdsLib_DataTypeDB_t DataDict;
+ EdsLib_DisplayDB_t NameDict;
+ EdsLib_DataTypeDB_t DataDict;
const EdsLib_DisplayDB_Entry_t *DisplayInfo;
- const char *EndPtr;
- size_t PartLength;
- uint16_t InstanceNum;
- uint16_t AppIdx;
- uint16_t StructId;
- EdsLib_Id_t Result;
- const char *Namespace;
+ const char *EndPtr;
+ size_t PartLength;
+ uint16_t InstanceNum;
+ uint16_t AppIdx;
+ uint16_t StructId;
+ EdsLib_Id_t Result;
+ const char *Namespace;
/*
* A global structure ID is different than a message ID in two ways:
@@ -772,8 +812,8 @@ EdsLib_Id_t EdsLib_DisplayDB_LookupTypeName(const EdsLib_DatabaseObject_t *GD, c
* - the format index goes directly into the map table
*/
- Result = EDSLIB_ID_INVALID;
- NameDict = NULL;
+ Result = EDSLIB_ID_INVALID;
+ NameDict = NULL;
InstanceNum = 0;
if (GD->DisplayDB_Table != NULL && GD->DataTypeDB_Table != NULL)
@@ -789,8 +829,7 @@ EdsLib_Id_t EdsLib_DisplayDB_LookupTypeName(const EdsLib_DatabaseObject_t *GD, c
{
DataDict = GD->DataTypeDB_Table[AppIdx];
NameDict = GD->DisplayDB_Table[AppIdx];
- if (NameDict == NULL || DataDict == NULL ||
- NameDict->DisplayInfoTable == NULL)
+ if (NameDict == NULL || DataDict == NULL || NameDict->DisplayInfoTable == NULL)
{
continue;
}
@@ -804,15 +843,13 @@ EdsLib_Id_t EdsLib_DisplayDB_LookupTypeName(const EdsLib_DatabaseObject_t *GD, c
if (Namespace != NULL)
{
PartLength = strlen(Namespace);
- if (strncmp(Namespace, String, PartLength) != 0 ||
- String[PartLength] != '/')
+ if (strncmp(Namespace, String, PartLength) != 0 || String[PartLength] != '/')
{
continue;
}
EndPtr += PartLength + 1;
}
- if (DisplayInfo->Name != NULL &&
- strcmp(DisplayInfo->Name,EndPtr) == 0)
+ if (DisplayInfo->Name != NULL && strcmp(DisplayInfo->Name, EndPtr) == 0)
{
/* Initialize the Global ID with the result */
Result = EDSLIB_MAKE_ID(AppIdx, StructId);
diff --git a/edslib/fsw/src/edslib_displaydb_base64.c b/edslib/fsw/src/edslib_displaydb_base64.c
index 6271749..fea49ed 100644
--- a/edslib/fsw/src/edslib_displaydb_base64.c
+++ b/edslib/fsw/src/edslib_displaydb_base64.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb_base64.c
* \ingroup fsw
@@ -34,37 +33,26 @@
#include "edslib_internal.h"
-static const char EdsLib_BASE64_CHARSET[64] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
+static const char EdsLib_BASE64_CHARSET[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
/*
* Note the reverse lookup must be nonzero for any valid base64 char. The top
* bit is used to accomplish this since only the lower 6 are used for decode.
* This is how the code determines whether a byte is within the charset or not.
*/
-static const uint8_t EdsLib_BASE64_REVERSE[128] =
-{
- ['A'] = 0x80,['B'] = 0x81,['C'] = 0x82,['D'] = 0x83,
- ['E'] = 0x84,['F'] = 0x85,['G'] = 0x86,['H'] = 0x87,
- ['I'] = 0x88,['J'] = 0x89,['K'] = 0x8A,['L'] = 0x8B,
- ['M'] = 0x8C,['N'] = 0x8D,['O'] = 0x8E,['P'] = 0x8F,
- ['Q'] = 0x90,['R'] = 0x91,['S'] = 0x92,['T'] = 0x93,
- ['U'] = 0x94,['V'] = 0x95,['W'] = 0x96,['X'] = 0x97,
- ['Y'] = 0x98,['Z'] = 0x99,['a'] = 0x9A,['b'] = 0x9B,
- ['c'] = 0x9C,['d'] = 0x9D,['e'] = 0x9E,['f'] = 0x9F,
- ['g'] = 0xA0,['h'] = 0xA1,['i'] = 0xA2,['j'] = 0xA3,
- ['k'] = 0xA4,['l'] = 0xA5,['m'] = 0xA6,['n'] = 0xA7,
- ['o'] = 0xA8,['p'] = 0xA9,['q'] = 0xAA,['r'] = 0xAB,
- ['s'] = 0xAC,['t'] = 0xAD,['u'] = 0xAE,['v'] = 0xAF,
- ['w'] = 0xB0,['x'] = 0xB1,['y'] = 0xB2,['z'] = 0xB3,
- ['0'] = 0xB4,['1'] = 0xB5,['2'] = 0xB6,['3'] = 0xB7,
- ['4'] = 0xB8,['5'] = 0xB9,['6'] = 0xBA,['7'] = 0xBB,
- ['8'] = 0xBC,['9'] = 0xBD,['+'] = 0xBE,['/'] = 0xBF
+static const uint8_t EdsLib_BASE64_REVERSE[128] = {
+ ['A'] = 0x80, ['B'] = 0x81, ['C'] = 0x82, ['D'] = 0x83, ['E'] = 0x84, ['F'] = 0x85, ['G'] = 0x86, ['H'] = 0x87,
+ ['I'] = 0x88, ['J'] = 0x89, ['K'] = 0x8A, ['L'] = 0x8B, ['M'] = 0x8C, ['N'] = 0x8D, ['O'] = 0x8E, ['P'] = 0x8F,
+ ['Q'] = 0x90, ['R'] = 0x91, ['S'] = 0x92, ['T'] = 0x93, ['U'] = 0x94, ['V'] = 0x95, ['W'] = 0x96, ['X'] = 0x97,
+ ['Y'] = 0x98, ['Z'] = 0x99, ['a'] = 0x9A, ['b'] = 0x9B, ['c'] = 0x9C, ['d'] = 0x9D, ['e'] = 0x9E, ['f'] = 0x9F,
+ ['g'] = 0xA0, ['h'] = 0xA1, ['i'] = 0xA2, ['j'] = 0xA3, ['k'] = 0xA4, ['l'] = 0xA5, ['m'] = 0xA6, ['n'] = 0xA7,
+ ['o'] = 0xA8, ['p'] = 0xA9, ['q'] = 0xAA, ['r'] = 0xAB, ['s'] = 0xAC, ['t'] = 0xAD, ['u'] = 0xAE, ['v'] = 0xAF,
+ ['w'] = 0xB0, ['x'] = 0xB1, ['y'] = 0xB2, ['z'] = 0xB3, ['0'] = 0xB4, ['1'] = 0xB5, ['2'] = 0xB6, ['3'] = 0xB7,
+ ['4'] = 0xB8, ['5'] = 0xB9, ['6'] = 0xBA, ['7'] = 0xBB, ['8'] = 0xBC, ['9'] = 0xBD, ['+'] = 0xBE, ['/'] = 0xBF
};
-
/*----------------------------------------------------------------
*
* EdsLib internal function
@@ -77,7 +65,7 @@ void EdsLib_DisplayDB_Base64Encode(char *Out, uint32_t OutputLenBytes, const uin
uint32_t NumBits;
uint32_t OutputPos;
uint32_t TailPos;
- uint8_t OutCh;
+ uint8_t OutCh;
/*
* Note - this currently does an unpadded base64 conversion i.e.
@@ -85,37 +73,37 @@ void EdsLib_DisplayDB_Base64Encode(char *Out, uint32_t OutputLenBytes, const uin
* of 3. These are really not necessary unless concatenating data.
*/
OutputPos = 1;
- TailPos = 0;
- ShiftReg = 0;
- NumBits = 0;
- while(InputLenBits > 0)
+ TailPos = 0;
+ ShiftReg = 0;
+ NumBits = 0;
+ while (InputLenBits > 0)
{
/* note at the start of this loop NumBits is always < 6,
* so it is guaranteed there is enough space to read at least 8 bits */
ShiftReg <<= 8;
- ShiftReg |= (*In);
+ ShiftReg |= (*In);
++In;
if (InputLenBits >= 8)
{
/* all 8 bits are valid */
- NumBits += 8;
+ NumBits += 8;
InputLenBits -= 8;
}
else
{
/* shift out bits that are not valid */
- NumBits += InputLenBits;
+ NumBits += InputLenBits;
ShiftReg >>= (8 - InputLenBits);
/* pad with zero bits to make a multiple of 6 */
InputLenBits = NumBits % 6;
if (InputLenBits != 0)
{
- InputLenBits = 6 - InputLenBits;
- ShiftReg <<= InputLenBits;
- NumBits += InputLenBits;
- InputLenBits = 0;
+ InputLenBits = 6 - InputLenBits;
+ ShiftReg <<= InputLenBits;
+ NumBits += InputLenBits;
+ InputLenBits = 0;
}
}
@@ -142,8 +130,8 @@ void EdsLib_DisplayDB_Base64Encode(char *Out, uint32_t OutputLenBytes, const uin
* so no need to include trailing zeros in the base64 data */
if (TailPos < OutputLenBytes)
{
- Out -= OutputPos - TailPos - 1;
- *Out = 0;
+ Out -= OutputPos - TailPos - 1;
+ *Out = 0;
}
}
@@ -158,15 +146,15 @@ void EdsLib_DisplayDB_Base64Decode(uint8_t *Out, uint32_t OutputLenBits, const c
uint32_t ActualLen;
uint32_t ShiftReg;
uint32_t NumBits;
- uint8_t Ch;
+ uint8_t Ch;
/* the native buffer is always a multiple of 8 bits,
* even if the packed EDS size is not */
ActualLen = EdsLib_BITS_TO_OCTETS(OutputLenBits);
- ShiftReg = 0;
- NumBits = 0;
+ ShiftReg = 0;
+ NumBits = 0;
- while(ActualLen > 0)
+ while (ActualLen > 0)
{
/* note at the start of this loop NumBits is always < 8,
* so it is guaranteed there is enough space to read at least 8 bits */
@@ -179,8 +167,8 @@ void EdsLib_DisplayDB_Base64Decode(uint8_t *Out, uint32_t OutputLenBits, const c
if (Ch != 0)
{
ShiftReg <<= 6;
- ShiftReg |= Ch & 0x3F;
- NumBits += 6;
+ ShiftReg |= Ch & 0x3F;
+ NumBits += 6;
}
++In;
}
@@ -188,14 +176,13 @@ void EdsLib_DisplayDB_Base64Decode(uint8_t *Out, uint32_t OutputLenBits, const c
{
/* generate zero padding to fill the entire space */
ShiftReg <<= 8;
- NumBits += 8;
+ NumBits += 8;
}
-
if (NumBits >= 8)
{
NumBits -= 8;
- *Out = (ShiftReg >> NumBits) & 0xFF;
+ *Out = (ShiftReg >> NumBits) & 0xFF;
--ActualLen;
++Out;
}
diff --git a/edslib/fsw/src/edslib_displaydb_iterator.c b/edslib/fsw/src/edslib_displaydb_iterator.c
index d58fd2e..9badf2b 100644
--- a/edslib/fsw/src/edslib_displaydb_iterator.c
+++ b/edslib/fsw/src/edslib_displaydb_iterator.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb_iterator.c
* \ingroup fsw
@@ -47,93 +46,94 @@
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-EdsLib_Iterator_Rc_t EdsLib_DisplayIterator_Wrapper(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- void *OpaqueArg)
+EdsLib_Iterator_Rc_t EdsLib_DisplayIterator_Wrapper(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ void *OpaqueArg)
{
- EdsLib_DisplayDB_InternalIterator_ControlBlock_t *Iterator = (EdsLib_DisplayDB_InternalIterator_ControlBlock_t *)OpaqueArg;
- EdsLib_DisplayIterator_StackEntry_t *TopEnt;
- const char *EntityName;
- EdsLib_Iterator_Rc_t RetCode;
+ EdsLib_DisplayDB_InternalIterator_ControlBlock_t *Iterator =
+ (EdsLib_DisplayDB_InternalIterator_ControlBlock_t *)OpaqueArg;
+ EdsLib_DisplayIterator_StackEntry_t *TopEnt;
+ const char *EntityName;
+ EdsLib_Iterator_Rc_t RetCode;
- RetCode = EDSLIB_ITERATOR_RC_DEFAULT;
- EntityName = NULL;
+ RetCode = EDSLIB_ITERATOR_RC_DEFAULT;
+ EntityName = NULL;
- switch(CbType)
- {
- case EDSLIB_ITERATOR_CBTYPE_START:
- {
- TopEnt = Iterator->NextStackEntry;
- ++Iterator->NextStackEntry;
+ switch (CbType)
+ {
+ case EDSLIB_ITERATOR_CBTYPE_START:
+ {
+ TopEnt = Iterator->NextStackEntry;
+ ++Iterator->NextStackEntry;
- /*
- * note it is possible to get a NULL display info here, as the display
- * info is loaded separately and therefore can be missing.
- */
- TopEnt->DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &EntityInfo->Details.RefObj);
- while (TopEnt->DisplayInf != NULL &&
- TopEnt->DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_REFERENCE_TYPE)
- {
- TopEnt->DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &TopEnt->DisplayInf->DisplayArg.RefObj);
- }
- break;
- }
- case EDSLIB_ITERATOR_CBTYPE_MEMBER:
- {
- TopEnt = Iterator->NextStackEntry - 1;
- if (TopEnt->DisplayInf)
- {
- if (TopEnt->DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE)
- {
- EntityName = TopEnt->DisplayInf->DisplayArg.NameTable[EntityInfo->CurrIndex];
- }
- else if (TopEnt->DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
- {
- const EdsLib_SymbolTableEntry_t *TableEnt =
- EdsLib_DisplaySymbolLookup_GetByValue(TopEnt->DisplayInf->DisplayArg.SymTable,
- TopEnt->DisplayInf->DisplayArgTableSize, EntityInfo->CurrIndex);
- if (TableEnt != NULL)
- {
- EntityName = TableEnt->SymName;
- }
- }
- }
- break;
- }
- case EDSLIB_ITERATOR_CBTYPE_END:
- {
- --Iterator->NextStackEntry;
- break;
- }
- default:
- break;
- }
+ /*
+ * note it is possible to get a NULL display info here, as the display
+ * info is loaded separately and therefore can be missing.
+ */
+ TopEnt->DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &EntityInfo->Details.RefObj);
+ while (TopEnt->DisplayInf != NULL && TopEnt->DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_REFERENCE_TYPE)
+ {
+ TopEnt->DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &TopEnt->DisplayInf->DisplayArg.RefObj);
+ }
+ break;
+ }
+ case EDSLIB_ITERATOR_CBTYPE_MEMBER:
+ {
+ TopEnt = Iterator->NextStackEntry - 1;
+ if (TopEnt->DisplayInf)
+ {
+ if (TopEnt->DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE)
+ {
+ EntityName = TopEnt->DisplayInf->DisplayArg.NameTable[EntityInfo->CurrIndex];
+ }
+ else if (TopEnt->DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
+ {
+ const EdsLib_SymbolTableEntry_t *TableEnt =
+ EdsLib_DisplaySymbolLookup_GetByValue(TopEnt->DisplayInf->DisplayArg.SymTable,
+ TopEnt->DisplayInf->DisplayArgTableSize,
+ EntityInfo->CurrIndex);
+ if (TableEnt != NULL)
+ {
+ EntityName = TableEnt->SymName;
+ }
+ }
+ }
+ break;
+ }
+ case EDSLIB_ITERATOR_CBTYPE_END:
+ {
+ --Iterator->NextStackEntry;
+ break;
+ }
+ default:
+ break;
+ }
- if (EntityInfo->Details.EntryType == EDSLIB_ENTRYTYPE_BASE_TYPE)
- {
- /*
- * This is a "hidden base type" structure.
- * This means that the members of this structure will be iterated as if
- * they are members of the parent structure, just like an inherited type
- * in the typical OO paradigm. In this case we descend _without_ giving
- * the typical user callback.
- */
- if (CbType == EDSLIB_ITERATOR_CBTYPE_MEMBER)
- {
- RetCode = EDSLIB_ITERATOR_RC_DESCEND;
- }
- else
- {
- RetCode = EDSLIB_ITERATOR_RC_CONTINUE;
- }
- }
- else
- {
- RetCode = Iterator->NextCallback(GD, CbType, EntityInfo, EntityName, Iterator->NextCallbackArg);
- }
+ if (EntityInfo->Details.EntryType == EDSLIB_ENTRYTYPE_BASE_TYPE)
+ {
+ /*
+ * This is a "hidden base type" structure.
+ * This means that the members of this structure will be iterated as if
+ * they are members of the parent structure, just like an inherited type
+ * in the typical OO paradigm. In this case we descend _without_ giving
+ * the typical user callback.
+ */
+ if (CbType == EDSLIB_ITERATOR_CBTYPE_MEMBER)
+ {
+ RetCode = EDSLIB_ITERATOR_RC_DESCEND;
+ }
+ else
+ {
+ RetCode = EDSLIB_ITERATOR_RC_CONTINUE;
+ }
+ }
+ else
+ {
+ RetCode = Iterator->NextCallback(GD, CbType, EntityInfo, EntityName, Iterator->NextCallbackArg);
+ }
- return RetCode;
+ return RetCode;
}
/*----------------------------------------------------------------
@@ -142,24 +142,25 @@ EdsLib_Iterator_Rc_t EdsLib_DisplayIterator_Wrapper(const EdsLib_DatabaseObject_
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-EdsLib_Iterator_Rc_t EdsLib_DisplayUserIterator_BaseName_Callback(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- const char *EntityName,
- void *OpaqueArg)
+EdsLib_Iterator_Rc_t
+EdsLib_DisplayUserIterator_BaseName_Callback(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ const char *EntityName,
+ void *OpaqueArg)
{
EdsLib_DisplayUserIterator_BaseName_ControlBlock_t *CtrlBlock = OpaqueArg;
- EdsLib_EntityDescriptor_t ParamBuff;
+ EdsLib_EntityDescriptor_t ParamBuff;
if (CbType == EDSLIB_ITERATOR_CBTYPE_MEMBER)
{
memset(&ParamBuff, 0, sizeof(ParamBuff));
- ParamBuff.EntityInfo.Offset = EntityInfo->StartOffset;
- ParamBuff.EntityInfo.MaxSize.Bits = EntityInfo->EndOffset.Bits - EntityInfo->StartOffset.Bits;
+ ParamBuff.EntityInfo.Offset = EntityInfo->StartOffset;
+ ParamBuff.EntityInfo.MaxSize.Bits = EntityInfo->EndOffset.Bits - EntityInfo->StartOffset.Bits;
ParamBuff.EntityInfo.MaxSize.Bytes = EntityInfo->EndOffset.Bytes - EntityInfo->StartOffset.Bytes;
- ParamBuff.EntityInfo.EdsId = EdsLib_Encode_StructId(&EntityInfo->Details.RefObj);
- ParamBuff.FullName = EntityName;
- ParamBuff.SeqNum = EntityInfo->CurrIndex;
+ ParamBuff.EntityInfo.EdsId = EdsLib_Encode_StructId(&EntityInfo->Details.RefObj);
+ ParamBuff.FullName = EntityName;
+ ParamBuff.SeqNum = EntityInfo->CurrIndex;
CtrlBlock->UserCallback(CtrlBlock->UserArg, &ParamBuff);
}
@@ -173,88 +174,95 @@ EdsLib_Iterator_Rc_t EdsLib_DisplayUserIterator_BaseName_Callback(const EdsLib_D
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-EdsLib_Iterator_Rc_t EdsLib_DisplayUserIterator_FullName_Callback(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- const char *EntityName,
- void *OpaqueArg)
+EdsLib_Iterator_Rc_t
+EdsLib_DisplayUserIterator_FullName_Callback(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ const char *EntityName,
+ void *OpaqueArg)
{
EdsLib_DisplayUserIterator_FullName_ControlBlock_t *CtrlBlock = OpaqueArg;
- EdsLib_DisplayUserIterator_FullName_StackEntry_t *TopEnt;
- EdsLib_Iterator_Rc_t RetCode;
+ EdsLib_DisplayUserIterator_FullName_StackEntry_t *TopEnt;
+ EdsLib_Iterator_Rc_t RetCode;
RetCode = EDSLIB_ITERATOR_RC_DEFAULT;
- switch(CbType)
+ switch (CbType)
{
- case EDSLIB_ITERATOR_CBTYPE_START:
- {
- TopEnt = CtrlBlock->NextEntry;
- ++CtrlBlock->NextEntry;
- TopEnt->ScratchOffset = strlen(CtrlBlock->ScratchNameBuffer);
- TopEnt->HasNamedMembers = (EntityInfo->DataDictPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER ||
- EntityInfo->DataDictPtr->BasicType == EDSLIB_BASICTYPE_COMPONENT);
- if (TopEnt->HasNamedMembers && TopEnt->ScratchOffset > 0 &&
- TopEnt->ScratchOffset < (sizeof(CtrlBlock->ScratchNameBuffer) - 1))
+ case EDSLIB_ITERATOR_CBTYPE_START:
{
- CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] = '.';
- ++TopEnt->ScratchOffset;
- CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] = 0;
+ TopEnt = CtrlBlock->NextEntry;
+ ++CtrlBlock->NextEntry;
+ TopEnt->ScratchOffset = strlen(CtrlBlock->ScratchNameBuffer);
+ TopEnt->HasNamedMembers = (EntityInfo->DataDictPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER
+ || EntityInfo->DataDictPtr->BasicType == EDSLIB_BASICTYPE_COMPONENT);
+ if (TopEnt->HasNamedMembers && TopEnt->ScratchOffset > 0
+ && TopEnt->ScratchOffset < (sizeof(CtrlBlock->ScratchNameBuffer) - 1))
+ {
+ CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] = '.';
+ ++TopEnt->ScratchOffset;
+ CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] = 0;
+ }
+ break;
}
- break;
- }
- case EDSLIB_ITERATOR_CBTYPE_MEMBER:
- {
- TopEnt = CtrlBlock->NextEntry - 1;
- if (EntityName != NULL)
+ case EDSLIB_ITERATOR_CBTYPE_MEMBER:
{
- /*
- * For arrays, the name will be suffixed with a C-style array index i.e. parent[index]
- * For structures, append a single '.' character as a C-style field delineator i.e "parent.member"
- */
- if (EntityInfo->Details.EntryType == EDSLIB_ENTRYTYPE_ARRAY_ELEMENT)
+ TopEnt = CtrlBlock->NextEntry - 1;
+ if (EntityName != NULL)
+ {
+ /*
+ * For arrays, the name will be suffixed with a C-style array index i.e. parent[index]
+ * For structures, append a single '.' character as a C-style field delineator i.e "parent.member"
+ */
+ if (EntityInfo->Details.EntryType == EDSLIB_ENTRYTYPE_ARRAY_ELEMENT)
+ {
+ snprintf(&CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset],
+ sizeof(CtrlBlock->ScratchNameBuffer) - TopEnt->ScratchOffset,
+ "[%s]",
+ EntityName);
+ }
+ else
+ {
+ snprintf(&CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset],
+ sizeof(CtrlBlock->ScratchNameBuffer) - TopEnt->ScratchOffset,
+ "%s",
+ EntityName);
+ }
+ }
+ else if (EntityInfo->Details.EntryType == EDSLIB_ENTRYTYPE_ARRAY_ELEMENT)
{
snprintf(&CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset],
- sizeof(CtrlBlock->ScratchNameBuffer) - TopEnt->ScratchOffset,
- "[%s]", EntityName);
+ sizeof(CtrlBlock->ScratchNameBuffer) - TopEnt->ScratchOffset,
+ "[%u]",
+ (unsigned int)EntityInfo->CurrIndex);
}
else
{
- snprintf(&CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset],
- sizeof(CtrlBlock->ScratchNameBuffer) - TopEnt->ScratchOffset,
- "%s", EntityName);
+ /* No name */
+ CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] = 0;
}
- }
- else if (EntityInfo->Details.EntryType == EDSLIB_ENTRYTYPE_ARRAY_ELEMENT)
- {
- snprintf(&CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset],
- sizeof(CtrlBlock->ScratchNameBuffer) - TopEnt->ScratchOffset,
- "[%u]", (unsigned int)EntityInfo->CurrIndex);
- }
- else
- {
- /* No name */
- CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] = 0;
- }
- if (EntityInfo->DataDictPtr->NumSubElements > 0)
- {
- RetCode = EDSLIB_ITERATOR_RC_DESCEND;
+ if (EntityInfo->DataDictPtr->NumSubElements > 0)
+ {
+ RetCode = EDSLIB_ITERATOR_RC_DESCEND;
+ }
+ else if (CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] != 0)
+ {
+ RetCode = EdsLib_DisplayUserIterator_BaseName_Callback(GD,
+ CbType,
+ EntityInfo,
+ CtrlBlock->ScratchNameBuffer,
+ &CtrlBlock->Base);
+ }
+ break;
}
- else if (CtrlBlock->ScratchNameBuffer[TopEnt->ScratchOffset] != 0)
+ case EDSLIB_ITERATOR_CBTYPE_END:
{
- RetCode = EdsLib_DisplayUserIterator_BaseName_Callback(GD, CbType,
- EntityInfo, CtrlBlock->ScratchNameBuffer, &CtrlBlock->Base);
+ --CtrlBlock->NextEntry;
+ break;
}
- break;
- }
- case EDSLIB_ITERATOR_CBTYPE_END:
- {
- --CtrlBlock->NextEntry;
- break;
- }
- default:
- break;
+ default:
+ break;
}
return RetCode;
diff --git a/edslib/fsw/src/edslib_displaydb_locate.c b/edslib/fsw/src/edslib_displaydb_locate.c
index 3d0d9c1..61fccdb 100644
--- a/edslib/fsw/src/edslib_displaydb_locate.c
+++ b/edslib/fsw/src/edslib_displaydb_locate.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb_locate.c
* \ingroup fsw
@@ -43,27 +42,26 @@
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static EdsLib_Iterator_Rc_t EdsLib_DisplayLocateMember_GetContainerPosition_Callback(
- const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- const char *EntityName,
- void *OpaqueArg)
+static EdsLib_Iterator_Rc_t
+EdsLib_DisplayLocateMember_GetContainerPosition_Callback(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ const char *EntityName,
+ void *OpaqueArg)
{
EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock = OpaqueArg;
- if (CbType == EDSLIB_ITERATOR_CBTYPE_MEMBER &&
- EntityName != NULL &&
- CtrlBlock->MatchQuality != EDSLIB_MATCHQUALITY_EXACT &&
- strncmp(EntityName, CtrlBlock->ContentPos, CtrlBlock->ContentLength) == 0 &&
- EntityName[CtrlBlock->ContentLength] == 0)
+ if (CbType == EDSLIB_ITERATOR_CBTYPE_MEMBER && EntityName != NULL
+ && CtrlBlock->MatchQuality != EDSLIB_MATCHQUALITY_EXACT
+ && strncmp(EntityName, CtrlBlock->ContentPos, CtrlBlock->ContentLength) == 0
+ && EntityName[CtrlBlock->ContentLength] == 0)
{
- CtrlBlock->MatchQuality = EDSLIB_MATCHQUALITY_EXACT;
- CtrlBlock->RefObj = EntityInfo->Details.RefObj;
- CtrlBlock->MaxSize.Bytes = EntityInfo->EndOffset.Bytes - EntityInfo->StartOffset.Bytes;
- CtrlBlock->MaxSize.Bits = EntityInfo->EndOffset.Bits - EntityInfo->StartOffset.Bits;
+ CtrlBlock->MatchQuality = EDSLIB_MATCHQUALITY_EXACT;
+ CtrlBlock->RefObj = EntityInfo->Details.RefObj;
+ CtrlBlock->MaxSize.Bytes = EntityInfo->EndOffset.Bytes - EntityInfo->StartOffset.Bytes;
+ CtrlBlock->MaxSize.Bits = EntityInfo->EndOffset.Bits - EntityInfo->StartOffset.Bits;
CtrlBlock->StartOffset.Bytes += EntityInfo->StartOffset.Bytes;
- CtrlBlock->StartOffset.Bits += EntityInfo->StartOffset.Bits;
+ CtrlBlock->StartOffset.Bits += EntityInfo->StartOffset.Bits;
}
if (CtrlBlock->MatchQuality != EDSLIB_MATCHQUALITY_EXACT)
@@ -79,12 +77,13 @@ static EdsLib_Iterator_Rc_t EdsLib_DisplayLocateMember_GetContainerPosition_Call
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static void EdsLib_DisplayLocateMember_GetContainerPosition(const EdsLib_DatabaseObject_t *GD, EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock)
+static void EdsLib_DisplayLocateMember_GetContainerPosition(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock)
{
EDSLIB_DECLARE_DISPLAY_ITERATOR_CB(IteratorState,
- EDSLIB_ITERATOR_MAX_BASETYPE_DEPTH,
- EdsLib_DisplayLocateMember_GetContainerPosition_Callback,
- CtrlBlock);
+ EDSLIB_ITERATOR_MAX_BASETYPE_DEPTH,
+ EdsLib_DisplayLocateMember_GetContainerPosition_Callback,
+ CtrlBlock);
EDSLIB_RESET_DISPLAY_ITERATOR_FROM_REFOBJ(IteratorState, CtrlBlock->RefObj);
@@ -96,12 +95,13 @@ static void EdsLib_DisplayLocateMember_GetContainerPosition(const EdsLib_Databas
* EdsLib local helper function
*
*-----------------------------------------------------------------*/
-static void EdsLib_DisplayLocateMember_GetArrayPosition(const EdsLib_DatabaseObject_t *GD, EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock)
+static void EdsLib_DisplayLocateMember_GetArrayPosition(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock)
{
- const EdsLib_DisplayDB_Entry_t *DisplayInf;
+ const EdsLib_DisplayDB_Entry_t *DisplayInf;
const EdsLib_SymbolTableEntry_t *Sym = NULL;
- const char *ConvEnd;
- int32_t LocalIdx;
+ const char *ConvEnd;
+ int32_t LocalIdx;
DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &CtrlBlock->RefObj);
while (DisplayInf != NULL && DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_REFERENCE_TYPE)
@@ -109,15 +109,16 @@ static void EdsLib_DisplayLocateMember_GetArrayPosition(const EdsLib_DatabaseObj
DisplayInf = EdsLib_DisplayDB_GetEntry(GD, &DisplayInf->DisplayArg.RefObj);
}
- if (DisplayInf != NULL &&
- DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
+ if (DisplayInf != NULL && DisplayInf->DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE)
{
- Sym = EdsLib_DisplaySymbolLookup_GetByName(DisplayInf->DisplayArg.SymTable, DisplayInf->DisplayArgTableSize,
- CtrlBlock->ContentPos, CtrlBlock->ContentLength);
+ Sym = EdsLib_DisplaySymbolLookup_GetByName(DisplayInf->DisplayArg.SymTable,
+ DisplayInf->DisplayArgTableSize,
+ CtrlBlock->ContentPos,
+ CtrlBlock->ContentLength);
}
if (Sym != NULL)
{
- LocalIdx = Sym->SymValue;
+ LocalIdx = Sym->SymValue;
CtrlBlock->MatchQuality = EDSLIB_MATCHQUALITY_EXACT;
}
else
@@ -131,11 +132,11 @@ static void EdsLib_DisplayLocateMember_GetArrayPosition(const EdsLib_DatabaseObj
}
if (CtrlBlock->MatchQuality != EDSLIB_MATCHQUALITY_NONE)
{
- CtrlBlock->RefObj = CtrlBlock->DataDict->Detail.Array->ElementRefObj;
- CtrlBlock->MaxSize.Bytes = (CtrlBlock->DataDict->SizeInfo.Bytes / CtrlBlock->DataDict->NumSubElements);
- CtrlBlock->MaxSize.Bits = (CtrlBlock->DataDict->SizeInfo.Bits / CtrlBlock->DataDict->NumSubElements);
+ CtrlBlock->RefObj = CtrlBlock->DataDict->Detail.Array->ElementRefObj;
+ CtrlBlock->MaxSize.Bytes = (CtrlBlock->DataDict->SizeInfo.Bytes / CtrlBlock->DataDict->NumSubElements);
+ CtrlBlock->MaxSize.Bits = (CtrlBlock->DataDict->SizeInfo.Bits / CtrlBlock->DataDict->NumSubElements);
CtrlBlock->StartOffset.Bytes += LocalIdx * CtrlBlock->MaxSize.Bytes;
- CtrlBlock->StartOffset.Bits += LocalIdx * CtrlBlock->MaxSize.Bits;
+ CtrlBlock->StartOffset.Bits += LocalIdx * CtrlBlock->MaxSize.Bits;
}
}
@@ -145,7 +146,8 @@ static void EdsLib_DisplayLocateMember_GetArrayPosition(const EdsLib_DatabaseObj
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-void EdsLib_DisplayLocateMember_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock)
+void EdsLib_DisplayLocateMember_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock)
{
const char *EndPos;
@@ -155,19 +157,46 @@ void EdsLib_DisplayLocateMember_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_D
}
CtrlBlock->DataDict = EdsLib_DataTypeDB_GetEntry(GD, &CtrlBlock->RefObj);
- if (*CtrlBlock->ContentPos != 0 && CtrlBlock->DataDict != NULL &&
- CtrlBlock->DataDict->NumSubElements > 0)
+ if (*CtrlBlock->ContentPos != 0 && CtrlBlock->DataDict != NULL && CtrlBlock->DataDict->NumSubElements > 0)
{
switch (CtrlBlock->DataDict->BasicType)
{
- case EDSLIB_BASICTYPE_ARRAY:
- if (*CtrlBlock->ContentPos == '[')
- {
- do
+ case EDSLIB_BASICTYPE_ARRAY:
+ if (*CtrlBlock->ContentPos == '[')
{
- ++CtrlBlock->ContentPos;
+ do
+ {
+ ++CtrlBlock->ContentPos;
+ } while (isspace((int)*CtrlBlock->ContentPos));
+
+ EndPos = CtrlBlock->ContentPos;
+ while (isalnum((int)*EndPos) || *EndPos == '_')
+ {
+ ++CtrlBlock->ContentLength;
+ ++EndPos;
+ }
+
+ while (isspace((int)*EndPos))
+ {
+ ++EndPos;
+ }
+
+ if (*EndPos == ']' && CtrlBlock->ContentLength > 0)
+ {
+ CtrlBlock->NextTokenPos = EndPos + 1;
+ EdsLib_DisplayLocateMember_GetArrayPosition(GD, CtrlBlock);
+ }
+ }
+ break;
+ case EDSLIB_BASICTYPE_CONTAINER:
+ case EDSLIB_BASICTYPE_COMPONENT:
+ if (*CtrlBlock->ContentPos == '.')
+ {
+ do
+ {
+ ++CtrlBlock->ContentPos;
+ } while (isspace((int)*CtrlBlock->ContentPos));
}
- while (isspace((int)*CtrlBlock->ContentPos));
EndPos = CtrlBlock->ContentPos;
while (isalnum((int)*EndPos) || *EndPos == '_')
@@ -176,44 +205,14 @@ void EdsLib_DisplayLocateMember_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_D
++EndPos;
}
- while (isspace((int)*EndPos))
- {
- ++EndPos;
- }
-
- if (*EndPos == ']' && CtrlBlock->ContentLength > 0)
- {
- CtrlBlock->NextTokenPos = EndPos + 1;
- EdsLib_DisplayLocateMember_GetArrayPosition(GD, CtrlBlock);
- }
- }
- break;
- case EDSLIB_BASICTYPE_CONTAINER:
- case EDSLIB_BASICTYPE_COMPONENT:
- if (*CtrlBlock->ContentPos == '.')
- {
- do
+ if (CtrlBlock->ContentLength > 0)
{
- ++CtrlBlock->ContentPos;
+ CtrlBlock->NextTokenPos = EndPos;
+ EdsLib_DisplayLocateMember_GetContainerPosition(GD, CtrlBlock);
}
- while (isspace((int)*CtrlBlock->ContentPos));
- }
-
- EndPos = CtrlBlock->ContentPos;
- while (isalnum((int)*EndPos) || *EndPos == '_')
- {
- ++CtrlBlock->ContentLength;
- ++EndPos;
- }
-
- if (CtrlBlock->ContentLength > 0)
- {
- CtrlBlock->NextTokenPos = EndPos;
- EdsLib_DisplayLocateMember_GetContainerPosition(GD, CtrlBlock);
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
}
}
diff --git a/edslib/fsw/src/edslib_displaydb_lookup.c b/edslib/fsw/src/edslib_displaydb_lookup.c
index fc48a70..303e7ab 100644
--- a/edslib/fsw/src/edslib_displaydb_lookup.c
+++ b/edslib/fsw/src/edslib_displaydb_lookup.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb_lookup.c
* \ingroup fsw
@@ -48,20 +47,20 @@
*-----------------------------------------------------------------*/
EdsLib_DisplayDB_t EdsLib_DisplayDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx)
{
- /*
- * As name tables are dependent on data tables, check that data table is also present
- */
- if (GD->DisplayDB_Table == NULL)
- {
- return NULL;
- }
+ /*
+ * As name tables are dependent on data tables, check that data table is also present
+ */
+ if (GD->DisplayDB_Table == NULL)
+ {
+ return NULL;
+ }
- if (AppIdx >= GD->AppTableSize)
- {
- return NULL;
- }
+ if (AppIdx >= GD->AppTableSize)
+ {
+ return NULL;
+ }
- return GD->DisplayDB_Table[AppIdx];
+ return GD->DisplayDB_Table[AppIdx];
}
/*----------------------------------------------------------------
@@ -70,34 +69,33 @@ EdsLib_DisplayDB_t EdsLib_DisplayDB_GetTopLevel(const EdsLib_DatabaseObject_t *G
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const EdsLib_DisplayDB_Entry_t *EdsLib_DisplayDB_GetEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj)
+const EdsLib_DisplayDB_Entry_t *EdsLib_DisplayDB_GetEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj)
{
- EdsLib_DisplayDB_t NameDict;
- EdsLib_DataTypeDB_t DataDict;
+ EdsLib_DisplayDB_t NameDict;
+ EdsLib_DataTypeDB_t DataDict;
- if (RefObj == NULL || RefObj->Qualifier != EdsLib_DbRef_Qualifier_DATATYPE)
- {
- return NULL;
- }
+ if (RefObj == NULL || RefObj->Qualifier != EdsLib_DbRef_Qualifier_DATATYPE)
+ {
+ return NULL;
+ }
- DataDict = EdsLib_DataTypeDB_GetTopLevel(GD, RefObj->AppIndex);
- if (DataDict == NULL)
- {
- return NULL;
- }
+ DataDict = EdsLib_DataTypeDB_GetTopLevel(GD, RefObj->AppIndex);
+ if (DataDict == NULL)
+ {
+ return NULL;
+ }
- NameDict = EdsLib_DisplayDB_GetTopLevel(GD, RefObj->AppIndex);
- if (NameDict == NULL)
- {
- return NULL;
- }
+ NameDict = EdsLib_DisplayDB_GetTopLevel(GD, RefObj->AppIndex);
+ if (NameDict == NULL)
+ {
+ return NULL;
+ }
- if (NameDict->DisplayInfoTable == NULL ||
- RefObj->SubIndex >= DataDict->DataTypeTableSize)
- {
- return NULL;
- }
+ if (NameDict->DisplayInfoTable == NULL || RefObj->SubIndex >= DataDict->DataTypeTableSize)
+ {
+ return NULL;
+ }
- return &NameDict->DisplayInfoTable[RefObj->SubIndex];
+ return &NameDict->DisplayInfoTable[RefObj->SubIndex];
}
-
diff --git a/edslib/fsw/src/edslib_displaydb_stringconv.c b/edslib/fsw/src/edslib_displaydb_stringconv.c
index 935a6a5..9fbf3c8 100644
--- a/edslib/fsw/src/edslib_displaydb_stringconv.c
+++ b/edslib/fsw/src/edslib_displaydb_stringconv.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_displaydb_stringconv.c
* \ingroup fsw
@@ -46,16 +45,19 @@
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByName(const EdsLib_SymbolTableEntry_t *SymbolDict, uint16_t TableSize, const char *String, uint32_t StringLen)
+const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByName(const EdsLib_SymbolTableEntry_t *SymbolDict,
+ uint16_t TableSize,
+ const char *String,
+ uint32_t StringLen)
{
const EdsLib_SymbolTableEntry_t *Sym;
- int Compare;
- uint32_t LowIndex;
- uint32_t HighIndex;
- uint32_t SearchIndex;
+ int Compare;
+ uint32_t LowIndex;
+ uint32_t HighIndex;
+ uint32_t SearchIndex;
- Sym = NULL;
- LowIndex = 0;
+ Sym = NULL;
+ LowIndex = 0;
HighIndex = TableSize;
while (true)
{
@@ -66,7 +68,7 @@ const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByName(const EdsL
}
SearchIndex = (LowIndex + HighIndex) / 2;
- Sym = &SymbolDict[SearchIndex];
+ Sym = &SymbolDict[SearchIndex];
Compare = strncmp(Sym->SymName, String, StringLen);
if (Compare == 0 && Sym->SymName[StringLen] == 0)
@@ -93,7 +95,8 @@ const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByName(const EdsL
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByValue(const EdsLib_SymbolTableEntry_t *SymbolDict, uint16_t TableSize, intmax_t Value)
+const EdsLib_SymbolTableEntry_t *
+EdsLib_DisplaySymbolLookup_GetByValue(const EdsLib_SymbolTableEntry_t *SymbolDict, uint16_t TableSize, intmax_t Value)
{
const EdsLib_SymbolTableEntry_t *Result;
@@ -121,21 +124,23 @@ const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByValue(const Eds
return Result;
}
-
/*----------------------------------------------------------------
*
* EdsLib internal function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr, const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
- char *OutputBuffer, uint32_t BufferSize, const void *SourcePtr)
+int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr,
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
+ char *OutputBuffer,
+ uint32_t BufferSize,
+ const void *SourcePtr)
{
EdsLib_GenericValueBuffer_t NumberBuffer;
- EdsLib_ConstPtr_t Src;
- int32_t Status;
+ EdsLib_ConstPtr_t Src;
+ int32_t Status;
- Src.Ptr = SourcePtr;
+ Src.Ptr = SourcePtr;
NumberBuffer.ValueType = EDSLIB_BASICTYPE_NONE;
/*
@@ -148,22 +153,22 @@ int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *
}
else if (DictEntryPtr->BasicType == EDSLIB_BASICTYPE_CONTAINER)
{
- snprintf(OutputBuffer,BufferSize,"");
+ snprintf(OutputBuffer, BufferSize, "");
Status = EDSLIB_SUCCESS;
}
else if (DictEntryPtr->BasicType == EDSLIB_BASICTYPE_COMPONENT)
{
- snprintf(OutputBuffer,BufferSize,"");
+ snprintf(OutputBuffer, BufferSize, "");
Status = EDSLIB_SUCCESS;
}
else if (DictEntryPtr->BasicType == EDSLIB_BASICTYPE_ARRAY)
{
- snprintf(OutputBuffer,BufferSize,"");
+ snprintf(OutputBuffer, BufferSize, "");
Status = EDSLIB_SUCCESS;
}
else if (DictEntryPtr->BasicType == EDSLIB_BASICTYPE_GENERIC)
{
- snprintf(OutputBuffer,BufferSize,"");
+ snprintf(OutputBuffer, BufferSize, "");
Status = EDSLIB_SUCCESS;
}
else
@@ -179,103 +184,110 @@ int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *
{
switch (DisplayInfoPtr->DisplayHint)
{
- case EDSLIB_DISPLAYHINT_STRING:
- {
- uint16_t SrcSize = DictEntryPtr->SizeInfo.Bytes;
-
- /*
- * binary blob contains character string data.
- * copy only PRINTABLE chars to output buffer,
- * as this is intended for UI display
- */
- while (SrcSize > 0 && BufferSize > 1 && Src.u->u8 != 0)
+ case EDSLIB_DISPLAYHINT_STRING:
{
- if (isprint((int)Src.u->u8))
+ uint16_t SrcSize = DictEntryPtr->SizeInfo.Bytes;
+
+ /*
+ * binary blob contains character string data.
+ * copy only PRINTABLE chars to output buffer,
+ * as this is intended for UI display
+ */
+ while (SrcSize > 0 && BufferSize > 1 && Src.u->u8 != 0)
{
- *OutputBuffer = Src.u->u8;
+ if (isprint((int)Src.u->u8))
+ {
+ *OutputBuffer = Src.u->u8;
+ }
+ else
+ {
+ *OutputBuffer = '.';
+ }
+
+ ++OutputBuffer;
+ --BufferSize;
+ ++Src.Addr;
+ --SrcSize;
}
- else
+ if (BufferSize > 0)
{
- *OutputBuffer = '.';
+ *OutputBuffer = 0;
}
-
- ++OutputBuffer;
- --BufferSize;
- ++Src.Addr;
- --SrcSize;
- }
- if (BufferSize > 0)
- {
- *OutputBuffer = 0;
- }
- Status = EDSLIB_SUCCESS;
- break;
- }
- case EDSLIB_DISPLAYHINT_BASE64:
- {
- /*
- * binary blob contains binary data, which cannot be
- * put into a normal string. Use Base64 encoding.
- */
- EdsLib_DisplayDB_Base64Encode(OutputBuffer, BufferSize, Src.Addr, DictEntryPtr->SizeInfo.Bits);
- Status = EDSLIB_SUCCESS;
- break;
- }
- case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
- {
- const EdsLib_SymbolTableEntry_t *Symbol;
-
- if (NumberBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT)
- {
- Symbol = EdsLib_DisplaySymbolLookup_GetByValue(DisplayInfoPtr->DisplayArg.SymTable,
- DisplayInfoPtr->DisplayArgTableSize, NumberBuffer.Value.SignedInteger);
- }
- else if (NumberBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
- {
- Symbol = EdsLib_DisplaySymbolLookup_GetByValue(DisplayInfoPtr->DisplayArg.SymTable,
- DisplayInfoPtr->DisplayArgTableSize, NumberBuffer.Value.UnsignedInteger);
+ Status = EDSLIB_SUCCESS;
+ break;
}
- else
+ case EDSLIB_DISPLAYHINT_BASE64:
{
- Symbol = NULL;
- }
-
- if (Symbol != NULL)
- {
- snprintf(OutputBuffer, BufferSize, "%s", Symbol->SymName);
+ /*
+ * binary blob contains binary data, which cannot be
+ * put into a normal string. Use Base64 encoding.
+ */
+ EdsLib_DisplayDB_Base64Encode(OutputBuffer, BufferSize, Src.Addr, DictEntryPtr->SizeInfo.Bits);
Status = EDSLIB_SUCCESS;
+ break;
}
- break;
- }
- case EDSLIB_DISPLAYHINT_ADDRESS:
- {
- /* memory addresses are always hex values */
- if (NumberBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT ||
- NumberBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
+ case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
{
- snprintf(OutputBuffer,BufferSize,"0x%0*llx", (int)(DictEntryPtr->SizeInfo.Bytes * 2),
- NumberBuffer.Value.UnsignedInteger);
- Status = EDSLIB_SUCCESS;
+ const EdsLib_SymbolTableEntry_t *Symbol;
+
+ if (NumberBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT)
+ {
+ Symbol = EdsLib_DisplaySymbolLookup_GetByValue(DisplayInfoPtr->DisplayArg.SymTable,
+ DisplayInfoPtr->DisplayArgTableSize,
+ NumberBuffer.Value.SignedInteger);
+ }
+ else if (NumberBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
+ {
+ Symbol = EdsLib_DisplaySymbolLookup_GetByValue(DisplayInfoPtr->DisplayArg.SymTable,
+ DisplayInfoPtr->DisplayArgTableSize,
+ NumberBuffer.Value.UnsignedInteger);
+ }
+ else
+ {
+ Symbol = NULL;
+ }
+
+ if (Symbol != NULL)
+ {
+ snprintf(OutputBuffer, BufferSize, "%s", Symbol->SymName);
+ Status = EDSLIB_SUCCESS;
+ }
+ break;
}
- break;
- }
- case EDSLIB_DISPLAYHINT_BOOLEAN:
- {
- /* memory addresses are always hex values */
- if ((NumberBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT && NumberBuffer.Value.UnsignedInteger != 0) ||
- (NumberBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT && NumberBuffer.Value.SignedInteger != 0))
+ case EDSLIB_DISPLAYHINT_ADDRESS:
{
- snprintf(OutputBuffer, BufferSize, "true");
+ /* memory addresses are always hex values */
+ if (NumberBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT
+ || NumberBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
+ {
+ snprintf(OutputBuffer,
+ BufferSize,
+ "0x%0*llx",
+ (int)(DictEntryPtr->SizeInfo.Bytes * 2),
+ NumberBuffer.Value.UnsignedInteger);
+ Status = EDSLIB_SUCCESS;
+ }
+ break;
}
- else
+ case EDSLIB_DISPLAYHINT_BOOLEAN:
{
- snprintf(OutputBuffer, BufferSize, "false");
+ /* memory addresses are always hex values */
+ if ((NumberBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT
+ && NumberBuffer.Value.UnsignedInteger != 0)
+ || (NumberBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT
+ && NumberBuffer.Value.SignedInteger != 0))
+ {
+ snprintf(OutputBuffer, BufferSize, "true");
+ }
+ else
+ {
+ snprintf(OutputBuffer, BufferSize, "false");
+ }
+ Status = EDSLIB_SUCCESS;
+ break;
}
- Status = EDSLIB_SUCCESS;
- break;
- }
- default:
- break;
+ default:
+ break;
}
}
}
@@ -285,27 +297,27 @@ int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *
*/
if (Status != EDSLIB_SUCCESS)
{
- switch(NumberBuffer.ValueType)
+ switch (NumberBuffer.ValueType)
{
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- snprintf(OutputBuffer,BufferSize,"%llu",NumberBuffer.Value.UnsignedInteger);
- Status = EDSLIB_SUCCESS;
- break;
- case EDSLIB_BASICTYPE_SIGNED_INT:
- snprintf(OutputBuffer,BufferSize,"%lld",NumberBuffer.Value.SignedInteger);
- Status = EDSLIB_SUCCESS;
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- snprintf(OutputBuffer,BufferSize,"%.4Lg",NumberBuffer.Value.FloatingPoint);
- Status = EDSLIB_SUCCESS;
- break;
- default:
- /*
- * catch-all case, to ensure something is written to the buffer.
- * If this is seen in the output it likely means a DB is missing.
- */
- snprintf(OutputBuffer,BufferSize,"<\?\?\?>");
- break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ snprintf(OutputBuffer, BufferSize, "%llu", NumberBuffer.Value.UnsignedInteger);
+ Status = EDSLIB_SUCCESS;
+ break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ snprintf(OutputBuffer, BufferSize, "%lld", NumberBuffer.Value.SignedInteger);
+ Status = EDSLIB_SUCCESS;
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ snprintf(OutputBuffer, BufferSize, "%.4Lg", NumberBuffer.Value.FloatingPoint);
+ Status = EDSLIB_SUCCESS;
+ break;
+ default:
+ /*
+ * catch-all case, to ensure something is written to the buffer.
+ * If this is seen in the output it likely means a DB is missing.
+ */
+ snprintf(OutputBuffer, BufferSize, "<\?\?\?>");
+ break;
}
}
@@ -318,14 +330,16 @@ int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_DisplayScalarConv_FromString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr, const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
- void *DestPtr, const char *SrcString)
+int32_t EdsLib_DisplayScalarConv_FromString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr,
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
+ void *DestPtr,
+ const char *SrcString)
{
EdsLib_GenericValueBuffer_t NumberBuffer;
- int32_t Status;
- EdsLib_Ptr_t Dst;
+ int32_t Status;
+ EdsLib_Ptr_t Dst;
- Dst.Ptr = DestPtr;
+ Dst.Ptr = DestPtr;
NumberBuffer.ValueType = EDSLIB_BASICTYPE_NONE;
if (DictEntryPtr == NULL)
@@ -348,151 +362,152 @@ int32_t EdsLib_DisplayScalarConv_FromString_Impl(const EdsLib_DataTypeDB_Entry_t
{
switch (DisplayInfoPtr->DisplayHint)
{
- case EDSLIB_DISPLAYHINT_STRING:
- {
- uint16_t DstSize = DictEntryPtr->SizeInfo.Bytes;
- while (DstSize > 0)
+ case EDSLIB_DISPLAYHINT_STRING:
{
- Dst.u->u8 = *SrcString;
- if (*SrcString != 0)
+ uint16_t DstSize = DictEntryPtr->SizeInfo.Bytes;
+ while (DstSize > 0)
{
- ++SrcString;
+ Dst.u->u8 = *SrcString;
+ if (*SrcString != 0)
+ {
+ ++SrcString;
+ }
+ ++Dst.Addr;
+ --DstSize;
}
- ++Dst.Addr;
- --DstSize;
- }
- Status = EDSLIB_SUCCESS;
- break;
- }
- case EDSLIB_DISPLAYHINT_BASE64:
- {
- /*
- * binary blob contains binary data, which cannot be
- * put into a normal string. Use Base64 encoding.
- */
- EdsLib_DisplayDB_Base64Decode(Dst.Addr, DictEntryPtr->SizeInfo.Bits, SrcString);
- Status = EDSLIB_SUCCESS;
- break;
- }
- case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
- {
- const EdsLib_SymbolTableEntry_t *Symbol;
-
- Symbol = EdsLib_DisplaySymbolLookup_GetByName(DisplayInfoPtr->DisplayArg.SymTable,
- DisplayInfoPtr->DisplayArgTableSize, SrcString, strlen(SrcString));
-
- if (Symbol != NULL)
- {
- NumberBuffer.Value.SignedInteger = Symbol->SymValue;
- NumberBuffer.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
- }
- break;
- }
- case EDSLIB_DISPLAYHINT_ADDRESS:
- {
- /* memory addresses are always hex values */
- const char *EndPtr;
- NumberBuffer.Value.UnsignedInteger = strtoull(SrcString, (char**)&EndPtr, 16);
- if (EndPtr != SrcString && *EndPtr == 0)
- {
- NumberBuffer.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
- }
- break;
- }
- case EDSLIB_DISPLAYHINT_BOOLEAN:
- {
- /* typically TRUE/FALSE, also accept YES/NO or 0/1 */
- const char *EndPtr = SrcString;
- if (strcasecmp(SrcString, "true") == 0)
- {
- EndPtr += 4;
- NumberBuffer.Value.UnsignedInteger = 1;
- }
- else if (strcasecmp(SrcString, "false") == 0)
- {
- EndPtr += 4;
- NumberBuffer.Value.UnsignedInteger = 0;
+ Status = EDSLIB_SUCCESS;
+ break;
}
- else if (strcasecmp(SrcString, "yes") == 0)
+ case EDSLIB_DISPLAYHINT_BASE64:
{
- EndPtr += 3;
- NumberBuffer.Value.UnsignedInteger = 1;
+ /*
+ * binary blob contains binary data, which cannot be
+ * put into a normal string. Use Base64 encoding.
+ */
+ EdsLib_DisplayDB_Base64Decode(Dst.Addr, DictEntryPtr->SizeInfo.Bits, SrcString);
+ Status = EDSLIB_SUCCESS;
+ break;
}
- else if (strcasecmp(SrcString, "no") == 0)
+ case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
{
- EndPtr += 2;
- NumberBuffer.Value.UnsignedInteger = 0;
+ const EdsLib_SymbolTableEntry_t *Symbol;
+
+ Symbol = EdsLib_DisplaySymbolLookup_GetByName(DisplayInfoPtr->DisplayArg.SymTable,
+ DisplayInfoPtr->DisplayArgTableSize,
+ SrcString,
+ strlen(SrcString));
+
+ if (Symbol != NULL)
+ {
+ NumberBuffer.Value.SignedInteger = Symbol->SymValue;
+ NumberBuffer.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ }
+ break;
}
- else
+ case EDSLIB_DISPLAYHINT_ADDRESS:
{
- NumberBuffer.Value.UnsignedInteger = strtol(SrcString, (char**)&EndPtr, 0);
+ /* memory addresses are always hex values */
+ const char *EndPtr;
+ NumberBuffer.Value.UnsignedInteger = strtoull(SrcString, (char **)&EndPtr, 16);
+ if (EndPtr != SrcString && *EndPtr == 0)
+ {
+ NumberBuffer.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ }
+ break;
}
- if (EndPtr != SrcString && *EndPtr == 0)
+ case EDSLIB_DISPLAYHINT_BOOLEAN:
{
- NumberBuffer.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ /* typically TRUE/FALSE, also accept YES/NO or 0/1 */
+ const char *EndPtr = SrcString;
+ if (strcasecmp(SrcString, "true") == 0)
+ {
+ EndPtr += 4;
+ NumberBuffer.Value.UnsignedInteger = 1;
+ }
+ else if (strcasecmp(SrcString, "false") == 0)
+ {
+ EndPtr += 4;
+ NumberBuffer.Value.UnsignedInteger = 0;
+ }
+ else if (strcasecmp(SrcString, "yes") == 0)
+ {
+ EndPtr += 3;
+ NumberBuffer.Value.UnsignedInteger = 1;
+ }
+ else if (strcasecmp(SrcString, "no") == 0)
+ {
+ EndPtr += 2;
+ NumberBuffer.Value.UnsignedInteger = 0;
+ }
+ else
+ {
+ NumberBuffer.Value.UnsignedInteger = strtol(SrcString, (char **)&EndPtr, 0);
+ }
+ if (EndPtr != SrcString && *EndPtr == 0)
+ {
+ NumberBuffer.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ }
+ break;
}
- break;
- }
- default:
- break;
+ default:
+ break;
}
}
- if (Status != EDSLIB_SUCCESS &&
- NumberBuffer.ValueType == EDSLIB_BASICTYPE_NONE)
+ if (Status != EDSLIB_SUCCESS && NumberBuffer.ValueType == EDSLIB_BASICTYPE_NONE)
{
const char *EndPtr;
- switch(DictEntryPtr->BasicType)
+ switch (DictEntryPtr->BasicType)
{
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- case EDSLIB_BASICTYPE_SIGNED_INT:
- case EDSLIB_BASICTYPE_FLOAT:
- {
- /*
- * NOTE: conversion is done into the system long double type --
- * This is because we do not have control over how the input data is
- * formatted. For instance, if the target type is a signed integer and
- * supplied string is "-5.0" or "1e3", these should still work.
- * Using a long double here should provide for a 64-bit mantissa, so
- * even 64 bit integer values can be stored without precision loss
- */
- NumberBuffer.Value.FloatingPoint = strtold(SrcString, (char**)&EndPtr);
- if (EndPtr != SrcString && *EndPtr == 0)
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ case EDSLIB_BASICTYPE_FLOAT:
{
- NumberBuffer.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ /*
+ * NOTE: conversion is done into the system long double type --
+ * This is because we do not have control over how the input data is
+ * formatted. For instance, if the target type is a signed integer and
+ * supplied string is "-5.0" or "1e3", these should still work.
+ * Using a long double here should provide for a 64-bit mantissa, so
+ * even 64 bit integer values can be stored without precision loss
+ */
+ NumberBuffer.Value.FloatingPoint = strtold(SrcString, (char **)&EndPtr);
+ if (EndPtr != SrcString && *EndPtr == 0)
+ {
+ NumberBuffer.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ }
+ break;
}
- break;
- }
- case EDSLIB_BASICTYPE_BINARY:
- {
- uint16_t DstSize = DictEntryPtr->SizeInfo.Bytes;
- size_t SrcSize = strlen(SrcString);
- Status = EDSLIB_SUCCESS;
-
- while (DstSize > 0 && SrcSize >= 2)
+ case EDSLIB_BASICTYPE_BINARY:
{
- NumberBuffer.Value.StringData[0] = *SrcString;
- ++SrcString;
- NumberBuffer.Value.StringData[1] = *SrcString;
- ++SrcString;
- NumberBuffer.Value.StringData[2] = 0;
- SrcSize -= 2;
-
- Dst.u->u8 = strtoul(NumberBuffer.Value.StringData, (char **)&EndPtr, 16);
- if (*EndPtr != 0)
+ uint16_t DstSize = DictEntryPtr->SizeInfo.Bytes;
+ size_t SrcSize = strlen(SrcString);
+ Status = EDSLIB_SUCCESS;
+
+ while (DstSize > 0 && SrcSize >= 2)
{
- Status = EDSLIB_FAILURE;
- break;
+ NumberBuffer.Value.StringData[0] = *SrcString;
+ ++SrcString;
+ NumberBuffer.Value.StringData[1] = *SrcString;
+ ++SrcString;
+ NumberBuffer.Value.StringData[2] = 0;
+ SrcSize -= 2;
+
+ Dst.u->u8 = strtoul(NumberBuffer.Value.StringData, (char **)&EndPtr, 16);
+ if (*EndPtr != 0)
+ {
+ Status = EDSLIB_FAILURE;
+ break;
+ }
+ ++Dst.Addr;
+ --DstSize;
}
- ++Dst.Addr;
- --DstSize;
+ break;
+ }
+ default:
+ {
+ break;
}
- break;
- }
- default:
- {
- break;
- }
}
}
diff --git a/edslib/fsw/src/edslib_global_api.c b/edslib/fsw/src/edslib_global_api.c
index a90085b..b43a88b 100644
--- a/edslib/fsw/src/edslib_global_api.c
+++ b/edslib/fsw/src/edslib_global_api.c
@@ -62,8 +62,10 @@ uint16_t EdsLib_GetNumPackages(const EdsLib_DatabaseObject_t *GD)
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_FindPackageIdxBySubstring(const EdsLib_DatabaseObject_t *GD, const char *MatchString, size_t MatchLen,
- uint8_t *IdxOut)
+int32_t EdsLib_FindPackageIdxBySubstring(const EdsLib_DatabaseObject_t *GD,
+ const char *MatchString,
+ size_t MatchLen,
+ uint8_t *IdxOut)
{
const char *NamePtr;
int32_t Status;
diff --git a/edslib/fsw/src/edslib_init.c b/edslib/fsw/src/edslib_init.c
index bc75a9e..24a166a 100644
--- a/edslib/fsw/src/edslib_init.c
+++ b/edslib/fsw/src/edslib_init.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_init.c
* \ingroup fsw
@@ -49,4 +48,3 @@ void EdsLib_Initialize(void)
EdsLib_IntfDB_Initialize();
EdsLib_Binding_Initialize();
}
-
diff --git a/edslib/fsw/src/edslib_internal.h b/edslib/fsw/src/edslib_internal.h
index 6a75fae..432796f 100644
--- a/edslib/fsw/src/edslib_internal.h
+++ b/edslib/fsw/src/edslib_internal.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_internal.h
* \ingroup fsw
@@ -32,7 +31,6 @@
#ifndef _EDSLIB_INTERNAL_H_
#define _EDSLIB_INTERNAL_H_
-
#include "edslib_database_types.h"
#include "edslib_database_ops.h"
#include "edslib_global.h"
@@ -54,7 +52,7 @@
* the runtime library will support. This also serves as a functional
* limit in case an (invalid) circular reference somehow exists in the DB.
*/
-#define EDSLIB_ITERATOR_MAX_DEEP_DEPTH 32
+#define EDSLIB_ITERATOR_MAX_DEEP_DEPTH 32
/**
* The limit for how deep a basetype hierarchy chain can be. This is an
@@ -62,20 +60,20 @@
* only "immediate" members can still descend into basetypes, but not need
* to allocate a state structure as large as EDSLIB_ITERATOR_MAX_DEEP_DEPTH
*/
-#define EDSLIB_ITERATOR_MAX_BASETYPE_DEPTH 8
+#define EDSLIB_ITERATOR_MAX_BASETYPE_DEPTH 8
/**
* The limit for depth when only iterating through the immediate type members.
* This is the smallest and most stack friendly depth but it does not support
* descending into sub-structures at all, including base types.
*/
-#define EDSLIB_ITERATOR_MAX_SHALLOW_DEPTH 2
+#define EDSLIB_ITERATOR_MAX_SHALLOW_DEPTH 2
/**
* An internal macro used to combine a type and size from the database into
* a single value that can be used in a switch/case statement.
*/
-#define EDSLIB_TYPE_AND_SIZE(x,y) (((x) << 8) | (y))
+#define EDSLIB_TYPE_AND_SIZE(x, y) (((x) << 8) | (y))
/**
* Some fields such as error control cannot be calculated immediately, they
@@ -83,7 +81,7 @@
* the maximum number of fields that can have deferred calculation in a single
* encode/decode operation.
*/
-#define EDSLIB_PACKEDPOSTPROC_MAX_DEFERRED_FIELDS 8
+#define EDSLIB_PACKEDPOSTPROC_MAX_DEFERRED_FIELDS 8
/******************************
* TYPEDEFS
@@ -96,9 +94,9 @@
*/
typedef union
{
- const void *Ptr;
+ const void *Ptr;
const EdsLib_GenericValueUnion_t *u;
- const uint8_t *Addr;
+ const uint8_t *Addr;
} EdsLib_ConstPtr_t;
/**
@@ -109,22 +107,21 @@ typedef union
*/
typedef union
{
- void *Ptr;
+ void *Ptr;
EdsLib_GenericValueUnion_t *u;
- uint8_t *Addr;
+ uint8_t *Addr;
} EdsLib_Ptr_t;
-
/**
* Argument to the basic iterator callback function.
* Indicates the type of callback taking place.
*/
typedef enum
{
- EDSLIB_ITERATOR_CBTYPE_UNDEFINED = 0,
- EDSLIB_ITERATOR_CBTYPE_START,
- EDSLIB_ITERATOR_CBTYPE_MEMBER,
- EDSLIB_ITERATOR_CBTYPE_END
+ EDSLIB_ITERATOR_CBTYPE_UNDEFINED = 0,
+ EDSLIB_ITERATOR_CBTYPE_START,
+ EDSLIB_ITERATOR_CBTYPE_MEMBER,
+ EDSLIB_ITERATOR_CBTYPE_END
} EdsLib_Iterator_CbType_t;
/**
@@ -142,11 +139,11 @@ typedef enum
typedef struct
{
- uint16_t CurrIndex;
- uint16_t CurrDepth;
- EdsLib_SizeInfo_t StartOffset;
- EdsLib_SizeInfo_t EndOffset;
- EdsLib_FieldDetailEntry_t Details;
+ uint16_t CurrIndex;
+ uint16_t CurrDepth;
+ EdsLib_SizeInfo_t StartOffset;
+ EdsLib_SizeInfo_t EndOffset;
+ EdsLib_FieldDetailEntry_t Details;
const EdsLib_DataTypeDB_Entry_t *DataDictPtr;
} EdsLib_DataTypeIterator_StackEntry_t;
@@ -154,16 +151,16 @@ typedef struct
* Prototype for the basic dictionary iterator callback functions.
*/
typedef EdsLib_Iterator_Rc_t (*EdsLib_DataTypeIterator_Callback_t)(
- const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- void *OpaqueArg);
+ const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ void *OpaqueArg);
typedef struct
{
EdsLib_DataTypeIterator_Callback_t Callback;
- void *CallbackArg;
- uint16_t StackSize;
+ void *CallbackArg;
+ uint16_t StackSize;
/*
* The "stack" is variably sized and must contain at least one item
@@ -184,9 +181,10 @@ typedef struct
* a stack to hold the state at each iteration level up to the specified maximum.
*/
#define EDSLIB_ITERATOR_CB_TYPE(depth) \
- struct { \
+ struct \
+ { \
EdsLib_DataTypeIterator_ControlBlock_t Cb; \
- EdsLib_DataTypeIterator_StackEntry_t StackEntries[depth-1]; \
+ EdsLib_DataTypeIterator_StackEntry_t StackEntries[depth - 1]; \
}
/**
@@ -195,26 +193,28 @@ typedef struct
* This wraps the control block structure with enough spare memory for
* a stack to hold the state at each iteration level up to the specified maximum.
*/
-#define EDSLIB_INITIALIZE_ITERATOR_CB(name,depth,cbfunc,cbarg) \
- do { \
- name.Cb.Callback = cbfunc; \
- name.Cb.CallbackArg = cbarg; \
- name.Cb.StackSize = depth; \
- } while(0)
+#define EDSLIB_INITIALIZE_ITERATOR_CB(name, depth, cbfunc, cbarg) \
+ do \
+ { \
+ name.Cb.Callback = cbfunc; \
+ name.Cb.CallbackArg = cbarg; \
+ name.Cb.StackSize = depth; \
+ } while (0)
/**
* A combined macro to both instantiate and initialize an iterator
*/
-#define EDSLIB_DECLARE_ITERATOR_CB(name,depth,cbfunc,cbarg) \
- EDSLIB_ITERATOR_CB_TYPE(depth) name; \
- EDSLIB_INITIALIZE_ITERATOR_CB(name,depth,cbfunc,cbarg)
+#define EDSLIB_DECLARE_ITERATOR_CB(name, depth, cbfunc, cbarg) \
+ EDSLIB_ITERATOR_CB_TYPE(depth) name; \
+ EDSLIB_INITIALIZE_ITERATOR_CB(name, depth, cbfunc, cbarg)
/**
* Macro to set an iterator to the start of a given object
* The object is specified directory as an EdsLib_DatabaseRef_t
*/
-#define EDSLIB_RESET_ITERATOR_FROM_REFOBJ(name,baseref) \
- do { \
+#define EDSLIB_RESET_ITERATOR_FROM_REFOBJ(name, baseref) \
+ do \
+ { \
memset(&name.Cb.StackBase[0], 0, sizeof(name.Cb.StackBase[0])); \
name.Cb.StackBase[0].Details.RefObj = baseref; \
} while (0)
@@ -223,13 +223,13 @@ typedef struct
* Macro to set an iterator to the start of a given object
* The object is specified directory as an EdsLib_Id_t
*/
-#define EDSLIB_RESET_ITERATOR_FROM_EDSID(name,edsid) \
- do { \
- memset(&name.Cb.StackBase[0], 0, sizeof(name.Cb.StackBase[0])); \
- EdsLib_Decode_StructId(&name.Cb.StackBase[0].Details.RefObj, edsid); \
+#define EDSLIB_RESET_ITERATOR_FROM_EDSID(name, edsid) \
+ do \
+ { \
+ memset(&name.Cb.StackBase[0], 0, sizeof(name.Cb.StackBase[0])); \
+ EdsLib_Decode_StructId(&name.Cb.StackBase[0].Details.RefObj, edsid); \
} while (0)
-
typedef enum
{
EDSLIB_BITPACK_OPERMODE_NONE = 0,
@@ -250,9 +250,9 @@ typedef enum
typedef struct
{
- EdsLib_EntryType_t EntryType;
- uint32_t PackedBitOffset;
- EdsLib_HandlerArgument_t HandlerArg;
+ EdsLib_EntryType_t EntryType;
+ uint32_t PackedBitOffset;
+ EdsLib_HandlerArgument_t HandlerArg;
const EdsLib_DataTypeDB_Entry_t *DictPtr;
} EdsLib_PackedPostProc_DeferredField_t;
@@ -264,50 +264,49 @@ typedef struct EdsLib_DataTypePackUnpack_ControlBlock EdsLib_DataTypePackUnpack_
* This permits a different function to be used when encoding, decoding, or
* populating or verifying error control fields.
*/
-typedef int32_t (*EdsLib_DataTypePackUnpack_HandleMemberFunc_t)(
- EdsLib_DataTypePackUnpack_ControlBlock_t *,
- const EdsLib_DataTypeIterator_StackEntry_t *,
- uint32_t,
- EdsLib_PackAction_t);
+typedef int32_t (*EdsLib_DataTypePackUnpack_HandleMemberFunc_t)(EdsLib_DataTypePackUnpack_ControlBlock_t *,
+ const EdsLib_DataTypeIterator_StackEntry_t *,
+ uint32_t,
+ EdsLib_PackAction_t);
struct EdsLib_DataTypePackUnpack_ControlBlock
{
- const void *NativeBufferPtr;
- EdsLib_DatabaseRef_t RefObj;
- EdsLib_SizeInfo_t MaxSize;
- EdsLib_SizeInfo_t LastNominalTail;
- uint32_t LastActualTailBitPos;
- int32_t Status;
- uint32_t MaxPasses;
+ const void *NativeBufferPtr;
+ EdsLib_DatabaseRef_t RefObj;
+ EdsLib_SizeInfo_t MaxSize;
+ EdsLib_SizeInfo_t LastNominalTail;
+ uint32_t LastActualTailBitPos;
+ int32_t Status;
+ uint32_t MaxPasses;
EdsLib_DataTypePackUnpack_HandleMemberFunc_t HandleMember;
};
typedef struct
{
EdsLib_DataTypePackUnpack_ControlBlock_t Common;
- const uint8_t *NativeSrcPtr;
- uint8_t *PackedDstPtr;
+ const uint8_t *NativeSrcPtr;
+ uint8_t *PackedDstPtr;
} EdsLib_DataTypePack_State_t;
typedef struct
{
EdsLib_DataTypePackUnpack_ControlBlock_t Common;
- const uint8_t *PackedSrcPtr;
- uint8_t *NativeDstPtr;
+ const uint8_t *PackedSrcPtr;
+ uint8_t *NativeDstPtr;
} EdsLib_DataTypeUnpack_State_t;
typedef struct
{
- EdsLib_DataTypePack_State_t Pack;
- uint16_t DeferredFieldCount;
+ EdsLib_DataTypePack_State_t Pack;
+ uint16_t DeferredFieldCount;
EdsLib_PackedPostProc_DeferredField_t DeferredFields[EDSLIB_PACKEDPOSTPROC_MAX_DEFERRED_FIELDS];
} EdsLib_PackedPostProc_ControlBlock_t;
typedef struct
{
EdsLib_DataTypeUnpack_State_t Unpack;
- uint32_t CheckFields;
- uint32_t RecomputeFields;
+ uint32_t CheckFields;
+ uint32_t RecomputeFields;
} EdsLib_NativePostProc_ControlBlock_t;
typedef struct
@@ -315,108 +314,110 @@ typedef struct
const EdsLib_DisplayDB_Entry_t *DisplayInf;
} EdsLib_DisplayIterator_StackEntry_t;
-typedef EdsLib_Iterator_Rc_t (*EdsLib_DisplayIterator_Callback_t)(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- const char *EntityName,
- void *OpaqueArg);
+typedef EdsLib_Iterator_Rc_t (*EdsLib_DisplayIterator_Callback_t)(
+ const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ const char *EntityName,
+ void *OpaqueArg);
typedef struct
{
EdsLib_DisplayIterator_StackEntry_t *NextStackEntry;
- EdsLib_DisplayIterator_Callback_t NextCallback;
- void *NextCallbackArg;
+ EdsLib_DisplayIterator_Callback_t NextCallback;
+ void *NextCallbackArg;
} EdsLib_DisplayDB_InternalIterator_ControlBlock_t;
-EdsLib_Iterator_Rc_t EdsLib_DisplayIterator_Wrapper(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- void *OpaqueArg);
-
-#define EDSLIB_DECLARE_DISPLAY_ITERATOR_CB(name,depth,cbfunc,cbarg) \
- struct { \
- EDSLIB_ITERATOR_CB_TYPE(depth) BaseIter; \
- EdsLib_DisplayDB_InternalIterator_ControlBlock_t DisplayCb; \
- EdsLib_DisplayIterator_StackEntry_t DisplayStack[depth]; \
- } name; \
- do { \
- EDSLIB_INITIALIZE_ITERATOR_CB(name.BaseIter,depth, \
- EdsLib_DisplayIterator_Wrapper, &name.DisplayCb); \
- name.DisplayCb.NextCallback = cbfunc; \
- name.DisplayCb.NextCallbackArg = cbarg; \
- } while(0)
-
-#define EDSLIB_RESET_DISPLAY_ITERATOR_FROM_REFOBJ(name,baseref) \
- do { \
- EDSLIB_RESET_ITERATOR_FROM_REFOBJ(name.BaseIter,baseref); \
- name.DisplayCb.NextStackEntry = name.DisplayStack; \
+EdsLib_Iterator_Rc_t EdsLib_DisplayIterator_Wrapper(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ void *OpaqueArg);
+
+#define EDSLIB_DECLARE_DISPLAY_ITERATOR_CB(name, depth, cbfunc, cbarg) \
+ struct \
+ { \
+ EDSLIB_ITERATOR_CB_TYPE(depth) BaseIter; \
+ EdsLib_DisplayDB_InternalIterator_ControlBlock_t DisplayCb; \
+ EdsLib_DisplayIterator_StackEntry_t DisplayStack[depth]; \
+ } name; \
+ do \
+ { \
+ EDSLIB_INITIALIZE_ITERATOR_CB(name.BaseIter, depth, EdsLib_DisplayIterator_Wrapper, &name.DisplayCb); \
+ name.DisplayCb.NextCallback = cbfunc; \
+ name.DisplayCb.NextCallbackArg = cbarg; \
} while (0)
-#define EDSLIB_RESET_DISPLAY_ITERATOR_FROM_EDSID(name,edsid) \
- do { \
- EDSLIB_RESET_ITERATOR_FROM_EDSID(name.BaseIter,edsid); \
- name.DisplayCb.NextStackEntry = name.DisplayStack; \
+#define EDSLIB_RESET_DISPLAY_ITERATOR_FROM_REFOBJ(name, baseref) \
+ do \
+ { \
+ EDSLIB_RESET_ITERATOR_FROM_REFOBJ(name.BaseIter, baseref); \
+ name.DisplayCb.NextStackEntry = name.DisplayStack; \
} while (0)
+#define EDSLIB_RESET_DISPLAY_ITERATOR_FROM_EDSID(name, edsid) \
+ do \
+ { \
+ EDSLIB_RESET_ITERATOR_FROM_EDSID(name.BaseIter, edsid); \
+ name.DisplayCb.NextStackEntry = name.DisplayStack; \
+ } while (0)
typedef struct
{
- EdsLib_DatabaseRef_t TargetRef;
- bool Recursive;
- EdsLib_ConstraintCallback_t UserCallback;
- void *CbArg;
- EdsLib_GenericValueBuffer_t TempConstraintValue;
+ EdsLib_DatabaseRef_t TargetRef;
+ bool Recursive;
+ EdsLib_ConstraintCallback_t UserCallback;
+ void *CbArg;
+ EdsLib_GenericValueBuffer_t TempConstraintValue;
EdsLib_DataTypeDB_EntityInfo_t TempMemberInfo;
} EdsLib_ConstraintIterator_ControlBlock_t;
typedef enum
{
- EDSLIB_MATCHQUALITY_NONE,
- EDSLIB_MATCHQUALITY_PARTIAL,
- EDSLIB_MATCHQUALITY_EXACT
+ EDSLIB_MATCHQUALITY_NONE,
+ EDSLIB_MATCHQUALITY_PARTIAL,
+ EDSLIB_MATCHQUALITY_EXACT
} EdsLib_MatchQuality_t;
typedef struct
{
- const char *NextTokenPos;
- const char *ContentPos;
+ const char *NextTokenPos;
+ const char *ContentPos;
const EdsLib_DataTypeDB_Entry_t *DataDict;
- uint32_t ContentLength;
- EdsLib_MatchQuality_t MatchQuality;
- EdsLib_DatabaseRef_t RefObj;
- EdsLib_SizeInfo_t StartOffset;
- EdsLib_SizeInfo_t MaxSize;
+ uint32_t ContentLength;
+ EdsLib_MatchQuality_t MatchQuality;
+ EdsLib_DatabaseRef_t RefObj;
+ EdsLib_SizeInfo_t StartOffset;
+ EdsLib_SizeInfo_t MaxSize;
} EdsLib_DisplayLocateMember_ControlBlock_t;
typedef struct
{
EdsLib_EntityCallback_t UserCallback;
- void *UserArg;
+ void *UserArg;
} EdsLib_DisplayUserIterator_BaseName_ControlBlock_t;
typedef struct
{
uint16_t ScratchOffset;
- bool HasNamedMembers;
+ bool HasNamedMembers;
} EdsLib_DisplayUserIterator_FullName_StackEntry_t;
-#define EDSLIB_ITERATOR_NAME_MAX_SIZE 256
-
+#define EDSLIB_ITERATOR_NAME_MAX_SIZE 256
typedef struct
{
EdsLib_DisplayUserIterator_BaseName_ControlBlock_t Base;
- EdsLib_DisplayUserIterator_FullName_StackEntry_t *NextEntry;
- char ScratchNameBuffer[EDSLIB_ITERATOR_NAME_MAX_SIZE];
+ EdsLib_DisplayUserIterator_FullName_StackEntry_t *NextEntry;
+ char ScratchNameBuffer[EDSLIB_ITERATOR_NAME_MAX_SIZE];
} EdsLib_DisplayUserIterator_FullName_ControlBlock_t;
-typedef struct EdsLib_IntfDB_FullContext
+typedef struct EdsLib_IntfDB_FullContext
{
- EdsLib_IntfDB_t IntfDBPtr;
+ EdsLib_IntfDB_t IntfDBPtr;
const EdsLib_IntfDB_ComponentEntry_t *CompEntry;
- const EdsLib_IntfDB_DeclIntfEntry_t *DeclIntfEntry;
+ const EdsLib_IntfDB_DeclIntfEntry_t *DeclIntfEntry;
const EdsLib_IntfDB_InterfaceEntry_t *CompIntfEntry;
- const EdsLib_IntfDB_CommandEntry_t *CmdEntry;
+ const EdsLib_IntfDB_CommandEntry_t *CmdEntry;
} EdsLib_IntfDB_FullContext_t;
/**********************************************************
@@ -436,12 +437,18 @@ void EdsLib_ErrorControl_Initialize(void);
*
**********************************************************/
-EdsLib_DataTypeDB_t EdsLib_DataTypeDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
-const EdsLib_DataTypeDB_Entry_t *EdsLib_DataTypeDB_GetEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj);
-void EdsLib_DataTypeDB_CopyTypeInfo(const EdsLib_DataTypeDB_Entry_t *DataDictEntry, EdsLib_DataTypeDB_TypeInfo_t *TypeInfo);
+EdsLib_DataTypeDB_t EdsLib_DataTypeDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
+const EdsLib_DataTypeDB_Entry_t *EdsLib_DataTypeDB_GetEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj);
+void EdsLib_DataTypeDB_CopyTypeInfo(const EdsLib_DataTypeDB_Entry_t *DataDictEntry,
+ EdsLib_DataTypeDB_TypeInfo_t *TypeInfo);
-void EdsLib_DataTypeLoad_Impl(EdsLib_GenericValueBuffer_t *ValueBuff, EdsLib_ConstPtr_t SrcPtr, const EdsLib_DataTypeDB_Entry_t *DictEntryPtr);
-void EdsLib_DataTypeStore_Impl(EdsLib_Ptr_t DstPtr, EdsLib_GenericValueBuffer_t *SrcBuff, const EdsLib_DataTypeDB_Entry_t *DictEntryPtr);
+void EdsLib_DataTypeLoad_Impl(EdsLib_GenericValueBuffer_t *ValueBuff,
+ EdsLib_ConstPtr_t SrcPtr,
+ const EdsLib_DataTypeDB_Entry_t *DictEntryPtr);
+void EdsLib_DataTypeStore_Impl(EdsLib_Ptr_t DstPtr,
+ EdsLib_GenericValueBuffer_t *SrcBuff,
+ const EdsLib_DataTypeDB_Entry_t *DictEntryPtr);
typedef int8_t (*EdsLib_EntryCompareFunc_t)(const void *, const EdsLib_FieldDetailEntry_t *);
typedef uint16_t (*EdsLib_GetArrayIdxFunc_t)(const void *, const EdsLib_SizeInfo_t *);
@@ -452,62 +459,86 @@ int8_t EdsLib_OffsetCompareBytes(const void *SubjectPtr, const EdsLib_FieldDetai
uint16_t EdsLib_GetArrayIdxFromBits(const void *SubjectPtr, const EdsLib_SizeInfo_t *ElemSize);
uint16_t EdsLib_GetArrayIdxFromBytes(const void *SubjectPtr, const EdsLib_SizeInfo_t *ElemSize);
-int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_DataTypeDB_Entry_t *BaseDict, const void *CompareArg, EdsLib_EntryCompareFunc_t CompFunc, EdsLib_DataTypeDB_EntityInfo_t *CompInfo);
-
-int32_t EdsLib_DataTypeDB_FindArrayMember_Impl(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_DataTypeDB_Entry_t *BaseDict, const void *GetIdxArg, EdsLib_GetArrayIdxFunc_t GetIdxFunc,
- EdsLib_DataTypeDB_EntityInfo_t *EntInfo);
-
-int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
- EdsLib_DataTypeIterator_ControlBlock_t *StateInfo);
-
-int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_ConstraintIterator_ControlBlock_t *CtlBlock, const EdsLib_DatabaseRef_t *BaseRef);
-int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t BaseId, EdsLib_Id_t DerivedId, EdsLib_ConstraintCallback_t Callback, void *CbArg);
-const EdsLib_IdentSequenceEntry_t *EdsLib_DataTypeExecuteConstraintSequence_Impl(const EdsLib_DatabaseObject_t *GD,
- const EdsLib_IdentityCheckSequence_t *CheckSequence, const void *Buffer, size_t MaxOffset);
-
-int32_t EdsLib_DataTypePack_HandleMember(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction);
-
-int32_t EdsLib_DataTypeUnpack_HandleMember(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction);
-
-int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- const EdsLib_SizeInfo_t *TargetOffset, EdsLib_DataTypeDB_EntityInfo_t *ResultInfo);
-
-int32_t EdsLib_DataTypeDB_PackUnpackFindTail(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- const EdsLib_SizeInfo_t *InputPtr, EdsLib_DataTypePackUnpack_ControlBlock_t *CbPtr);
-
-void EdsLib_DataTypePackUnpack_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_DataTypePackUnpack_ControlBlock_t *PackState);
-int32_t EdsLib_DataTypeIdentifyBuffer_Impl(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_Entry_t *DataDictPtr, const void *Buffer, size_t MaxOffset,
- uint16_t *DerivTableIndex, EdsLib_DatabaseRef_t *ActualObj);
-
-void EdsLib_DataTypeConstraintEntityLookup_Impl(const EdsLib_DataTypeDB_Entry_t *DataDictPtr, uint16_t ConstraintIdx, const EdsLib_DatabaseRef_t **RefObjPtr, EdsLib_SizeInfo_t *Offset);
-
-int32_t EdsLib_NativeObject_PostProc_Callback(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction);
-
-int32_t EdsLib_PackedObject_PostProc_Callback(
- EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
- const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
- uint32_t BitPosition,
- EdsLib_PackAction_t PackAction);
+int32_t EdsLib_DataTypeDB_FindContainerMember_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_Entry_t *BaseDict,
+ const void *CompareArg,
+ EdsLib_EntryCompareFunc_t CompFunc,
+ EdsLib_DataTypeDB_EntityInfo_t *CompInfo);
+
+int32_t EdsLib_DataTypeDB_FindArrayMember_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_Entry_t *BaseDict,
+ const void *GetIdxArg,
+ EdsLib_GetArrayIdxFunc_t GetIdxFunc,
+ EdsLib_DataTypeDB_EntityInfo_t *EntInfo);
+
+int32_t EdsLib_DataTypeIterator_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DataTypeIterator_ControlBlock_t *StateInfo);
+
+int32_t EdsLib_DataTypeDB_ConstraintIterator_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_ConstraintIterator_ControlBlock_t *CtlBlock,
+ const EdsLib_DatabaseRef_t *BaseRef);
+int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t BaseId,
+ EdsLib_Id_t DerivedId,
+ EdsLib_ConstraintCallback_t Callback,
+ void *CbArg);
+const EdsLib_IdentSequenceEntry_t *
+EdsLib_DataTypeExecuteConstraintSequence_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_IdentityCheckSequence_t *CheckSequence,
+ const void *Buffer,
+ size_t MaxOffset);
+
+int32_t EdsLib_DataTypePack_HandleMember(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction);
+
+int32_t EdsLib_DataTypeUnpack_HandleMember(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction);
+
+int32_t EdsLib_DataTypeDB_PackUnpackFindTailEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const EdsLib_SizeInfo_t *TargetOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *ResultInfo);
+
+int32_t EdsLib_DataTypeDB_PackUnpackFindTail(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const EdsLib_SizeInfo_t *InputPtr,
+ EdsLib_DataTypePackUnpack_ControlBlock_t *CbPtr);
+
+void EdsLib_DataTypePackUnpack_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DataTypePackUnpack_ControlBlock_t *PackState);
+int32_t EdsLib_DataTypeIdentifyBuffer_Impl(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ const void *Buffer,
+ size_t MaxOffset,
+ uint16_t *DerivTableIndex,
+ EdsLib_DatabaseRef_t *ActualObj);
+
+void EdsLib_DataTypeConstraintEntityLookup_Impl(const EdsLib_DataTypeDB_Entry_t *DataDictPtr,
+ uint16_t ConstraintIdx,
+ const EdsLib_DatabaseRef_t **RefObjPtr,
+ EdsLib_SizeInfo_t *Offset);
+
+int32_t EdsLib_NativeObject_PostProc_Callback(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction);
+
+int32_t EdsLib_PackedObject_PostProc_Callback(EdsLib_DataTypePackUnpack_ControlBlock_t *Parent,
+ const EdsLib_DataTypeIterator_StackEntry_t *CbInfo,
+ uint32_t BitPosition,
+ EdsLib_PackAction_t PackAction);
void EdsLib_PackedObject_PostProc_Deferred(EdsLib_PackedPostProc_ControlBlock_t *Base);
-
-void EdsLib_UpdateErrorControlField(const EdsLib_DataTypeDB_Entry_t *ErrorCtlDictPtr, void *PackedObject,
- uint32_t TotalBitSize, EdsLib_ErrorControlType_t ErrorCtlType, uint32_t ErrorCtlOffsetBits);
+void EdsLib_UpdateErrorControlField(const EdsLib_DataTypeDB_Entry_t *ErrorCtlDictPtr,
+ void *PackedObject,
+ uint32_t TotalBitSize,
+ EdsLib_ErrorControlType_t ErrorCtlType,
+ uint32_t ErrorCtlOffsetBits);
/**********************************************************
* PROTOTYPES - DisplayDB helper functions
@@ -517,36 +548,49 @@ void EdsLib_UpdateErrorControlField(const EdsLib_DataTypeDB_Entry_t *ErrorCtlDic
*
**********************************************************/
-
-EdsLib_DisplayDB_t EdsLib_DisplayDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
-const EdsLib_DisplayDB_Entry_t *EdsLib_DisplayDB_GetEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj);
-
-const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByName(const EdsLib_SymbolTableEntry_t *SymbolDict, uint16_t TableSize, const char *String, uint32_t StringLen);
-const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByValue(const EdsLib_SymbolTableEntry_t *SymbolDict, uint16_t TableSize, intmax_t Value);
-
-void EdsLib_DisplayLocateMember_Impl(const EdsLib_DatabaseObject_t *GD, EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock);
-
-EdsLib_Iterator_Rc_t EdsLib_DisplayUserIterator_BaseName_Callback(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- const char *EntityName,
- void *OpaqueArg);
-
-EdsLib_Iterator_Rc_t EdsLib_DisplayUserIterator_FullName_Callback(const EdsLib_DatabaseObject_t *GD,
- EdsLib_Iterator_CbType_t CbType,
- const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
- const char *EntityName,
- void *OpaqueArg);
-
-int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr, const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
- char *OutputBuffer, uint32_t BufferSize, const void *SourcePtr);
-
-int32_t EdsLib_DisplayScalarConv_FromString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr, const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
- void *DestPtr, const char *SrcString);
-
-
-uintmax_t EdsLib_ErrorControlCompute(EdsLib_ErrorControlType_t Algorithm, const void *Buffer, uint32_t BufferSizeBits, uint32_t ErrCtlBitPos);
-
+EdsLib_DisplayDB_t EdsLib_DisplayDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
+const EdsLib_DisplayDB_Entry_t *EdsLib_DisplayDB_GetEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj);
+
+const EdsLib_SymbolTableEntry_t *EdsLib_DisplaySymbolLookup_GetByName(const EdsLib_SymbolTableEntry_t *SymbolDict,
+ uint16_t TableSize,
+ const char *String,
+ uint32_t StringLen);
+const EdsLib_SymbolTableEntry_t *
+EdsLib_DisplaySymbolLookup_GetByValue(const EdsLib_SymbolTableEntry_t *SymbolDict, uint16_t TableSize, intmax_t Value);
+
+void EdsLib_DisplayLocateMember_Impl(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_DisplayLocateMember_ControlBlock_t *CtrlBlock);
+
+EdsLib_Iterator_Rc_t
+EdsLib_DisplayUserIterator_BaseName_Callback(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ const char *EntityName,
+ void *OpaqueArg);
+
+EdsLib_Iterator_Rc_t
+EdsLib_DisplayUserIterator_FullName_Callback(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Iterator_CbType_t CbType,
+ const EdsLib_DataTypeIterator_StackEntry_t *EntityInfo,
+ const char *EntityName,
+ void *OpaqueArg);
+
+int32_t EdsLib_DisplayScalarConv_ToString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr,
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
+ char *OutputBuffer,
+ uint32_t BufferSize,
+ const void *SourcePtr);
+
+int32_t EdsLib_DisplayScalarConv_FromString_Impl(const EdsLib_DataTypeDB_Entry_t *DictEntryPtr,
+ const EdsLib_DisplayDB_Entry_t *DisplayInfoPtr,
+ void *DestPtr,
+ const char *SrcString);
+
+uintmax_t EdsLib_ErrorControlCompute(EdsLib_ErrorControlType_t Algorithm,
+ const void *Buffer,
+ uint32_t BufferSizeBits,
+ uint32_t ErrCtlBitPos);
/**********************************************************
* PROTOTYPES - IntfDB lookup helper functions
@@ -556,19 +600,46 @@ uintmax_t EdsLib_ErrorControlCompute(EdsLib_ErrorControlType_t Algorithm, const
*
**********************************************************/
-EdsLib_IntfDB_t EdsLib_IntfDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
-const EdsLib_IntfDB_ComponentEntry_t *EdsLib_IntfDB_GetComponentEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj);
-const EdsLib_IntfDB_DeclIntfEntry_t *EdsLib_IntfDB_GetDeclIntfEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj);
-const EdsLib_IntfDB_InterfaceEntry_t *EdsLib_IntfDB_GetInterfaceEntryFromCompIdx(const EdsLib_IntfDB_ComponentEntry_t *CompEntry, uint16_t CompIdx);
-const EdsLib_IntfDB_CommandEntry_t *EdsLib_IntfDB_GetCommandEntryFromIntfIdx(const EdsLib_IntfDB_DeclIntfEntry_t *IntfEntry, uint16_t IntfIdx);
-const EdsLib_IntfDB_InterfaceEntry_t *EdsLib_IntfDB_GetComponentInterfaceEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj, const EdsLib_IntfDB_ComponentEntry_t **CompEntryOut);
-const EdsLib_IntfDB_CommandEntry_t *EdsLib_IntfDB_GetDeclIntfCommandEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj, const EdsLib_IntfDB_DeclIntfEntry_t **DeclIntfOut);
-
-int32_t EdsLib_IntfDB_FindComponentBySubstring(EdsLib_IntfDB_t IntfDBPtr, const char *CompName, size_t MatchLen, uint16_t *IdxOut);
-int32_t EdsLib_IntfDB_FindDeclIntfBySubstring(EdsLib_IntfDB_t IntfDBPtr, const char *IntfName, size_t MatchLen, uint16_t *IdxOut);
-int32_t EdsLib_IntfDB_FindComponentInterfaceBySubstring(const EdsLib_IntfDB_ComponentEntry_t *CompEntry, const char *IntfName, size_t MatchLen, uint16_t *IdxOut);
-int32_t EdsLib_IntfDB_FindComponentByQualifiedName(const EdsLib_DatabaseObject_t *GD, const char *CompName, size_t MatchLen, EdsLib_DatabaseRef_t *RefObj);
-int32_t EdsLib_IntfDB_FindDeclIntfByQualifiedName(const EdsLib_DatabaseObject_t *GD, const char *IntfName, size_t MatchLen, EdsLib_DatabaseRef_t *RefObj);
-int32_t EdsLib_IntfDB_FindFullContext(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj, EdsLib_IntfDB_FullContext_t *CtxtOut);
-
-#endif /* _EDSLIB_INTERNAL_H_ */
+EdsLib_IntfDB_t EdsLib_IntfDB_GetTopLevel(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx);
+const EdsLib_IntfDB_ComponentEntry_t *EdsLib_IntfDB_GetComponentEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj);
+const EdsLib_IntfDB_DeclIntfEntry_t *EdsLib_IntfDB_GetDeclIntfEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj);
+const EdsLib_IntfDB_InterfaceEntry_t *
+EdsLib_IntfDB_GetInterfaceEntryFromCompIdx(const EdsLib_IntfDB_ComponentEntry_t *CompEntry, uint16_t CompIdx);
+const EdsLib_IntfDB_CommandEntry_t *
+EdsLib_IntfDB_GetCommandEntryFromIntfIdx(const EdsLib_IntfDB_DeclIntfEntry_t *IntfEntry, uint16_t IntfIdx);
+const EdsLib_IntfDB_InterfaceEntry_t *
+EdsLib_IntfDB_GetComponentInterfaceEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj,
+ const EdsLib_IntfDB_ComponentEntry_t **CompEntryOut);
+const EdsLib_IntfDB_CommandEntry_t *
+EdsLib_IntfDB_GetDeclIntfCommandEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj,
+ const EdsLib_IntfDB_DeclIntfEntry_t **DeclIntfOut);
+
+int32_t EdsLib_IntfDB_FindComponentBySubstring(EdsLib_IntfDB_t IntfDBPtr,
+ const char *CompName,
+ size_t MatchLen,
+ uint16_t *IdxOut);
+int32_t EdsLib_IntfDB_FindDeclIntfBySubstring(EdsLib_IntfDB_t IntfDBPtr,
+ const char *IntfName,
+ size_t MatchLen,
+ uint16_t *IdxOut);
+int32_t EdsLib_IntfDB_FindComponentInterfaceBySubstring(const EdsLib_IntfDB_ComponentEntry_t *CompEntry,
+ const char *IntfName,
+ size_t MatchLen,
+ uint16_t *IdxOut);
+int32_t EdsLib_IntfDB_FindComponentByQualifiedName(const EdsLib_DatabaseObject_t *GD,
+ const char *CompName,
+ size_t MatchLen,
+ EdsLib_DatabaseRef_t *RefObj);
+int32_t EdsLib_IntfDB_FindDeclIntfByQualifiedName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ size_t MatchLen,
+ EdsLib_DatabaseRef_t *RefObj);
+int32_t EdsLib_IntfDB_FindFullContext(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj,
+ EdsLib_IntfDB_FullContext_t *CtxtOut);
+
+#endif /* _EDSLIB_INTERNAL_H_ */
diff --git a/edslib/fsw/src/edslib_intfdb_api.c b/edslib/fsw/src/edslib_intfdb_api.c
index 2ec32df..02224d5 100644
--- a/edslib/fsw/src/edslib_intfdb_api.c
+++ b/edslib/fsw/src/edslib_intfdb_api.c
@@ -52,7 +52,9 @@
* to ensure that this code is linked into the target.
*
*-----------------------------------------------------------------*/
-void EdsLib_IntfDB_Initialize(void) {}
+void EdsLib_IntfDB_Initialize(void)
+{
+}
/*----------------------------------------------------------------
*
@@ -76,7 +78,8 @@ void EdsLib_IntfDB_ExportComponentInfo(const EdsLib_IntfDB_ComponentEntry_t *Com
*
*-----------------------------------------------------------------*/
void EdsLib_IntfDB_ExportCommandInfo(const EdsLib_IntfDB_CommandEntry_t *CmdEntry,
- EdsLib_IntfDB_CommandInfo_t *CmdInfoBuffer, const EdsLib_DatabaseRef_t *SelfRefObj)
+ EdsLib_IntfDB_CommandInfo_t *CmdInfoBuffer,
+ const EdsLib_DatabaseRef_t *SelfRefObj)
{
EdsLib_DatabaseRef_t ParentRefObj;
@@ -121,7 +124,8 @@ void EdsLib_IntfDB_ExportInterfaceInfo(const EdsLib_IntfDB_InterfaceEntry_t *Int
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t ComponentId,
+int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t ComponentId,
EdsLib_IntfDB_ComponentInfo_t *CompInfoBuffer)
{
const EdsLib_IntfDB_ComponentEntry_t *CompEntry;
@@ -150,8 +154,10 @@ int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD, EdsLib
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx, const char *CompName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD,
+ uint16_t AppIdx,
+ const char *CompName,
+ EdsLib_Id_t *IdBuffer)
{
EdsLib_IntfDB_t IntfDBPtr;
EdsLib_DatabaseRef_t RefObj;
@@ -190,8 +196,10 @@ int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t ComponentId,
- const char *IntfName, EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t ComponentId,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
const EdsLib_IntfDB_ComponentEntry_t *CompEntry;
EdsLib_DatabaseRef_t RefObj;
@@ -231,8 +239,9 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObj
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
EdsLib_DatabaseRef_t RefObj;
int32_t Status;
@@ -260,8 +269,9 @@ int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObjec
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
const EdsLib_IntfDB_ComponentEntry_t *CompEntry;
const char *Separator;
@@ -296,7 +306,9 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObje
}
else
{
- Status = EdsLib_IntfDB_FindComponentInterfaceBySubstring(CompEntry, Separator, strlen(Separator),
+ Status = EdsLib_IntfDB_FindComponentInterfaceBySubstring(CompEntry,
+ Separator,
+ strlen(Separator),
&RefObj.SubIndex);
}
}
@@ -322,8 +334,10 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObje
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx,
- const char *IntfName, EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD,
+ uint16_t AppIdx,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
EdsLib_IntfDB_t IntfDBPtr;
const EdsLib_IntfDB_DeclIntfEntry_t *IntfPtr;
@@ -374,8 +388,10 @@ int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObje
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId, const char *CmdName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
+ const char *CmdName,
+ EdsLib_Id_t *IdBuffer)
{
const EdsLib_IntfDB_DeclIntfEntry_t *IntfEntry;
const EdsLib_IntfDB_CommandEntry_t *CmdEntry;
@@ -432,8 +448,9 @@ int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD,
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t CommandId,
- EdsLib_IntfDB_CommandInfo_t *CommandInfoBuffer)
+int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t CommandId,
+ EdsLib_IntfDB_CommandInfo_t *CommandInfoBuffer)
{
const EdsLib_IntfDB_CommandEntry_t *CmdEntry;
EdsLib_DatabaseRef_t RefObj;
@@ -461,7 +478,8 @@ int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_I
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId,
+int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
EdsLib_IntfDB_InterfaceInfo_t *IntfInfoBuffer)
{
const EdsLib_IntfDB_InterfaceEntry_t *IntfEntry;
@@ -490,8 +508,11 @@ int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *G
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t CmdEdsId,
- EdsLib_Id_t CompIntfEdsId, EdsLib_Id_t *IdBuffer, size_t NumIdBufs)
+int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t CmdEdsId,
+ EdsLib_Id_t CompIntfEdsId,
+ EdsLib_Id_t *IdBuffer,
+ size_t NumIdBufs)
{
const EdsLib_IntfDB_InterfaceEntry_t *IntfEntry;
const EdsLib_IntfDB_CommandEntry_t *CmdEntry;
@@ -575,8 +596,10 @@ int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD, Ed
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId, EdsLib_Id_t *IdBuffer,
- size_t NumIdBufs)
+int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
+ EdsLib_Id_t *IdBuffer,
+ size_t NumIdBufs)
{
const EdsLib_IntfDB_DeclIntfEntry_t *DeclIntfEntry;
EdsLib_DatabaseRef_t RefObj;
@@ -622,8 +645,8 @@ int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD, EdsLib_
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *BufferPtr,
- size_t BufferLen)
+int32_t
+EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *BufferPtr, size_t BufferLen)
{
int32_t Status;
EdsLib_IntfDB_FullContext_t Ctxt;
@@ -659,7 +682,7 @@ int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
}
LengthRemain -= PrintLen;
- CurrPtr += PrintLen;
+ CurrPtr += PrintLen;
/* Note, only one or two of these pointers can be non-null at the same time */
if (Ctxt.DeclIntfEntry != NULL)
@@ -671,7 +694,7 @@ int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
break;
}
LengthRemain -= PrintLen;
- CurrPtr += PrintLen;
+ CurrPtr += PrintLen;
}
if (Ctxt.CompEntry != NULL)
{
@@ -682,7 +705,7 @@ int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
break;
}
LengthRemain -= PrintLen;
- CurrPtr += PrintLen;
+ CurrPtr += PrintLen;
}
if (Ctxt.CmdEntry != NULL)
{
@@ -693,7 +716,7 @@ int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
break;
}
LengthRemain -= PrintLen;
- CurrPtr += PrintLen;
+ CurrPtr += PrintLen;
}
if (Ctxt.CompIntfEntry != NULL)
{
@@ -704,7 +727,7 @@ int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
break;
}
LengthRemain -= PrintLen;
- CurrPtr += PrintLen;
+ CurrPtr += PrintLen;
}
} while (false);
diff --git a/edslib/fsw/src/edslib_intfdb_lookup.c b/edslib/fsw/src/edslib_intfdb_lookup.c
index 40a288d..17f90d8 100644
--- a/edslib/fsw/src/edslib_intfdb_lookup.c
+++ b/edslib/fsw/src/edslib_intfdb_lookup.c
@@ -202,7 +202,8 @@ EdsLib_IntfDB_GetCommandEntryFromIntfIdx(const EdsLib_IntfDB_DeclIntfEntry_t *In
*
*-----------------------------------------------------------------*/
const EdsLib_IntfDB_InterfaceEntry_t *
-EdsLib_IntfDB_GetComponentInterfaceEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj,
+EdsLib_IntfDB_GetComponentInterfaceEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj,
const EdsLib_IntfDB_ComponentEntry_t **CompEntryOut)
{
EdsLib_IntfDB_t IntfDB;
@@ -252,7 +253,8 @@ EdsLib_IntfDB_GetComponentInterfaceEntry(const EdsLib_DatabaseObject_t *GD, cons
*
*-----------------------------------------------------------------*/
const EdsLib_IntfDB_CommandEntry_t *
-EdsLib_IntfDB_GetDeclIntfCommandEntry(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj,
+EdsLib_IntfDB_GetDeclIntfCommandEntry(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj,
const EdsLib_IntfDB_DeclIntfEntry_t **DeclIntfOut)
{
EdsLib_IntfDB_t IntfDB;
@@ -261,7 +263,7 @@ EdsLib_IntfDB_GetDeclIntfCommandEntry(const EdsLib_DatabaseObject_t *GD, const E
uint16_t i;
IntfEntry = NULL;
- CmdEntry = NULL;
+ CmdEntry = NULL;
do
{
@@ -301,8 +303,10 @@ EdsLib_IntfDB_GetDeclIntfCommandEntry(const EdsLib_DatabaseObject_t *GD, const E
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindComponentBySubstring(EdsLib_IntfDB_t IntfDBPtr, const char *CompName, size_t MatchLen,
- uint16_t *IdxOut)
+int32_t EdsLib_IntfDB_FindComponentBySubstring(EdsLib_IntfDB_t IntfDBPtr,
+ const char *CompName,
+ size_t MatchLen,
+ uint16_t *IdxOut)
{
const EdsLib_IntfDB_ComponentEntry_t *CompEntry;
int32_t Status;
@@ -314,8 +318,8 @@ int32_t EdsLib_IntfDB_FindComponentBySubstring(EdsLib_IntfDB_t IntfDBPtr, const
{
CompEntry = &IntfDBPtr->ComponentListEntries[i];
- if (CompEntry->Name != NULL && strlen(CompEntry->Name) == MatchLen &&
- memcmp(CompEntry->Name, CompName, MatchLen) == 0)
+ if (CompEntry->Name != NULL && strlen(CompEntry->Name) == MatchLen
+ && memcmp(CompEntry->Name, CompName, MatchLen) == 0)
{
*IdxOut = 1 + IntfDBPtr->DeclIntfListSize + i;
Status = EDSLIB_SUCCESS;
@@ -332,8 +336,10 @@ int32_t EdsLib_IntfDB_FindComponentBySubstring(EdsLib_IntfDB_t IntfDBPtr, const
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindDeclIntfBySubstring(EdsLib_IntfDB_t IntfDBPtr, const char *IntfName, size_t MatchLen,
- uint16_t *IdxOut)
+int32_t EdsLib_IntfDB_FindDeclIntfBySubstring(EdsLib_IntfDB_t IntfDBPtr,
+ const char *IntfName,
+ size_t MatchLen,
+ uint16_t *IdxOut)
{
const EdsLib_IntfDB_DeclIntfEntry_t *DeclIntfEntry;
int32_t Status;
@@ -345,8 +351,8 @@ int32_t EdsLib_IntfDB_FindDeclIntfBySubstring(EdsLib_IntfDB_t IntfDBPtr, const c
{
DeclIntfEntry = &IntfDBPtr->DeclIntfListEntries[i];
- if (DeclIntfEntry->Name != NULL && strlen(DeclIntfEntry->Name) == MatchLen &&
- memcmp(DeclIntfEntry->Name, IntfName, MatchLen) == 0)
+ if (DeclIntfEntry->Name != NULL && strlen(DeclIntfEntry->Name) == MatchLen
+ && memcmp(DeclIntfEntry->Name, IntfName, MatchLen) == 0)
{
*IdxOut = 1 + i;
Status = EDSLIB_SUCCESS;
@@ -364,7 +370,9 @@ int32_t EdsLib_IntfDB_FindDeclIntfBySubstring(EdsLib_IntfDB_t IntfDBPtr, const c
*
*-----------------------------------------------------------------*/
int32_t EdsLib_IntfDB_FindComponentInterfaceBySubstring(const EdsLib_IntfDB_ComponentEntry_t *CompEntry,
- const char *IntfName, size_t MatchLen, uint16_t *IdxOut)
+ const char *IntfName,
+ size_t MatchLen,
+ uint16_t *IdxOut)
{
const EdsLib_IntfDB_InterfaceEntry_t *IntfEntry;
uint16_t CompIdx;
@@ -378,8 +386,8 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceBySubstring(const EdsLib_IntfDB_Comp
{
IntfEntry = EdsLib_IntfDB_GetInterfaceEntryFromCompIdx(CompEntry, CompIdx);
- if (IntfEntry != NULL && IntfEntry->Name != NULL && strlen(IntfEntry->Name) == MatchLen &&
- memcmp(IntfEntry->Name, IntfName, MatchLen) == 0)
+ if (IntfEntry != NULL && IntfEntry->Name != NULL && strlen(IntfEntry->Name) == MatchLen
+ && memcmp(IntfEntry->Name, IntfName, MatchLen) == 0)
{
*IdxOut = CompIdx;
@@ -400,8 +408,10 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceBySubstring(const EdsLib_IntfDB_Comp
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindDeclIntfByQualifiedName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- size_t MatchLen, EdsLib_DatabaseRef_t *RefObj)
+int32_t EdsLib_IntfDB_FindDeclIntfByQualifiedName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ size_t MatchLen,
+ EdsLib_DatabaseRef_t *RefObj)
{
EdsLib_IntfDB_t IntfDBPtr;
const char *Sep;
@@ -430,7 +440,7 @@ int32_t EdsLib_IntfDB_FindDeclIntfByQualifiedName(const EdsLib_DatabaseObject_t
}
CurrChunkPtr += CurrChunkLen + 1;
- CurrChunkLen = MatchLen - (CurrChunkPtr - IntfName);
+ CurrChunkLen = MatchLen - (CurrChunkPtr - IntfName);
}
if (IntfDBPtr != NULL)
@@ -452,8 +462,10 @@ int32_t EdsLib_IntfDB_FindDeclIntfByQualifiedName(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindComponentByQualifiedName(const EdsLib_DatabaseObject_t *GD, const char *CompName,
- size_t MatchLen, EdsLib_DatabaseRef_t *RefObj)
+int32_t EdsLib_IntfDB_FindComponentByQualifiedName(const EdsLib_DatabaseObject_t *GD,
+ const char *CompName,
+ size_t MatchLen,
+ EdsLib_DatabaseRef_t *RefObj)
{
EdsLib_IntfDB_t IntfDBPtr;
const char *Sep;
@@ -482,7 +494,7 @@ int32_t EdsLib_IntfDB_FindComponentByQualifiedName(const EdsLib_DatabaseObject_t
}
CurrChunkPtr += CurrChunkLen + 1;
- CurrChunkLen = MatchLen - (CurrChunkPtr - CompName);
+ CurrChunkLen = MatchLen - (CurrChunkPtr - CompName);
}
if (IntfDBPtr != NULL)
@@ -504,8 +516,9 @@ int32_t EdsLib_IntfDB_FindComponentByQualifiedName(const EdsLib_DatabaseObject_t
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
-int32_t EdsLib_IntfDB_FindFullContext(const EdsLib_DatabaseObject_t *GD, const EdsLib_DatabaseRef_t *RefObj,
- EdsLib_IntfDB_FullContext_t *CtxtOut)
+int32_t EdsLib_IntfDB_FindFullContext(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DatabaseRef_t *RefObj,
+ EdsLib_IntfDB_FullContext_t *CtxtOut)
{
EdsLib_IntfDB_t IntfDBPtr;
const EdsLib_IntfDB_ComponentEntry_t *CompEntry;
diff --git a/edslib/fsw/unit-test/edslib_datatypedb_test.c b/edslib/fsw/unit-test/edslib_datatypedb_test.c
index a840157..0ea8d0d 100644
--- a/edslib/fsw/unit-test/edslib_datatypedb_test.c
+++ b/edslib/fsw/unit-test/edslib_datatypedb_test.c
@@ -38,14 +38,14 @@
#include "edslib_datatypedb.h"
-const char *UT_DYNAMIC_APPNAME_TABLE[UT_MAX_INDEX] = {NULL};
-EdsLib_DataTypeDB_t UT_DYNAMIC_DATATYPEDB_TABLE[UT_MAX_INDEX] = {NULL};
+const char *UT_DYNAMIC_APPNAME_TABLE[UT_MAX_INDEX] = { NULL };
+EdsLib_DataTypeDB_t UT_DYNAMIC_DATATYPEDB_TABLE[UT_MAX_INDEX] = { NULL };
-EdsLib_DatabaseObject_t UT_DYNAMIC_DB = {.AppTableSize = UT_MAX_INDEX,
- .AppName_Table = UT_DYNAMIC_APPNAME_TABLE,
- .DataTypeDB_Table = UT_DYNAMIC_DATATYPEDB_TABLE,
- .DisplayDB_Table = NULL,
- .IntfDB_Table = NULL};
+EdsLib_DatabaseObject_t UT_DYNAMIC_DB = { .AppTableSize = UT_MAX_INDEX,
+ .AppName_Table = UT_DYNAMIC_APPNAME_TABLE,
+ .DataTypeDB_Table = UT_DYNAMIC_DATATYPEDB_TABLE,
+ .DisplayDB_Table = NULL,
+ .IntfDB_Table = NULL };
void Test_EdsLib_DataTypeDB_Initialize(void)
{
@@ -165,8 +165,10 @@ void Test_EdsLib_DataTypeDB_GetDerivedInfo(void)
UtAssert_INT32_EQ(EdsLib_DataTypeDB_GetDerivedInfo(&UT_DATABASE, UT_EDS_CMDHDR_ID, &DerivInfo), EDSLIB_SUCCESS);
}
-void UtConstraintCallback(const EdsLib_DatabaseObject_t *GD, const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
- EdsLib_GenericValueBuffer_t *ConstraintValue, void *Arg)
+void UtConstraintCallback(const EdsLib_DatabaseObject_t *GD,
+ const EdsLib_DataTypeDB_EntityInfo_t *MemberInfo,
+ EdsLib_GenericValueBuffer_t *ConstraintValue,
+ void *Arg)
{
}
@@ -177,8 +179,11 @@ void Test_EdsLib_DataTypeDB_ConstraintIterator(void)
* DerivedId, EdsLib_ConstraintCallback_t Callback, void *CbArg);
*/
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_ConstraintIterator(&UT_DATABASE, UT_EDS_CMDHDR_ID, UT_EDS_CMD1_ID,
- UtConstraintCallback, NULL),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_ConstraintIterator(&UT_DATABASE,
+ UT_EDS_CMDHDR_ID,
+ UT_EDS_CMD1_ID,
+ UtConstraintCallback,
+ NULL),
EDSLIB_SUCCESS);
}
@@ -206,7 +211,11 @@ void Test_EdsLib_DataTypeDB_PackCompleteObject(void)
memset(&PackBuf, 0xAA, sizeof(PackBuf));
EdsId = UT_EDS_CMD1_ID;
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId, &PackBuf, &CmdBuf, sizeof(PackBuf) * 8,
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId,
+ &PackBuf,
+ &CmdBuf,
+ sizeof(PackBuf) * 8,
sizeof(CmdBuf)),
EDSLIB_SUCCESS);
}
@@ -252,8 +261,13 @@ void Test_EdsLib_DataTypeDB_PackPartialObject(void)
memset(&PackBuf, 0xAA, sizeof(PackBuf));
EdsId = UT_EDS_CMD1_ID;
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackPartialObject(&UT_DATABASE, &EdsId, &PackBuf, &CmdBuf, sizeof(PackBuf) * 8,
- sizeof(CmdBuf), 0),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackPartialObject(&UT_DATABASE,
+ &EdsId,
+ &PackBuf,
+ &CmdBuf,
+ sizeof(PackBuf) * 8,
+ sizeof(CmdBuf),
+ 0),
EDSLIB_SUCCESS);
}
@@ -271,7 +285,11 @@ void Test_EdsLib_DataTypeDB_UnpackCompleteObject(void)
memset(&PackBuf, 0, sizeof(PackBuf));
EdsId = UT_EDS_CMDHDR_ID;
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId, &CmdBuf, &PackBuf, sizeof(CmdBuf),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId,
+ &CmdBuf,
+ &PackBuf,
+ sizeof(CmdBuf),
sizeof(PackBuf) * 8),
EDSLIB_SUCCESS);
}
@@ -317,8 +335,13 @@ void Test_EdsLib_DataTypeDB_UnpackPartialObject(void)
memset(&PackBuf, 0, sizeof(PackBuf));
EdsId = UT_EDS_CMDHDR_ID;
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackPartialObject(&UT_DATABASE, &EdsId, &CmdBuf, &PackBuf, sizeof(CmdBuf),
- sizeof(PackBuf) * 8, 0),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackPartialObject(&UT_DATABASE,
+ &EdsId,
+ &CmdBuf,
+ &PackBuf,
+ sizeof(CmdBuf),
+ sizeof(PackBuf) * 8,
+ 0),
EDSLIB_SUCCESS);
}
@@ -372,7 +395,11 @@ void Test_EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(void)
ProcessedSize.Bits = EdsLib_OCTETS_TO_BITS(sizeof(PackBuf));
ProcessedSize.Bytes = sizeof(CmdBuf);
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(&UT_DATABASE, UT_EDS_CMD1_ID, &CmdBuf, &PackBuf, 0,
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(&UT_DATABASE,
+ UT_EDS_CMD1_ID,
+ &CmdBuf,
+ &PackBuf,
+ 0,
&ProcessedSize),
EDSLIB_SUCCESS);
}
@@ -463,7 +490,10 @@ void Test_EdsLib_DataTypeDB_IdentifyBufferWithSize(void)
/* Setup */
UtAssert_INT32_EQ(EdsLib_DataTypeDB_InitializeNativeObject(&UT_DATABASE, UT_EDS_CMD1_ID, &CmdBuf), EDSLIB_SUCCESS);
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_IdentifyBufferWithSize(&UT_DATABASE, UT_EDS_CMDHDR_ID, &CmdBuf, sizeof(CmdBuf),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_IdentifyBufferWithSize(&UT_DATABASE,
+ UT_EDS_CMDHDR_ID,
+ &CmdBuf,
+ sizeof(CmdBuf),
&DerivObjInfo),
EDSLIB_SUCCESS);
@@ -524,14 +554,22 @@ void UtTest_Setup(void)
UtTest_Add(Test_EdsLib_DataTypeDB_ConstraintIterator, NULL, NULL, "EdsLib_DataTypeDB_ConstraintIterator");
UtTest_Add(Test_EdsLib_DataTypeDB_BaseCheck, NULL, NULL, "EdsLib_DataTypeDB_BaseCheck");
UtTest_Add(Test_EdsLib_DataTypeDB_PackCompleteObject, NULL, NULL, "EdsLib_DataTypeDB_PackCompleteObject");
- UtTest_Add(Test_EdsLib_DataTypeDB_PackPartialObjectVarSize, NULL, NULL,
+ UtTest_Add(Test_EdsLib_DataTypeDB_PackPartialObjectVarSize,
+ NULL,
+ NULL,
"EdsLib_DataTypeDB_PackPartialObjectVarSize");
UtTest_Add(Test_EdsLib_DataTypeDB_UnpackCompleteObject, NULL, NULL, "EdsLib_DataTypeDB_UnpackCompleteObject");
- UtTest_Add(Test_EdsLib_DataTypeDB_UnpackPartialObjectVarSize, NULL, NULL,
+ UtTest_Add(Test_EdsLib_DataTypeDB_UnpackPartialObjectVarSize,
+ NULL,
+ NULL,
"EdsLib_DataTypeDB_UnpackPartialObjectVarSize");
- UtTest_Add(Test_EdsLib_DataTypeDB_FinalizePackedObjectVarSize, NULL, NULL,
+ UtTest_Add(Test_EdsLib_DataTypeDB_FinalizePackedObjectVarSize,
+ NULL,
+ NULL,
"EdsLib_DataTypeDB_FinalizePackedObjectVarSize");
- UtTest_Add(Test_EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize, NULL, NULL,
+ UtTest_Add(Test_EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize,
+ NULL,
+ NULL,
"EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize");
UtTest_Add(Test_EdsLib_DataTypeDB_InitializeNativeObject, NULL, NULL, "EdsLib_DataTypeDB_InitializeNativeObject");
UtTest_Add(Test_EdsLib_DataTypeDB_LoadValue, NULL, NULL, "EdsLib_DataTypeDB_LoadValue");
diff --git a/edslib/fsw/unit-test/edslib_displaydb_test.c b/edslib/fsw/unit-test/edslib_displaydb_test.c
index 284af25..23a051f 100644
--- a/edslib/fsw/unit-test/edslib_displaydb_test.c
+++ b/edslib/fsw/unit-test/edslib_displaydb_test.c
@@ -136,7 +136,9 @@ void Test_EdsLib_DisplayDB_GetNameByIndex(void)
UtAssert_STRINGBUF_EQ(Name, -1, "Cmd1Data1", -1);
}
-static void Test_EntityCallback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc) {}
+static void Test_EntityCallback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc)
+{
+}
void Test_EdsLib_DisplayDB_IterateBaseEntities(void)
{
@@ -178,7 +180,7 @@ void Test_EdsLib_Generate_Hexdump(void)
/* Test Case for:
* void EdsLib_Generate_Hexdump(void *output, const uint8_t *DataPtr, uint16_t DisplayOffset, uint16_t Count);
*/
- const uint8_t Data[] = {0x0A, 0x0B, 0x0C, 0x0D};
+ const uint8_t Data[] = { 0x0A, 0x0B, 0x0C, 0x0D };
UtAssert_VOIDCALL(EdsLib_Generate_Hexdump(stdout, Data, 0, sizeof(Data)));
}
@@ -238,7 +240,9 @@ void Test_EdsLib_DisplayDB_GetEnumValue(void)
UtAssert_UINT32_EQ(ValueBuffer.Value.UnsignedInteger, 142);
}
-static void Test_SymbolCallback(void *Arg, const char *SymbolName, int32_t SymbolValue) {}
+static void Test_SymbolCallback(void *Arg, const char *SymbolName, int32_t SymbolValue)
+{
+}
void Test_EdsLib_DisplayDB_IterateEnumValues(void)
{
diff --git a/edslib/fsw/unit-test/edslib_intfdb_test.c b/edslib/fsw/unit-test/edslib_intfdb_test.c
index ada9e0a..f260ce7 100644
--- a/edslib/fsw/unit-test/edslib_intfdb_test.c
+++ b/edslib/fsw/unit-test/edslib_intfdb_test.c
@@ -229,13 +229,21 @@ void UtTest_Setup(void)
{
UtTest_Add(Test_EdsLib_IntfDB_Initialize, NULL, NULL, "EdsLib_IntfDB_Initialize");
UtTest_Add(Test_EdsLib_IntfDB_FindComponentByLocalName, NULL, NULL, "EdsLib_IntfDB_FindComponentByLocalName");
- UtTest_Add(Test_EdsLib_IntfDB_FindDeclaredInterfaceByLocalName, NULL, NULL,
+ UtTest_Add(Test_EdsLib_IntfDB_FindDeclaredInterfaceByLocalName,
+ NULL,
+ NULL,
"EdsLib_IntfDB_FindDeclaredInterfaceByLocalName");
- UtTest_Add(Test_EdsLib_IntfDB_FindDeclaredInterfaceByFullName, NULL, NULL,
+ UtTest_Add(Test_EdsLib_IntfDB_FindDeclaredInterfaceByFullName,
+ NULL,
+ NULL,
"EdsLib_IntfDB_FindDeclaredInterfaceByFullName");
- UtTest_Add(Test_EdsLib_IntfDB_FindComponentInterfaceByLocalName, NULL, NULL,
+ UtTest_Add(Test_EdsLib_IntfDB_FindComponentInterfaceByLocalName,
+ NULL,
+ NULL,
"EdsLib_IntfDB_FindComponentInterfaceByLocalName");
- UtTest_Add(Test_EdsLib_IntfDB_FindComponentInterfaceByFullName, NULL, NULL,
+ UtTest_Add(Test_EdsLib_IntfDB_FindComponentInterfaceByFullName,
+ NULL,
+ NULL,
"EdsLib_IntfDB_FindComponentInterfaceByFullName");
UtTest_Add(Test_EdsLib_IntfDB_FindCommandByLocalName, NULL, NULL, "EdsLib_IntfDB_FindCommandByLocalName");
UtTest_Add(Test_EdsLib_IntfDB_FindAllCommands, NULL, NULL, "EdsLib_IntfDB_FindAllCommands");
diff --git a/edslib/fsw/unit-test/edslib_pack_test.c b/edslib/fsw/unit-test/edslib_pack_test.c
index 8d460a3..0c26650 100644
--- a/edslib/fsw/unit-test/edslib_pack_test.c
+++ b/edslib/fsw/unit-test/edslib_pack_test.c
@@ -87,15 +87,19 @@ void Test_ALL_BOOLEANS(void)
unsigned char *vector = TESTDATA_ALL_BOOLEANS_bin;
size_t len = TESTDATA_ALL_BOOLEANS_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_t *NativeObj = &UtRef_ALL_BOOLEANS;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -114,8 +118,12 @@ void Test_ALL_FLOATS(void)
memset(&PackObj, 0xEE, sizeof(PackObj));
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_FLOATS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -125,15 +133,19 @@ void Test_ALL_SIGNED_INTS(void)
unsigned char *vector = TESTDATA_ALL_SIGNED_INTS_bin;
size_t len = TESTDATA_ALL_SIGNED_INTS_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_t *NativeObj = &UtRef_ALL_SIGNED_INTS;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -143,15 +155,19 @@ void Test_ALL_UNSIGNED_INTS(void)
unsigned char *vector = TESTDATA_ALL_UNSIGNED_INTS_bin;
size_t len = TESTDATA_ALL_UNSIGNED_INTS_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_t *NativeObj = &UtRef_ALL_UNSIGNED_INTS;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -161,15 +177,19 @@ void Test_COMPOUND_TYPES(void)
unsigned char *vector = TESTDATA_COMPOUND_TYPES_bin;
size_t len = TESTDATA_COMPOUND_TYPES_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_t *NativeObj = &UtRef_COMPOUND_TYPES;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -188,8 +208,12 @@ void Test_DERIV_F64(void)
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_F64_t));
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_BASE_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -206,8 +230,12 @@ void Test_DERIV_U16(void)
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_U16_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_U16_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -224,8 +252,12 @@ void Test_DERIV_U32(void)
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_U32_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_U32_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -244,8 +276,12 @@ void Test_ER_EVEN_FOUR(void)
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t));
@@ -320,8 +356,12 @@ void Test_ER_ODD_ONE(void)
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t));
@@ -389,15 +429,19 @@ void Test_ERRCTL_CHECKSUM(void)
unsigned char *vector = TESTDATA_ERRCTL_CHECKSUM_bin;
size_t len = TESTDATA_ERRCTL_CHECKSUM_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_t *NativeObj = &UtRef_ERRCTL_CHECKSUM;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -418,8 +462,12 @@ void Test_ERRCTL_CHECKSUM_LONGITUDINAL(void)
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_LONGITUDINAL_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_LONGITUDINAL_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -429,15 +477,19 @@ void Test_ERRCTL_CRC16EL(void)
unsigned char *vector = TESTDATA_ERRCTL_CRC16EL_bin;
size_t len = TESTDATA_ERRCTL_CRC16EL_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_t *NativeObj = &UtRef_ERRCTL_CRC16EL;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -454,8 +506,12 @@ void Test_ERRCTL_CRC8(void)
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC8_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC8_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -473,8 +529,12 @@ void Test_MFLOAT32EBxEU3(void)
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_MFLOAT32EBxEU3_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_MFLOAT32EBxEU3_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(UtRef_MFLOAT32EBxEU3)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(UtRef_MFLOAT32EBxEU3)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -485,16 +545,20 @@ void Test_OPTIONAL_DIRECT_350(void)
unsigned char *vector = TESTDATA_OPTIONAL_DIRECT_350_bin;
size_t len = TESTDATA_OPTIONAL_DIRECT_350_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t *NativeObj = &UtRef_OPTIONAL_DIRECT_350;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t));
@@ -511,9 +575,9 @@ void Test_OPTIONAL_DIRECT_450(void)
unsigned char *vector = TESTDATA_OPTIONAL_DIRECT_450_bin;
size_t len = TESTDATA_OPTIONAL_DIRECT_450_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t *NativeObj = &UtRef_OPTIONAL_DIRECT_450;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -535,16 +599,20 @@ void Test_OPTIONAL_FIRST_4(void)
unsigned char *vector = TESTDATA_OPTIONAL_FIRST_4_bin;
size_t len = TESTDATA_OPTIONAL_FIRST_4_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t *NativeObj = &UtRef_OPTIONAL_FIRST_4;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t));
@@ -563,9 +631,9 @@ void Test_OPTIONAL_FIRST_5(void)
unsigned char *vector = TESTDATA_OPTIONAL_FIRST_5_bin;
size_t len = TESTDATA_OPTIONAL_FIRST_5_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t *NativeObj = &UtRef_OPTIONAL_FIRST_5;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -586,16 +654,20 @@ void Test_OPTIONAL_LAST_8(void)
unsigned char *vector = TESTDATA_OPTIONAL_LAST_8_bin;
size_t len = TESTDATA_OPTIONAL_LAST_8_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t *NativeObj = &UtRef_OPTIONAL_LAST_8;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t));
@@ -614,9 +686,9 @@ void Test_OPTIONAL_LAST_9(void)
unsigned char *vector = TESTDATA_OPTIONAL_LAST_9_bin;
size_t len = TESTDATA_OPTIONAL_LAST_9_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t *NativeObj = &UtRef_OPTIONAL_LAST_9;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -637,16 +709,20 @@ void Test_OPTIONAL_MID_6(void)
unsigned char *vector = TESTDATA_OPTIONAL_MID_6_bin;
size_t len = TESTDATA_OPTIONAL_MID_6_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t *NativeObj = &UtRef_OPTIONAL_MID_6;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t));
@@ -665,9 +741,9 @@ void Test_OPTIONAL_MID_7(void)
unsigned char *vector = TESTDATA_OPTIONAL_MID_7_bin;
size_t len = TESTDATA_OPTIONAL_MID_7_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t *NativeObj = &UtRef_OPTIONAL_MID_7;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -688,16 +764,20 @@ void Test_OPTIONAL_MULTI_10(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_10_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_10_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t *NativeObj = &UtRef_OPTIONAL_MULTI_10;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
/* Include validation that the var size API must be used for this */
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_NOT_FIXED_SIZE);
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t));
@@ -716,9 +796,9 @@ void Test_OPTIONAL_MULTI_11(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_11_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_11_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t *NativeObj = &UtRef_OPTIONAL_MULTI_11;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -739,9 +819,9 @@ void Test_OPTIONAL_MULTI_12(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_12_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_12_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t *NativeObj = &UtRef_OPTIONAL_MULTI_12;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -762,9 +842,9 @@ void Test_OPTIONAL_MULTI_13(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_13_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_13_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t *NativeObj = &UtRef_OPTIONAL_MULTI_13;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t PackObj;
EdsLib_SizeInfo_t SizeInfo;
@@ -785,15 +865,19 @@ void Test_OVERRIDE_TYPES(void)
unsigned char *vector = TESTDATA_OVERRIDE_TYPES_bin;
size_t len = TESTDATA_OVERRIDE_TYPES_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
const EdsDataType_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_t *NativeObj = &UtRef_OVERRIDE_TYPES;
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(*NativeObj)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(*NativeObj)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
@@ -811,8 +895,12 @@ void Test_S6EBx4(void)
EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_S6EBx4_t PackObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_S6EBx4_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE, &EdsId_Base, PackObj, NativeObj,
- sizeof(PackObj) * 8, sizeof(UtRef_S6EBx4)),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_PackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ PackObj,
+ NativeObj,
+ sizeof(PackObj) * 8,
+ sizeof(UtRef_S6EBx4)),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
UtAssert_Eds_Contents(vector, PackObj, len);
diff --git a/edslib/fsw/unit-test/edslib_unpack_test.c b/edslib/fsw/unit-test/edslib_unpack_test.c
index 263e634..f1fe385 100644
--- a/edslib/fsw/unit-test/edslib_unpack_test.c
+++ b/edslib/fsw/unit-test/edslib_unpack_test.c
@@ -62,7 +62,10 @@ void Test_Contents(void *Arg, const EdsLib_EntityDescriptor_t *Param)
if (Pair->ref)
{
- EdsLib_Scalar_ToString(&UT_DATABASE, Param->EntityInfo.EdsId, ref_buffer, sizeof(ref_buffer),
+ EdsLib_Scalar_ToString(&UT_DATABASE,
+ Param->EntityInfo.EdsId,
+ ref_buffer,
+ sizeof(ref_buffer),
&Pair->ref[Param->EntityInfo.Offset.Bytes]);
}
else
@@ -72,7 +75,10 @@ void Test_Contents(void *Arg, const EdsLib_EntityDescriptor_t *Param)
if (Pair->actual)
{
- EdsLib_Scalar_ToString(&UT_DATABASE, Param->EntityInfo.EdsId, actual_buffer, sizeof(actual_buffer),
+ EdsLib_Scalar_ToString(&UT_DATABASE,
+ Param->EntityInfo.EdsId,
+ actual_buffer,
+ sizeof(actual_buffer),
&Pair->actual[Param->EntityInfo.Offset.Bytes]);
}
else
@@ -80,14 +86,16 @@ void Test_Contents(void *Arg, const EdsLib_EntityDescriptor_t *Param)
actual_buffer[0] = 0;
}
- UtPrintf("FullName=%s Offset=%lu Value=%s", Param->FullName, (unsigned long)Param->EntityInfo.Offset.Bytes,
+ UtPrintf("FullName=%s Offset=%lu Value=%s",
+ Param->FullName,
+ (unsigned long)Param->EntityInfo.Offset.Bytes,
actual_buffer);
UtAssert_STRINGBUF_EQ(actual_buffer, sizeof(actual_buffer), ref_buffer, sizeof(ref_buffer));
}
void UtAssert_Eds_Contents(EdsLib_Id_t EdsId, const void *ref, const void *actual)
{
- Test_ComparePair_t Pair = {.actual = actual, .ref = ref};
+ Test_ComparePair_t Pair = { .actual = actual, .ref = ref };
EdsLib_DisplayDB_IterateAllEntities(&UT_DATABASE, EdsId, Test_Contents, &Pair);
}
@@ -96,15 +104,19 @@ void Test_ALL_BOOLEANS(void)
unsigned char *vector = TESTDATA_ALL_BOOLEANS_bin;
size_t len = TESTDATA_ALL_BOOLEANS_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_BOOLEANS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -123,8 +135,12 @@ void Test_ALL_FLOATS(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_FLOATS_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_FLOATS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -136,15 +152,19 @@ void Test_ALL_SIGNED_INTS(void)
unsigned char *vector = TESTDATA_ALL_SIGNED_INTS_bin;
size_t len = TESTDATA_ALL_SIGNED_INTS_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_SIGNED_INTS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -156,15 +176,19 @@ void Test_ALL_UNSIGNED_INTS(void)
unsigned char *vector = TESTDATA_ALL_UNSIGNED_INTS_bin;
size_t len = TESTDATA_ALL_UNSIGNED_INTS_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ALL_UNSIGNED_INTS_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -176,15 +200,19 @@ void Test_COMPOUND_TYPES(void)
unsigned char *vector = TESTDATA_COMPOUND_TYPES_bin;
size_t len = TESTDATA_COMPOUND_TYPES_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_COMPOUND_TYPES_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -204,8 +232,12 @@ void Test_DERIV_F64(void)
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_F64_t));
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_BASE_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -224,8 +256,12 @@ void Test_DERIV_U16(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_DERIV_U16_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_U16_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -244,8 +280,12 @@ void Test_DERIV_U32(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_DERIV_U32_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_DERIV_U32_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -264,8 +304,12 @@ void Test_ER_EVEN_FOUR(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -284,8 +328,12 @@ void Test_ER_EVEN_SIX(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -304,8 +352,12 @@ void Test_ER_EVEN_TWO(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_EVEN_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -324,8 +376,12 @@ void Test_ER_ODD_ONE(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -344,8 +400,12 @@ void Test_ER_ODD_SEVEN(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -364,8 +424,12 @@ void Test_ER_ODD_THREE(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ER_ODD_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -377,15 +441,19 @@ void Test_ERRCTL_CHECKSUM(void)
unsigned char *vector = TESTDATA_ERRCTL_CHECKSUM_bin;
size_t len = TESTDATA_ERRCTL_CHECKSUM_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -406,8 +474,12 @@ void Test_ERRCTL_CHECKSUM_LONGITUDINAL(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_LONGITUDINAL_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CHECKSUM_LONGITUDINAL_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -419,15 +491,19 @@ void Test_ERRCTL_CRC16EL(void)
unsigned char *vector = TESTDATA_ERRCTL_CRC16EL_bin;
size_t len = TESTDATA_ERRCTL_CRC16EL_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC16EL_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -446,8 +522,12 @@ void Test_ERRCTL_CRC8(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC8_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_ERRCTL_CRC8_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -466,8 +546,12 @@ void Test_MFLOAT32EBxEU3(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_MFLOAT32EBxEU3_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_MFLOAT32EBxEU3_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -479,15 +563,19 @@ void Test_OPTIONAL_DIRECT_350(void)
unsigned char *vector = TESTDATA_OPTIONAL_DIRECT_350_bin;
size_t len = TESTDATA_OPTIONAL_DIRECT_350_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -499,15 +587,19 @@ void Test_OPTIONAL_DIRECT_450(void)
unsigned char *vector = TESTDATA_OPTIONAL_DIRECT_450_bin;
size_t len = TESTDATA_OPTIONAL_DIRECT_450_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_DIRECT_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -519,15 +611,19 @@ void Test_OPTIONAL_FIRST_4(void)
unsigned char *vector = TESTDATA_OPTIONAL_FIRST_4_bin;
size_t len = TESTDATA_OPTIONAL_FIRST_4_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -539,15 +635,19 @@ void Test_OPTIONAL_FIRST_5(void)
unsigned char *vector = TESTDATA_OPTIONAL_FIRST_5_bin;
size_t len = TESTDATA_OPTIONAL_FIRST_5_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_FIRST_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -559,15 +659,19 @@ void Test_OPTIONAL_LAST_8(void)
unsigned char *vector = TESTDATA_OPTIONAL_LAST_8_bin;
size_t len = TESTDATA_OPTIONAL_LAST_8_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -579,15 +683,19 @@ void Test_OPTIONAL_LAST_9(void)
unsigned char *vector = TESTDATA_OPTIONAL_LAST_9_bin;
size_t len = TESTDATA_OPTIONAL_LAST_9_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_LAST_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -599,15 +707,19 @@ void Test_OPTIONAL_MID_6(void)
unsigned char *vector = TESTDATA_OPTIONAL_MID_6_bin;
size_t len = TESTDATA_OPTIONAL_MID_6_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -619,15 +731,19 @@ void Test_OPTIONAL_MID_7(void)
unsigned char *vector = TESTDATA_OPTIONAL_MID_7_bin;
size_t len = TESTDATA_OPTIONAL_MID_7_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MID_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -639,15 +755,19 @@ void Test_OPTIONAL_MULTI_10(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_10_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_10_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -659,15 +779,19 @@ void Test_OPTIONAL_MULTI_11(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_11_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_11_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -679,15 +803,19 @@ void Test_OPTIONAL_MULTI_12(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_12_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_12_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -699,15 +827,19 @@ void Test_OPTIONAL_MULTI_13(void)
unsigned char *vector = TESTDATA_OPTIONAL_MULTI_13_bin;
size_t len = TESTDATA_OPTIONAL_MULTI_13_bin_len;
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t NativeObj;
UtAssert_LTEQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OPTIONAL_MULTI_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -719,15 +851,19 @@ void Test_OVERRIDE_TYPES(void)
unsigned char *vector = TESTDATA_OVERRIDE_TYPES_bin;
size_t len = TESTDATA_OVERRIDE_TYPES_bin_len;
EdsLib_Id_t EdsId_Expect = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
EdsLib_Id_t EdsId_Base = EDSLIB_MAKE_ID(UT_INDEX_CCSDS_SOIS_SAMPLETYPES,
- EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
+ EdsContainer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_DATADICTIONARY);
EdsDataType_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_OVERRIDE_TYPES_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
@@ -746,8 +882,12 @@ void Test_S6EBx4(void)
EdsDataType_CCSDS_SOIS_SAMPLETYPES_S6EBx4_t NativeObj;
UtAssert_EQ(size_t, len, sizeof(EdsPackedBuffer_CCSDS_SOIS_SAMPLETYPES_S6EBx4_t));
- UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE, &EdsId_Base, &NativeObj, vector,
- sizeof(NativeObj), len * 8),
+ UtAssert_INT32_EQ(EdsLib_DataTypeDB_UnpackCompleteObject(&UT_DATABASE,
+ &EdsId_Base,
+ &NativeObj,
+ vector,
+ sizeof(NativeObj),
+ len * 8),
EDSLIB_SUCCESS);
UtAssert_INT32_EQ(EdsId_Base, EdsId_Expect);
diff --git a/edslib/fsw/ut-stubs/edslib_binding_objects_stubs.c b/edslib/fsw/ut-stubs/edslib_binding_objects_stubs.c
index 1437226..b015304 100644
--- a/edslib/fsw/ut-stubs/edslib_binding_objects_stubs.c
+++ b/edslib/fsw/ut-stubs/edslib_binding_objects_stubs.c
@@ -66,8 +66,9 @@ EdsLib_Binding_Compatibility_t EdsLib_Binding_CheckEdsObjectsCompatible(EdsLib_B
* Generated stub function for EdsLib_Binding_ExportToPackedBuffer()
* ----------------------------------------------------
*/
-int32_t EdsLib_Binding_ExportToPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData, void *PackedData,
- size_t PackedDataSize)
+int32_t EdsLib_Binding_ExportToPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ void *PackedData,
+ size_t PackedDataSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_Binding_ExportToPackedBuffer, int32_t);
@@ -134,7 +135,8 @@ size_t EdsLib_Binding_GetNativeSize(const EdsLib_Binding_DescriptorObject_t *Obj
* ----------------------------------------------------
*/
void EdsLib_Binding_InitDescriptor(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
- const EdsLib_DatabaseObject_t *EdsDB, EdsLib_Id_t EdsId)
+ const EdsLib_DatabaseObject_t *EdsDB,
+ EdsLib_Id_t EdsId)
{
UT_GenStub_AddParam(EdsLib_Binding_InitDescriptor, EdsLib_Binding_DescriptorObject_t *, ObjectUserData);
UT_GenStub_AddParam(EdsLib_Binding_InitDescriptor, const EdsLib_DatabaseObject_t *, EdsDB);
@@ -148,8 +150,9 @@ void EdsLib_Binding_InitDescriptor(EdsLib_Binding_DescriptorObject_t *ObjectUser
* Generated stub function for EdsLib_Binding_InitFromPackedBuffer()
* ----------------------------------------------------
*/
-int32_t EdsLib_Binding_InitFromPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData, const void *PackedData,
- size_t PackedDataSize)
+int32_t EdsLib_Binding_InitFromPackedBuffer(EdsLib_Binding_DescriptorObject_t *ObjectUserData,
+ const void *PackedData,
+ size_t PackedDataSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_Binding_InitFromPackedBuffer, int32_t);
@@ -195,8 +198,8 @@ void EdsLib_Binding_InitSubObject(EdsLib_Binding_DescriptorObject_t *SubOb
* Generated stub function for EdsLib_Binding_InitUnmanagedBuffer()
* ----------------------------------------------------
*/
-EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Binding_Buffer_Content_t *ContentPtr,
- void *DataPtr, size_t MaxContentSize)
+EdsLib_Binding_Buffer_Content_t *
+EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Binding_Buffer_Content_t *ContentPtr, void *DataPtr, size_t MaxContentSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_Binding_InitUnmanagedBuffer, EdsLib_Binding_Buffer_Content_t *);
@@ -216,7 +219,6 @@ EdsLib_Binding_Buffer_Content_t *EdsLib_Binding_InitUnmanagedBuffer(EdsLib_Bindi
*/
void EdsLib_Binding_Initialize(void)
{
-
UT_GenStub_Execute(EdsLib_Binding_Initialize, Basic, NULL);
}
diff --git a/edslib/fsw/ut-stubs/edslib_datatypedb_stubs.c b/edslib/fsw/ut-stubs/edslib_datatypedb_stubs.c
index 656afd8..6e43381 100644
--- a/edslib/fsw/ut-stubs/edslib_datatypedb_stubs.c
+++ b/edslib/fsw/ut-stubs/edslib_datatypedb_stubs.c
@@ -63,8 +63,11 @@ int32_t EdsLib_DataTypeDB_BaseCheck(const EdsLib_DatabaseObject_t *GD, EdsLib_Id
* Generated stub function for EdsLib_DataTypeDB_ConstraintIterator()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t BaseId,
- EdsLib_Id_t DerivedId, EdsLib_ConstraintCallback_t Callback, void *CbArg)
+int32_t EdsLib_DataTypeDB_ConstraintIterator(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t BaseId,
+ EdsLib_Id_t DerivedId,
+ EdsLib_ConstraintCallback_t Callback,
+ void *CbArg)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_ConstraintIterator, int32_t);
@@ -102,9 +105,11 @@ int32_t EdsLib_DataTypeDB_FinalizePackedObject(const EdsLib_DatabaseObject_t *GD
* Generated stub function for EdsLib_DataTypeDB_FinalizePackedObjectVarSize()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- const void *NativeBuffer, void *PackedBuffer,
- const EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_FinalizePackedObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *NativeBuffer,
+ void *PackedBuffer,
+ const EdsLib_SizeInfo_t *ProcessedSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_FinalizePackedObjectVarSize, int32_t);
@@ -140,8 +145,10 @@ uint16_t EdsLib_DataTypeDB_GetAppIdx(const EdsLib_DataTypeDB_t AppDict)
* Generated stub function for EdsLib_DataTypeDB_GetConstraintEntity()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- uint16_t ConstraintIdx, EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
+int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t ConstraintIdx,
+ EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_GetConstraintEntity, int32_t);
@@ -160,7 +167,8 @@ int32_t EdsLib_DataTypeDB_GetConstraintEntity(const EdsLib_DatabaseObject_t *GD,
* Generated stub function for EdsLib_DataTypeDB_GetDerivedInfo()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
+int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
EdsLib_DataTypeDB_DerivedTypeInfo_t *DerivInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_GetDerivedInfo, int32_t);
@@ -179,8 +187,10 @@ int32_t EdsLib_DataTypeDB_GetDerivedInfo(const EdsLib_DatabaseObject_t *GD, EdsL
* Generated stub function for EdsLib_DataTypeDB_GetDerivedTypeById()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t DerivId,
- EdsLib_Id_t *DerivedEdsId)
+int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t DerivId,
+ EdsLib_Id_t *DerivedEdsId)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_GetDerivedTypeById, int32_t);
@@ -199,7 +209,9 @@ int32_t EdsLib_DataTypeDB_GetDerivedTypeById(const EdsLib_DatabaseObject_t *GD,
* Generated stub function for EdsLib_DataTypeDB_GetMemberByIndex()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t SubIndex,
+int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t SubIndex,
EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_GetMemberByIndex, int32_t);
@@ -219,8 +231,10 @@ int32_t EdsLib_DataTypeDB_GetMemberByIndex(const EdsLib_DatabaseObject_t *GD, Ed
* Generated stub function for EdsLib_DataTypeDB_GetMemberByNativeOffset()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- uint32_t ByteOffset, EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
+int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint32_t ByteOffset,
+ EdsLib_DataTypeDB_EntityInfo_t *MemberInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_GetMemberByNativeOffset, int32_t);
@@ -239,8 +253,9 @@ int32_t EdsLib_DataTypeDB_GetMemberByNativeOffset(const EdsLib_DatabaseObject_t
* Generated stub function for EdsLib_DataTypeDB_GetTypeInfo()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- EdsLib_DataTypeDB_TypeInfo_t *TypeInfo)
+int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_DataTypeDB_TypeInfo_t *TypeInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_GetTypeInfo, int32_t);
@@ -258,7 +273,8 @@ int32_t EdsLib_DataTypeDB_GetTypeInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_
* Generated stub function for EdsLib_DataTypeDB_IdentifyBuffer()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
+int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
const void *MessageBuffer,
EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo)
{
@@ -279,8 +295,10 @@ int32_t EdsLib_DataTypeDB_IdentifyBuffer(const EdsLib_DatabaseObject_t *GD, EdsL
* Generated stub function for EdsLib_DataTypeDB_IdentifyBufferWithSize()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- const void *BufferPtr, size_t BufferSize,
+int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const void *BufferPtr,
+ size_t BufferSize,
EdsLib_DataTypeDB_DerivativeObjectInfo_t *DerivObjInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_IdentifyBufferWithSize, int32_t);
@@ -289,7 +307,8 @@ int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *
UT_GenStub_AddParam(EdsLib_DataTypeDB_IdentifyBufferWithSize, EdsLib_Id_t, EdsId);
UT_GenStub_AddParam(EdsLib_DataTypeDB_IdentifyBufferWithSize, const void *, BufferPtr);
UT_GenStub_AddParam(EdsLib_DataTypeDB_IdentifyBufferWithSize, size_t, BufferSize);
- UT_GenStub_AddParam(EdsLib_DataTypeDB_IdentifyBufferWithSize, EdsLib_DataTypeDB_DerivativeObjectInfo_t *,
+ UT_GenStub_AddParam(EdsLib_DataTypeDB_IdentifyBufferWithSize,
+ EdsLib_DataTypeDB_DerivativeObjectInfo_t *,
DerivObjInfo);
UT_GenStub_Execute(EdsLib_DataTypeDB_IdentifyBufferWithSize, Basic, NULL);
@@ -304,7 +323,6 @@ int32_t EdsLib_DataTypeDB_IdentifyBufferWithSize(const EdsLib_DatabaseObject_t *
*/
void EdsLib_DataTypeDB_Initialize(void)
{
-
UT_GenStub_Execute(EdsLib_DataTypeDB_Initialize, Basic, NULL);
}
@@ -313,8 +331,8 @@ void EdsLib_DataTypeDB_Initialize(void)
* Generated stub function for EdsLib_DataTypeDB_InitializeNativeObject()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- void *UnpackedObj)
+int32_t
+EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *UnpackedObj)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_InitializeNativeObject, int32_t);
@@ -332,8 +350,10 @@ int32_t EdsLib_DataTypeDB_InitializeNativeObject(const EdsLib_DatabaseObject_t *
* Generated stub function for EdsLib_DataTypeDB_LoadValue()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- EdsLib_GenericValueBuffer_t *DestBuffer, const void *SrcPtr)
+int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_GenericValueBuffer_t *DestBuffer,
+ const void *SrcPtr)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_LoadValue, int32_t);
@@ -352,9 +372,12 @@ int32_t EdsLib_DataTypeDB_LoadValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id
* Generated stub function for EdsLib_DataTypeDB_PackCompleteObject()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId, void *DestBuffer,
- const void *SourceBuffer, uint32_t MaxPackedBitSize,
- uint32_t SourceByteSize)
+int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxPackedBitSize,
+ uint32_t SourceByteSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_PackCompleteObject, int32_t);
@@ -375,9 +398,11 @@ int32_t EdsLib_DataTypeDB_PackCompleteObject(const EdsLib_DatabaseObject_t *GD,
* Generated stub function for EdsLib_DataTypeDB_PackCompleteObjectVarSize()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer,
- EdsLib_SizeInfo_t *PackedSize)
+int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ EdsLib_SizeInfo_t *PackedSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_PackCompleteObjectVarSize, int32_t);
@@ -397,9 +422,13 @@ int32_t EdsLib_DataTypeDB_PackCompleteObjectVarSize(const EdsLib_DatabaseObject_
* Generated stub function for EdsLib_DataTypeDB_PackPartialObject()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId, void *DestBuffer,
- const void *SourceBuffer, uint32_t MaxPackedBitSize,
- uint32_t SourceByteSize, uint32_t StartingBit)
+int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxPackedBitSize,
+ uint32_t SourceByteSize,
+ uint32_t StartingBit)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_PackPartialObject, int32_t);
@@ -421,9 +450,12 @@ int32_t EdsLib_DataTypeDB_PackPartialObject(const EdsLib_DatabaseObject_t *GD, E
* Generated stub function for EdsLib_DataTypeDB_PackPartialObjectVarSize()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer,
- const EdsLib_SizeInfo_t *MaxSize, EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_PackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ const EdsLib_SizeInfo_t *MaxSize,
+ EdsLib_SizeInfo_t *ProcessedSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_PackPartialObjectVarSize, int32_t);
@@ -461,8 +493,10 @@ int32_t EdsLib_DataTypeDB_Register(EdsLib_DatabaseObject_t *GD, EdsLib_DataTypeD
* Generated stub function for EdsLib_DataTypeDB_StoreValue()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr,
- EdsLib_GenericValueBuffer_t *SrcBuffer)
+int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *DestPtr,
+ EdsLib_GenericValueBuffer_t *SrcBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_StoreValue, int32_t);
@@ -481,9 +515,12 @@ int32_t EdsLib_DataTypeDB_StoreValue(const EdsLib_DatabaseObject_t *GD, EdsLib_I
* Generated stub function for EdsLib_DataTypeDB_UnpackCompleteObject()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId, void *DestBuffer,
- const void *SourceBuffer, uint32_t MaxNativeByteSize,
- uint32_t SourceBitSize)
+int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxNativeByteSize,
+ uint32_t SourceBitSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_UnpackCompleteObject, int32_t);
@@ -504,9 +541,13 @@ int32_t EdsLib_DataTypeDB_UnpackCompleteObject(const EdsLib_DatabaseObject_t *GD
* Generated stub function for EdsLib_DataTypeDB_UnpackPartialObject()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId, void *DestBuffer,
- const void *SourceBuffer, uint32_t MaxNativeByteSize,
- uint32_t SourceBitSize, uint32_t StartingByte)
+int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ uint32_t MaxNativeByteSize,
+ uint32_t SourceBitSize,
+ uint32_t StartingByte)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_UnpackPartialObject, int32_t);
@@ -528,9 +569,12 @@ int32_t EdsLib_DataTypeDB_UnpackPartialObject(const EdsLib_DatabaseObject_t *GD,
* Generated stub function for EdsLib_DataTypeDB_UnpackPartialObjectVarSize()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t *EdsId,
- void *DestBuffer, const void *SourceBuffer,
- const EdsLib_SizeInfo_t *MaxSize, EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_UnpackPartialObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t *EdsId,
+ void *DestBuffer,
+ const void *SourceBuffer,
+ const EdsLib_SizeInfo_t *MaxSize,
+ EdsLib_SizeInfo_t *ProcessedSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_UnpackPartialObjectVarSize, int32_t);
@@ -568,8 +612,11 @@ int32_t EdsLib_DataTypeDB_Unregister(EdsLib_DatabaseObject_t *GD, uint16_t AppId
* Generated stub function for EdsLib_DataTypeDB_VerifyUnpackedObject()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *UnpackedObj,
- const void *PackedObj, uint32_t RecomputeFields)
+int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *UnpackedObj,
+ const void *PackedObj,
+ uint32_t RecomputeFields)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_VerifyUnpackedObject, int32_t);
@@ -589,9 +636,12 @@ int32_t EdsLib_DataTypeDB_VerifyUnpackedObject(const EdsLib_DatabaseObject_t *GD
* Generated stub function for EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize()
* ----------------------------------------------------
*/
-int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- void *NativeBuffer, const void *PackedBuffer,
- uint32_t RecomputeFields, const EdsLib_SizeInfo_t *ProcessedSize)
+int32_t EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ void *NativeBuffer,
+ const void *PackedBuffer,
+ uint32_t RecomputeFields,
+ const EdsLib_SizeInfo_t *ProcessedSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DataTypeDB_VerifyUnpackedObjectVarSize, int32_t);
diff --git a/edslib/fsw/ut-stubs/edslib_displaydb_stubs.c b/edslib/fsw/ut-stubs/edslib_displaydb_stubs.c
index 4b7315d..f7da423 100644
--- a/edslib/fsw/ut-stubs/edslib_displaydb_stubs.c
+++ b/edslib/fsw/ut-stubs/edslib_displaydb_stubs.c
@@ -113,7 +113,8 @@ const char *EdsLib_DisplayDB_GetEdsName(const EdsLib_DatabaseObject_t *GD, uint1
* Generated stub function for EdsLib_DisplayDB_GetEnumLabel()
* ----------------------------------------------------
*/
-const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
+const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
const EdsLib_GenericValueBuffer_t *ValueBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DisplayDB_GetEnumLabel, const char *);
@@ -132,8 +133,11 @@ const char *EdsLib_DisplayDB_GetEnumLabel(const EdsLib_DatabaseObject_t *GD, Eds
* Generated stub function for EdsLib_DisplayDB_GetEnumLabelByIndex()
* ----------------------------------------------------
*/
-const char *EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, uint16_t Index,
- char *Buffer, uint32_t BufferSize)
+const char *EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ uint16_t Index,
+ char *Buffer,
+ uint32_t BufferSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DisplayDB_GetEnumLabelByIndex, const char *);
@@ -153,8 +157,10 @@ const char *EdsLib_DisplayDB_GetEnumLabelByIndex(const EdsLib_DatabaseObject_t *
* Generated stub function for EdsLib_DisplayDB_GetEnumValue()
* ----------------------------------------------------
*/
-void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *String,
- EdsLib_GenericValueBuffer_t *ValueBuffer)
+void EdsLib_DisplayDB_GetEnumValue(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *String,
+ EdsLib_GenericValueBuffer_t *ValueBuffer)
{
UT_GenStub_AddParam(EdsLib_DisplayDB_GetEnumValue, const EdsLib_DatabaseObject_t *, GD);
UT_GenStub_AddParam(EdsLib_DisplayDB_GetEnumValue, EdsLib_Id_t, EdsId);
@@ -187,8 +193,10 @@ intmax_t EdsLib_DisplayDB_GetEnumValueByIndex(const EdsLib_DatabaseObject_t *GD,
* Generated stub function for EdsLib_DisplayDB_GetIndexByName()
* ----------------------------------------------------
*/
-int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *Name,
- uint16_t *SubIndex)
+int32_t EdsLib_DisplayDB_GetIndexByName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *Name,
+ uint16_t *SubIndex)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DisplayDB_GetIndexByName, int32_t);
@@ -242,8 +250,8 @@ const char *EdsLib_DisplayDB_GetNamespace(const EdsLib_DatabaseObject_t *GD, Eds
* Generated stub function for EdsLib_DisplayDB_GetTypeName()
* ----------------------------------------------------
*/
-const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *Buffer,
- uint32_t BufferSize)
+const char *
+EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *Buffer, uint32_t BufferSize)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DisplayDB_GetTypeName, const char *);
@@ -264,7 +272,6 @@ const char *EdsLib_DisplayDB_GetTypeName(const EdsLib_DatabaseObject_t *GD, EdsL
*/
void EdsLib_DisplayDB_Initialize(void)
{
-
UT_GenStub_Execute(EdsLib_DisplayDB_Initialize, Basic, NULL);
}
@@ -273,8 +280,10 @@ void EdsLib_DisplayDB_Initialize(void)
* Generated stub function for EdsLib_DisplayDB_IterateAllEntities()
* ----------------------------------------------------
*/
-void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- EdsLib_EntityCallback_t Callback, void *Arg)
+void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_EntityCallback_t Callback,
+ void *Arg)
{
UT_GenStub_AddParam(EdsLib_DisplayDB_IterateAllEntities, const EdsLib_DatabaseObject_t *, GD);
UT_GenStub_AddParam(EdsLib_DisplayDB_IterateAllEntities, EdsLib_Id_t, EdsId);
@@ -289,8 +298,10 @@ void EdsLib_DisplayDB_IterateAllEntities(const EdsLib_DatabaseObject_t *GD, EdsL
* Generated stub function for EdsLib_DisplayDB_IterateBaseEntities()
* ----------------------------------------------------
*/
-void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- EdsLib_EntityCallback_t Callback, void *Arg)
+void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_EntityCallback_t Callback,
+ void *Arg)
{
UT_GenStub_AddParam(EdsLib_DisplayDB_IterateBaseEntities, const EdsLib_DatabaseObject_t *, GD);
UT_GenStub_AddParam(EdsLib_DisplayDB_IterateBaseEntities, EdsLib_Id_t, EdsId);
@@ -305,8 +316,10 @@ void EdsLib_DisplayDB_IterateBaseEntities(const EdsLib_DatabaseObject_t *GD, Eds
* Generated stub function for EdsLib_DisplayDB_IterateEnumValues()
* ----------------------------------------------------
*/
-void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId,
- EdsLib_SymbolCallback_t Callback, void *Arg)
+void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ EdsLib_SymbolCallback_t Callback,
+ void *Arg)
{
UT_GenStub_AddParam(EdsLib_DisplayDB_IterateEnumValues, const EdsLib_DatabaseObject_t *, GD);
UT_GenStub_AddParam(EdsLib_DisplayDB_IterateEnumValues, EdsLib_Id_t, EdsId);
@@ -321,7 +334,9 @@ void EdsLib_DisplayDB_IterateEnumValues(const EdsLib_DatabaseObject_t *GD, EdsLi
* Generated stub function for EdsLib_DisplayDB_LocateSubEntity()
* ----------------------------------------------------
*/
-int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, const char *Name,
+int32_t EdsLib_DisplayDB_LocateSubEntity(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ const char *Name,
EdsLib_DataTypeDB_EntityInfo_t *CompInfo)
{
UT_GenStub_SetupReturnBuffer(EdsLib_DisplayDB_LocateSubEntity, int32_t);
@@ -373,8 +388,8 @@ void EdsLib_Generate_Hexdump(void *output, const uint8_t *DataPtr, uint16_t Disp
* Generated stub function for EdsLib_Scalar_FromString()
* ----------------------------------------------------
*/
-int32_t EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr,
- const char *SrcString)
+int32_t
+EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, void *DestPtr, const char *SrcString)
{
UT_GenStub_SetupReturnBuffer(EdsLib_Scalar_FromString, int32_t);
@@ -393,8 +408,11 @@ int32_t EdsLib_Scalar_FromString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
* Generated stub function for EdsLib_Scalar_ToString()
* ----------------------------------------------------
*/
-int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *OutputBuffer,
- uint32_t BufferSize, const void *SrcPtr)
+int32_t EdsLib_Scalar_ToString(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t EdsId,
+ char *OutputBuffer,
+ uint32_t BufferSize,
+ const void *SrcPtr)
{
UT_GenStub_SetupReturnBuffer(EdsLib_Scalar_ToString, int32_t);
diff --git a/edslib/fsw/ut-stubs/edslib_global_stubs.c b/edslib/fsw/ut-stubs/edslib_global_stubs.c
index 5079996..ee8976d 100644
--- a/edslib/fsw/ut-stubs/edslib_global_stubs.c
+++ b/edslib/fsw/ut-stubs/edslib_global_stubs.c
@@ -50,8 +50,10 @@ int32_t EdsLib_FindPackageIdxByName(const EdsLib_DatabaseObject_t *GD, const cha
* Generated stub function for EdsLib_FindPackageIdxBySubstring()
* ----------------------------------------------------
*/
-int32_t EdsLib_FindPackageIdxBySubstring(const EdsLib_DatabaseObject_t *GD, const char *MatchString, size_t MatchLen,
- uint8_t *IdxOut)
+int32_t EdsLib_FindPackageIdxBySubstring(const EdsLib_DatabaseObject_t *GD,
+ const char *MatchString,
+ size_t MatchLen,
+ uint8_t *IdxOut)
{
UT_GenStub_SetupReturnBuffer(EdsLib_FindPackageIdxBySubstring, int32_t);
diff --git a/edslib/fsw/ut-stubs/edslib_init_stubs.c b/edslib/fsw/ut-stubs/edslib_init_stubs.c
index b72726b..f87c771 100644
--- a/edslib/fsw/ut-stubs/edslib_init_stubs.c
+++ b/edslib/fsw/ut-stubs/edslib_init_stubs.c
@@ -34,6 +34,5 @@
*/
void EdsLib_Initialize(void)
{
-
UT_GenStub_Execute(EdsLib_Initialize, Basic, NULL);
}
diff --git a/edslib/fsw/ut-stubs/edslib_intfdb_stubs.c b/edslib/fsw/ut-stubs/edslib_intfdb_stubs.c
index d64adf3..a79881d 100644
--- a/edslib/fsw/ut-stubs/edslib_intfdb_stubs.c
+++ b/edslib/fsw/ut-stubs/edslib_intfdb_stubs.c
@@ -32,8 +32,11 @@
* Generated stub function for EdsLib_IntfDB_FindAllArgumentTypes()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t CmdEdsId,
- EdsLib_Id_t CompIntfEdsId, EdsLib_Id_t *IdBuffer, size_t NumIdBufs)
+int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t CmdEdsId,
+ EdsLib_Id_t CompIntfEdsId,
+ EdsLib_Id_t *IdBuffer,
+ size_t NumIdBufs)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindAllArgumentTypes, int32_t);
@@ -53,8 +56,10 @@ int32_t EdsLib_IntfDB_FindAllArgumentTypes(const EdsLib_DatabaseObject_t *GD, Ed
* Generated stub function for EdsLib_IntfDB_FindAllCommands()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId, EdsLib_Id_t *IdBuffer,
- size_t NumIdBufs)
+int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
+ EdsLib_Id_t *IdBuffer,
+ size_t NumIdBufs)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindAllCommands, int32_t);
@@ -73,8 +78,10 @@ int32_t EdsLib_IntfDB_FindAllCommands(const EdsLib_DatabaseObject_t *GD, EdsLib_
* Generated stub function for EdsLib_IntfDB_FindCommandByLocalName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId, const char *CmdName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
+ const char *CmdName,
+ EdsLib_Id_t *IdBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindCommandByLocalName, int32_t);
@@ -93,8 +100,10 @@ int32_t EdsLib_IntfDB_FindCommandByLocalName(const EdsLib_DatabaseObject_t *GD,
* Generated stub function for EdsLib_IntfDB_FindComponentByLocalName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx, const char *CompName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD,
+ uint16_t AppIdx,
+ const char *CompName,
+ EdsLib_Id_t *IdBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindComponentByLocalName, int32_t);
@@ -113,8 +122,9 @@ int32_t EdsLib_IntfDB_FindComponentByLocalName(const EdsLib_DatabaseObject_t *GD
* Generated stub function for EdsLib_IntfDB_FindComponentInterfaceByFullName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindComponentInterfaceByFullName, int32_t);
@@ -132,8 +142,10 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceByFullName(const EdsLib_DatabaseObje
* Generated stub function for EdsLib_IntfDB_FindComponentInterfaceByLocalName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t ComponentId,
- const char *IntfName, EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t ComponentId,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindComponentInterfaceByLocalName, int32_t);
@@ -152,8 +164,9 @@ int32_t EdsLib_IntfDB_FindComponentInterfaceByLocalName(const EdsLib_DatabaseObj
* Generated stub function for EdsLib_IntfDB_FindDeclaredInterfaceByFullName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObject_t *GD, const char *IntfName,
- EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObject_t *GD,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindDeclaredInterfaceByFullName, int32_t);
@@ -171,8 +184,10 @@ int32_t EdsLib_IntfDB_FindDeclaredInterfaceByFullName(const EdsLib_DatabaseObjec
* Generated stub function for EdsLib_IntfDB_FindDeclaredInterfaceByLocalName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD, uint16_t AppIdx,
- const char *IntfName, EdsLib_Id_t *IdBuffer)
+int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObject_t *GD,
+ uint16_t AppIdx,
+ const char *IntfName,
+ EdsLib_Id_t *IdBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_FindDeclaredInterfaceByLocalName, int32_t);
@@ -191,8 +206,9 @@ int32_t EdsLib_IntfDB_FindDeclaredInterfaceByLocalName(const EdsLib_DatabaseObje
* Generated stub function for EdsLib_IntfDB_GetCommandInfo()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t CommandId,
- EdsLib_IntfDB_CommandInfo_t *CommandInfoBuffer)
+int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t CommandId,
+ EdsLib_IntfDB_CommandInfo_t *CommandInfoBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_GetCommandInfo, int32_t);
@@ -210,7 +226,8 @@ int32_t EdsLib_IntfDB_GetCommandInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_I
* Generated stub function for EdsLib_IntfDB_GetComponentInfo()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t ComponentId,
+int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t ComponentId,
EdsLib_IntfDB_ComponentInfo_t *CompInfoBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_GetComponentInfo, int32_t);
@@ -229,7 +246,8 @@ int32_t EdsLib_IntfDB_GetComponentInfo(const EdsLib_DatabaseObject_t *GD, EdsLib
* Generated stub function for EdsLib_IntfDB_GetComponentInterfaceInfo()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t IntfId,
+int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *GD,
+ EdsLib_Id_t IntfId,
EdsLib_IntfDB_InterfaceInfo_t *IntfInfoBuffer)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_GetComponentInterfaceInfo, int32_t);
@@ -248,8 +266,8 @@ int32_t EdsLib_IntfDB_GetComponentInterfaceInfo(const EdsLib_DatabaseObject_t *G
* Generated stub function for EdsLib_IntfDB_GetFullName()
* ----------------------------------------------------
*/
-int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *BufferPtr,
- size_t BufferLen)
+int32_t
+EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t EdsId, char *BufferPtr, size_t BufferLen)
{
UT_GenStub_SetupReturnBuffer(EdsLib_IntfDB_GetFullName, int32_t);
@@ -270,6 +288,5 @@ int32_t EdsLib_IntfDB_GetFullName(const EdsLib_DatabaseObject_t *GD, EdsLib_Id_t
*/
void EdsLib_IntfDB_Initialize(void)
{
-
UT_GenStub_Execute(EdsLib_IntfDB_Initialize, Basic, NULL);
}
diff --git a/edslib/json/inc/edslib_json_objects.h b/edslib/json/inc/edslib_json_objects.h
index e6bcd84..9948d02 100644
--- a/edslib/json/inc/edslib_json_objects.h
+++ b/edslib/json/inc/edslib_json_objects.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_json_objects.h
* \ingroup json
@@ -32,26 +31,24 @@
#include
-
#ifdef __cplusplus
extern "C"
{
#endif
-/*
- * decouple from json-c headers;
- * json_object will be an abstract struct
- */
-typedef struct json_object EdsLib_JsonBinding_Object_t;
-typedef struct EdsLib_Binding_DescriptorObject EdsLib_JsonBinding_DescriptorObject_t;
+ /*
+ * decouple from json-c headers;
+ * json_object will be an abstract struct
+ */
+ typedef struct json_object EdsLib_JsonBinding_Object_t;
+ typedef struct EdsLib_Binding_DescriptorObject EdsLib_JsonBinding_DescriptorObject_t;
-void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObject, EdsLib_JsonBinding_Object_t *SrcObject);
-EdsLib_JsonBinding_Object_t *EdsLib_JSON_EdsObjectToJSON(const EdsLib_JsonBinding_DescriptorObject_t *SrcObject);
+ void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObject,
+ EdsLib_JsonBinding_Object_t *SrcObject);
+ EdsLib_JsonBinding_Object_t *EdsLib_JSON_EdsObjectToJSON(const EdsLib_JsonBinding_DescriptorObject_t *SrcObject);
#ifdef __cplusplus
-} /* extern "C" */
+} /* extern "C" */
#endif
-
-#endif /* _EDSLIB_JSON_OBJECTS_H_ */
-
+#endif /* _EDSLIB_JSON_OBJECTS_H_ */
diff --git a/edslib/json/src/edslib_json_objects.c b/edslib/json/src/edslib_json_objects.c
index 048dc34..ef3442d 100644
--- a/edslib/json/src/edslib_json_objects.c
+++ b/edslib/json/src/edslib_json_objects.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_json_objects.c
* \ingroup json
@@ -41,14 +40,14 @@
typedef struct
{
const EdsLib_Binding_DescriptorObject_t *ParentObj;
- struct json_object *JsonObject;
+ struct json_object *JsonObject;
} EdsLib_JsonBinding_ObjectConversion_t;
static void EdsLib_JSON_SetJSONObject_Callback(void *Arg, const EdsLib_EntityDescriptor_t *Param)
{
EdsLib_JsonBinding_ObjectConversion_t *State = Arg;
- EdsLib_JsonBinding_DescriptorObject_t SubDesc;
- struct json_object *ThisElement;
+ EdsLib_JsonBinding_DescriptorObject_t SubDesc;
+ struct json_object *ThisElement;
EdsLib_Binding_InitSubObject(&SubDesc, State->ParentObj, &Param->EntityInfo);
@@ -84,13 +83,10 @@ static void EdsLib_JSON_SetJSONObject_Callback(void *Arg, const EdsLib_EntityDes
}
}
-static int EdsLib_JSON_Double2Str(struct json_object *jso,
- struct printbuf *pb,
- int level,
- int flags)
+static int EdsLib_JSON_Double2Str(struct json_object *jso, struct printbuf *pb, int level, int flags)
{
- char buf[32];
- int size;
+ char buf[32];
+ int size;
double value = json_object_get_double(jso);
if (value == value)
@@ -116,110 +112,116 @@ EdsLib_JsonBinding_Object_t *EdsLib_JSON_EdsObjectToJSON(const EdsLib_JsonBindin
ThisElement = NULL;
- switch(SrcObject->TypeInfo.ElemType)
- {
- case EDSLIB_BASICTYPE_SIGNED_INT:
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- case EDSLIB_BASICTYPE_FLOAT:
+ switch (SrcObject->TypeInfo.ElemType)
{
- EdsLib_GenericValueBuffer_t ValueBuffer;
- const char *SymName;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ case EDSLIB_BASICTYPE_FLOAT:
+ {
+ EdsLib_GenericValueBuffer_t ValueBuffer;
+ const char *SymName;
- EdsLib_Binding_LoadValue(SrcObject, &ValueBuffer);
+ EdsLib_Binding_LoadValue(SrcObject, &ValueBuffer);
- /*
- * note JSON-C does not have a separate unsigned object type,
- * so convert to a signed type. Internally this uses a wide type (64 bits)
- * so it is generally OK but will truncate values that are greater than 2^63.
- *
- * This is a limitation of JSON really, so it is what it is. It is unlikely
- * that such large values will need to be represented in JSON, so this will
- * probably never be noticed.
- */
- if (ValueBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
- {
- ValueBuffer.Value.SignedInteger = ValueBuffer.Value.UnsignedInteger;
- ValueBuffer.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
- }
+ /*
+ * note JSON-C does not have a separate unsigned object type,
+ * so convert to a signed type. Internally this uses a wide type (64 bits)
+ * so it is generally OK but will truncate values that are greater than 2^63.
+ *
+ * This is a limitation of JSON really, so it is what it is. It is unlikely
+ * that such large values will need to be represented in JSON, so this will
+ * probably never be noticed.
+ */
+ if (ValueBuffer.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT)
+ {
+ ValueBuffer.Value.SignedInteger = ValueBuffer.Value.UnsignedInteger;
+ ValueBuffer.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ }
- SymName = EdsLib_DisplayDB_GetEnumLabel(SrcObject->GD, SrcObject->EdsId, &ValueBuffer);
- if (SymName != NULL)
- {
- ThisElement = json_object_new_string(SymName);
- }
- else if (ValueBuffer.ValueType == EDSLIB_BASICTYPE_FLOAT)
- {
- ThisElement = json_object_new_double(ValueBuffer.Value.FloatingPoint);
- json_object_set_serializer(ThisElement, EdsLib_JSON_Double2Str, NULL, NULL);
- }
- else if (ValueBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT)
- {
- if (EdsLib_DisplayDB_GetDisplayHint(SrcObject->GD, SrcObject->EdsId) == EDSLIB_DISPLAYHINT_BOOLEAN)
+ SymName = EdsLib_DisplayDB_GetEnumLabel(SrcObject->GD, SrcObject->EdsId, &ValueBuffer);
+ if (SymName != NULL)
+ {
+ ThisElement = json_object_new_string(SymName);
+ }
+ else if (ValueBuffer.ValueType == EDSLIB_BASICTYPE_FLOAT)
{
- ThisElement = json_object_new_boolean(ValueBuffer.Value.SignedInteger);
+ ThisElement = json_object_new_double(ValueBuffer.Value.FloatingPoint);
+ json_object_set_serializer(ThisElement, EdsLib_JSON_Double2Str, NULL, NULL);
}
- else
+ else if (ValueBuffer.ValueType == EDSLIB_BASICTYPE_SIGNED_INT)
{
- ThisElement = json_object_new_int64(ValueBuffer.Value.SignedInteger);
+ if (EdsLib_DisplayDB_GetDisplayHint(SrcObject->GD, SrcObject->EdsId) == EDSLIB_DISPLAYHINT_BOOLEAN)
+ {
+ ThisElement = json_object_new_boolean(ValueBuffer.Value.SignedInteger);
+ }
+ else
+ {
+ ThisElement = json_object_new_int64(ValueBuffer.Value.SignedInteger);
+ }
}
+ break;
}
- break;
- }
- case EDSLIB_BASICTYPE_BINARY:
- {
- /*
- * JSON objects cannot contain binary data directly;
- * Use the EdsLib scalar conversion to export the data in a safe form.
- *
- * allocate a temporary buffer with 1 byte per 6 bits of actual binary data,
- * to cover the case where the data is base64 encoded.
- *
- * Include a few bytes of extra space in the buffer for e.g. termination.
- */
- uint32_t MaxSize = 4 + ((SrcObject->TypeInfo.Size.Bits + 5) / 6);
- char* Buffer = malloc(MaxSize);
-
- if (Buffer != NULL)
+ case EDSLIB_BASICTYPE_BINARY:
{
- if (EdsLib_Scalar_ToString(SrcObject->GD, SrcObject->EdsId, Buffer, MaxSize,
- EdsLib_Binding_GetNativeObject(SrcObject)) == EDSLIB_SUCCESS)
+ /*
+ * JSON objects cannot contain binary data directly;
+ * Use the EdsLib scalar conversion to export the data in a safe form.
+ *
+ * allocate a temporary buffer with 1 byte per 6 bits of actual binary data,
+ * to cover the case where the data is base64 encoded.
+ *
+ * Include a few bytes of extra space in the buffer for e.g. termination.
+ */
+ uint32_t MaxSize = 4 + ((SrcObject->TypeInfo.Size.Bits + 5) / 6);
+ char *Buffer = malloc(MaxSize);
+
+ if (Buffer != NULL)
{
- ThisElement = json_object_new_string(Buffer);
+ if (EdsLib_Scalar_ToString(SrcObject->GD,
+ SrcObject->EdsId,
+ Buffer,
+ MaxSize,
+ EdsLib_Binding_GetNativeObject(SrcObject))
+ == EDSLIB_SUCCESS)
+ {
+ ThisElement = json_object_new_string(Buffer);
+ }
+ free(Buffer);
}
- free(Buffer);
+ break;
}
- break;
- }
- case EDSLIB_BASICTYPE_ARRAY:
- {
- uint16_t Idx;
- EdsLib_DataTypeDB_EntityInfo_t CompInfo;
- EdsLib_JsonBinding_DescriptorObject_t SubDesc;
-
- ThisElement = json_object_new_array();
- for (Idx=0; Idx < SrcObject->TypeInfo.NumSubElements; ++Idx)
+ case EDSLIB_BASICTYPE_ARRAY:
{
- EdsLib_DataTypeDB_GetMemberByIndex(SrcObject->GD, SrcObject->EdsId, Idx, &CompInfo);
- EdsLib_Binding_InitSubObject(&SubDesc, SrcObject, &CompInfo);
- json_object_array_put_idx(ThisElement, Idx, EdsLib_JSON_EdsObjectToJSON(&SubDesc));
+ uint16_t Idx;
+ EdsLib_DataTypeDB_EntityInfo_t CompInfo;
+ EdsLib_JsonBinding_DescriptorObject_t SubDesc;
+
+ ThisElement = json_object_new_array();
+ for (Idx = 0; Idx < SrcObject->TypeInfo.NumSubElements; ++Idx)
+ {
+ EdsLib_DataTypeDB_GetMemberByIndex(SrcObject->GD, SrcObject->EdsId, Idx, &CompInfo);
+ EdsLib_Binding_InitSubObject(&SubDesc, SrcObject, &CompInfo);
+ json_object_array_put_idx(ThisElement, Idx, EdsLib_JSON_EdsObjectToJSON(&SubDesc));
+ }
+ break;
}
- break;
- }
- case EDSLIB_BASICTYPE_CONTAINER:
- case EDSLIB_BASICTYPE_COMPONENT:
- {
- EdsLib_JsonBinding_ObjectConversion_t SubObject;
+ case EDSLIB_BASICTYPE_CONTAINER:
+ case EDSLIB_BASICTYPE_COMPONENT:
+ {
+ EdsLib_JsonBinding_ObjectConversion_t SubObject;
- SubObject.ParentObj = SrcObject;
- SubObject.JsonObject = json_object_new_object();
- EdsLib_DisplayDB_IterateBaseEntities(SrcObject->GD, SrcObject->EdsId,
- EdsLib_JSON_SetJSONObject_Callback, &SubObject);
+ SubObject.ParentObj = SrcObject;
+ SubObject.JsonObject = json_object_new_object();
+ EdsLib_DisplayDB_IterateBaseEntities(SrcObject->GD,
+ SrcObject->EdsId,
+ EdsLib_JSON_SetJSONObject_Callback,
+ &SubObject);
- ThisElement = SubObject.JsonObject;
- break;
- }
- default:
- break;
+ ThisElement = SubObject.JsonObject;
+ break;
+ }
+ default:
+ break;
}
return ThisElement;
@@ -228,18 +230,18 @@ EdsLib_JsonBinding_Object_t *EdsLib_JSON_EdsObjectToJSON(const EdsLib_JsonBindin
static void EdsLib_JSON_SetEDSObject_Callback(void *Arg, const EdsLib_EntityDescriptor_t *Param)
{
EdsLib_JsonBinding_ObjectConversion_t *State = Arg;
- EdsLib_JsonBinding_DescriptorObject_t SubDesc;
- struct json_object *SubObj;
+ EdsLib_JsonBinding_DescriptorObject_t SubDesc;
+ struct json_object *SubObj;
- if (json_object_object_get_ex(State->JsonObject, Param->FullName, &SubObj) &&
- SubObj != NULL)
+ if (json_object_object_get_ex(State->JsonObject, Param->FullName, &SubObj) && SubObj != NULL)
{
EdsLib_Binding_InitSubObject(&SubDesc, State->ParentObj, &Param->EntityInfo);
EdsLib_JSON_EdsObjectFromJSON(&SubDesc, SubObj);
}
}
-void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObject, EdsLib_JsonBinding_Object_t *SrcObject)
+void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObject,
+ EdsLib_JsonBinding_Object_t *SrcObject)
{
enum json_type SrcType;
@@ -256,22 +258,22 @@ void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObj
if (SrcType == json_type_double)
{
ValueBuffer.Value.FloatingPoint = json_object_get_double(SrcObject);
- ValueBuffer.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ ValueBuffer.ValueType = EDSLIB_BASICTYPE_FLOAT;
}
else if (SrcType == json_type_int)
{
ValueBuffer.Value.SignedInteger = json_object_get_int64(SrcObject);
- ValueBuffer.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ValueBuffer.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
}
else if (SrcType == json_type_boolean)
{
ValueBuffer.Value.UnsignedInteger = json_object_get_boolean(SrcObject);
- ValueBuffer.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ValueBuffer.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
else
{
ValueBuffer.Value.UnsignedInteger = 0;
- ValueBuffer.ValueType = EDSLIB_BASICTYPE_NONE;
+ ValueBuffer.ValueType = EDSLIB_BASICTYPE_NONE;
}
if (ValueBuffer.ValueType != EDSLIB_BASICTYPE_NONE)
@@ -284,18 +286,19 @@ void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObj
* If the JSON value is a string, then just use the EdsLib parser to import it.
* This should coerce most strings into the correct type, whatever it is.
*/
- EdsLib_Scalar_FromString(DstObject->GD, DstObject->EdsId,
- EdsLib_Binding_GetNativeObject(DstObject), json_object_get_string(SrcObject));
+ EdsLib_Scalar_FromString(DstObject->GD,
+ DstObject->EdsId,
+ EdsLib_Binding_GetNativeObject(DstObject),
+ json_object_get_string(SrcObject));
}
}
- else if (DstObject->TypeInfo.ElemType == EDSLIB_BASICTYPE_ARRAY &&
- SrcType == json_type_array)
+ else if (DstObject->TypeInfo.ElemType == EDSLIB_BASICTYPE_ARRAY && SrcType == json_type_array)
{
- uint16_t Idx;
- EdsLib_DataTypeDB_EntityInfo_t CompInfo;
+ uint16_t Idx;
+ EdsLib_DataTypeDB_EntityInfo_t CompInfo;
EdsLib_JsonBinding_DescriptorObject_t SubDesc;
- for (Idx=0; Idx < DstObject->TypeInfo.NumSubElements; ++Idx)
+ for (Idx = 0; Idx < DstObject->TypeInfo.NumSubElements; ++Idx)
{
if (EdsLib_DataTypeDB_GetMemberByIndex(DstObject->GD, DstObject->EdsId, Idx, &CompInfo) == EDSLIB_SUCCESS)
{
@@ -308,11 +311,12 @@ void EdsLib_JSON_EdsObjectFromJSON(EdsLib_JsonBinding_DescriptorObject_t *DstObj
{
EdsLib_JsonBinding_ObjectConversion_t SubObject;
- SubObject.ParentObj = DstObject;
+ SubObject.ParentObj = DstObject;
SubObject.JsonObject = SrcObject;
- EdsLib_DisplayDB_IterateBaseEntities(DstObject->GD, DstObject->EdsId,
- EdsLib_JSON_SetEDSObject_Callback, &SubObject);
+ EdsLib_DisplayDB_IterateBaseEntities(DstObject->GD,
+ DstObject->EdsId,
+ EdsLib_JSON_SetEDSObject_Callback,
+ &SubObject);
}
}
-
diff --git a/edslib/lua/inc/edslib_lua_objects.h b/edslib/lua/inc/edslib_lua_objects.h
index bbe8f88..397c342 100644
--- a/edslib/lua/inc/edslib_lua_objects.h
+++ b/edslib/lua/inc/edslib_lua_objects.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_lua_objects.h
* \ingroup lua
@@ -30,7 +29,6 @@
#ifndef _EDSLIB_LUA_OBJECTS_H_
#define _EDSLIB_LUA_OBJECTS_H_
-
#include
#include
@@ -39,9 +37,9 @@
* These are not distinct types, but intended to be aliases of types defined elsewhere.
* They are aliases to avoid creating a dependency on the header file which actually defines them.
*/
-typedef struct lua_State EdsLib_LuaBinding_State_t;
-typedef struct EdsLib_Binding_DescriptorObject EdsLib_LuaBinding_DescriptorObject_t;
-typedef struct EdsLib_DatabaseObject EdsLib_LuaBinding_DatabaseObject_t;
+typedef struct lua_State EdsLib_LuaBinding_State_t;
+typedef struct EdsLib_Binding_DescriptorObject EdsLib_LuaBinding_DescriptorObject_t;
+typedef struct EdsLib_DatabaseObject EdsLib_LuaBinding_DatabaseObject_t;
typedef struct
{
@@ -49,9 +47,8 @@ typedef struct
} EdsLib_Lua_Database_Userdata_t;
void EdsLib_LuaBinding_GetNativeObject(EdsLib_LuaBinding_State_t *lua, int narg, void **OutPtr, size_t *SizeBuf);
-EdsLib_LuaBinding_DescriptorObject_t *EdsLib_LuaBinding_CreateEmptyObject(EdsLib_LuaBinding_State_t *lua, size_t MaxSize);
+EdsLib_LuaBinding_DescriptorObject_t *EdsLib_LuaBinding_CreateEmptyObject(EdsLib_LuaBinding_State_t *lua,
+ size_t MaxSize);
void EdsLib_Lua_Attach(EdsLib_LuaBinding_State_t *lua, const EdsLib_LuaBinding_DatabaseObject_t *MissionObj);
-
-#endif /* _EDSLIB_LUA_OBJECTS_H_ */
-
+#endif /* _EDSLIB_LUA_OBJECTS_H_ */
diff --git a/edslib/lua/src/edslib_lua_objects.c b/edslib/lua/src/edslib_lua_objects.c
index 0be3e92..2cb0ae8 100644
--- a/edslib/lua/src/edslib_lua_objects.c
+++ b/edslib/lua/src/edslib_lua_objects.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_lua_objects.c
* \ingroup lua
@@ -52,7 +51,7 @@
#include "edslib_binding_objects.h"
#include "edslib_lua_objects.h"
-#define EDSLIB_MAX_BUFFER_SIZE 65528
+#define EDSLIB_MAX_BUFFER_SIZE 65528
static int EdsLib_LuaBinding_DestroyObject(lua_State *lua)
{
@@ -84,7 +83,10 @@ static EdsLib_Binding_DescriptorObject_t *EdsLib_LuaBinding_NewDescriptor(lua_St
return ObjectUserData;
}
-static EdsLib_Binding_DescriptorObject_t *EdsLib_LuaBinding_NewSubObject(lua_State *lua, const EdsLib_Binding_DescriptorObject_t *ParentObj, const EdsLib_DataTypeDB_EntityInfo_t *Component)
+static EdsLib_Binding_DescriptorObject_t *
+EdsLib_LuaBinding_NewSubObject(lua_State *lua,
+ const EdsLib_Binding_DescriptorObject_t *ParentObj,
+ const EdsLib_DataTypeDB_EntityInfo_t *Component)
{
EdsLib_Binding_DescriptorObject_t *SubObject = EdsLib_LuaBinding_NewDescriptor(lua);
EdsLib_Binding_InitSubObject(SubObject, ParentObj, Component);
@@ -94,8 +96,8 @@ static EdsLib_Binding_DescriptorObject_t *EdsLib_LuaBinding_NewSubObject(lua_Sta
static int EdsLib_LuaBinding_GetField(lua_State *lua)
{
EdsLib_Binding_DescriptorObject_t *Object;
- EdsLib_DataTypeDB_EntityInfo_t ComponentInfo;
- int32_t Status;
+ EdsLib_DataTypeDB_EntityInfo_t ComponentInfo;
+ int32_t Status;
/*
* Expected LUA stack:
@@ -109,46 +111,43 @@ static int EdsLib_LuaBinding_GetField(lua_State *lua)
switch (Object->TypeInfo.ElemType)
{
- case EDSLIB_BASICTYPE_CONTAINER:
- case EDSLIB_BASICTYPE_COMPONENT:
- {
- /* For containers, the field should be a name */
- const char *Name = luaL_checkstring(lua, 2);
- Status = EdsLib_DisplayDB_LocateSubEntity(Object->GD,
- Object->EdsId,
- Name, &ComponentInfo);
- break;
- }
- case EDSLIB_BASICTYPE_ARRAY:
- {
- /* For arrays, the field can be an integer (normal case)
- * or an enumeration label if the array was defined using an "indexTypeRef" of an enumeration
- */
- uint16_t SubIndex;
-
- if (lua_type(lua, 2) == LUA_TNUMBER)
+ case EDSLIB_BASICTYPE_CONTAINER:
+ case EDSLIB_BASICTYPE_COMPONENT:
{
- /* In Lua array indices should start at 1, not 0 */
- SubIndex = luaL_checkinteger(lua, 2) - 1;
- Status = EDSLIB_SUCCESS;
+ /* For containers, the field should be a name */
+ const char *Name = luaL_checkstring(lua, 2);
+ Status = EdsLib_DisplayDB_LocateSubEntity(Object->GD, Object->EdsId, Name, &ComponentInfo);
+ break;
}
- else
+ case EDSLIB_BASICTYPE_ARRAY:
{
- Status = EdsLib_DisplayDB_GetIndexByName(Object->GD, Object->EdsId, lua_tostring(lua, 2), &SubIndex);
- }
+ /* For arrays, the field can be an integer (normal case)
+ * or an enumeration label if the array was defined using an "indexTypeRef" of an enumeration
+ */
+ uint16_t SubIndex;
- if (Status == EDSLIB_SUCCESS)
+ if (lua_type(lua, 2) == LUA_TNUMBER)
+ {
+ /* In Lua array indices should start at 1, not 0 */
+ SubIndex = luaL_checkinteger(lua, 2) - 1;
+ Status = EDSLIB_SUCCESS;
+ }
+ else
+ {
+ Status = EdsLib_DisplayDB_GetIndexByName(Object->GD, Object->EdsId, lua_tostring(lua, 2), &SubIndex);
+ }
+
+ if (Status == EDSLIB_SUCCESS)
+ {
+ Status = EdsLib_DataTypeDB_GetMemberByIndex(Object->GD, Object->EdsId, SubIndex, &ComponentInfo);
+ }
+ break;
+ }
+ default:
{
- Status = EdsLib_DataTypeDB_GetMemberByIndex(Object->GD, Object->EdsId,
- SubIndex, &ComponentInfo);
+ Status = EDSLIB_NAME_NOT_FOUND;
+ break;
}
- break;
- }
- default:
- {
- Status = EDSLIB_NAME_NOT_FOUND;
- break;
- }
}
if (Status != EDSLIB_SUCCESS)
@@ -159,13 +158,12 @@ static int EdsLib_LuaBinding_GetField(lua_State *lua)
/* Push a temporary EdsLib userdata object to reflect the sub-structure */
EdsLib_LuaBinding_NewSubObject(lua, Object, &ComponentInfo);
return 1;
-
}
static void EdsLib_LuaBinding_EnumerateMembers_Callback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc)
{
- lua_State *lua = Arg;
- int idx;
+ lua_State *lua = Arg;
+ int idx;
EdsLib_Binding_DescriptorObject_t *BaseObj = luaL_checkudata(lua, -3, "EdsLib_Object");
luaL_checktype(lua, -2, LUA_TTABLE);
@@ -194,8 +192,8 @@ static void EdsLib_LuaBinding_EnumerateMembers_Callback(void *Arg, const EdsLib_
static int EdsLib_LuaBinding_EdsObjectToLuaObject(lua_State *lua)
{
EdsLib_Binding_DescriptorObject_t *Object;
- EdsLib_DisplayHint_t DispHint;
- int start_top = lua_gettop(lua);
+ EdsLib_DisplayHint_t DispHint;
+ int start_top = lua_gettop(lua);
Object = luaL_testudata(lua, start_top, "EdsLib_Object");
@@ -219,8 +217,8 @@ static int EdsLib_LuaBinding_EdsObjectToLuaObject(lua_State *lua)
{
if (Object->TypeInfo.ElemType == EDSLIB_BASICTYPE_BINARY)
{
- const char *Str = (const char*)EdsLib_Binding_GetNativeObject(Object);
- uint32_t StrSize = 0;
+ const char *Str = (const char *)EdsLib_Binding_GetNativeObject(Object);
+ uint32_t StrSize = 0;
if (DispHint == EDSLIB_DISPLAYHINT_STRING)
{
@@ -243,9 +241,12 @@ static int EdsLib_LuaBinding_EdsObjectToLuaObject(lua_State *lua)
{
char StringBuffer[256];
- if (EdsLib_Scalar_ToString(Object->GD, Object->EdsId,
- StringBuffer, sizeof(StringBuffer),
- EdsLib_Binding_GetNativeObject(Object)) == EDSLIB_SUCCESS)
+ if (EdsLib_Scalar_ToString(Object->GD,
+ Object->EdsId,
+ StringBuffer,
+ sizeof(StringBuffer),
+ EdsLib_Binding_GetNativeObject(Object))
+ == EDSLIB_SUCCESS)
{
lua_pushstring(lua, StringBuffer);
}
@@ -256,35 +257,35 @@ static int EdsLib_LuaBinding_EdsObjectToLuaObject(lua_State *lua)
EdsLib_Binding_LoadValue(Object, &ValueBuff);
- switch(ValueBuff.ValueType)
+ switch (ValueBuff.ValueType)
{
- case EDSLIB_BASICTYPE_SIGNED_INT:
- if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
- {
- /* preserve the boolean nature of the integer field */
- lua_pushboolean(lua, ValueBuff.Value.SignedInteger);
- }
- else
- {
- lua_pushinteger(lua, ValueBuff.Value.SignedInteger);
- }
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
- {
- /* preserve the boolean nature of the integer field */
- lua_pushboolean(lua, ValueBuff.Value.UnsignedInteger);
- }
- else
- {
- lua_pushinteger(lua, ValueBuff.Value.UnsignedInteger);
- }
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- lua_pushnumber(lua, ValueBuff.Value.FloatingPoint);
- break;
- default:
- break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
+ {
+ /* preserve the boolean nature of the integer field */
+ lua_pushboolean(lua, ValueBuff.Value.SignedInteger);
+ }
+ else
+ {
+ lua_pushinteger(lua, ValueBuff.Value.SignedInteger);
+ }
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
+ {
+ /* preserve the boolean nature of the integer field */
+ lua_pushboolean(lua, ValueBuff.Value.UnsignedInteger);
+ }
+ else
+ {
+ lua_pushinteger(lua, ValueBuff.Value.UnsignedInteger);
+ }
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ lua_pushnumber(lua, ValueBuff.Value.FloatingPoint);
+ break;
+ default:
+ break;
}
}
}
@@ -293,22 +294,24 @@ static int EdsLib_LuaBinding_EdsObjectToLuaObject(lua_State *lua)
int idx;
/* Create a temporary table with the name name/userdata pairs */
- lua_newtable(lua); /* index 2 -- contains the names */
- lua_newtable(lua); /* index 3 -- contains the value types (userdata) */
- EdsLib_DisplayDB_IterateBaseEntities(Object->GD, Object->EdsId,
- EdsLib_LuaBinding_EnumerateMembers_Callback, lua);
+ lua_newtable(lua); /* index 2 -- contains the names */
+ lua_newtable(lua); /* index 3 -- contains the value types (userdata) */
+ EdsLib_DisplayDB_IterateBaseEntities(Object->GD,
+ Object->EdsId,
+ EdsLib_LuaBinding_EnumerateMembers_Callback,
+ lua);
/* Create the table that will be returned */
- lua_newtable(lua); /* index 4 -- final result */
+ lua_newtable(lua); /* index 4 -- final result */
/* Attempt to convert each userdata into a Lua object, recursing as necessary */
for (idx = 1; idx <= lua_rawlen(lua, 2); ++idx)
{
- lua_rawgeti(lua, 2, idx); /* get name from first temp table */
+ lua_rawgeti(lua, 2, idx); /* get name from first temp table */
lua_pushcfunction(lua, EdsLib_LuaBinding_EdsObjectToLuaObject);
- lua_rawgeti(lua, 3, idx); /* get userdata from second temp table */
- lua_call(lua, 1, 1); /* recursive call to convert sub-userdata to Lua object */
- lua_rawset(lua, 4); /* store in final table */
+ lua_rawgeti(lua, 3, idx); /* get userdata from second temp table */
+ lua_call(lua, 1, 1); /* recursive call to convert sub-userdata to Lua object */
+ lua_rawset(lua, 4); /* store in final table */
}
/* note that the two intermediate tables will be dropped; only the top is returned */
@@ -326,7 +329,7 @@ static int EdsLib_LuaBinding_EdsObjectToLuaObject(lua_State *lua)
static int EdsLib_LuaBinding_LuaObjectToEdsObject(lua_State *lua)
{
EdsLib_Binding_DescriptorObject_t *Object;
- int start_top = lua_gettop(lua);
+ int start_top = lua_gettop(lua);
Object = luaL_checkudata(lua, start_top - 1, "EdsLib_Object");
@@ -335,7 +338,7 @@ static int EdsLib_LuaBinding_LuaObjectToEdsObject(lua_State *lua)
if (lua_type(lua, start_top) == LUA_TSTRING)
{
const char *SrcString = lua_tostring(lua, start_top);
- uint32_t SrcLength = lua_rawlen(lua, start_top);
+ uint32_t SrcLength = lua_rawlen(lua, start_top);
/*
* If the target is a binary field (which includes EDS strings)
@@ -360,11 +363,8 @@ static int EdsLib_LuaBinding_LuaObjectToEdsObject(lua_State *lua)
* This will attempt to parse the string as the appropriate EDS type.
* (therefore slower than the simple case above)
*/
- EdsLib_Scalar_FromString(Object->GD, Object->EdsId,
- EdsLib_Binding_GetNativeObject(Object),
- SrcString);
+ EdsLib_Scalar_FromString(Object->GD, Object->EdsId, EdsLib_Binding_GetNativeObject(Object), SrcString);
}
-
}
else
{
@@ -374,12 +374,12 @@ static int EdsLib_LuaBinding_LuaObjectToEdsObject(lua_State *lua)
{
/* in Lua all numbers are floats */
ValueBuff.Value.FloatingPoint = lua_tonumber(lua, start_top);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_FLOAT;
}
else if (lua_type(lua, start_top) == LUA_TBOOLEAN)
{
ValueBuff.Value.SignedInteger = lua_toboolean(lua, start_top);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
}
else
{
@@ -394,7 +394,7 @@ static int EdsLib_LuaBinding_LuaObjectToEdsObject(lua_State *lua)
if (lua_istable(lua, start_top))
{
lua_pushnil(lua);
- while(lua_next(lua, start_top))
+ while (lua_next(lua, start_top))
{
lua_pushcfunction(lua, EdsLib_LuaBinding_LuaObjectToEdsObject);
lua_pushcfunction(lua, EdsLib_LuaBinding_GetField);
@@ -470,17 +470,16 @@ static int EdsLib_LuaBinding_EdsObjectAssignValue(lua_State *lua)
SrcObject = NULL;
}
- if (SrcObject != NULL && EdsLib_Binding_IsDescBufferValid(SrcObject) &&
- EdsLib_Binding_CheckEdsObjectsCompatible(DestObject, SrcObject) !=
- EDSLIB_BINDING_COMPATIBILITY_NONE)
+ if (SrcObject != NULL && EdsLib_Binding_IsDescBufferValid(SrcObject)
+ && EdsLib_Binding_CheckEdsObjectsCompatible(DestObject, SrcObject) != EDSLIB_BINDING_COMPATIBILITY_NONE)
{
/*
* In the simple case, the objects are binary compatible, and the
* value can be simply memcpy()'ed to the destination object
*/
memcpy(EdsLib_Binding_GetNativeObject(DestObject),
- EdsLib_Binding_GetNativeObject(SrcObject),
- SrcObject->TypeInfo.Size.Bytes);
+ EdsLib_Binding_GetNativeObject(SrcObject),
+ SrcObject->TypeInfo.Size.Bytes);
}
else
{
@@ -505,7 +504,7 @@ static int EdsLib_LuaBinding_EdsObjectAssignValue(lua_State *lua)
lua_call(lua, 1, 1);
}
- lua_call(lua, 2, 0); /* Calling LuaObjectToEdsObject */
+ lua_call(lua, 2, 0); /* Calling LuaObjectToEdsObject */
}
return 0;
@@ -520,7 +519,7 @@ static int EdsLib_LuaBinding_SetField(lua_State *lua)
* Field Value @ 3
*/
- lua_settop(lua, 3); /* adjust stack in case different number of args were passed in */
+ lua_settop(lua, 3); /* adjust stack in case different number of args were passed in */
lua_pushcfunction(lua, EdsLib_LuaBinding_EdsObjectAssignValue);
@@ -536,12 +535,13 @@ static int EdsLib_LuaBinding_SetField(lua_State *lua)
return 0;
}
-static void EdsLib_LuaBinding_PushBufferAsString(lua_State *lua, const char *Desc, const uint8_t *Buffer, uint32_t ContentBitSize)
+static void
+EdsLib_LuaBinding_PushBufferAsString(lua_State *lua, const char *Desc, const uint8_t *Buffer, uint32_t ContentBitSize)
{
luaL_Buffer lbuf;
- char TempString[5];
- uint32_t i;
- uint32_t ContentByteSize = (ContentBitSize + 7) / 8;
+ char TempString[5];
+ uint32_t i;
+ uint32_t ContentByteSize = (ContentBitSize + 7) / 8;
lua_pushfstring(lua, "%s(%d", Desc, (int)ContentBitSize);
luaL_buffinit(lua, &lbuf);
@@ -549,7 +549,7 @@ static void EdsLib_LuaBinding_PushBufferAsString(lua_State *lua, const char *Des
if (ContentByteSize > 0)
{
luaL_addstring(&lbuf, ":");
- for(i = 0; i < ContentByteSize; ++i)
+ for (i = 0; i < ContentByteSize; ++i)
{
snprintf(TempString, sizeof(TempString), " %02x", Buffer[i]);
luaL_addstring(&lbuf, TempString);
@@ -559,7 +559,6 @@ static void EdsLib_LuaBinding_PushBufferAsString(lua_State *lua, const char *Des
luaL_pushresult(&lbuf);
lua_pushstring(lua, ")");
lua_concat(lua, 3);
-
}
static int EdsLib_LuaBinding_BufferToString(lua_State *lua)
@@ -568,9 +567,8 @@ static int EdsLib_LuaBinding_BufferToString(lua_State *lua)
if (lua_type(lua, 1) == LUA_TSTRING)
{
- const uint8_t *Buffer = (const uint8_t*)lua_tostring(lua, 1);
- EdsLib_LuaBinding_PushBufferAsString(lua, "BITSTREAM",
- Buffer, 8 * lua_rawlen(lua, 1));
+ const uint8_t *Buffer = (const uint8_t *)lua_tostring(lua, 1);
+ EdsLib_LuaBinding_PushBufferAsString(lua, "BITSTREAM", Buffer, 8 * lua_rawlen(lua, 1));
nret = 1;
}
else if (lua_type(lua, 1) == LUA_TUSERDATA)
@@ -579,10 +577,11 @@ static int EdsLib_LuaBinding_BufferToString(lua_State *lua)
if (EdsLib_Binding_IsDescBufferValid(Object))
{
char TypeName[128];
- EdsLib_LuaBinding_PushBufferAsString(lua,
- EdsLib_DisplayDB_GetTypeName(Object->GD, Object->EdsId, TypeName, sizeof(TypeName)),
- EdsLib_Binding_GetNativeObject(Object),
- 8 * Object->TypeInfo.Size.Bytes);
+ EdsLib_LuaBinding_PushBufferAsString(
+ lua,
+ EdsLib_DisplayDB_GetTypeName(Object->GD, Object->EdsId, TypeName, sizeof(TypeName)),
+ EdsLib_Binding_GetNativeObject(Object),
+ 8 * Object->TypeInfo.Size.Bytes);
nret = 1;
}
}
@@ -593,7 +592,7 @@ static int EdsLib_LuaBinding_BufferToString(lua_State *lua)
static int EdsLib_LuaBinding_ObjectToString(lua_State *lua)
{
EdsLib_Binding_DescriptorObject_t *ObjectUserData;
- char StringBuffer[256];
+ char StringBuffer[256];
ObjectUserData = luaL_checkudata(lua, 1, "EdsLib_Object");
@@ -604,20 +603,29 @@ static int EdsLib_LuaBinding_ObjectToString(lua_State *lua)
if (!EdsLib_Binding_IsDescBufferValid(ObjectUserData))
{
/* Object is a descriptor only; return a string containing the EDS type descriptor */
- lua_pushstring(lua, EdsLib_DisplayDB_GetTypeName(ObjectUserData->GD, ObjectUserData->EdsId, StringBuffer, sizeof(StringBuffer)));
+ lua_pushstring(lua,
+ EdsLib_DisplayDB_GetTypeName(ObjectUserData->GD,
+ ObjectUserData->EdsId,
+ StringBuffer,
+ sizeof(StringBuffer)));
}
- else if (ObjectUserData->TypeInfo.NumSubElements == 0 && ObjectUserData->TypeInfo.Size.Bytes > 0 &&
- EdsLib_Scalar_ToString(ObjectUserData->GD, ObjectUserData->EdsId, StringBuffer, sizeof(StringBuffer),
- EdsLib_Binding_GetNativeObject(ObjectUserData)) == EDSLIB_SUCCESS)
+ else if (ObjectUserData->TypeInfo.NumSubElements == 0 && ObjectUserData->TypeInfo.Size.Bytes > 0
+ && EdsLib_Scalar_ToString(ObjectUserData->GD,
+ ObjectUserData->EdsId,
+ StringBuffer,
+ sizeof(StringBuffer),
+ EdsLib_Binding_GetNativeObject(ObjectUserData))
+ == EDSLIB_SUCCESS)
{
lua_pushstring(lua, StringBuffer);
}
else
{
- EdsLib_LuaBinding_PushBufferAsString(lua,
- EdsLib_DisplayDB_GetTypeName(ObjectUserData->GD, ObjectUserData->EdsId, StringBuffer, sizeof(StringBuffer)),
- EdsLib_Binding_GetNativeObject(ObjectUserData),
- 8 * ObjectUserData->TypeInfo.Size.Bytes);
+ EdsLib_LuaBinding_PushBufferAsString(
+ lua,
+ EdsLib_DisplayDB_GetTypeName(ObjectUserData->GD, ObjectUserData->EdsId, StringBuffer, sizeof(StringBuffer)),
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ 8 * ObjectUserData->TypeInfo.Size.Bytes);
}
return 1;
@@ -625,10 +633,10 @@ static int EdsLib_LuaBinding_ObjectToString(lua_State *lua)
static int EdsLib_LuaBinding_NewObject(lua_State *lua)
{
- EdsLib_Lua_Database_Userdata_t *DbObj = luaL_checkudata(lua, lua_upvalueindex(1), "EdsDb");
- EdsLib_Binding_DescriptorObject_t *ObjectUserData;
+ EdsLib_Lua_Database_Userdata_t *DbObj = luaL_checkudata(lua, lua_upvalueindex(1), "EdsDb");
+ EdsLib_Binding_DescriptorObject_t *ObjectUserData;
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- EdsLib_Binding_DescriptorObject_t *SrcObject;
+ EdsLib_Binding_DescriptorObject_t *SrcObject;
/*
* The second argument to this function is an optional initializer.
@@ -646,8 +654,9 @@ static int EdsLib_LuaBinding_NewObject(lua_State *lua)
if (lua_type(lua, 1) == LUA_TSTRING)
{
- EdsLib_Binding_InitDescriptor(ObjectUserData, DbObj->GD,
- EdsLib_DisplayDB_LookupTypeName(DbObj->GD, luaL_checkstring(lua, 1)));
+ EdsLib_Binding_InitDescriptor(ObjectUserData,
+ DbObj->GD,
+ EdsLib_DisplayDB_LookupTypeName(DbObj->GD, luaL_checkstring(lua, 1)));
}
else if (lua_type(lua, 1) == LUA_TUSERDATA)
{
@@ -679,13 +688,10 @@ static int EdsLib_LuaBinding_NewObject(lua_State *lua)
if (!EdsLib_Binding_IsDescBufferValid(ObjectUserData))
{
- return luaL_error(lua, "Memory allocation error obtaining buffer for %d bytes",
- (int)DerivInfo.MaxSize.Bytes);
+ return luaL_error(lua, "Memory allocation error obtaining buffer for %d bytes", (int)DerivInfo.MaxSize.Bytes);
}
-
- if (ObjectUserData->TypeInfo.NumSubElements > 0 &&
- lua_type(lua, 2) == LUA_TSTRING)
+ if (ObjectUserData->TypeInfo.NumSubElements > 0 && lua_type(lua, 2) == LUA_TSTRING)
{
/*
* When initializing a compound object (array or container) from a string,
@@ -693,20 +699,21 @@ static int EdsLib_LuaBinding_NewObject(lua_State *lua)
*
* Initialize the new object from the serialized object
*/
- EdsLib_DataTypeDB_UnpackCompleteObject(DbObj->GD, &ObjectUserData->EdsId,
- EdsLib_Binding_GetNativeObject(ObjectUserData),
- lua_tostring(lua, 2), DerivInfo.MaxSize.Bytes, 8 * lua_rawlen(lua, 2));
+ EdsLib_DataTypeDB_UnpackCompleteObject(DbObj->GD,
+ &ObjectUserData->EdsId,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ lua_tostring(lua, 2),
+ DerivInfo.MaxSize.Bytes,
+ 8 * lua_rawlen(lua, 2));
/*
* The unpack operation may modify the EdsId, so look up details after completion.
*/
- EdsLib_DataTypeDB_GetTypeInfo(DbObj->GD, ObjectUserData->EdsId,
- &ObjectUserData->TypeInfo);
+ EdsLib_DataTypeDB_GetTypeInfo(DbObj->GD, ObjectUserData->EdsId, &ObjectUserData->TypeInfo);
}
else
{
- EdsLib_DataTypeDB_GetTypeInfo(DbObj->GD, ObjectUserData->EdsId,
- &ObjectUserData->TypeInfo);
+ EdsLib_DataTypeDB_GetTypeInfo(DbObj->GD, ObjectUserData->EdsId, &ObjectUserData->TypeInfo);
/*
* Initialize the new object from scratch, optionally using a Lua value to prepare internal fields
@@ -716,32 +723,30 @@ static int EdsLib_LuaBinding_NewObject(lua_State *lua)
if (!lua_isnil(lua, 2))
{
lua_pushcfunction(lua, EdsLib_LuaBinding_EdsObjectAssignValue);
- lua_pushvalue(lua, 3); /* new object */
- lua_pushvalue(lua, 2); /* initializer object */
+ lua_pushvalue(lua, 3); /* new object */
+ lua_pushvalue(lua, 2); /* initializer object */
lua_call(lua, 2, 0);
}
}
-
return 1;
}
static int EdsLib_LuaBinding_EncodeObject(lua_State *lua)
{
- EdsLib_Binding_DescriptorObject_t *ObjectUserData;
+ EdsLib_Binding_DescriptorObject_t *ObjectUserData;
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- EdsLib_Id_t PackMsg;
- EdsLib_SizeInfo_t ActualSize;
- uint32_t MaxPackedSize;
- uint8_t LocalScratchBuffer[64];
- void *PackBufPtr;
- int32_t PackStatus;
- int nret;
+ EdsLib_Id_t PackMsg;
+ EdsLib_SizeInfo_t ActualSize;
+ uint32_t MaxPackedSize;
+ uint8_t LocalScratchBuffer[64];
+ void *PackBufPtr;
+ int32_t PackStatus;
+ int nret;
ObjectUserData = luaL_checkudata(lua, 1, "EdsLib_Object");
- if (EdsLib_DataTypeDB_GetDerivedInfo(ObjectUserData->GD, ObjectUserData->EdsId,
- &DerivInfo) == EDSLIB_SUCCESS)
+ if (EdsLib_DataTypeDB_GetDerivedInfo(ObjectUserData->GD, ObjectUserData->EdsId, &DerivInfo) == EDSLIB_SUCCESS)
{
/* allocate enough buffer storage for the largest derivative type */
MaxPackedSize = DerivInfo.MaxSize.Bits;
@@ -752,8 +757,8 @@ static int EdsLib_LuaBinding_EncodeObject(lua_State *lua)
MaxPackedSize = ObjectUserData->TypeInfo.Size.Bits;
}
- nret = 0;
- PackMsg = ObjectUserData->EdsId;
+ nret = 0;
+ PackMsg = ObjectUserData->EdsId;
MaxPackedSize = EdsLib_BITS_TO_OCTETS(MaxPackedSize);
/*
@@ -773,14 +778,14 @@ static int EdsLib_LuaBinding_EncodeObject(lua_State *lua)
{
memset(PackBufPtr, 0, MaxPackedSize);
- ActualSize.Bits = EdsLib_OCTETS_TO_BITS(MaxPackedSize);
+ ActualSize.Bits = EdsLib_OCTETS_TO_BITS(MaxPackedSize);
ActualSize.Bytes = EdsLib_Binding_GetNativeSize(ObjectUserData);
PackStatus = EdsLib_DataTypeDB_PackCompleteObjectVarSize(ObjectUserData->GD,
- &PackMsg,
- PackBufPtr,
- EdsLib_Binding_GetNativeObject(ObjectUserData),
- &ActualSize);
+ &PackMsg,
+ PackBufPtr,
+ EdsLib_Binding_GetNativeObject(ObjectUserData),
+ &ActualSize);
if (PackStatus == EDSLIB_SUCCESS)
{
@@ -800,9 +805,8 @@ static int EdsLib_LuaBinding_EncodeObject(lua_State *lua)
static int EdsLib_LuaBinding_GetMetaData(lua_State *lua)
{
- EdsLib_Binding_DescriptorObject_t *ObjectUserData =
- luaL_checkudata(lua, 1, "EdsLib_Object");
- char StringBuffer[128];
+ EdsLib_Binding_DescriptorObject_t *ObjectUserData = luaL_checkudata(lua, 1, "EdsLib_Object");
+ char StringBuffer[128];
lua_newtable(lua);
lua_pushinteger(lua, ObjectUserData->TypeInfo.Size.Bits);
@@ -815,38 +819,40 @@ static int EdsLib_LuaBinding_GetMetaData(lua_State *lua)
lua_setfield(lua, -2, "BytePosition");
lua_pushinteger(lua, ObjectUserData->EdsId);
lua_setfield(lua, -2, "TypeId");
- lua_pushstring(lua, EdsLib_DisplayDB_GetTypeName(ObjectUserData->GD, ObjectUserData->EdsId, StringBuffer, sizeof(StringBuffer)));
+ lua_pushstring(
+ lua,
+ EdsLib_DisplayDB_GetTypeName(ObjectUserData->GD, ObjectUserData->EdsId, StringBuffer, sizeof(StringBuffer)));
lua_setfield(lua, -2, "TypeName");
switch (ObjectUserData->TypeInfo.ElemType)
{
- case EDSLIB_BASICTYPE_SIGNED_INT:
- lua_pushstring(lua, "SIGNED_INT");
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- lua_pushstring(lua, "UNSIGNED_INT");
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- lua_pushstring(lua, "IEEE_FLOAT");
- break;
- case EDSLIB_BASICTYPE_BINARY:
- lua_pushstring(lua, "BINARY");
- break;
- case EDSLIB_BASICTYPE_CONTAINER:
- lua_pushstring(lua, "CONTAINER");
- break;
- case EDSLIB_BASICTYPE_COMPONENT:
- lua_pushstring(lua, "COMPONENT");
- break;
- case EDSLIB_BASICTYPE_ARRAY:
- lua_pushstring(lua, "ARRAY");
- break;
- case EDSLIB_BASICTYPE_GENERIC:
- lua_pushstring(lua, "GENERIC");
- break;
- default:
- lua_pushnil(lua);
- break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ lua_pushstring(lua, "SIGNED_INT");
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ lua_pushstring(lua, "UNSIGNED_INT");
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ lua_pushstring(lua, "IEEE_FLOAT");
+ break;
+ case EDSLIB_BASICTYPE_BINARY:
+ lua_pushstring(lua, "BINARY");
+ break;
+ case EDSLIB_BASICTYPE_CONTAINER:
+ lua_pushstring(lua, "CONTAINER");
+ break;
+ case EDSLIB_BASICTYPE_COMPONENT:
+ lua_pushstring(lua, "COMPONENT");
+ break;
+ case EDSLIB_BASICTYPE_ARRAY:
+ lua_pushstring(lua, "ARRAY");
+ break;
+ case EDSLIB_BASICTYPE_GENERIC:
+ lua_pushstring(lua, "GENERIC");
+ break;
+ default:
+ lua_pushnil(lua);
+ break;
}
lua_setfield(lua, -2, "TypeClass");
@@ -867,12 +873,11 @@ static int EdsLib_LuaBinding_GetMemberIterator(lua_State *lua)
{
EdsLib_Binding_DescriptorObject_t *Object = luaL_checkudata(lua, 1, "EdsLib_Object");
- lua_newtable(lua); /* table to hold names */
- lua_newtable(lua); /* table to hold values (userdata) */
+ lua_newtable(lua); /* table to hold names */
+ lua_newtable(lua); /* table to hold values (userdata) */
/* fill in the two temporary tables */
- EdsLib_DisplayDB_IterateBaseEntities(Object->GD, Object->EdsId,
- EdsLib_LuaBinding_EnumerateMembers_Callback, lua);
+ EdsLib_DisplayDB_IterateBaseEntities(Object->GD, Object->EdsId, EdsLib_LuaBinding_EnumerateMembers_Callback, lua);
lua_pushinteger(lua, 0); /* "next index" into the table */
lua_pushcclosure(lua, EdsLib_LuaBinding_MemberIterator_Impl, 3);
@@ -887,8 +892,8 @@ static void EdsLib_LuaBinding_CountMembers_Callback(void *Arg, const EdsLib_Enti
static int EdsLib_LuaBinding_GetObjectLength(lua_State *lua)
{
- EdsLib_Binding_DescriptorObject_t *Object = luaL_checkudata(lua, 1, "EdsLib_Object");
- lua_Integer ResultLen = 0;
+ EdsLib_Binding_DescriptorObject_t *Object = luaL_checkudata(lua, 1, "EdsLib_Object");
+ lua_Integer ResultLen = 0;
if (Object->TypeInfo.ElemType == EDSLIB_BASICTYPE_ARRAY)
{
@@ -901,8 +906,10 @@ static int EdsLib_LuaBinding_GetObjectLength(lua_State *lua)
* the possible presence of unnamed base types. The number returned here
* reflect the same number that one would get from an iterator.
*/
- EdsLib_DisplayDB_IterateBaseEntities(Object->GD, Object->EdsId,
- EdsLib_LuaBinding_CountMembers_Callback, &ResultLen);
+ EdsLib_DisplayDB_IterateBaseEntities(Object->GD,
+ Object->EdsId,
+ EdsLib_LuaBinding_CountMembers_Callback,
+ &ResultLen);
}
lua_pushinteger(lua, ResultLen);
@@ -927,8 +934,8 @@ static int EdsLib_LuaBinding_TypeEqualCheck(lua_State *lua)
}
else
{
- lua_pushboolean(lua, EdsLib_Binding_CheckEdsObjectsCompatible(Obj1, Obj2) ==
- EDSLIB_BINDING_COMPATIBILITY_EXACT);
+ lua_pushboolean(lua,
+ EdsLib_Binding_CheckEdsObjectsCompatible(Obj1, Obj2) == EDSLIB_BINDING_COMPATIBILITY_EXACT);
}
return 1;
@@ -943,8 +950,6 @@ static int EdsLib_LuaBinding_API(lua_State *lua)
return 1;
}
-
-
/* *********************************************************
* PUBLIC API FUNCTIONS BELOW HERE
* *********************************************************/
@@ -976,7 +981,8 @@ void EdsLib_LuaBinding_GetNativeObject(EdsLib_LuaBinding_State_t *lua, int narg,
}
}
-EdsLib_LuaBinding_DescriptorObject_t *EdsLib_LuaBinding_CreateEmptyObject(EdsLib_LuaBinding_State_t *lua, size_t MaxSize)
+EdsLib_LuaBinding_DescriptorObject_t *EdsLib_LuaBinding_CreateEmptyObject(EdsLib_LuaBinding_State_t *lua,
+ size_t MaxSize)
{
EdsLib_Binding_DescriptorObject_t *ObjectUserData;
@@ -997,8 +1003,8 @@ void EdsLib_Lua_Attach(EdsLib_LuaBinding_State_t *lua, const EdsLib_LuaBinding_D
}
EdsLib_Lua_Database_Userdata_t *DbObj = lua_newuserdata(lua, sizeof(EdsLib_Lua_Database_Userdata_t));
- DbObj->GD = MissionObj;
- Obj = lua_gettop(lua);
+ DbObj->GD = MissionObj;
+ Obj = lua_gettop(lua);
lua_newtable(lua);
diff --git a/edslib/python/CMakeLists.txt b/edslib/python/CMakeLists.txt
index add721b..63355b9 100644
--- a/edslib/python/CMakeLists.txt
+++ b/edslib/python/CMakeLists.txt
@@ -38,9 +38,6 @@
# PYTHON_LIBS = libraries to put on link line (-l switches)
#
-# More fixes needed for 3.13!
-add_definitions(-Wno-deprecated-declarations)
-
project(EDSLIB_PYTHONBINDINGS C)
if(NOT PYTHON_FOUND)
@@ -79,6 +76,11 @@ option(EDSLIB_PYTHON_BUILD_STANDALONE_MODULE
if (NOT PYTHON_FOUND)
message(" Python support not configured, skipping EdsLib Python bindings")
else ()
+ # Note when using the Python.h header file it sometimes defines things like _XOPEN_SOURCE directly
+ # To avoid triggering errors, do not use any existing compile definitions in this module
+ set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "")
+ set_directory_properties(PROPERTIES COMPILE_OPTIONS "-Wno-deprecated-declarations")
+
include_directories(inc)
include_directories(${EDSLIB_FSW_SOURCE_DIR}/inc)
include_directories(${PYTHON_INCLUDE_DIRS})
diff --git a/edslib/python/inc/edslib_python.h b/edslib/python/inc/edslib_python.h
index 04a415d..39a5ee2 100644
--- a/edslib/python/inc/edslib_python.h
+++ b/edslib/python/inc/edslib_python.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file edslib_python.h
* \ingroup python
@@ -30,7 +29,6 @@
#ifndef _EDSLIB_PYTHON_H_
#define _EDSLIB_PYTHON_H_
-
#include
#include
#include
@@ -40,7 +38,7 @@
*
* This is provided for applications that supply their own custom init routine.
*/
-#define EDSLIB_PYTHON_DOC "Module which provides an interface to the EDS Runtime Library."
+#define EDSLIB_PYTHON_DOC "Module which provides an interface to the EDS Runtime Library."
/**
* Base Name of the Python module
@@ -50,7 +48,7 @@
* as the base name, which carries through to the respective "repr()"
* implementation and other user-visible items.
*/
-#define EDSLIB_PYTHON_MODULE_NAME "EdsLib"
+#define EDSLIB_PYTHON_MODULE_NAME "EdsLib"
/**
* Get the name of a Python entity
@@ -59,8 +57,7 @@
* by adding a prefix of EDSLIB_PYTHON_MODULE_NAME. It is used
* by all types to keep the naming consistent.
*/
-#define EDSLIB_PYTHON_ENTITY_NAME(x) EDSLIB_PYTHON_MODULE_NAME "." x
-
+#define EDSLIB_PYTHON_ENTITY_NAME(x) EDSLIB_PYTHON_MODULE_NAME "." x
/**
* Main Initializer function that sets up a newly-minted module object
@@ -75,7 +72,7 @@
* different naming and calling conventions). So it is expected that
* an additional wrapper around this will be added to accommodate this.
*/
-PyObject* EdsLib_Python_CreateModule(void);
+PyObject *EdsLib_Python_CreateModule(void);
/**
* Creates a Python EDS Database object from a C Database Object
@@ -151,7 +148,7 @@ const void *EdsLib_Python_ObjectPeek(PyObject *obj);
* is the base type for other types, then this will return
* the size of the largest possible derivative type.
*/
-Py_ssize_t EdsLib_Python_DatabaseEntry_GetMaxSize(PyTypeObject* objtype);
+Py_ssize_t EdsLib_Python_DatabaseEntry_GetMaxSize(PyTypeObject *objtype);
/**
* Create an EDS dynamic array from a C array.
@@ -165,7 +162,8 @@ Py_ssize_t EdsLib_Python_DatabaseEntry_GetMaxSize(PyTypeObject* objtype);
* buffer storage. The buffer will be "read-write" so modifications
* are possible from Python and these will be visible from C.
*/
-PyObject *EdsLib_Python_DynamicArray_FromPtrAndSize(PyTypeObject *objtype, void *ptr, Py_ssize_t nelem, Py_ssize_t elemsz);
+PyObject *
+EdsLib_Python_DynamicArray_FromPtrAndSize(PyTypeObject *objtype, void *ptr, Py_ssize_t nelem, Py_ssize_t elemsz);
/**
* Create an EDS dynamic array from a C array.
@@ -180,8 +178,9 @@ PyObject *EdsLib_Python_DynamicArray_FromPtrAndSize(PyTypeObject *objtype, void
* are not possible from Python. Attempts to get a writable buffer
* using the buffer protocol will fail.
*/
-PyObject *EdsLib_Python_DynamicArray_FromConstPtrAndSize(PyTypeObject *objtype, const void *ptr, Py_ssize_t nelem, Py_ssize_t elemsz);
-
-
-#endif /* _EDSLIB_PYTHON_H_ */
+PyObject *EdsLib_Python_DynamicArray_FromConstPtrAndSize(PyTypeObject *objtype,
+ const void *ptr,
+ Py_ssize_t nelem,
+ Py_ssize_t elemsz);
+#endif /* _EDSLIB_PYTHON_H_ */
diff --git a/edslib/python/src/edslib_python_accessor.c b/edslib/python/src/edslib_python_accessor.c
index 8fa5dcd..3436e80 100644
--- a/edslib/python/src/edslib_python_accessor.c
+++ b/edslib/python/src/edslib_python_accessor.c
@@ -18,41 +18,36 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_accessor.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** This is an object that combines an offset and buffer size along with a
-** pointer to the associated EDS database entry. It implements the Python
-** "descriptor protocol". Instances of this object are can be stored as
-** attributes in other objects to describe EDS object instances within
-** arbitrary memory buffers.
+ ** This is an object that combines an offset and buffer size along with a
+ ** pointer to the associated EDS database entry. It implements the Python
+ ** "descriptor protocol". Instances of this object are can be stored as
+ ** attributes in other objects to describe EDS object instances within
+ ** arbitrary memory buffers.
*/
#include "edslib_python_internal.h"
-static PyObject * EdsLib_Python_Accessor_descr_get(PyObject *obj, PyObject *refobj, PyObject *reftype);
-static int EdsLib_Python_Accessor_descr_set(PyObject *obj, PyObject *refobj, PyObject *val);
-static PyObject * EdsLib_Python_Accessor_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
-static void EdsLib_Python_Accessor_dealloc(PyObject * obj);
-static PyObject * EdsLib_Python_Accessor_repr(PyObject *obj);
-
-PyTypeObject EdsLib_Python_AccessorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("ElementAccessor"),
- .tp_basicsize = sizeof(EdsLib_Python_Accessor_t),
- .tp_dealloc = EdsLib_Python_Accessor_dealloc,
- .tp_new = EdsLib_Python_Accessor_new,
- .tp_repr = EdsLib_Python_Accessor_repr,
- .tp_descr_get = EdsLib_Python_Accessor_descr_get,
- .tp_descr_set = EdsLib_Python_Accessor_descr_set,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS Element Accessor Type")
-};
-
+static PyObject *EdsLib_Python_Accessor_descr_get(PyObject *obj, PyObject *refobj, PyObject *reftype);
+static int EdsLib_Python_Accessor_descr_set(PyObject *obj, PyObject *refobj, PyObject *val);
+static PyObject *EdsLib_Python_Accessor_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
+static void EdsLib_Python_Accessor_dealloc(PyObject *obj);
+static PyObject *EdsLib_Python_Accessor_repr(PyObject *obj);
+
+PyTypeObject EdsLib_Python_AccessorType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("ElementAccessor"),
+ .tp_basicsize = sizeof(EdsLib_Python_Accessor_t),
+ .tp_dealloc = EdsLib_Python_Accessor_dealloc,
+ .tp_new = EdsLib_Python_Accessor_new,
+ .tp_repr = EdsLib_Python_Accessor_repr,
+ .tp_descr_get = EdsLib_Python_Accessor_descr_get,
+ .tp_descr_set = EdsLib_Python_Accessor_descr_set,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS Element Accessor Type") };
PyObject *EdsLib_Python_ElementAccessor_CreateFromOffsetSize(EdsLib_Id_t EdsId, Py_ssize_t Offset, Py_ssize_t Length)
{
@@ -63,33 +58,33 @@ PyObject *EdsLib_Python_ElementAccessor_CreateFromOffsetSize(EdsLib_Id_t EdsId,
{
return NULL;
}
- self->EdsId = EdsId;
- self->Offset = Offset;
+ self->EdsId = EdsId;
+ self->Offset = Offset;
self->TotalLength = Length;
- return (PyObject*)self;
+ return (PyObject *)self;
}
PyObject *EdsLib_Python_ElementAccessor_CreateFromEntityInfo(const EdsLib_DataTypeDB_EntityInfo_t *EntityInfo)
{
return EdsLib_Python_ElementAccessor_CreateFromOffsetSize(EntityInfo->EdsId,
- EntityInfo->Offset.Bytes, EntityInfo->MaxSize.Bytes);
+ EntityInfo->Offset.Bytes,
+ EntityInfo->MaxSize.Bytes);
}
-static void EdsLib_Python_Accessor_dealloc(PyObject * obj)
+static void EdsLib_Python_Accessor_dealloc(PyObject *obj)
{
obj->ob_type->tp_free(obj);
}
-static PyObject * EdsLib_Python_Accessor_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
+static PyObject *EdsLib_Python_Accessor_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
{
- EdsLib_Python_Accessor_t *self = NULL;
- Py_ssize_t Offset = 0;
- Py_ssize_t BufferSize = 0;
- unsigned long EdsId;
+ EdsLib_Python_Accessor_t *self = NULL;
+ Py_ssize_t Offset = 0;
+ Py_ssize_t BufferSize = 0;
+ unsigned long EdsId;
- if (!PyArg_ParseTuple(args, "kn|n:EdsLib_Python_Accessor_new",
- &EdsId, &BufferSize, &Offset))
+ if (!PyArg_ParseTuple(args, "kn|n:EdsLib_Python_Accessor_new", &EdsId, &BufferSize, &Offset))
{
return NULL;
}
@@ -104,33 +99,33 @@ static PyObject * EdsLib_Python_Accessor_new(PyTypeObject *obj, PyObject *args,
* By default, if not supplied, the assume the buffer size is
* equal to the maximum possible size
*/
- self->EdsId = EdsId;
- self->Offset = Offset;
+ self->EdsId = EdsId;
+ self->Offset = Offset;
self->TotalLength = BufferSize;
- return (PyObject*)self;
+ return (PyObject *)self;
}
-PyObject * EdsLib_Python_Accessor_repr(PyObject *obj)
+PyObject *EdsLib_Python_Accessor_repr(PyObject *obj)
{
- EdsLib_Python_Accessor_t *self = (EdsLib_Python_Accessor_t *)obj;
- PyObject *result = NULL;
+ EdsLib_Python_Accessor_t *self = (EdsLib_Python_Accessor_t *)obj;
+ PyObject *result = NULL;
result = PyUnicode_FromFormat("%s(%lu,%zd,%zd)",
- obj->ob_type->tp_name,
- (unsigned long)self->EdsId,
- self->TotalLength,
- self->Offset);
+ obj->ob_type->tp_name,
+ (unsigned long)self->EdsId,
+ self->TotalLength,
+ self->Offset);
return result;
}
static PyObject *EdsLib_Python_Accessor_descr_get(PyObject *obj, PyObject *refobj, PyObject *reftype)
{
- EdsLib_Python_Accessor_t *self = (EdsLib_Python_Accessor_t *)obj;
+ EdsLib_Python_Accessor_t *self = (EdsLib_Python_Accessor_t *)obj;
EdsLib_Python_Database_t *edsdb = NULL;
- PyTypeObject *subtype;
- PyObject *result;
+ PyTypeObject *subtype;
+ PyObject *result;
result = NULL;
@@ -156,9 +151,9 @@ static PyObject *EdsLib_Python_Accessor_descr_get(PyObject *obj, PyObject *refob
{
edsdb = ((EdsLib_Python_DatabaseEntry_t *)refobj->ob_type)->EdsDb;
}
- else if (PyObject_IsInstance(refobj, (PyObject*)&EdsLib_Python_ObjectArrayType))
+ else if (PyObject_IsInstance(refobj, (PyObject *)&EdsLib_Python_ObjectArrayType))
{
- edsdb = ((EdsLib_Python_ObjectArray_t*)refobj)->RefDbEntry->EdsDb;
+ edsdb = ((EdsLib_Python_ObjectArray_t *)refobj)->RefDbEntry->EdsDb;
}
if (edsdb == NULL)
@@ -183,7 +178,7 @@ static PyObject *EdsLib_Python_Accessor_descr_get(PyObject *obj, PyObject *refob
static int EdsLib_Python_Accessor_descr_set(PyObject *obj, PyObject *refobj, PyObject *val)
{
PyObject *dstobj = NULL;
- int result = -1;
+ int result = -1;
do
{
@@ -199,17 +194,15 @@ static int EdsLib_Python_Accessor_descr_set(PyObject *obj, PyObject *refobj, PyO
break;
}
- if (!EdsLib_Python_ConvertPythonToEdsObject((EdsLib_Python_ObjectBase_t*)dstobj, val))
+ if (!EdsLib_Python_ConvertPythonToEdsObject((EdsLib_Python_ObjectBase_t *)dstobj, val))
{
break;
}
result = 0;
- }
- while(0);
+ } while (0);
Py_XDECREF(dstobj);
return result;
}
-
diff --git a/edslib/python/src/edslib_python_array.c b/edslib/python/src/edslib_python_array.c
index ef47c24..2c6ab88 100644
--- a/edslib/python/src/edslib_python_array.c
+++ b/edslib/python/src/edslib_python_array.c
@@ -18,60 +18,49 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_array.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** This extends the base type with the Python Sequence protocol. This forms
-** the base type of all EDS array objects. For static EDS arrays, i.e.
-** those defined at compile time in an EDS file using the "ArrayDataType" EDS
-** element, this type will be further derived with the EDS definition in a
-** manner similar to scalars and containers.
-**
-** The python bindings also allow for dynamic arrays, which are allocated at
-** run time from any other EDS object and allow any length to be created,
-** memory permitting. These also derive (separately) from this base type.
+ ** This extends the base type with the Python Sequence protocol. This forms
+ ** the base type of all EDS array objects. For static EDS arrays, i.e.
+ ** those defined at compile time in an EDS file using the "ArrayDataType" EDS
+ ** element, this type will be further derived with the EDS definition in a
+ ** manner similar to scalars and containers.
+ **
+ ** The python bindings also allow for dynamic arrays, which are allocated at
+ ** run time from any other EDS object and allow any length to be created,
+ ** memory permitting. These also derive (separately) from this base type.
*/
#include "edslib_python_internal.h"
-static Py_ssize_t EdsLib_Python_ObjectArray_seq_len(PyObject *obj);
-static PyObject * EdsLib_Python_ObjectArray_seq_item(PyObject *obj, Py_ssize_t idx);
-static int EdsLib_Python_ObjectArray_seq_ass_item(PyObject *obj, Py_ssize_t idx, PyObject *val);
-static int EdsLib_Python_ObjectArray_getbuffer(PyObject *obj, Py_buffer *view, int flags);
-static void EdsLib_Python_ObjectArray_releasebuffer(PyObject *obj, Py_buffer *view);
-static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args, PyObject *kwds);
-
-
-static PyBufferProcs EdsLib_Python_ObjectArray_BufferProcs =
-{
- .bf_getbuffer = EdsLib_Python_ObjectArray_getbuffer,
- .bf_releasebuffer = EdsLib_Python_ObjectArray_releasebuffer
-};
-
-
-static PySequenceMethods EdsLib_Python_ObjectArray_SequenceMethods =
-{
- .sq_length = EdsLib_Python_ObjectArray_seq_len,
- .sq_item = EdsLib_Python_ObjectArray_seq_item,
- .sq_ass_item = EdsLib_Python_ObjectArray_seq_ass_item
-};
-
-PyTypeObject EdsLib_Python_ObjectArrayType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Array"),
- .tp_basicsize = sizeof(EdsLib_Python_ObjectArray_t),
- .tp_base = &EdsLib_Python_ObjectBaseType,
- .tp_as_buffer = &EdsLib_Python_ObjectArray_BufferProcs,
- .tp_as_sequence = &EdsLib_Python_ObjectArray_SequenceMethods,
- .tp_init = EdsLib_Python_ObjectArray_init,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS Array Type")
-};
-
+static Py_ssize_t EdsLib_Python_ObjectArray_seq_len(PyObject *obj);
+static PyObject *EdsLib_Python_ObjectArray_seq_item(PyObject *obj, Py_ssize_t idx);
+static int EdsLib_Python_ObjectArray_seq_ass_item(PyObject *obj, Py_ssize_t idx, PyObject *val);
+static int EdsLib_Python_ObjectArray_getbuffer(PyObject *obj, Py_buffer *view, int flags);
+static void EdsLib_Python_ObjectArray_releasebuffer(PyObject *obj, Py_buffer *view);
+static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args, PyObject *kwds);
+
+static PyBufferProcs EdsLib_Python_ObjectArray_BufferProcs = { .bf_getbuffer = EdsLib_Python_ObjectArray_getbuffer,
+ .bf_releasebuffer =
+ EdsLib_Python_ObjectArray_releasebuffer };
+
+static PySequenceMethods EdsLib_Python_ObjectArray_SequenceMethods = { .sq_length = EdsLib_Python_ObjectArray_seq_len,
+ .sq_item = EdsLib_Python_ObjectArray_seq_item,
+ .sq_ass_item =
+ EdsLib_Python_ObjectArray_seq_ass_item };
+
+PyTypeObject EdsLib_Python_ObjectArrayType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("Array"),
+ .tp_basicsize = sizeof(EdsLib_Python_ObjectArray_t),
+ .tp_base = &EdsLib_Python_ObjectBaseType,
+ .tp_as_buffer = &EdsLib_Python_ObjectArray_BufferProcs,
+ .tp_as_sequence = &EdsLib_Python_ObjectArray_SequenceMethods,
+ .tp_init = EdsLib_Python_ObjectArray_init,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS Array Type") };
static Py_ssize_t EdsLib_Python_ObjectArray_seq_len(PyObject *obj)
{
@@ -79,31 +68,30 @@ static Py_ssize_t EdsLib_Python_ObjectArray_seq_len(PyObject *obj)
return self->ElementCount;
}
-static PyObject * EdsLib_Python_ObjectArray_GetIndexAccessor(PyObject *obj, Py_ssize_t idx)
+static PyObject *EdsLib_Python_ObjectArray_GetIndexAccessor(PyObject *obj, Py_ssize_t idx)
{
EdsLib_Python_ObjectArray_t *self = (EdsLib_Python_ObjectArray_t *)obj;
- PyObject *accessor;
-
+ PyObject *accessor;
if (idx >= 0 && idx < self->ElementCount)
{
accessor = EdsLib_Python_ElementAccessor_CreateFromOffsetSize(self->RefDbEntry->EdsId,
- self->ElementSize * idx, self->ElementSize);
+ self->ElementSize * idx,
+ self->ElementSize);
}
else
{
- PyErr_Format(PyExc_IndexError, "Request for index %zd in array of length %zd",
- idx, self->ElementCount);
+ PyErr_Format(PyExc_IndexError, "Request for index %zd in array of length %zd", idx, self->ElementCount);
accessor = NULL;
}
return accessor;
}
-static PyObject * EdsLib_Python_ObjectArray_seq_item(PyObject *obj, Py_ssize_t idx)
+static PyObject *EdsLib_Python_ObjectArray_seq_item(PyObject *obj, Py_ssize_t idx)
{
- PyObject *accessor = EdsLib_Python_ObjectArray_GetIndexAccessor(obj, idx);
- PyObject *result;
+ PyObject *accessor = EdsLib_Python_ObjectArray_GetIndexAccessor(obj, idx);
+ PyObject *result;
descrgetfunc getfunc;
if (accessor == NULL)
@@ -134,8 +122,8 @@ static PyObject * EdsLib_Python_ObjectArray_seq_item(PyObject *obj, Py_ssize_t
static int EdsLib_Python_ObjectArray_seq_ass_item(PyObject *obj, Py_ssize_t idx, PyObject *val)
{
- PyObject *accessor = EdsLib_Python_ObjectArray_GetIndexAccessor(obj, idx);
- int result;
+ PyObject *accessor = EdsLib_Python_ObjectArray_GetIndexAccessor(obj, idx);
+ int result;
descrsetfunc setfunc;
if (accessor == NULL)
@@ -162,10 +150,10 @@ static int EdsLib_Python_ObjectArray_seq_ass_item(PyObject *obj, Py_ssize_t idx,
static int EdsLib_Python_ObjectArray_getbuffer(PyObject *obj, Py_buffer *view, int flags)
{
- EdsLib_Python_ObjectArray_t * self = (EdsLib_Python_ObjectArray_t *)obj;
- Py_ssize_t ArrayItemSize;
+ EdsLib_Python_ObjectArray_t *self = (EdsLib_Python_ObjectArray_t *)obj;
+ Py_ssize_t ArrayItemSize;
- ArrayItemSize = EdsLib_Python_DatabaseEntry_GetMaxSize((PyTypeObject*)self->RefDbEntry);
+ ArrayItemSize = EdsLib_Python_DatabaseEntry_GetMaxSize((PyTypeObject *)self->RefDbEntry);
if (view->itemsize <= 0)
{
return -1;
@@ -192,7 +180,7 @@ static int EdsLib_Python_ObjectArray_getbuffer(PyObject *obj, Py_buffer *view, i
}
if ((flags & PyBUF_ND) == PyBUF_ND)
{
- view->ndim = 1;
+ view->ndim = 1;
view->shape = &self->ElementCount;
}
if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES)
@@ -208,18 +196,18 @@ static void EdsLib_Python_ObjectArray_releasebuffer(PyObject *obj, Py_buffer *vi
EdsLib_Python_Buffer_ReleaseContentRef(view->internal);
}
-static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args, PyObject *kwds)
+static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args, PyObject *kwds)
{
- static const char *in_kwlist[] = { "value", NULL };
- EdsLib_Python_ObjectArray_t * self = (EdsLib_Python_ObjectArray_t *)obj;
- EdsLib_Python_DatabaseEntry_t *dbent = NULL;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ static const char *in_kwlist[] = { "value", NULL };
+ EdsLib_Python_ObjectArray_t *self = (EdsLib_Python_ObjectArray_t *)obj;
+ EdsLib_Python_DatabaseEntry_t *dbent = NULL;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- Py_ssize_t maxsize = -1;
- Py_ssize_t nelem = -1;
- Py_ssize_t elemsz = -1;
- Py_ssize_t idx;
- int result = -1;
+ Py_ssize_t maxsize = -1;
+ Py_ssize_t nelem = -1;
+ Py_ssize_t elemsz = -1;
+ Py_ssize_t idx;
+ int result = -1;
/*
* First drop any existing buffer (e.g. in case __init__ is invoked directly)
@@ -227,11 +215,11 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
Py_CLEAR(self->RefDbEntry);
kwds = EdsLib_Python_ObjectBase_InitArgsToKwds(args, kwds, in_kwlist);
- args = NULL; /* should no longer be used directly */
+ args = NULL; /* should no longer be used directly */
do
{
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|O:ObjectArray_init", "dbent", &dbent))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|O:ObjectArray_init", "dbent", &dbent))
{
break;
}
@@ -241,29 +229,26 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
Py_INCREF(dbent); /* make owned. It is DECREF'ed at the end of this function. */
if (Py_TYPE(dbent) != &EdsLib_Python_DatabaseEntryType)
{
- PyErr_Format(PyExc_TypeError, "dbent must be a database entry type, not %s",
- Py_TYPE(dbent)->tp_name);
+ PyErr_Format(PyExc_TypeError, "dbent must be a database entry type, not %s", Py_TYPE(dbent)->tp_name);
break;
}
}
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|n:ObjectArray_init", "nelem", &nelem))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|n:ObjectArray_init", "nelem", &nelem))
{
break;
}
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|n:ObjectArray_init", "elemsz", &elemsz))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|n:ObjectArray_init", "elemsz", &elemsz))
{
break;
}
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|n:ObjectArray_init", "maxsize", &maxsize))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|n:ObjectArray_init", "maxsize", &maxsize))
{
break;
}
-
-
/*
* If the object has a direct EDS definition (static array) then look up the info now.
* This does not work for dynamic arrays or anything that doesn't directly map to an EDS definition.
@@ -282,15 +267,17 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
{
EdsLib_DataTypeDB_EntityInfo_t EntityInfo;
- if (EdsLib_DataTypeDB_GetMemberByIndex(SelfDbEntry->EdsDb->GD, SelfDbEntry->EdsId, 0, &EntityInfo) != EDSLIB_SUCCESS)
+ if (EdsLib_DataTypeDB_GetMemberByIndex(SelfDbEntry->EdsDb->GD, SelfDbEntry->EdsId, 0, &EntityInfo)
+ != EDSLIB_SUCCESS)
{
PyErr_Format(PyExc_RuntimeError, "Cannot get array entity info from EDS DB");
break;
}
- dbent = (EdsLib_Python_DatabaseEntry_t *)EdsLib_Python_DatabaseEntry_GetFromEdsId((PyObject*)SelfDbEntry->EdsDb, EntityInfo.EdsId);
+ dbent = (EdsLib_Python_DatabaseEntry_t *)EdsLib_Python_DatabaseEntry_GetFromEdsId(
+ (PyObject *)SelfDbEntry->EdsDb,
+ EntityInfo.EdsId);
}
-
}
else
{
@@ -326,8 +313,7 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
{
elemsz = maxsize / nelem;
}
- else if (EdsLib_DataTypeDB_GetDerivedInfo(dbent->EdsDb->GD,
- dbent->EdsId, &DerivInfo) == EDSLIB_SUCCESS)
+ else if (EdsLib_DataTypeDB_GetDerivedInfo(dbent->EdsDb->GD, dbent->EdsId, &DerivInfo) == EDSLIB_SUCCESS)
{
elemsz = DerivInfo.MaxSize.Bytes;
}
@@ -381,10 +367,10 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
break;
}
- self->RefDbEntry = dbent;
- dbent = NULL; /* steal ref */
+ self->RefDbEntry = dbent;
+ dbent = NULL; /* steal ref */
self->ElementCount = nelem;
- self->ElementSize = elemsz;
+ self->ElementSize = elemsz;
/*
* At this point the Python object is fully initialized....
@@ -399,7 +385,8 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
* Now get the type info for the _element_ rather than the array itself.
* This should always be present
*/
- if (EdsLib_DataTypeDB_GetTypeInfo(self->RefDbEntry->EdsDb->GD, self->RefDbEntry->EdsId, &TypeInfo) != EDSLIB_SUCCESS)
+ if (EdsLib_DataTypeDB_GetTypeInfo(self->RefDbEntry->EdsDb->GD, self->RefDbEntry->EdsId, &TypeInfo)
+ != EDSLIB_SUCCESS)
{
PyErr_Format(PyExc_RuntimeError, "Cannot get type info from EDS DB");
break;
@@ -411,7 +398,7 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
* */
if (TypeInfo.NumSubElements > 0)
{
- EdsLib_Binding_Buffer_Content_t *content;
+ EdsLib_Binding_Buffer_Content_t *content;
EdsLib_Binding_DescriptorObject_t desc;
content = EdsLib_Python_Buffer_GetContentRef(self->objbase.StorageBuf, PyBUF_WRITABLE);
@@ -422,8 +409,8 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
memset(&desc, 0, sizeof(desc));
- desc.GD = self->RefDbEntry->EdsDb->GD;
- desc.EdsId = self->RefDbEntry->EdsId;
+ desc.GD = self->RefDbEntry->EdsDb->GD;
+ desc.EdsId = self->RefDbEntry->EdsId;
desc.Offset = self->objbase.Offset;
desc.Length = self->ElementSize;
EdsLib_Binding_SetDescBuffer(&desc, content);
@@ -440,12 +427,10 @@ static int EdsLib_Python_ObjectArray_init(PyObject *obj, PyObject *args
}
result = 0;
- }
- while (0);
+ } while (0);
Py_XDECREF(dbent);
Py_XDECREF(kwds);
return result;
}
-
diff --git a/edslib/python/src/edslib_python_base.c b/edslib/python/src/edslib_python_base.c
index 48e0621..f8213f6 100644
--- a/edslib/python/src/edslib_python_base.c
+++ b/edslib/python/src/edslib_python_base.c
@@ -18,19 +18,18 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_base.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement common base type Python bindings for EDS objects
-**
-** This extends the accessor type with actual instance information, mainly
-** a buffer object to hold the EDS object described by the accessor.
-**
-** This is functionality that every instance of an EDS object should implement,
-** such as the buffer protocol.
+ ** Implement common base type Python bindings for EDS objects
+ **
+ ** This extends the accessor type with actual instance information, mainly
+ ** a buffer object to hold the EDS object described by the accessor.
+ **
+ ** This is functionality that every instance of an EDS object should implement,
+ ** such as the buffer protocol.
*/
/*
@@ -103,41 +102,34 @@
*
*/
-
#include "edslib_python_internal.h"
-static char EDSLIB_PYTHON_BYTES_FORMAT[] = "B";
-
-static void EdsLib_Python_ObjectBase_dealloc(PyObject * obj);
-static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject *kwds);
-static PyObject * EdsLib_Python_ObjectBase_repr(PyObject *obj);
-static PyObject * EdsLib_Python_ObjectBase_call(PyObject *obj, PyObject *args, PyObject *kwds);
-static int EdsLib_Python_ObjectBase_getbuffer(PyObject *obj, Py_buffer *view, int flags);
-static void EdsLib_Python_ObjectBase_releasebuffer(PyObject *obj, Py_buffer *view);
-
-static PyBufferProcs EdsLib_Python_ObjectBase_BufferProcs =
-{
- .bf_getbuffer = EdsLib_Python_ObjectBase_getbuffer,
- .bf_releasebuffer = EdsLib_Python_ObjectBase_releasebuffer
-};
-
-
-PyTypeObject EdsLib_Python_ObjectBaseType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Object"),
- .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
- .tp_dealloc = EdsLib_Python_ObjectBase_dealloc,
- .tp_init = EdsLib_Python_ObjectBase_init,
- .tp_new = PyType_GenericNew,
- .tp_repr = EdsLib_Python_ObjectBase_repr,
- .tp_call = EdsLib_Python_ObjectBase_call,
- .tp_as_buffer = &EdsLib_Python_ObjectBase_BufferProcs,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS Object")
-};
-
-static void EdsLib_Python_ObjectBase_dealloc(PyObject * obj)
+static char EDSLIB_PYTHON_BYTES_FORMAT[] = "B";
+
+static void EdsLib_Python_ObjectBase_dealloc(PyObject *obj);
+static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject *kwds);
+static PyObject *EdsLib_Python_ObjectBase_repr(PyObject *obj);
+static PyObject *EdsLib_Python_ObjectBase_call(PyObject *obj, PyObject *args, PyObject *kwds);
+static int EdsLib_Python_ObjectBase_getbuffer(PyObject *obj, Py_buffer *view, int flags);
+static void EdsLib_Python_ObjectBase_releasebuffer(PyObject *obj, Py_buffer *view);
+
+static PyBufferProcs EdsLib_Python_ObjectBase_BufferProcs = { .bf_getbuffer = EdsLib_Python_ObjectBase_getbuffer,
+ .bf_releasebuffer =
+ EdsLib_Python_ObjectBase_releasebuffer };
+
+PyTypeObject EdsLib_Python_ObjectBaseType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("Object"),
+ .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
+ .tp_dealloc = EdsLib_Python_ObjectBase_dealloc,
+ .tp_init = EdsLib_Python_ObjectBase_init,
+ .tp_new = PyType_GenericNew,
+ .tp_repr = EdsLib_Python_ObjectBase_repr,
+ .tp_call = EdsLib_Python_ObjectBase_call,
+ .tp_as_buffer = &EdsLib_Python_ObjectBase_BufferProcs,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS Object") };
+
+static void EdsLib_Python_ObjectBase_dealloc(PyObject *obj)
{
EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
@@ -157,8 +149,7 @@ PyObject *EdsLib_Python_ObjectBase_GenericNew(PyTypeObject *objtype, PyObject *k
* so to construct an object it should always be a subtype */
if (!PyType_IsSubtype(objtype, &EdsLib_Python_ObjectBaseType))
{
- PyErr_Format(PyExc_TypeError, "Cannot construct EDS objects of type %s\n",
- objtype->tp_name);
+ PyErr_Format(PyExc_TypeError, "Cannot construct EDS objects of type %s\n", objtype->tp_name);
break;
}
@@ -174,18 +165,17 @@ PyObject *EdsLib_Python_ObjectBase_GenericNew(PyTypeObject *objtype, PyObject *k
self = NULL;
break;
}
- }
- while(0);
-
+ } while (0);
return self;
}
-PyObject *EdsLib_Python_ObjectBase_NewSubObject(PyObject *obj, PyTypeObject *subobjtype, Py_ssize_t Offset, Py_ssize_t MaxSize)
+PyObject *
+EdsLib_Python_ObjectBase_NewSubObject(PyObject *obj, PyTypeObject *subobjtype, Py_ssize_t Offset, Py_ssize_t MaxSize)
{
- static const char *kwlist[] = { "buffer", "offset", "maxsize", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
+ static const char *kwlist[] = { "buffer", "offset", "maxsize", NULL };
+ PyObject *args = NULL;
+ PyObject *result = NULL;
EdsLib_Python_ObjectBase_t *self;
/* sanity check -- the type should always be an EDS object */
@@ -197,8 +187,7 @@ PyObject *EdsLib_Python_ObjectBase_NewSubObject(PyObject *obj, PyTypeObject *sub
self = (EdsLib_Python_ObjectBase_t *)obj;
- args = EdsLib_Python_ObjectBase_BuildKwArgs("Onn", kwlist,
- self->StorageBuf, Offset + self->Offset, MaxSize);
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("Onn", kwlist, self->StorageBuf, Offset + self->Offset, MaxSize);
if (args == NULL)
{
return NULL;
@@ -210,15 +199,13 @@ PyObject *EdsLib_Python_ObjectBase_NewSubObject(PyObject *obj, PyTypeObject *sub
return result;
}
-
PyObject *EdsLib_Python_ObjectFromBuffer(PyTypeObject *objtype, PyObject *bufobj, int readonly)
{
static const char *kwlist[] = { "buffer", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
+ PyObject *args = NULL;
+ PyObject *result = NULL;
- args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist,
- EdsLib_Python_Buffer_FromObject(bufobj, readonly));
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist, EdsLib_Python_Buffer_FromObject(bufobj, readonly));
if (args == NULL)
{
return NULL;
@@ -228,18 +215,15 @@ PyObject *EdsLib_Python_ObjectFromBuffer(PyTypeObject *objtype, PyObject *bufobj
Py_DECREF(args);
return result;
-
}
-
PyObject *EdsLib_Python_ObjectFromPtr(PyTypeObject *objtype, void *ptr, Py_ssize_t size)
{
static const char *kwlist[] = { "buffer", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
+ PyObject *args = NULL;
+ PyObject *result = NULL;
- args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist,
- EdsLib_Python_Buffer_FromPtrAndSize(ptr, size));
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist, EdsLib_Python_Buffer_FromPtrAndSize(ptr, size));
if (args == NULL)
{
return NULL;
@@ -254,11 +238,10 @@ PyObject *EdsLib_Python_ObjectFromPtr(PyTypeObject *objtype, void *ptr, Py_ssize
PyObject *EdsLib_Python_ObjectNewCopy(PyTypeObject *objtype, const void *ptr, Py_ssize_t size)
{
static const char *kwlist[] = { "buffer", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
+ PyObject *args = NULL;
+ PyObject *result = NULL;
- args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist,
- EdsLib_Python_Buffer_Copy(ptr, size));
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist, EdsLib_Python_Buffer_Copy(ptr, size));
if (args == NULL)
{
return NULL;
@@ -273,11 +256,10 @@ PyObject *EdsLib_Python_ObjectNewCopy(PyTypeObject *objtype, const void *ptr, Py
PyObject *EdsLib_Python_ObjectFromConstPtr(PyTypeObject *objtype, const void *ptr, Py_ssize_t size)
{
static const char *kwlist[] = { "buffer", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
+ PyObject *args = NULL;
+ PyObject *result = NULL;
- args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist,
- EdsLib_Python_Buffer_FromConstPtrAndSize(ptr, size));
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("N", kwlist, EdsLib_Python_Buffer_FromConstPtrAndSize(ptr, size));
if (args == NULL)
{
return NULL;
@@ -306,14 +288,14 @@ const void *EdsLib_Python_ObjectPeek(PyObject *obj)
static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject *kwds)
{
- static const char *in_kwlist[] = { "value", NULL };
- EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
+ static const char *in_kwlist[] = { "value", NULL };
+ EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
EdsLib_Binding_DescriptorObject_t viewdesc;
- PyObject *srcvalue = NULL;
- PyObject *bufobj = NULL;
- Py_ssize_t MaxSize = 0;
- Py_ssize_t Offset = 0;
- int result = -1;
+ PyObject *srcvalue = NULL;
+ PyObject *bufobj = NULL;
+ Py_ssize_t MaxSize = 0;
+ Py_ssize_t Offset = 0;
+ int result = -1;
/*
* First drop any existing buffer (e.g. in case __init__ is invoked directly)
@@ -321,26 +303,26 @@ static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject
Py_CLEAR(self->StorageBuf);
kwds = EdsLib_Python_ObjectBase_InitArgsToKwds(args, kwds, in_kwlist);
- args = NULL; /* should no longer be used directly */
+ args = NULL; /* should no longer be used directly */
do
{
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|O:ObjectBase_init", "value", &srcvalue))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|O:ObjectBase_init", "value", &srcvalue))
{
break;
}
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|O:ObjectBase_init", "buffer", &bufobj))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|O:ObjectBase_init", "buffer", &bufobj))
{
break;
}
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|n:ObjectBase_init", "offset", &Offset))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|n:ObjectBase_init", "offset", &Offset))
{
break;
}
- if (!EdsLib_Python_ObjectBase_GetKwArg(kwds,"|n:ObjectBase_init", "maxsize", &MaxSize))
+ if (!EdsLib_Python_ObjectBase_GetKwArg(kwds, "|n:ObjectBase_init", "maxsize", &MaxSize))
{
break;
}
@@ -395,7 +377,7 @@ static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject
break;
}
- self->Offset = Offset;
+ self->Offset = Offset;
self->TotalLength = MaxSize;
/*
@@ -405,8 +387,8 @@ static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject
* Note This default approach only works for those objects directly in EDS (DB entries)
* For other object types like Dynamic Arrays they will need a custom routine to do this.
*/
- if (!EdsLib_Python_Buffer_IsInitialized(self->StorageBuf) &&
- Py_TYPE(Py_TYPE(self)) == &EdsLib_Python_DatabaseEntryType)
+ if (!EdsLib_Python_Buffer_IsInitialized(self->StorageBuf)
+ && Py_TYPE(Py_TYPE(self)) == &EdsLib_Python_DatabaseEntryType)
{
if (!EdsLib_Python_SetupObjectDesciptor(self, &viewdesc, PyBUF_WRITABLE))
{
@@ -421,15 +403,13 @@ static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject
/* attempt to initialize the new object from the passed in value.
* If no srcvalue was provided, do nothing. */
- if (srcvalue != NULL &&
- !EdsLib_Python_ConvertPythonToEdsObject(self, srcvalue))
+ if (srcvalue != NULL && !EdsLib_Python_ConvertPythonToEdsObject(self, srcvalue))
{
break;
}
result = 0;
- }
- while(0);
+ } while (0);
Py_XDECREF(kwds);
@@ -438,8 +418,8 @@ static int EdsLib_Python_ObjectBase_init(PyObject *obj, PyObject *args, PyObject
static PyObject *EdsLib_Python_ObjectBase_repr(PyObject *obj)
{
- PyObject *val;
- PyObject *result;
+ PyObject *val;
+ PyObject *result;
ternaryfunc callfunc = Py_TYPE(obj)->tp_call;
if (callfunc == NULL)
@@ -471,14 +451,13 @@ static PyObject *EdsLib_Python_ObjectBase_repr(PyObject *obj)
Py_DECREF(val);
return result;
-
}
static PyObject *EdsLib_Python_ObjectBase_call(PyObject *obj, PyObject *args, PyObject *kwds)
{
- EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
- PyObject *value = NULL;
- PyObject *result;
+ EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
+ PyObject *value = NULL;
+ PyObject *result;
/*
* This functions has two modes:
@@ -487,8 +466,7 @@ static PyObject *EdsLib_Python_ObjectBase_call(PyObject *obj, PyObject *args, Py
* - If an argument is provided, it is a "setter"
* In this case it needs a read-write buffer
*/
- if (args != NULL &&
- !PyArg_UnpackTuple(args, __func__, 0, 1, &value))
+ if (args != NULL && !PyArg_UnpackTuple(args, __func__, 0, 1, &value))
{
return NULL;
}
@@ -516,7 +494,7 @@ static PyObject *EdsLib_Python_ObjectBase_call(PyObject *obj, PyObject *args, Py
int EdsLib_Python_ObjectBase_InitBufferView(EdsLib_Python_ObjectBase_t *self, Py_buffer *view, int flags)
{
- EdsLib_Binding_Buffer_Content_t* content;
+ EdsLib_Binding_Buffer_Content_t *content;
memset(view, 0, sizeof(*view));
@@ -545,16 +523,16 @@ int EdsLib_Python_ObjectBase_InitBufferView(EdsLib_Python_ObjectBase_t *self, Py
}
/* adjust the view pointer/length to point to the window indicated by the accessor */
- view->obj = (PyObject*)self;
+ view->obj = (PyObject *)self;
Py_INCREF(view->obj);
- view->buf = content->Data + self->Offset;
- view->len = self->TotalLength;
- view->readonly = self->StorageBuf->is_readonly;
- view->itemsize = 0;
- view->ndim = 0;
- view->format = NULL;
- view->shape = NULL;
- view->strides = NULL;
+ view->buf = content->Data + self->Offset;
+ view->len = self->TotalLength;
+ view->readonly = self->StorageBuf->is_readonly;
+ view->itemsize = 0;
+ view->ndim = 0;
+ view->format = NULL;
+ view->shape = NULL;
+ view->strides = NULL;
view->suboffsets = NULL;
/*
@@ -569,7 +547,7 @@ int EdsLib_Python_ObjectBase_InitBufferView(EdsLib_Python_ObjectBase_t *self, Py
static int EdsLib_Python_ObjectBase_getbuffer(PyObject *obj, Py_buffer *view, int flags)
{
- EdsLib_Python_ObjectBase_t * self = (EdsLib_Python_ObjectBase_t *)obj;
+ EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
if (EdsLib_Python_ObjectBase_InitBufferView(self, view, flags) != 0)
{
@@ -589,7 +567,7 @@ static int EdsLib_Python_ObjectBase_getbuffer(PyObject *obj, Py_buffer *view, in
}
if ((flags & PyBUF_ND) == PyBUF_ND)
{
- view->ndim = 1;
+ view->ndim = 1;
view->shape = &view->len;
}
if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES)
@@ -597,7 +575,6 @@ static int EdsLib_Python_ObjectBase_getbuffer(PyObject *obj, Py_buffer *view, in
view->strides = &view->itemsize;
}
-
return 0;
}
@@ -608,9 +585,9 @@ static void EdsLib_Python_ObjectBase_releasebuffer(PyObject *obj, Py_buffer *vie
PyObject *EdsLib_Python_ObjectBase_InitArgsToKwds(PyObject *args, PyObject *kwds, const char **kwlist)
{
- PyObject *subargs;
- bool positional_args_valid = (args != NULL && PyTuple_Check(args));
- bool kw_args_valid = (kwds != NULL && PyDict_Check(kwds));
+ PyObject *subargs;
+ bool positional_args_valid = (args != NULL && PyTuple_Check(args));
+ bool kw_args_valid = (kwds != NULL && PyDict_Check(kwds));
Py_ssize_t idx;
/*
@@ -663,8 +640,8 @@ PyObject *EdsLib_Python_ObjectBase_InitArgsToKwds(PyObject *args, PyObject *kwds
bool EdsLib_Python_ObjectBase_SetKwArg(PyObject *kwds, const char *format, const char *kw, ...)
{
PyObject *args;
- bool result = false;
- va_list va;
+ bool result = false;
+ va_list va;
/*
* First convert the value to a python object, then
@@ -674,7 +651,6 @@ bool EdsLib_Python_ObjectBase_SetKwArg(PyObject *kwds, const char *format, const
args = Py_VaBuildValue(format, va);
va_end(va);
-
if (args != NULL)
{
result = (PyDict_SetItemString(kwds, kw, args) == 0);
@@ -686,10 +662,10 @@ bool EdsLib_Python_ObjectBase_SetKwArg(PyObject *kwds, const char *format, const
PyObject *EdsLib_Python_ObjectBase_BuildKwArgs(const char *format, const char **kwlist, ...)
{
- PyObject *args = NULL;
- PyObject *kwds = NULL;
+ PyObject *args = NULL;
+ PyObject *kwds = NULL;
Py_ssize_t idx;
- va_list va;
+ va_list va;
do
{
@@ -736,27 +712,24 @@ PyObject *EdsLib_Python_ObjectBase_BuildKwArgs(const char *format, const char **
}
}
}
- else if (kwlist[0] != NULL &&
- PyDict_SetItemString(kwds, kwlist[0], args) != 0)
+ else if (kwlist[0] != NULL && PyDict_SetItemString(kwds, kwlist[0], args) != 0)
{
/* failed to insert -- unlikely but possible */
Py_DECREF(kwds);
kwds = NULL;
break;
}
- }
- while(0);
+ } while (0);
Py_XDECREF(args);
return kwds;
}
-
bool EdsLib_Python_ObjectBase_GetKwArg(PyObject *kwds, const char *format, const char *kw, void *OutPtr)
{
- bool result;
- bool is_optional;
+ bool result;
+ bool is_optional;
PyObject *item;
/*
@@ -810,4 +783,3 @@ bool EdsLib_Python_ObjectBase_GetKwArg(PyObject *kwds, const char *format, const
return result;
}
-
diff --git a/edslib/python/src/edslib_python_buffer.c b/edslib/python/src/edslib_python_buffer.c
index 5bb5b96..068b734 100644
--- a/edslib/python/src/edslib_python_buffer.c
+++ b/edslib/python/src/edslib_python_buffer.c
@@ -18,33 +18,27 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_buffer.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement Python wrapper type for EdsLib buffer objects
+ ** Implement Python wrapper type for EdsLib buffer objects
*/
#include "edslib_python_internal.h"
-static PyObject * EdsLib_Python_Buffer_repr(PyObject *obj);
-static void EdsLib_Python_Buffer_dealloc(PyObject *obj);
-
-PyTypeObject EdsLib_Python_BufferType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Buffer"),
- .tp_dealloc = EdsLib_Python_Buffer_dealloc,
- .tp_basicsize = sizeof(EdsLib_Python_Buffer_t),
- .tp_repr = EdsLib_Python_Buffer_repr,
- .tp_flags = Py_TPFLAGS_DEFAULT,
- .tp_doc = PyDoc_STR("EDS Buffer")
-};
+static PyObject *EdsLib_Python_Buffer_repr(PyObject *obj);
+static void EdsLib_Python_Buffer_dealloc(PyObject *obj);
+PyTypeObject EdsLib_Python_BufferType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name = EDSLIB_PYTHON_ENTITY_NAME("Buffer"),
+ .tp_dealloc = EdsLib_Python_Buffer_dealloc,
+ .tp_basicsize = sizeof(EdsLib_Python_Buffer_t),
+ .tp_repr = EdsLib_Python_Buffer_repr,
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+ .tp_doc = PyDoc_STR("EDS Buffer") };
-EdsLib_Binding_Buffer_Content_t* EdsLib_Python_Buffer_GetContentRef(EdsLib_Python_Buffer_t *self, int userflags)
+EdsLib_Binding_Buffer_Content_t *EdsLib_Python_Buffer_GetContentRef(EdsLib_Python_Buffer_t *self, int userflags)
{
/*
* Confirm writability
@@ -84,16 +78,16 @@ EdsLib_Binding_Buffer_Content_t* EdsLib_Python_Buffer_GetContentRef(EdsLib_Pytho
return &self->edsbuf;
}
-void EdsLib_Python_Buffer_ReleaseContentRef(EdsLib_Binding_Buffer_Content_t* ref)
+void EdsLib_Python_Buffer_ReleaseContentRef(EdsLib_Binding_Buffer_Content_t *ref)
{
union
{
- uint8_t *byte;
- const EdsLib_Binding_Buffer_Content_t* ref;
- EdsLib_Python_Buffer_t *self;
+ uint8_t *byte;
+ const EdsLib_Binding_Buffer_Content_t *ref;
+ EdsLib_Python_Buffer_t *self;
} ptr;
- ptr.ref = ref;
+ ptr.ref = ref;
ptr.byte -= offsetof(EdsLib_Python_Buffer_t, edsbuf);
if (ptr.self->edsbuf.ReferenceCount > 0)
@@ -109,7 +103,7 @@ void EdsLib_Python_Buffer_ReleaseContentRef(EdsLib_Binding_Buffer_Content_t* ref
static void EdsLib_Python_Buffer_dealloc(PyObject *obj)
{
- EdsLib_Python_Buffer_t *self = (EdsLib_Python_Buffer_t*)obj;
+ EdsLib_Python_Buffer_t *self = (EdsLib_Python_Buffer_t *)obj;
if (self->bufobj)
{
Py_DECREF(self->bufobj->pyobj);
@@ -126,25 +120,26 @@ static void EdsLib_Python_Buffer_dealloc(PyObject *obj)
static PyObject *EdsLib_Python_Buffer_repr(PyObject *obj)
{
- EdsLib_Python_Buffer_t *self = (EdsLib_Python_Buffer_t*)obj;
- PyObject *result;
+ EdsLib_Python_Buffer_t *self = (EdsLib_Python_Buffer_t *)obj;
+ PyObject *result;
if (self->bufobj != NULL)
{
- result = PyUnicode_FromFormat("%s(%R)",obj->ob_type->tp_name,self->bufobj->pyobj);
+ result = PyUnicode_FromFormat("%s(%R)", obj->ob_type->tp_name, self->bufobj->pyobj);
}
else
{
- result = PyUnicode_FromFormat("%s(%p,%zu)",obj->ob_type->tp_name, self->edsbuf.Data, self->edsbuf.MaxContentSize);
+ result =
+ PyUnicode_FromFormat("%s(%p,%zu)", obj->ob_type->tp_name, self->edsbuf.Data, self->edsbuf.MaxContentSize);
}
return result;
}
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int readonly)
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int readonly)
{
- EdsLib_Python_Buffer_t *self = NULL;
- EdsLib_Python_View_t *viewobj = NULL;
+ EdsLib_Python_Buffer_t *self = NULL;
+ EdsLib_Python_View_t *viewobj = NULL;
do
{
@@ -159,7 +154,7 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int re
break;
}
- viewobj = PyMem_Malloc(sizeof(EdsLib_Python_View_t*));
+ viewobj = PyMem_Malloc(sizeof(EdsLib_Python_View_t *));
if (viewobj == NULL)
{
PyErr_NoMemory();
@@ -180,14 +175,13 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int re
*/
memset(viewobj, 0, sizeof(*viewobj));
Py_INCREF(bufobj);
- viewobj->pyobj = bufobj;
- self->bufobj = viewobj;
- self->is_readonly = readonly;
- self->is_dynamic = 0;
+ viewobj->pyobj = bufobj;
+ self->bufobj = viewobj;
+ self->is_readonly = readonly;
+ self->is_dynamic = 0;
self->is_initialized = 1;
memset(&self->edsbuf, 0, sizeof(self->edsbuf));
- }
- while(0);
+ } while (0);
if (self == NULL && viewobj != NULL)
{
@@ -197,10 +191,10 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int re
return self;
}
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_New(Py_ssize_t len)
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_New(Py_ssize_t len)
{
- EdsLib_Python_Buffer_t* self;
- void *mem;
+ EdsLib_Python_Buffer_t *self;
+ void *mem;
mem = PyMem_Malloc(len);
if (mem == NULL)
@@ -218,9 +212,9 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_New(Py_ssize_t len)
* Each must be individually set here or else unpredictable
* behavior ensues.
*/
- self->bufobj = NULL;
- self->is_readonly = 0;
- self->is_dynamic = 1;
+ self->bufobj = NULL;
+ self->is_readonly = 0;
+ self->is_dynamic = 1;
self->is_initialized = 0;
memset(mem, 0, len);
EdsLib_Binding_InitUnmanagedBuffer(&self->edsbuf, mem, len);
@@ -233,9 +227,9 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_New(Py_ssize_t len)
return self;
}
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromPtrAndSize(void *buf, Py_ssize_t len)
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_FromPtrAndSize(void *buf, Py_ssize_t len)
{
- EdsLib_Python_Buffer_t* self;
+ EdsLib_Python_Buffer_t *self;
self = PyObject_New(EdsLib_Python_Buffer_t, &EdsLib_Python_BufferType);
if (self != NULL)
@@ -246,9 +240,9 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromPtrAndSize(void *buf, Py_ssize_
* Each must be individually set here or else unpredictable
* behavior ensues.
*/
- self->bufobj = NULL;
- self->is_readonly = 0;
- self->is_dynamic = 0;
+ self->bufobj = NULL;
+ self->is_readonly = 0;
+ self->is_dynamic = 0;
self->is_initialized = 1;
EdsLib_Binding_InitUnmanagedBuffer(&self->edsbuf, buf, len);
}
@@ -256,9 +250,9 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromPtrAndSize(void *buf, Py_ssize_
return self;
}
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_Copy(const void *buf, Py_ssize_t len)
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_Copy(const void *buf, Py_ssize_t len)
{
- EdsLib_Python_Buffer_t* self = (EdsLib_Python_Buffer_t*)EdsLib_Python_Buffer_New(len);
+ EdsLib_Python_Buffer_t *self = (EdsLib_Python_Buffer_t *)EdsLib_Python_Buffer_New(len);
if (self != NULL)
{
@@ -269,9 +263,9 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_Copy(const void *buf, Py_ssize_t le
return self;
}
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromConstPtrAndSize(const void *buf, Py_ssize_t len)
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_FromConstPtrAndSize(const void *buf, Py_ssize_t len)
{
- EdsLib_Python_Buffer_t* self;
+ EdsLib_Python_Buffer_t *self;
self = PyObject_New(EdsLib_Python_Buffer_t, &EdsLib_Python_BufferType);
if (self != NULL)
@@ -282,17 +276,17 @@ EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromConstPtrAndSize(const void *buf
* Each must be individually set here or else unpredictable
* behavior ensues.
*/
- self->bufobj = NULL;
- self->is_readonly = 1;
- self->is_dynamic = 0;
+ self->bufobj = NULL;
+ self->is_readonly = 1;
+ self->is_dynamic = 0;
self->is_initialized = 1;
- EdsLib_Binding_InitUnmanagedBuffer(&self->edsbuf, (void*)buf, len);
+ EdsLib_Binding_InitUnmanagedBuffer(&self->edsbuf, (void *)buf, len);
}
return self;
}
-const void *EdsLib_Python_Buffer_Peek(EdsLib_Python_Buffer_t* buf)
+const void *EdsLib_Python_Buffer_Peek(EdsLib_Python_Buffer_t *buf)
{
/* cannot peek into Python-backed objects */
if (buf->bufobj != NULL)
@@ -303,10 +297,10 @@ const void *EdsLib_Python_Buffer_Peek(EdsLib_Python_Buffer_t* buf)
return buf->edsbuf.Data;
}
-Py_ssize_t EdsLib_Python_Buffer_GetMaxSize(EdsLib_Python_Buffer_t* buf)
+Py_ssize_t EdsLib_Python_Buffer_GetMaxSize(EdsLib_Python_Buffer_t *buf)
{
EdsLib_Binding_Buffer_Content_t *content;
- Py_ssize_t MaxSize = -1;
+ Py_ssize_t MaxSize = -1;
content = EdsLib_Python_Buffer_GetContentRef(buf, PyBUF_SIMPLE);
if (content != NULL)
@@ -318,13 +312,12 @@ Py_ssize_t EdsLib_Python_Buffer_GetMaxSize(EdsLib_Python_Buffer_t* buf)
return MaxSize;
}
-bool EdsLib_Python_Buffer_IsInitialized(EdsLib_Python_Buffer_t* buf)
+bool EdsLib_Python_Buffer_IsInitialized(EdsLib_Python_Buffer_t *buf)
{
return buf->is_initialized;
}
-void EdsLib_Python_Buffer_SetInitialized(EdsLib_Python_Buffer_t* buf)
+void EdsLib_Python_Buffer_SetInitialized(EdsLib_Python_Buffer_t *buf)
{
buf->is_initialized = 1;
}
-
diff --git a/edslib/python/src/edslib_python_container.c b/edslib/python/src/edslib_python_container.c
index 0d4b493..6245c99 100644
--- a/edslib/python/src/edslib_python_container.c
+++ b/edslib/python/src/edslib_python_container.c
@@ -18,79 +18,69 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_container.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement Python datatype for EDS container objects
-**
-** This extends the base object with the mapping protocol and an
-** iterator that access the attributes
+ ** Implement Python datatype for EDS container objects
+ **
+ ** This extends the base object with the mapping protocol and an
+ ** iterator that access the attributes
*/
#include "edslib_python_internal.h"
-
-static PyObject * EdsLib_Python_ObjectContainer_keys(PyObject *obj);
-static PyObject * EdsLib_Python_ObjectContainer_values(PyObject *obj);
-static PyObject * EdsLib_Python_ObjectContainer_items(PyObject *obj);
-static PyObject * EdsLib_Python_ObjectContainer_iter(PyObject *obj);
-static Py_ssize_t EdsLib_Python_ObjectContainer_map_len(PyObject *obj);
-
-static void EdsLib_Python_ContainerIterator_dealloc(PyObject * obj);
-static int EdsLib_Python_ContainerIterator_traverse(PyObject *obj, visitproc visit, void *arg);
-static int EdsLib_Python_ContainerIterator_clear(PyObject *obj);
-static PyObject * EdsLib_Python_ContainerIterator_iternext(PyObject *obj);
-
-static PyMethodDef EdsLib_Python_Database_methods[] =
-{
- {"keys", (PyCFunction)EdsLib_Python_ObjectContainer_keys, METH_NOARGS, "Get a list of keys in container"},
- {"values", (PyCFunction)EdsLib_Python_ObjectContainer_values, METH_NOARGS, "Get a list of values in container"},
- {"items", (PyCFunction)EdsLib_Python_ObjectContainer_items, METH_NOARGS, "Get a list of key/value tuples in container"},
- {NULL} /* Sentinel */
-};
-
-
-static PyMappingMethods EdsLib_Python_EdsContainer_MappingMethods =
-{
- .mp_length = EdsLib_Python_ObjectContainer_map_len,
- .mp_subscript = PyObject_GenericGetAttr,
- .mp_ass_subscript = PyObject_GenericSetAttr
+static PyObject *EdsLib_Python_ObjectContainer_keys(PyObject *obj);
+static PyObject *EdsLib_Python_ObjectContainer_values(PyObject *obj);
+static PyObject *EdsLib_Python_ObjectContainer_items(PyObject *obj);
+static PyObject *EdsLib_Python_ObjectContainer_iter(PyObject *obj);
+static Py_ssize_t EdsLib_Python_ObjectContainer_map_len(PyObject *obj);
+
+static void EdsLib_Python_ContainerIterator_dealloc(PyObject *obj);
+static int EdsLib_Python_ContainerIterator_traverse(PyObject *obj, visitproc visit, void *arg);
+static int EdsLib_Python_ContainerIterator_clear(PyObject *obj);
+static PyObject *EdsLib_Python_ContainerIterator_iternext(PyObject *obj);
+
+static PyMethodDef EdsLib_Python_Database_methods[] = {
+ { "keys", (PyCFunction)EdsLib_Python_ObjectContainer_keys, METH_NOARGS, "Get a list of keys in container" },
+ { "values", (PyCFunction)EdsLib_Python_ObjectContainer_values, METH_NOARGS, "Get a list of values in container" },
+ { "items",
+ (PyCFunction)EdsLib_Python_ObjectContainer_items,
+ METH_NOARGS, "Get a list of key/value tuples in container" },
+ { NULL } /* Sentinel */
};
-PyTypeObject EdsLib_Python_ObjectContainerType =
+static PyMappingMethods EdsLib_Python_EdsContainer_MappingMethods = { .mp_length =
+ EdsLib_Python_ObjectContainer_map_len,
+ .mp_subscript = PyObject_GenericGetAttr,
+ .mp_ass_subscript = PyObject_GenericSetAttr };
+
+PyTypeObject EdsLib_Python_ObjectContainerType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("Container"),
+ .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
+ .tp_base = &EdsLib_Python_ObjectBaseType,
+ .tp_as_mapping = &EdsLib_Python_EdsContainer_MappingMethods,
+ .tp_methods = EdsLib_Python_Database_methods,
+ .tp_iter = EdsLib_Python_ObjectContainer_iter,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS ContainerDataType") };
+
+PyTypeObject EdsLib_Python_ContainerIteratorType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("ContainerIterator"),
+ .tp_basicsize = sizeof(EdsLib_Python_ContainerIterator_t),
+ .tp_dealloc = EdsLib_Python_ContainerIterator_dealloc,
+ .tp_getattro = PyObject_GenericGetAttr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_traverse = EdsLib_Python_ContainerIterator_traverse,
+ .tp_clear = EdsLib_Python_ContainerIterator_clear,
+ .tp_iter = PyObject_SelfIter,
+ .tp_iternext = EdsLib_Python_ContainerIterator_iternext,
+ .tp_doc = PyDoc_STR("EDS ContainerIteratorType") };
+
+static void EdsLib_Python_ContainerIterator_dealloc(PyObject *obj)
{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Container"),
- .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
- .tp_base = &EdsLib_Python_ObjectBaseType,
- .tp_as_mapping = &EdsLib_Python_EdsContainer_MappingMethods,
- .tp_methods = EdsLib_Python_Database_methods,
- .tp_iter = EdsLib_Python_ObjectContainer_iter,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS ContainerDataType")
-};
-
-PyTypeObject EdsLib_Python_ContainerIteratorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("ContainerIterator"),
- .tp_basicsize = sizeof(EdsLib_Python_ContainerIterator_t),
- .tp_dealloc = EdsLib_Python_ContainerIterator_dealloc,
- .tp_getattro = PyObject_GenericGetAttr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
- .tp_traverse = EdsLib_Python_ContainerIterator_traverse,
- .tp_clear = EdsLib_Python_ContainerIterator_clear,
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = EdsLib_Python_ContainerIterator_iternext,
- .tp_doc = PyDoc_STR("EDS ContainerIteratorType")
-};
-
-static void EdsLib_Python_ContainerIterator_dealloc(PyObject * obj)
-{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->refobj);
PyObject_GC_Del(self);
@@ -98,25 +88,25 @@ static void EdsLib_Python_ContainerIterator_dealloc(PyObject * obj)
static int EdsLib_Python_ContainerIterator_traverse(PyObject *obj, visitproc visit, void *arg)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
Py_VISIT(self->refobj);
return 0;
}
static int EdsLib_Python_ContainerIterator_clear(PyObject *obj)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
Py_CLEAR(self->refobj);
return 0;
}
static PyObject *EdsLib_Python_ContainerIterator_iternext(PyObject *obj)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
- EdsLib_Python_DatabaseEntry_t *dbent = NULL;
- PyObject *key = NULL;
- PyObject *value = NULL;
- PyObject *result = NULL;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
+ EdsLib_Python_DatabaseEntry_t *dbent = NULL;
+ PyObject *key = NULL;
+ PyObject *value = NULL;
+ PyObject *result = NULL;
do
{
@@ -147,8 +137,7 @@ static PyObject *EdsLib_Python_ContainerIterator_iternext(PyObject *obj)
}
result = PyTuple_Pack(2, key, value);
- }
- while(0);
+ } while (0);
Py_XDECREF(key);
Py_XDECREF(value);
@@ -159,10 +148,10 @@ static PyObject *EdsLib_Python_ContainerIterator_iternext(PyObject *obj)
static PyObject *EdsLib_Python_ObjectContainer_keys(PyObject *obj)
{
EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj->ob_type;
- Py_ssize_t idx;
- Py_ssize_t size;
- PyObject *key;
- PyObject *result;
+ Py_ssize_t idx;
+ Py_ssize_t size;
+ PyObject *key;
+ PyObject *result;
/* sanity check that the db entry has a valid subentry list (it should for all containers) */
if (dbent->SubEntityList == NULL || !PyList_Check(dbent->SubEntityList))
@@ -170,7 +159,7 @@ static PyObject *EdsLib_Python_ObjectContainer_keys(PyObject *obj)
return PyErr_Format(PyExc_TypeError, "%s is not a mappable EDS type", Py_TYPE(obj)->tp_name);
}
- size = PyList_GET_SIZE(dbent->SubEntityList);
+ size = PyList_GET_SIZE(dbent->SubEntityList);
result = PyList_New(size);
if (result == NULL)
{
@@ -182,13 +171,13 @@ static PyObject *EdsLib_Python_ObjectContainer_keys(PyObject *obj)
* If the list were ever modified, bad things would happen. */
for (idx = 0; idx < size; ++idx)
{
- key = PyList_GET_ITEM(dbent->SubEntityList, idx); /* borrowed ref */
+ key = PyList_GET_ITEM(dbent->SubEntityList, idx); /* borrowed ref */
if (key == NULL)
{
key = Py_None;
}
- Py_INCREF(key); /* compensate for stealing */
- PyList_SET_ITEM(result, idx, key); /* steals ref */
+ Py_INCREF(key); /* compensate for stealing */
+ PyList_SET_ITEM(result, idx, key); /* steals ref */
}
return result;
@@ -197,18 +186,18 @@ static PyObject *EdsLib_Python_ObjectContainer_keys(PyObject *obj)
static PyObject *EdsLib_Python_ObjectContainer_values(PyObject *obj)
{
EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj->ob_type;
- Py_ssize_t idx;
- Py_ssize_t size;
- PyObject *val;
- PyObject *key;
- PyObject *result;
+ Py_ssize_t idx;
+ Py_ssize_t size;
+ PyObject *val;
+ PyObject *key;
+ PyObject *result;
if (dbent->SubEntityList == NULL || !PyList_Check(dbent->SubEntityList))
{
return PyErr_Format(PyExc_TypeError, "%s is not a mappable EDS type", Py_TYPE(obj)->tp_name);
}
- size = PyList_GET_SIZE(dbent->SubEntityList);
+ size = PyList_GET_SIZE(dbent->SubEntityList);
result = PyList_New(size);
if (result == NULL)
{
@@ -217,10 +206,10 @@ static PyObject *EdsLib_Python_ObjectContainer_values(PyObject *obj)
for (idx = 0; idx < size; ++idx)
{
- key = PyList_GET_ITEM(dbent->SubEntityList, idx); /* borrowed ref */
+ key = PyList_GET_ITEM(dbent->SubEntityList, idx); /* borrowed ref */
if (key != NULL)
{
- val = PyObject_GetAttr(obj, key); /* new ref */
+ val = PyObject_GetAttr(obj, key); /* new ref */
}
else
{
@@ -232,7 +221,7 @@ static PyObject *EdsLib_Python_ObjectContainer_values(PyObject *obj)
val = Py_None;
Py_INCREF(val);
}
- PyList_SET_ITEM(result, idx, val); /* steals ref */
+ PyList_SET_ITEM(result, idx, val); /* steals ref */
}
return result;
@@ -241,19 +230,19 @@ static PyObject *EdsLib_Python_ObjectContainer_values(PyObject *obj)
static PyObject *EdsLib_Python_ObjectContainer_items(PyObject *obj)
{
EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj->ob_type;
- Py_ssize_t idx;
- Py_ssize_t size;
- PyObject *item;
- PyObject *val;
- PyObject *key;
- PyObject *result;
+ Py_ssize_t idx;
+ Py_ssize_t size;
+ PyObject *item;
+ PyObject *val;
+ PyObject *key;
+ PyObject *result;
if (dbent->SubEntityList == NULL || !PyList_Check(dbent->SubEntityList))
{
return PyErr_Format(PyExc_TypeError, "%s is not a mappable EDS type", Py_TYPE(obj)->tp_name);
}
- size = PyList_GET_SIZE(dbent->SubEntityList);
+ size = PyList_GET_SIZE(dbent->SubEntityList);
result = PyList_New(size);
if (result == NULL)
{
@@ -262,10 +251,10 @@ static PyObject *EdsLib_Python_ObjectContainer_items(PyObject *obj)
for (idx = 0; idx < size; ++idx)
{
- key = PyList_GET_ITEM(dbent->SubEntityList, idx); /* borrowed ref */
+ key = PyList_GET_ITEM(dbent->SubEntityList, idx); /* borrowed ref */
if (key != NULL)
{
- val = PyObject_GetAttr(obj, key); /* new ref */
+ val = PyObject_GetAttr(obj, key); /* new ref */
}
else
{
@@ -281,30 +270,30 @@ static PyObject *EdsLib_Python_ObjectContainer_items(PyObject *obj)
item = PyTuple_Pack(2, key, val);
if (item != NULL)
{
- PyList_SET_ITEM(result, idx, item); /* steals ref to item */
+ PyList_SET_ITEM(result, idx, item); /* steals ref to item */
}
- Py_DECREF(val); /* release val ref */
+ Py_DECREF(val); /* release val ref */
}
return result;
}
-static Py_ssize_t EdsLib_Python_ObjectContainer_map_len(PyObject *obj)
+static Py_ssize_t EdsLib_Python_ObjectContainer_map_len(PyObject *obj)
{
EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj->ob_type;
- lenfunc lenf = dbent->type_base.as_sequence.sq_length;
+ lenfunc lenf = dbent->type_base.as_sequence.sq_length;
if (lenf == NULL)
{
return 0;
}
- return lenf((PyObject*)dbent);
+ return lenf((PyObject *)dbent);
}
-static PyObject * EdsLib_Python_ObjectContainer_iter(PyObject *obj)
+static PyObject *EdsLib_Python_ObjectContainer_iter(PyObject *obj)
{
- EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj->ob_type;
+ EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj->ob_type;
EdsLib_Python_ContainerIterator_t *result;
/* sanity check that the db entry has a valid subentry list (it should for all containers) */
@@ -324,5 +313,5 @@ static PyObject * EdsLib_Python_ObjectContainer_iter(PyObject *obj)
result->refobj = obj;
PyObject_GC_Track(result);
- return (PyObject*)result;
+ return (PyObject *)result;
}
diff --git a/edslib/python/src/edslib_python_conversions.c b/edslib/python/src/edslib_python_conversions.c
index be3caf8..9e727ab 100644
--- a/edslib/python/src/edslib_python_conversions.c
+++ b/edslib/python/src/edslib_python_conversions.c
@@ -18,13 +18,12 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_conversions.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement conversion routines for EDS/Python objects
+ ** Implement conversion routines for EDS/Python objects
*/
#include "edslib_python_internal.h"
@@ -37,7 +36,7 @@
typedef struct
{
EdsLib_Binding_DescriptorObject_t desc;
- PyObject *pyobj;
+ PyObject *pyobj;
} EdsLib_Python_ObjectConversionState_t;
/*
@@ -49,10 +48,11 @@ typedef struct
static void EdsLib_Python_ConvertEdsObjectToPythonImpl(EdsLib_Python_ObjectConversionState_t *ConvPair);
static void EdsLib_Python_ConvertPythonToEdsObjectImpl(EdsLib_Python_ObjectConversionState_t *ConvPair);
-static int EdsLib_Python_InitBindingDescriptorObject(EdsLib_Python_ObjectBase_t *self, EdsLib_Binding_DescriptorObject_t *desc)
+static int EdsLib_Python_InitBindingDescriptorObject(EdsLib_Python_ObjectBase_t *self,
+ EdsLib_Binding_DescriptorObject_t *desc)
{
EdsLib_Python_DatabaseEntry_t *dbent;
- int32_t Status;
+ int32_t Status;
/*
* EdsLib Binding descriptor objects can only be generated from
@@ -76,65 +76,19 @@ static int EdsLib_Python_InitBindingDescriptorObject(EdsLib_Python_ObjectBase_t
return 0;
}
- desc->GD = dbent->EdsDb->GD;
- desc->EdsId = dbent->EdsId;
- desc->Offset = self->Offset;
- desc->Length = self->TotalLength;
+ desc->GD = dbent->EdsDb->GD;
+ desc->EdsId = dbent->EdsId;
+ desc->Offset = self->Offset;
+ desc->Length = self->TotalLength;
desc->BufferPtr = NULL;
return 1;
}
-static void EdsLib_Python_ConvertPyMembers_Callback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc)
-{
- EdsLib_Python_ObjectConversionState_t *ParentConv = Arg;
- EdsLib_Python_ObjectConversionState_t subpair;
-
- /* Any conversion error should have set an exception/error context.
- * To avoid triggering multiple exceptions, this is a no-op after the first error */
- if (PyErr_Occurred() == NULL)
- {
- EdsLib_Binding_InitSubObject(&subpair.desc, &ParentConv->desc, &ParamDesc->EntityInfo);
-
- /* If a named index is present in EDS, and the python object supports the
- * mapping protocol, then use the mapping to relate the objects. This use
- * case is primarily for containers, but also applies to arrays where an enum
- * type is used as the index. */
- if (ParamDesc->FullName != NULL && PyMapping_Check(ParentConv->pyobj))
- {
- /* new ref */
- subpair.pyobj = PyMapping_GetItemString(ParentConv->pyobj, (char*)ParamDesc->FullName);
- }
- else if (PySequence_Check(ParentConv->pyobj) &&
- ParamDesc->SeqNum < PySequence_Size(ParentConv->pyobj))
- {
- /* Use sequence protocol as a backup, which handles normal EDS arrays
- * or python lists being assigned to EDS containers */
- /*new ref*/
- subpair.pyobj = PySequence_GetItem(ParentConv->pyobj, ParamDesc->SeqNum);
- }
- else
- {
- /* no common ground found, so no conversion is possible */
- subpair.pyobj = NULL;
- }
-
- /*
- * The absence of an object here is not necessarily an error;
- * treat it as a no-op if that occurs.
- */
- if (subpair.pyobj != NULL)
- {
- EdsLib_Python_ConvertPythonToEdsObjectImpl(&subpair);
- Py_DECREF(subpair.pyobj);
- }
- }
-}
-
static void EdsLib_Python_ConvertEdsMembers_Callback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc)
{
EdsLib_Python_ObjectConversionState_t *ParentConv = Arg;
- EdsLib_Python_ObjectConversionState_t subpair;
+ EdsLib_Python_ObjectConversionState_t subpair;
/* Any conversion error should have set an exception/error context */
if (PyErr_Occurred() == NULL)
@@ -161,7 +115,7 @@ static void EdsLib_Python_ConvertEdsMembers_Callback(void *Arg, const EdsLib_Ent
{
/* If there is a named index then use it
* The python object should always be a Dictionary in this case */
- PyDict_SetItemString(ParentConv->pyobj, (char*)ParamDesc->FullName, subpair.pyobj);
+ PyDict_SetItemString(ParentConv->pyobj, (char *)ParamDesc->FullName, subpair.pyobj);
Py_DECREF(subpair.pyobj);
}
else
@@ -186,16 +140,17 @@ static void EdsLib_Python_ConvertEdsObjectToPythonImpl(EdsLib_Python_ObjectConve
{
ConvPair->pyobj = PyList_New(ConvPair->desc.TypeInfo.NumSubElements);
}
- else if (ConvPair->desc.TypeInfo.ElemType == EDSLIB_BASICTYPE_CONTAINER ||
- ConvPair->desc.TypeInfo.ElemType == EDSLIB_BASICTYPE_COMPONENT)
+ else if (ConvPair->desc.TypeInfo.ElemType == EDSLIB_BASICTYPE_CONTAINER
+ || ConvPair->desc.TypeInfo.ElemType == EDSLIB_BASICTYPE_COMPONENT)
{
ConvPair->pyobj = PyDict_New();
}
else
{
- PyErr_Format(PyExc_RuntimeError, "Cannot map %s/%s to a python type",
- EdsLib_DisplayDB_GetNamespace(ConvPair->desc.GD, ConvPair->desc.EdsId),
- EdsLib_DisplayDB_GetBaseName(ConvPair->desc.GD, ConvPair->desc.EdsId));
+ PyErr_Format(PyExc_RuntimeError,
+ "Cannot map %s/%s to a python type",
+ EdsLib_DisplayDB_GetNamespace(ConvPair->desc.GD, ConvPair->desc.EdsId),
+ EdsLib_DisplayDB_GetBaseName(ConvPair->desc.GD, ConvPair->desc.EdsId));
ConvPair->pyobj = NULL;
}
@@ -205,8 +160,10 @@ static void EdsLib_Python_ConvertEdsObjectToPythonImpl(EdsLib_Python_ObjectConve
*/
if (ConvPair->pyobj != NULL && ConvPair->desc.TypeInfo.NumSubElements > 0)
{
- EdsLib_DisplayDB_IterateBaseEntities(ConvPair->desc.GD, ConvPair->desc.EdsId,
- EdsLib_Python_ConvertEdsMembers_Callback, ConvPair);
+ EdsLib_DisplayDB_IterateBaseEntities(ConvPair->desc.GD,
+ ConvPair->desc.EdsId,
+ EdsLib_Python_ConvertEdsMembers_Callback,
+ ConvPair);
}
}
@@ -221,7 +178,8 @@ static int EdsLib_Python_CopyEdsObjectPacked(EdsLib_Python_ObjectConversionState
}
Status = EdsLib_Binding_InitFromPackedBuffer(&ConvPair->desc,
- PyBytes_AsString(ConvPair->pyobj), PyBytes_Size(ConvPair->pyobj));
+ PyBytes_AsString(ConvPair->pyobj),
+ PyBytes_Size(ConvPair->pyobj));
if (Status != EDSLIB_SUCCESS)
{
@@ -259,16 +217,14 @@ static int EdsLib_Python_CopyEdsObjectDirect(EdsLib_Python_ObjectConversionState
* any trailing data. */
size_t DstSize = EdsLib_Binding_GetNativeSize(&ConvPair->desc);
size_t SrcSize = EdsLib_Binding_GetNativeSize(&srcobj);
- char *DstPtr = EdsLib_Binding_GetNativeObject(&ConvPair->desc);
+ char *DstPtr = EdsLib_Binding_GetNativeObject(&ConvPair->desc);
if (DstSize < SrcSize)
{
SrcSize = DstSize;
}
- memcpy(DstPtr,
- EdsLib_Binding_GetNativeObject(&srcobj),
- SrcSize);
+ memcpy(DstPtr, EdsLib_Binding_GetNativeObject(&srcobj), SrcSize);
if (SrcSize < DstSize)
{
@@ -280,6 +236,121 @@ static int EdsLib_Python_CopyEdsObjectDirect(EdsLib_Python_ObjectConversionState
return 1;
}
+static void EdsLib_Python_ConvertPythonSubObjectToEdsImpl(EdsLib_Binding_DescriptorObject_t *ParentDesc,
+ uint16_t SubIndex,
+ PyObject *MemberValue)
+{
+ EdsLib_DataTypeDB_EntityInfo_t MemberInfo;
+ EdsLib_Python_ObjectConversionState_t subpair;
+ int32_t EdsStatus;
+
+ EdsStatus = EdsLib_DataTypeDB_GetMemberByIndex(ParentDesc->GD, ParentDesc->EdsId, SubIndex, &MemberInfo);
+ if (EdsStatus != EDSLIB_SUCCESS)
+ {
+ /* This means the subindex is not valid for this object */
+ PyErr_Format(PyExc_IndexError, "Invalid Index: %u, Status=%d", (unsigned int)SubIndex, (int)EdsStatus);
+ }
+ else
+ {
+ EdsLib_Binding_InitSubObject(&subpair.desc, ParentDesc, &MemberInfo);
+ subpair.pyobj = MemberValue;
+ EdsLib_Python_ConvertPythonToEdsObjectImpl(&subpair);
+ }
+}
+
+/*
+ * internal function, may be called recursively
+ */
+static void EdsLib_Python_ConvertPythonSequenceToEdsObjImpl(EdsLib_Python_ObjectConversionState_t *ConvPair)
+{
+ Py_ssize_t SeqSize;
+ Py_ssize_t idx;
+ PyObject *MemberValue;
+
+ /* Any conversion error should have set an exception/error context.
+ * To avoid triggering multiple exceptions, this stops after the first error */
+ SeqSize = PySequence_Size(ConvPair->pyobj);
+ for (idx = 0; PyErr_Occurred() == NULL && idx < SeqSize; ++idx)
+ {
+ MemberValue = PySequence_GetItem(ConvPair->pyobj, idx);
+ if (MemberValue == NULL)
+ {
+ /* not expected */
+ break;
+ }
+
+ EdsLib_Python_ConvertPythonSubObjectToEdsImpl(&ConvPair->desc, idx, MemberValue);
+ Py_DECREF(MemberValue);
+ }
+}
+
+/*
+ * internal function, may be called recursively
+ */
+static void EdsLib_Python_ConvertPythonMappingToEdsObjImpl(EdsLib_Python_ObjectConversionState_t *ConvPair)
+{
+ PyObject *MemberList;
+ PyObject *MemberKey;
+ PyObject *MemberValue;
+ Py_ssize_t MapSize;
+ Py_ssize_t idx;
+ int32_t EdsStatus;
+ uint16_t SubIndex;
+
+ MemberList = PyMapping_Keys(ConvPair->pyobj);
+ if (MemberList != NULL)
+ {
+ MapSize = PyList_GET_SIZE(MemberList);
+ /* Any conversion error should have set an exception/error context.
+ * To avoid triggering multiple exceptions, this stops after the first error */
+ for (idx = 0; PyErr_Occurred() == NULL && idx < MapSize; ++idx)
+ {
+ /* NOTE: this gets a borrowed ref */
+ MemberKey = PyList_GET_ITEM(MemberList, idx);
+ MemberValue = PyObject_GetItem(ConvPair->pyobj, MemberKey);
+ if (MemberValue == NULL)
+ {
+ /* not expected */
+ break;
+ }
+
+ /* Do an EDS lookup but make sure the string is plain ASCII */
+ /* this drops the borrowed ref and replaces it with a strong ref */
+ if (PyUnicode_Check(MemberKey))
+ {
+ MemberKey = PyUnicode_AsASCIIString(MemberKey);
+ }
+ else
+ {
+ MemberKey = PyObject_ASCII(MemberKey);
+ }
+
+ if (MemberKey != NULL)
+ {
+ EdsStatus = EdsLib_DisplayDB_GetIndexByName(ConvPair->desc.GD,
+ ConvPair->desc.EdsId,
+ PyBytes_AsString(MemberKey),
+ &SubIndex);
+ if (EdsStatus != EDSLIB_SUCCESS)
+ {
+ /* This means the python object contained a key that does not exist */
+ PyErr_Format(PyExc_KeyError, "Key does not exist in EDS object: %R", MemberKey);
+ }
+ else
+ {
+ EdsLib_Python_ConvertPythonSubObjectToEdsImpl(&ConvPair->desc, SubIndex, MemberValue);
+ }
+
+ Py_DECREF(MemberKey);
+ }
+
+ Py_DECREF(MemberValue);
+ }
+
+ Py_DECREF(MemberList);
+ }
+}
+
/*
* internal function, may be called recursively
*/
@@ -292,17 +363,23 @@ static void EdsLib_Python_ConvertPythonToEdsObjectImpl(EdsLib_Python_ObjectConve
*
* For all other types of python objects, call the regular conversion routine.
*/
- if (ConvPair->pyobj == Py_None ||
- EdsLib_Python_CopyEdsObjectPacked(ConvPair) ||
- EdsLib_Python_CopyEdsObjectDirect(ConvPair))
+ if (ConvPair->pyobj == Py_None || EdsLib_Python_CopyEdsObjectPacked(ConvPair)
+ || EdsLib_Python_CopyEdsObjectDirect(ConvPair))
{
/* no-op */
}
- else if (ConvPair->desc.TypeInfo.NumSubElements > 0)
+ else if (PyList_Check(ConvPair->pyobj) || PyTuple_Check(ConvPair->pyobj))
+ {
+ /* Note that this is specifically checking for List or Tuple here because
+ * the PySequence check is too broad; it also includes strings and Bytes
+ * objects which we do NOT want to interpret in this way */
+ EdsLib_Python_ConvertPythonSequenceToEdsObjImpl(ConvPair);
+ }
+ else if (PyAnySet_Check(ConvPair->pyobj) || PyDict_Check(ConvPair->pyobj))
{
- /* Convert all sub-entities (will recuse back to this function for each item) */
- EdsLib_DisplayDB_IterateBaseEntities(ConvPair->desc.GD, ConvPair->desc.EdsId,
- EdsLib_Python_ConvertPyMembers_Callback, ConvPair);
+ /* As for sequences, the PyMapping_Check is too broad and will match
+ * unicode objects as well */
+ EdsLib_Python_ConvertPythonMappingToEdsObjImpl(ConvPair);
}
else
{
@@ -311,21 +388,19 @@ static void EdsLib_Python_ConvertPythonToEdsObjectImpl(EdsLib_Python_ObjectConve
}
}
-
-
PyObject *EdsLib_Python_ConvertEdsScalarToPython(EdsLib_Binding_DescriptorObject_t *edsobj)
{
- EdsLib_DisplayHint_t DispHint;
- const char *Ptr;
- size_t ActualSize;
+ EdsLib_DisplayHint_t DispHint;
+ const char *Ptr;
+ size_t ActualSize;
EdsLib_GenericValueBuffer_t ValueBuff;
- char StringBuffer[256];
- PyObject *result;
+ char StringBuffer[256];
+ PyObject *result;
- Ptr = EdsLib_Binding_GetNativeObject(edsobj);
+ Ptr = EdsLib_Binding_GetNativeObject(edsobj);
ActualSize = EdsLib_Binding_GetNativeSize(edsobj);
- DispHint = EdsLib_DisplayDB_GetDisplayHint(edsobj->GD, edsobj->EdsId);
- result = NULL;
+ DispHint = EdsLib_DisplayDB_GetDisplayHint(edsobj->GD, edsobj->EdsId);
+ result = NULL;
if (edsobj->TypeInfo.ElemType == EDSLIB_BASICTYPE_BINARY)
{
@@ -347,9 +422,9 @@ PyObject *EdsLib_Python_ConvertEdsScalarToPython(EdsLib_Binding_DescriptorObject
}
else
{
- if (DispHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE &&
- EdsLib_Scalar_ToString(edsobj->GD, edsobj->EdsId,
- StringBuffer, sizeof(StringBuffer), Ptr) == EDSLIB_SUCCESS)
+ if (DispHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE
+ && EdsLib_Scalar_ToString(edsobj->GD, edsobj->EdsId, StringBuffer, sizeof(StringBuffer), Ptr)
+ == EDSLIB_SUCCESS)
{
result = PyUnicode_FromString(StringBuffer);
}
@@ -357,35 +432,35 @@ PyObject *EdsLib_Python_ConvertEdsScalarToPython(EdsLib_Binding_DescriptorObject
{
EdsLib_Binding_LoadValue(edsobj, &ValueBuff);
- switch(ValueBuff.ValueType)
+ switch (ValueBuff.ValueType)
{
- case EDSLIB_BASICTYPE_SIGNED_INT:
- if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
- {
- /* preserve the boolean nature of the integer field */
- result = PyBool_FromLong(ValueBuff.Value.SignedInteger);
- }
- else
- {
- result = PyLong_FromLongLong(ValueBuff.Value.SignedInteger);
- }
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
- {
- /* preserve the boolean nature of the integer field */
- result = PyBool_FromLong(ValueBuff.Value.UnsignedInteger);
- }
- else
- {
- result = PyLong_FromUnsignedLongLong(ValueBuff.Value.UnsignedInteger);
- }
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- result = PyFloat_FromDouble(ValueBuff.Value.FloatingPoint);
- break;
- default:
- break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
+ {
+ /* preserve the boolean nature of the integer field */
+ result = PyBool_FromLong(ValueBuff.Value.SignedInteger);
+ }
+ else
+ {
+ result = PyLong_FromLongLong(ValueBuff.Value.SignedInteger);
+ }
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ if (DispHint == EDSLIB_DISPLAYHINT_BOOLEAN)
+ {
+ /* preserve the boolean nature of the integer field */
+ result = PyBool_FromLong(ValueBuff.Value.UnsignedInteger);
+ }
+ else
+ {
+ result = PyLong_FromUnsignedLongLong(ValueBuff.Value.UnsignedInteger);
+ }
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ result = PyFloat_FromDouble(ValueBuff.Value.FloatingPoint);
+ break;
+ default:
+ break;
}
}
}
@@ -393,20 +468,19 @@ PyObject *EdsLib_Python_ConvertEdsScalarToPython(EdsLib_Binding_DescriptorObject
return result;
}
-
bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *edsobj, PyObject *pyobj)
{
- char *Ptr;
- size_t ActualSize;
+ char *Ptr;
+ size_t ActualSize;
EdsLib_GenericValueBuffer_t ValueBuff;
- PyObject *ReprObj = NULL;
- PyObject *BytesObj = NULL;
- PyObject *NumberObj = NULL;
- bool success = false;
+ PyObject *ReprObj = NULL;
+ PyObject *BytesObj = NULL;
+ PyObject *NumberObj = NULL;
+ bool success = false;
- Ptr = EdsLib_Binding_GetNativeObject(edsobj);
+ Ptr = EdsLib_Binding_GetNativeObject(edsobj);
ActualSize = EdsLib_Binding_GetNativeSize(edsobj);
- memset(&ValueBuff,0,sizeof(ValueBuff));
+ memset(&ValueBuff, 0, sizeof(ValueBuff));
/*
* First check if a string or string-like object was supplied by the caller.
@@ -433,40 +507,39 @@ bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *e
if (edsobj->TypeInfo.ElemType == EDSLIB_BASICTYPE_UNSIGNED_INT)
{
ValueBuff.Value.UnsignedInteger = PyInt_AsUnsignedLongMask(pyobj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
else
{
ValueBuff.Value.SignedInteger = PyInt_AsLong(pyobj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
}
}
#endif
else if (PyBool_Check(pyobj))
{
ValueBuff.Value.UnsignedInteger = (pyobj == Py_True);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
else if (PyLong_Check(pyobj))
{
if (edsobj->TypeInfo.ElemType == EDSLIB_BASICTYPE_UNSIGNED_INT)
{
ValueBuff.Value.UnsignedInteger = PyLong_AsUnsignedLongLong(pyobj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
}
else
{
ValueBuff.Value.SignedInteger = PyLong_AsLongLong(pyobj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
}
}
else if (PyFloat_Check(pyobj))
{
ValueBuff.Value.FloatingPoint = PyFloat_AsDouble(pyobj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_FLOAT;
}
-
/*
* Depending on the desired/wanted data type, if the simple conversion above
* did not produce a usable value, then try a backup approach.
@@ -474,34 +547,34 @@ bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *e
*/
if (ValueBuff.ValueType == EDSLIB_BASICTYPE_NONE && PyNumber_Check(pyobj))
{
- switch(edsobj->TypeInfo.ElemType)
+ switch (edsobj->TypeInfo.ElemType)
{
- case EDSLIB_BASICTYPE_SIGNED_INT:
- NumberObj = PyNumber_Long(pyobj);
- if (NumberObj != NULL)
- {
- ValueBuff.Value.SignedInteger = PyLong_AsLongLong(NumberObj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
- }
- break;
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- NumberObj = PyNumber_Long(pyobj);
- if (NumberObj != NULL)
- {
- ValueBuff.Value.UnsignedInteger = PyLong_AsUnsignedLongLong(NumberObj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
- }
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- NumberObj = PyNumber_Float(pyobj);
- if (NumberObj != NULL)
- {
- ValueBuff.Value.FloatingPoint = PyFloat_AsDouble(NumberObj);
- ValueBuff.ValueType = EDSLIB_BASICTYPE_FLOAT;
- }
- break;
- default:
- break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ NumberObj = PyNumber_Long(pyobj);
+ if (NumberObj != NULL)
+ {
+ ValueBuff.Value.SignedInteger = PyLong_AsLongLong(NumberObj);
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ }
+ break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ NumberObj = PyNumber_Long(pyobj);
+ if (NumberObj != NULL)
+ {
+ ValueBuff.Value.UnsignedInteger = PyLong_AsUnsignedLongLong(NumberObj);
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ }
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ NumberObj = PyNumber_Float(pyobj);
+ if (NumberObj != NULL)
+ {
+ ValueBuff.Value.FloatingPoint = PyFloat_AsDouble(NumberObj);
+ ValueBuff.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ }
+ break;
+ default:
+ break;
}
}
@@ -511,9 +584,8 @@ bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *e
* the EdsLib FromString function can parse it. This should, for instance,
* handle coercion of Python numbers into EDS strings where needed.
*/
- if (BytesObj == NULL &&
- (ValueBuff.ValueType == EDSLIB_BASICTYPE_NONE ||
- edsobj->TypeInfo.ElemType == EDSLIB_BASICTYPE_BINARY))
+ if (BytesObj == NULL
+ && (ValueBuff.ValueType == EDSLIB_BASICTYPE_NONE || edsobj->TypeInfo.ElemType == EDSLIB_BASICTYPE_BINARY))
{
ReprObj = PyObject_Repr(pyobj);
if (ReprObj != NULL)
@@ -554,8 +626,7 @@ bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *e
}
success = true;
}
- else if(EdsLib_Scalar_FromString(edsobj->GD, edsobj->EdsId,
- Ptr, PyBytes_AsString(BytesObj)) == EDSLIB_SUCCESS)
+ else if (EdsLib_Scalar_FromString(edsobj->GD, edsobj->EdsId, Ptr, PyBytes_AsString(BytesObj)) == EDSLIB_SUCCESS)
{
success = true;
}
@@ -576,8 +647,10 @@ bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *e
if (!success)
{
- PyErr_Format(PyExc_TypeError, "Cannot initialize %s from %s",
- EdsLib_DisplayDB_GetBaseName(edsobj->GD, edsobj->EdsId), pyobj->ob_type->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "Cannot initialize %s from %s",
+ EdsLib_DisplayDB_GetBaseName(edsobj->GD, edsobj->EdsId),
+ pyobj->ob_type->tp_name);
}
return success;
@@ -589,7 +662,7 @@ bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *e
PyObject *EdsLib_Python_ConvertEdsObjectToPython(EdsLib_Python_ObjectBase_t *self)
{
EdsLib_Python_ObjectConversionState_t ConvPair;
- EdsLib_Binding_Buffer_Content_t* content = NULL;
+ EdsLib_Binding_Buffer_Content_t *content = NULL;
memset(&ConvPair, 0, sizeof(ConvPair));
@@ -628,8 +701,7 @@ PyObject *EdsLib_Python_ConvertEdsObjectToPython(EdsLib_Python_ObjectBase_t *sel
* If unsuccessful, it will set an exception before returning.
*/
EdsLib_Python_ConvertEdsObjectToPythonImpl(&ConvPair);
- }
- while(0);
+ } while (0);
/* be sure to release window reference before returning */
if (content != NULL)
@@ -647,8 +719,8 @@ PyObject *EdsLib_Python_ConvertEdsObjectToPython(EdsLib_Python_ObjectBase_t *sel
bool EdsLib_Python_ConvertPythonToEdsObject(EdsLib_Python_ObjectBase_t *self, PyObject *pyobj)
{
EdsLib_Python_ObjectConversionState_t ConvPair;
- EdsLib_Binding_Buffer_Content_t *content = NULL;
- bool success = false;
+ EdsLib_Binding_Buffer_Content_t *content = NULL;
+ bool success = false;
memset(&ConvPair, 0, sizeof(ConvPair));
@@ -694,8 +766,7 @@ bool EdsLib_Python_ConvertPythonToEdsObject(EdsLib_Python_ObjectBase_t *self, Py
*/
EdsLib_Python_ConvertPythonToEdsObjectImpl(&ConvPair);
success = (PyErr_Occurred() == NULL);
- }
- while(0);
+ } while (0);
/* be sure to release window reference before returning */
if (content != NULL)
@@ -707,7 +778,9 @@ bool EdsLib_Python_ConvertPythonToEdsObject(EdsLib_Python_ObjectBase_t *self, Py
return success;
}
-int EdsLib_Python_SetupObjectDesciptor(EdsLib_Python_ObjectBase_t *self, EdsLib_Binding_DescriptorObject_t *descobj, int flags)
+int EdsLib_Python_SetupObjectDesciptor(EdsLib_Python_ObjectBase_t *self,
+ EdsLib_Binding_DescriptorObject_t *descobj,
+ int flags)
{
EdsLib_Binding_Buffer_Content_t *content;
@@ -743,13 +816,13 @@ void EdsLib_Python_ReleaseObjectDesciptor(EdsLib_Binding_DescriptorObject_t *des
}
}
-EdsLib_Id_t EdsLib_Python_ConvertArgToEdsId(const EdsLib_DatabaseObject_t *GD, PyObject* arg)
+EdsLib_Id_t EdsLib_Python_ConvertArgToEdsId(const EdsLib_DatabaseObject_t *GD, PyObject *arg)
{
EdsLib_Id_t Result;
- PyObject *temp_id;
+ PyObject *temp_id;
temp_id = NULL;
- Result = EDSLIB_ID_INVALID;
+ Result = EDSLIB_ID_INVALID;
/*
* The identifier might come from the python interpreter as a string or number.
diff --git a/edslib/python/src/edslib_python_database.c b/edslib/python/src/edslib_python_database.c
index 259d491..cb913c8 100644
--- a/edslib/python/src/edslib_python_database.c
+++ b/edslib/python/src/edslib_python_database.c
@@ -35,51 +35,45 @@
PyObject *EdsLib_Python_DatabaseCache = NULL;
-static void EdsLib_Python_Database_dealloc(PyObject * obj);
-static PyObject * EdsLib_Python_Database_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
-static PyObject * EdsLib_Python_Database_repr(PyObject *obj);
-static int EdsLib_Python_Database_traverse(PyObject *obj, visitproc visit, void *arg);
-static int EdsLib_Python_Database_clear(PyObject *obj);
-
-static PyObject * EdsLib_Python_Database_getentry(PyObject *obj, PyObject *key);
-static PyObject * EdsLib_Python_Database_IsContainer(PyObject *obj, PyObject *arg);
-static PyObject * EdsLib_Python_Database_IsArray(PyObject *obj, PyObject *arg);
-static PyObject * EdsLib_Python_Database_IsNumber(PyObject *obj, PyObject *arg);
-static PyObject * EdsLib_Python_Database_IsEnum(PyObject *obj, PyObject *arg);
-
-static PyMethodDef EdsLib_Python_Database_methods[] =
-{
- {"Entry", EdsLib_Python_Database_getentry, METH_O, "Lookup an EDS type from DB."},
- {"IsContainer", EdsLib_Python_Database_IsContainer, METH_O, "Check if an object is a container."},
- {"IsArray", EdsLib_Python_Database_IsArray, METH_O, "Check if an object is an array."},
- {"IsNumber", EdsLib_Python_Database_IsNumber, METH_O, "Check if an object is a number."},
- {"IsEnum", EdsLib_Python_Database_IsEnum, METH_O, "Check if a database entry is an enumeration."},
- {NULL} /* Sentinel */
+static void EdsLib_Python_Database_dealloc(PyObject *obj);
+static PyObject *EdsLib_Python_Database_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
+static PyObject *EdsLib_Python_Database_repr(PyObject *obj);
+static int EdsLib_Python_Database_traverse(PyObject *obj, visitproc visit, void *arg);
+static int EdsLib_Python_Database_clear(PyObject *obj);
+
+static PyObject *EdsLib_Python_Database_getentry(PyObject *obj, PyObject *key);
+static PyObject *EdsLib_Python_Database_IsContainer(PyObject *obj, PyObject *arg);
+static PyObject *EdsLib_Python_Database_IsArray(PyObject *obj, PyObject *arg);
+static PyObject *EdsLib_Python_Database_IsNumber(PyObject *obj, PyObject *arg);
+static PyObject *EdsLib_Python_Database_IsEnum(PyObject *obj, PyObject *arg);
+
+static PyMethodDef EdsLib_Python_Database_methods[] = {
+ { "Entry", EdsLib_Python_Database_getentry, METH_O, "Lookup an EDS type from DB." },
+ { "IsContainer", EdsLib_Python_Database_IsContainer, METH_O, "Check if an object is a container." },
+ { "IsArray", EdsLib_Python_Database_IsArray, METH_O, "Check if an object is an array." },
+ { "IsNumber", EdsLib_Python_Database_IsNumber, METH_O, "Check if an object is a number." },
+ { "IsEnum", EdsLib_Python_Database_IsEnum, METH_O, "Check if a database entry is an enumeration." },
+ { NULL } /* Sentinel */
};
-static struct PyMemberDef EdsLib_Python_Database_members[] =
-{
- {"Name", T_OBJECT_EX, offsetof(EdsLib_Python_Database_t, DbName), READONLY, "Database Name" },
- {NULL} /* Sentinel */
+static struct PyMemberDef EdsLib_Python_Database_members[] = {
+ { "Name", T_OBJECT_EX, offsetof(EdsLib_Python_Database_t, DbName), READONLY, "Database Name" },
+ { NULL } /* Sentinel */
};
-
-PyTypeObject EdsLib_Python_DatabaseType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Database"),
- .tp_basicsize = sizeof(EdsLib_Python_Database_t),
- .tp_dealloc = EdsLib_Python_Database_dealloc,
- .tp_new = EdsLib_Python_Database_new,
- .tp_methods = EdsLib_Python_Database_methods,
- .tp_members = EdsLib_Python_Database_members,
- .tp_repr = EdsLib_Python_Database_repr,
- .tp_traverse = EdsLib_Python_Database_traverse,
- .tp_clear = EdsLib_Python_Database_clear,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,
- .tp_weaklistoffset = offsetof(EdsLib_Python_Database_t, WeakRefList),
- .tp_doc = "EDS database"
-};
+PyTypeObject EdsLib_Python_DatabaseType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("Database"),
+ .tp_basicsize = sizeof(EdsLib_Python_Database_t),
+ .tp_dealloc = EdsLib_Python_Database_dealloc,
+ .tp_new = EdsLib_Python_Database_new,
+ .tp_methods = EdsLib_Python_Database_methods,
+ .tp_members = EdsLib_Python_Database_members,
+ .tp_repr = EdsLib_Python_Database_repr,
+ .tp_traverse = EdsLib_Python_Database_traverse,
+ .tp_clear = EdsLib_Python_Database_clear,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_weaklistoffset = offsetof(EdsLib_Python_Database_t, WeakRefList),
+ .tp_doc = "EDS database" };
static int EdsLib_Python_Database_traverse(PyObject *obj, visitproc visit, void *arg)
{
@@ -180,11 +174,11 @@ int EdsLib_Python_SaveToCache(PyObject *cachedict, PyObject *idxval, PyObject *o
return 0;
}
-static EdsLib_Python_Database_t *EdsLib_Python_Database_CreateImpl(PyTypeObject *obj, PyObject *Name,
- const EdsLib_DatabaseObject_t *GD)
+static EdsLib_Python_Database_t *
+EdsLib_Python_Database_CreateImpl(PyTypeObject *obj, PyObject *Name, const EdsLib_DatabaseObject_t *GD)
{
EdsLib_Python_Database_t *self;
- bool IsSuccess;
+ bool IsSuccess;
IsSuccess = false;
@@ -207,7 +201,7 @@ static EdsLib_Python_Database_t *EdsLib_Python_Database_CreateImpl(PyTypeObject
self->DbName = Name;
/* Create a weak reference to store in the local cache in case this
- * database is constructed again. */
+ * database is constructed again. */
if (EdsLib_Python_SaveToCache(EdsLib_Python_DatabaseCache, Name, (PyObject *)self) < 0)
{
/* if something went wrong this raises an error and must return NULL */
@@ -215,8 +209,7 @@ static EdsLib_Python_Database_t *EdsLib_Python_Database_CreateImpl(PyTypeObject
}
IsSuccess = true;
- }
- while (false);
+ } while (false);
if (!IsSuccess && self != NULL)
{
@@ -239,7 +232,8 @@ PyObject *EdsLib_Python_Database_CreateFromStaticDB(const char *Name, const EdsL
return NULL;
}
- self = (EdsLib_Python_Database_t *)EdsLib_Python_GetFromCache(EdsLib_Python_DatabaseCache, pyname,
+ self = (EdsLib_Python_Database_t *)EdsLib_Python_GetFromCache(EdsLib_Python_DatabaseCache,
+ pyname,
&EdsLib_Python_DatabaseType);
if (self != NULL)
{
@@ -270,21 +264,21 @@ const EdsLib_DatabaseObject_t *EdsLib_Python_Database_GetDB(PyObject *obj)
return NULL;
}
- return ((EdsLib_Python_Database_t*)obj)->GD;
+ return ((EdsLib_Python_Database_t *)obj)->GD;
}
static PyObject *EdsLib_Python_Database_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
{
- const char *dbstr;
- PyObject *nameobj;
- PyObject *argobj;
- char *p;
- char tempstring[512];
- void *handle;
- void *symbol;
- const char *errstr;
+ const char *dbstr;
+ PyObject *nameobj;
+ PyObject *argobj;
+ char *p;
+ char tempstring[512];
+ void *handle;
+ void *symbol;
+ const char *errstr;
EdsLib_Python_Database_t *self;
- bool IsSuccess;
+ bool IsSuccess;
/* note: the object returned here is a borrowed ref */
if (!PyArg_ParseTuple(args, "O:Database_new", &argobj))
@@ -323,7 +317,8 @@ static PyObject *EdsLib_Python_Database_new(PyTypeObject *obj, PyObject *args, P
* To avoid wasting resources, do not create the same database multiple times.
* First check if the db cache object already contains an instance for this name
*/
- self = (EdsLib_Python_Database_t *)EdsLib_Python_GetFromCache(EdsLib_Python_DatabaseCache, nameobj,
+ self = (EdsLib_Python_Database_t *)EdsLib_Python_GetFromCache(EdsLib_Python_DatabaseCache,
+ nameobj,
&EdsLib_Python_DatabaseType);
if (self != NULL)
{
@@ -398,10 +393,10 @@ static PyObject *EdsLib_Python_Database_new(PyTypeObject *obj, PyObject *args, P
}
}
- return (PyObject*)self;
+ return (PyObject *)self;
}
-PyObject * EdsLib_Python_Database_repr(PyObject *obj)
+PyObject *EdsLib_Python_Database_repr(PyObject *obj)
{
EdsLib_Python_Database_t *self = (EdsLib_Python_Database_t *)obj;
@@ -410,22 +405,22 @@ PyObject * EdsLib_Python_Database_repr(PyObject *obj)
static PyObject *EdsLib_Python_Database_getentry(PyObject *obj, PyObject *key)
{
- EdsLib_Python_Database_t *dbobj = (EdsLib_Python_Database_t *)obj;
- PyObject *result = NULL;
- EdsLib_Id_t EdsId;
+ EdsLib_Python_Database_t *dbobj = (EdsLib_Python_Database_t *)obj;
+ PyObject *result = NULL;
+ EdsLib_Id_t EdsId;
EdsId = EdsLib_Python_ConvertArgToEdsId(dbobj->GD, key);
/* if not valid this should have raised an exception */
if (EdsLib_Is_Valid(EdsId))
{
- result = (PyObject*)EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(dbobj, EdsId);
+ result = (PyObject *)EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(dbobj, EdsId);
}
return result;
}
-static PyObject * EdsLib_Python_Database_IsContainer(PyObject *obj, PyObject *arg)
+static PyObject *EdsLib_Python_Database_IsContainer(PyObject *obj, PyObject *arg)
{
PyObject *result;
@@ -443,7 +438,7 @@ static PyObject * EdsLib_Python_Database_IsContainer(PyObject *obj, PyObject *
return result;
}
-static PyObject * EdsLib_Python_Database_IsArray(PyObject *obj, PyObject *arg)
+static PyObject *EdsLib_Python_Database_IsArray(PyObject *obj, PyObject *arg)
{
PyObject *result;
@@ -461,7 +456,7 @@ static PyObject * EdsLib_Python_Database_IsArray(PyObject *obj, PyObject *arg)
return result;
}
-static PyObject * EdsLib_Python_Database_IsNumber(PyObject *obj, PyObject *arg)
+static PyObject *EdsLib_Python_Database_IsNumber(PyObject *obj, PyObject *arg)
{
PyObject *result;
@@ -479,19 +474,19 @@ static PyObject * EdsLib_Python_Database_IsNumber(PyObject *obj, PyObject *arg
return result;
}
-static PyObject * EdsLib_Python_Database_IsEnum(PyObject *obj, PyObject *arg)
+static PyObject *EdsLib_Python_Database_IsEnum(PyObject *obj, PyObject *arg)
{
EdsLib_Python_DatabaseEntry_t *dbent;
- EdsLib_DisplayHint_t DisplayHint;
- PyTypeObject *base_type;
+ EdsLib_DisplayHint_t DisplayHint;
+ PyTypeObject *base_type;
PyObject *result = NULL;
if (Py_TYPE(arg) == &EdsLib_Python_DatabaseEntryType)
{
- dbent = (EdsLib_Python_DatabaseEntry_t *)arg;
+ dbent = (EdsLib_Python_DatabaseEntry_t *)arg;
DisplayHint = EdsLib_DisplayDB_GetDisplayHint(dbent->EdsDb->GD, dbent->EdsId);
- base_type = dbent->type_base.ht_type.tp_base;
+ base_type = dbent->type_base.ht_type.tp_base;
if ((DisplayHint == EDSLIB_DISPLAYHINT_ENUM_SYMTABLE) && (base_type == &EdsLib_Python_ObjectNumberType))
{
diff --git a/edslib/python/src/edslib_python_databaseentry.c b/edslib/python/src/edslib_python_databaseentry.c
index 44d105d..d60e7da 100644
--- a/edslib/python/src/edslib_python_databaseentry.c
+++ b/edslib/python/src/edslib_python_databaseentry.c
@@ -19,118 +19,105 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_databaseentry.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement the "database entry" type
-**
-** This is a dynamic datatype which refers back to an entry in an EDS database.
-** All instances of EDS objects should be types of this type. (note that in
-** python types are also objects which have a type, recursively)
+ ** Implement the "database entry" type
+ **
+ ** This is a dynamic datatype which refers back to an entry in an EDS database.
+ ** All instances of EDS objects should be types of this type. (note that in
+ ** python types are also objects which have a type, recursively)
*/
#include "edslib_python_internal.h"
#include
-static PyObject * EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
-static int EdsLib_Python_DatabaseEntry_init(PyObject *obj, PyObject *args, PyObject *kwds);
-static void EdsLib_Python_DatabaseEntry_dealloc(PyObject * obj);
-static PyObject * EdsLib_Python_DatabaseEntry_repr(PyObject *obj);
-static int EdsLib_Python_DatabaseEntry_traverse(PyObject *obj, visitproc visit, void *arg);
-static int EdsLib_Python_DatabaseEntry_clear(PyObject *obj);
-static Py_ssize_t EdsLib_Python_DatabaseEntry_len(PyObject *obj);
-static PyObject * EdsLib_Python_DatabaseEntry_seq_item(PyObject *obj, Py_ssize_t idx);
-static PyObject * EdsLib_Python_DatabaseEntry_map_subscript(PyObject *obj, PyObject *subscr);
-static PyObject * EdsLib_Python_DatabaseEntry_iter(PyObject *obj);
-
-static void EdsLib_Python_EnumEntryIterator_dealloc(PyObject * obj);
-static int EdsLib_Python_EnumEntryIterator_traverse(PyObject *obj, visitproc visit, void *arg);
-static int EdsLib_Python_EnumEntryIterator_clear(PyObject *obj);
-static PyObject * EdsLib_Python_EnumEntryIterator_iternext(PyObject *obj);
-
-static void EdsLib_Python_ContainerEntryIterator_dealloc(PyObject * obj);
-static int EdsLib_Python_ContainerEntryIterator_traverse(PyObject *obj, visitproc visit, void *arg);
-static int EdsLib_Python_ContainerEntryIterator_clear(PyObject *obj);
-static PyObject * EdsLib_Python_ContainerEntryIterator_iternext(PyObject *obj);
-
-static PySequenceMethods EdsLib_Python_DatabaseEntry_SequenceMethods =
-{
- .sq_length = EdsLib_Python_DatabaseEntry_len,
- .sq_item = EdsLib_Python_DatabaseEntry_seq_item
+static PyObject *EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *args, PyObject *kwds);
+static int EdsLib_Python_DatabaseEntry_init(PyObject *obj, PyObject *args, PyObject *kwds);
+static void EdsLib_Python_DatabaseEntry_dealloc(PyObject *obj);
+static PyObject *EdsLib_Python_DatabaseEntry_repr(PyObject *obj);
+static int EdsLib_Python_DatabaseEntry_traverse(PyObject *obj, visitproc visit, void *arg);
+static int EdsLib_Python_DatabaseEntry_clear(PyObject *obj);
+static Py_ssize_t EdsLib_Python_DatabaseEntry_len(PyObject *obj);
+static PyObject *EdsLib_Python_DatabaseEntry_seq_item(PyObject *obj, Py_ssize_t idx);
+static PyObject *EdsLib_Python_DatabaseEntry_map_subscript(PyObject *obj, PyObject *subscr);
+static PyObject *EdsLib_Python_DatabaseEntry_iter(PyObject *obj);
+
+static void EdsLib_Python_EnumEntryIterator_dealloc(PyObject *obj);
+static int EdsLib_Python_EnumEntryIterator_traverse(PyObject *obj, visitproc visit, void *arg);
+static int EdsLib_Python_EnumEntryIterator_clear(PyObject *obj);
+static PyObject *EdsLib_Python_EnumEntryIterator_iternext(PyObject *obj);
+
+static void EdsLib_Python_ContainerEntryIterator_dealloc(PyObject *obj);
+static int EdsLib_Python_ContainerEntryIterator_traverse(PyObject *obj, visitproc visit, void *arg);
+static int EdsLib_Python_ContainerEntryIterator_clear(PyObject *obj);
+static PyObject *EdsLib_Python_ContainerEntryIterator_iternext(PyObject *obj);
+
+static PySequenceMethods EdsLib_Python_DatabaseEntry_SequenceMethods = { .sq_length = EdsLib_Python_DatabaseEntry_len,
+ .sq_item =
+ EdsLib_Python_DatabaseEntry_seq_item };
+
+static PyMappingMethods EdsLib_Python_DatabaseEntry_MappingMethods = { .mp_length = EdsLib_Python_DatabaseEntry_len,
+ .mp_subscript =
+ EdsLib_Python_DatabaseEntry_map_subscript };
+
+static struct PyMemberDef EdsLib_Python_DatabaseEntry_members[] = {
+ { "Name", T_OBJECT_EX, offsetof(EdsLib_Python_DatabaseEntry_t, BaseName), READONLY, "Database Name" },
+ { NULL } /* Sentinel */
};
-static PyMappingMethods EdsLib_Python_DatabaseEntry_MappingMethods =
-{
- .mp_length = EdsLib_Python_DatabaseEntry_len,
- .mp_subscript = EdsLib_Python_DatabaseEntry_map_subscript
-};
-
-static struct PyMemberDef EdsLib_Python_DatabaseEntry_members[] =
-{
- {"Name", T_OBJECT_EX, offsetof(EdsLib_Python_DatabaseEntry_t, BaseName), READONLY, "Database Name" },
- {NULL} /* Sentinel */
-};
-
-PyTypeObject EdsLib_Python_DatabaseEntryType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("DatabaseEntry"),
- .tp_basicsize = sizeof(EdsLib_Python_DatabaseEntry_t),
- .tp_dealloc = EdsLib_Python_DatabaseEntry_dealloc,
- .tp_new = EdsLib_Python_DatabaseEntry_new,
- .tp_as_sequence = &EdsLib_Python_DatabaseEntry_SequenceMethods,
- .tp_as_mapping = &EdsLib_Python_DatabaseEntry_MappingMethods,
- .tp_members = EdsLib_Python_DatabaseEntry_members,
- .tp_init = EdsLib_Python_DatabaseEntry_init,
- .tp_repr = EdsLib_Python_DatabaseEntry_repr,
- .tp_traverse = EdsLib_Python_DatabaseEntry_traverse,
- .tp_clear = EdsLib_Python_DatabaseEntry_clear,
- .tp_base = &PyType_Type,
- .tp_iter = EdsLib_Python_DatabaseEntry_iter,
- .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,
- .tp_weaklistoffset = offsetof(EdsLib_Python_DatabaseEntry_t, WeakRefList),
- .tp_doc = PyDoc_STR("EDS database entry")
-};
-
-PyTypeObject EdsLib_Python_EnumEntryIteratorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("EnumerationEntryIterator"),
- .tp_basicsize = sizeof(EdsLib_Python_EnumerationIterator_t),
- .tp_dealloc = EdsLib_Python_EnumEntryIterator_dealloc,
- .tp_getattro = PyObject_GenericGetAttr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
- .tp_traverse = EdsLib_Python_EnumEntryIterator_traverse,
- .tp_clear = EdsLib_Python_EnumEntryIterator_clear,
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = EdsLib_Python_EnumEntryIterator_iternext,
- .tp_doc = PyDoc_STR("EDS EnumerationIteratorType")
-};
-
-PyTypeObject EdsLib_Python_ContainerEntryIteratorType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("ContainerEntryIterator"),
- .tp_basicsize = sizeof(EdsLib_Python_ContainerIterator_t),
- .tp_dealloc = EdsLib_Python_ContainerEntryIterator_dealloc,
- .tp_getattro = PyObject_GenericGetAttr,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
- .tp_traverse = EdsLib_Python_ContainerEntryIterator_traverse,
- .tp_clear = EdsLib_Python_ContainerEntryIterator_clear,
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = EdsLib_Python_ContainerEntryIterator_iternext,
- .tp_doc = PyDoc_STR("EDS ContainerIteratorType")
-};
-
-static void EdsLib_Python_DatabaseEntry_GetFormatCodes(char *buffer, const EdsLib_Python_Database_t *refdb, EdsLib_Id_t EdsId)
+PyTypeObject EdsLib_Python_DatabaseEntryType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("DatabaseEntry"),
+ .tp_basicsize = sizeof(EdsLib_Python_DatabaseEntry_t),
+ .tp_dealloc = EdsLib_Python_DatabaseEntry_dealloc,
+ .tp_new = EdsLib_Python_DatabaseEntry_new,
+ .tp_as_sequence = &EdsLib_Python_DatabaseEntry_SequenceMethods,
+ .tp_as_mapping = &EdsLib_Python_DatabaseEntry_MappingMethods,
+ .tp_members = EdsLib_Python_DatabaseEntry_members,
+ .tp_init = EdsLib_Python_DatabaseEntry_init,
+ .tp_repr = EdsLib_Python_DatabaseEntry_repr,
+ .tp_traverse = EdsLib_Python_DatabaseEntry_traverse,
+ .tp_clear = EdsLib_Python_DatabaseEntry_clear,
+ .tp_base = &PyType_Type,
+ .tp_iter = EdsLib_Python_DatabaseEntry_iter,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_weaklistoffset =
+ offsetof(EdsLib_Python_DatabaseEntry_t, WeakRefList),
+ .tp_doc = PyDoc_STR("EDS database entry") };
+
+PyTypeObject EdsLib_Python_EnumEntryIteratorType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("EnumerationEntryIterator"),
+ .tp_basicsize = sizeof(EdsLib_Python_EnumerationIterator_t),
+ .tp_dealloc = EdsLib_Python_EnumEntryIterator_dealloc,
+ .tp_getattro = PyObject_GenericGetAttr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_traverse = EdsLib_Python_EnumEntryIterator_traverse,
+ .tp_clear = EdsLib_Python_EnumEntryIterator_clear,
+ .tp_iter = PyObject_SelfIter,
+ .tp_iternext = EdsLib_Python_EnumEntryIterator_iternext,
+ .tp_doc = PyDoc_STR("EDS EnumerationIteratorType") };
+
+PyTypeObject EdsLib_Python_ContainerEntryIteratorType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("ContainerEntryIterator"),
+ .tp_basicsize = sizeof(EdsLib_Python_ContainerIterator_t),
+ .tp_dealloc = EdsLib_Python_ContainerEntryIterator_dealloc,
+ .tp_getattro = PyObject_GenericGetAttr,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ .tp_traverse = EdsLib_Python_ContainerEntryIterator_traverse,
+ .tp_clear = EdsLib_Python_ContainerEntryIterator_clear,
+ .tp_iter = PyObject_SelfIter,
+ .tp_iternext = EdsLib_Python_ContainerEntryIterator_iternext,
+ .tp_doc = PyDoc_STR("EDS ContainerIteratorType") };
+
+static void
+EdsLib_Python_DatabaseEntry_GetFormatCodes(char *buffer, const EdsLib_Python_Database_t *refdb, EdsLib_Id_t EdsId)
{
EdsLib_DataTypeDB_EntityInfo_t EntityInfo;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- Py_ssize_t RepeatCount;
- char code = 0;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ Py_ssize_t RepeatCount;
+ char code = 0;
/*
* For arrays, get the format for the actual item.
@@ -148,76 +135,75 @@ static void EdsLib_Python_DatabaseEntry_GetFormatCodes(char *buffer, const EdsLi
RepeatCount = 1;
}
- switch(TypeInfo.ElemType)
+ switch (TypeInfo.ElemType)
{
- case EDSLIB_BASICTYPE_UNSIGNED_INT:
- if (TypeInfo.Size.Bytes == sizeof(unsigned char))
- {
- code = 'B';
- }
- else if (TypeInfo.Size.Bytes == sizeof(unsigned short))
- {
- code = 'H';
- }
- else if (TypeInfo.Size.Bytes == sizeof(unsigned int))
- {
- code = 'I';
- }
- else if (TypeInfo.Size.Bytes == sizeof(unsigned long))
- {
- code = 'L';
- }
- else if (TypeInfo.Size.Bytes == sizeof(unsigned long long))
- {
- code = 'Q';
- }
- break;
- case EDSLIB_BASICTYPE_SIGNED_INT:
- if (TypeInfo.Size.Bytes == sizeof(signed char))
- {
- code = 'b';
- }
- else if (TypeInfo.Size.Bytes == sizeof(signed short))
- {
- code = 'h';
- }
- else if (TypeInfo.Size.Bytes == sizeof(signed int))
- {
- code = 'i';
- }
- else if (TypeInfo.Size.Bytes == sizeof(signed long))
- {
- code = 'l';
- }
- else if (TypeInfo.Size.Bytes == sizeof(signed long long))
- {
- code = 'q';
- }
- break;
- case EDSLIB_BASICTYPE_FLOAT:
- if (TypeInfo.Size.Bytes == sizeof(float))
- {
- code = 'f';
- }
- else if (TypeInfo.Size.Bytes == sizeof(double))
- {
- code = 'd';
- }
- break;
- default:
- break;
+ case EDSLIB_BASICTYPE_UNSIGNED_INT:
+ if (TypeInfo.Size.Bytes == sizeof(unsigned char))
+ {
+ code = 'B';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(unsigned short))
+ {
+ code = 'H';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(unsigned int))
+ {
+ code = 'I';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(unsigned long))
+ {
+ code = 'L';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(unsigned long long))
+ {
+ code = 'Q';
+ }
+ break;
+ case EDSLIB_BASICTYPE_SIGNED_INT:
+ if (TypeInfo.Size.Bytes == sizeof(signed char))
+ {
+ code = 'b';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(signed short))
+ {
+ code = 'h';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(signed int))
+ {
+ code = 'i';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(signed long))
+ {
+ code = 'l';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(signed long long))
+ {
+ code = 'q';
+ }
+ break;
+ case EDSLIB_BASICTYPE_FLOAT:
+ if (TypeInfo.Size.Bytes == sizeof(float))
+ {
+ code = 'f';
+ }
+ else if (TypeInfo.Size.Bytes == sizeof(double))
+ {
+ code = 'd';
+ }
+ break;
+ default:
+ break;
}
if (code == 0)
{
RepeatCount *= TypeInfo.Size.Bytes;
- code = 'B';
+ code = 'B';
}
if (RepeatCount > 1)
{
- snprintf(buffer, EDSLIB_PYTHON_FORMATCODE_LEN, "%u%c",
- (unsigned int)RepeatCount, code);
+ snprintf(buffer, EDSLIB_PYTHON_FORMATCODE_LEN, "%u%c", (unsigned int)RepeatCount, code);
}
else
{
@@ -226,15 +212,13 @@ static void EdsLib_Python_DatabaseEntry_GetFormatCodes(char *buffer, const EdsLi
}
}
-
-
static void EdsLib_Python_DatabaseEntry_build_dict_callback(void *Arg, const EdsLib_EntityDescriptor_t *ParamDesc)
{
- PyObject *args = Arg;
+ PyObject *args = Arg;
PyObject *MemberDictionary = PyTuple_GET_ITEM(args, 1);
- PyObject *MemberList = PyTuple_GET_ITEM(args, 2);
- PyObject *MemberName = NULL;
- PyObject *accessor = NULL;
+ PyObject *MemberList = PyTuple_GET_ITEM(args, 2);
+ PyObject *MemberName = NULL;
+ PyObject *accessor = NULL;
if (PyErr_Occurred())
{
@@ -261,8 +245,7 @@ static void EdsLib_Python_DatabaseEntry_build_dict_callback(void *Arg, const Eds
PyList_Append(MemberList, MemberName);
PyDict_SetItem(MemberDictionary, MemberName, accessor);
- }
- while(0);
+ } while (0);
}
/*
@@ -287,13 +270,13 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId(PyObject *obj, EdsLib_Id_
PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Database_t *refdb, EdsLib_Id_t EdsId)
{
EdsLib_Python_DatabaseEntry_t *self = NULL;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
- PyObject *edsidval = NULL;
- PyObject *tempargs = NULL;
- PyObject *typename = NULL;
- PyObject *typedict = NULL;
- PyObject *typelist = NULL;
- PyTypeObject *basetype = NULL;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ PyObject *edsidval = NULL;
+ PyObject *tempargs = NULL;
+ PyObject *typename = NULL;
+ PyObject *typedict = NULL;
+ PyObject *typelist = NULL;
+ PyTypeObject *basetype = NULL;
do
{
@@ -307,7 +290,9 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Databa
* To avoid wasting resources, type objects are only created on demand.
* First check if the db cache object already contains an instance for this ID
*/
- self = (EdsLib_Python_DatabaseEntry_t *)EdsLib_Python_GetFromCache(refdb->TypeCache, edsidval, &EdsLib_Python_DatabaseEntryType);
+ self = (EdsLib_Python_DatabaseEntry_t *)EdsLib_Python_GetFromCache(refdb->TypeCache,
+ edsidval,
+ &EdsLib_Python_DatabaseEntryType);
if (self != NULL)
{
break;
@@ -338,9 +323,8 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Databa
{
basetype = &EdsLib_Python_ObjectScalarType;
}
- else if (TypeInfo.ElemType == EDSLIB_BASICTYPE_FLOAT ||
- TypeInfo.ElemType == EDSLIB_BASICTYPE_SIGNED_INT ||
- TypeInfo.ElemType == EDSLIB_BASICTYPE_UNSIGNED_INT)
+ else if (TypeInfo.ElemType == EDSLIB_BASICTYPE_FLOAT || TypeInfo.ElemType == EDSLIB_BASICTYPE_SIGNED_INT
+ || TypeInfo.ElemType == EDSLIB_BASICTYPE_UNSIGNED_INT)
{
basetype = &EdsLib_Python_ObjectNumberType;
}
@@ -371,8 +355,10 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Databa
break;
}
- EdsLib_DisplayDB_IterateBaseEntities(refdb->GD, EdsId,
- EdsLib_Python_DatabaseEntry_build_dict_callback, tempargs);
+ EdsLib_DisplayDB_IterateBaseEntities(refdb->GD,
+ EdsId,
+ EdsLib_Python_DatabaseEntry_build_dict_callback,
+ tempargs);
Py_DECREF(tempargs);
tempargs = NULL;
@@ -388,10 +374,10 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Databa
* expects certain constraints regarding a type name.
*/
typename = PyUnicode_FromFormat("%s.%s.%s.%s",
- EdsLib_Python_DatabaseEntryType.tp_name,
- PyBytes_AsString(refdb->DbName),
- EdsLib_DisplayDB_GetNamespace(refdb->GD, EdsId),
- EdsLib_DisplayDB_GetBaseName(refdb->GD, EdsId));
+ EdsLib_Python_DatabaseEntryType.tp_name,
+ PyBytes_AsString(refdb->DbName),
+ EdsLib_DisplayDB_GetNamespace(refdb->GD, EdsId),
+ EdsLib_DisplayDB_GetBaseName(refdb->GD, EdsId));
if (typename == NULL)
{
@@ -421,7 +407,8 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Databa
* Call the "new" function from the base type to properly
* create a heaptype object (it is complicated)
*/
- self = (EdsLib_Python_DatabaseEntry_t *)EdsLib_Python_DatabaseEntryType.tp_base->tp_new(&EdsLib_Python_DatabaseEntryType, tempargs, NULL);
+ self = (EdsLib_Python_DatabaseEntry_t *)
+ EdsLib_Python_DatabaseEntryType.tp_base->tp_new(&EdsLib_Python_DatabaseEntryType, tempargs, NULL);
Py_DECREF(tempargs);
tempargs = NULL;
if (self == NULL)
@@ -430,29 +417,28 @@ PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Databa
}
Py_INCREF(refdb);
- self->EdsDb = refdb;
- self->EdsId = EdsId;
- self->BaseName = PyUnicode_FromFormat("%s", EdsLib_DisplayDB_GetBaseName(refdb->GD, EdsId));
+ self->EdsDb = refdb;
+ self->EdsId = EdsId;
+ self->BaseName = PyUnicode_FromFormat("%s", EdsLib_DisplayDB_GetBaseName(refdb->GD, EdsId));
self->EdsTypeName = PyUnicode_FromFormat("%s/%s",
- EdsLib_DisplayDB_GetNamespace(refdb->GD, EdsId),
- EdsLib_DisplayDB_GetBaseName(refdb->GD, EdsId));
+ EdsLib_DisplayDB_GetNamespace(refdb->GD, EdsId),
+ EdsLib_DisplayDB_GetBaseName(refdb->GD, EdsId));
EdsLib_Python_DatabaseEntry_GetFormatCodes(self->FormatInfo, refdb, EdsId);
/* "steal" the reference to typelist, if valid */
self->SubEntityList = typelist;
- typelist = NULL;
+ typelist = NULL;
/* Create a weak reference to store in the local cache in case this
* type is needed again. */
- if (EdsLib_Python_SaveToCache(refdb->TypeCache, edsidval, (PyObject*)self) < 0)
+ if (EdsLib_Python_SaveToCache(refdb->TypeCache, edsidval, (PyObject *)self) < 0)
{
/* if something went wrong this raises an error and must return NULL */
Py_DECREF(self);
self = NULL;
}
- }
- while(0);
+ } while (0);
/* decrement refcount for all temporary objects created */
Py_XDECREF(edsidval);
@@ -488,12 +474,12 @@ static int EdsLib_Python_DatabaseEntry_clear(PyObject *obj)
static PyObject *EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *args, PyObject *kwds)
{
- PyObject *arg1;
- PyObject *arg2;
- EdsLib_Python_Database_t *refdb = NULL;
- PyObject *result = NULL;
- PyObject *tempargs = NULL;
- EdsLib_Id_t EdsId = EDSLIB_ID_INVALID;
+ PyObject *arg1;
+ PyObject *arg2;
+ EdsLib_Python_Database_t *refdb = NULL;
+ PyObject *result = NULL;
+ PyObject *tempargs = NULL;
+ EdsLib_Id_t EdsId = EDSLIB_ID_INVALID;
/*
* Database entries are constructed from two values:
@@ -515,7 +501,7 @@ static PyObject *EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *ar
{
if (Py_TYPE(arg1) == &EdsLib_Python_DatabaseType)
{
- refdb = (EdsLib_Python_Database_t*)arg1;
+ refdb = (EdsLib_Python_Database_t *)arg1;
Py_INCREF(refdb);
}
else
@@ -525,7 +511,7 @@ static PyObject *EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *ar
{
break;
}
- refdb = (EdsLib_Python_Database_t*)PyObject_Call((PyObject*)&EdsLib_Python_DatabaseType, tempargs, NULL);
+ refdb = (EdsLib_Python_Database_t *)PyObject_Call((PyObject *)&EdsLib_Python_DatabaseType, tempargs, NULL);
Py_DECREF(tempargs);
tempargs = NULL;
}
@@ -540,10 +526,9 @@ static PyObject *EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *ar
/* if not valid this should have raised an exception */
if (EdsLib_Is_Valid(EdsId))
{
- result = (PyObject*)EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(refdb, EdsId);
+ result = (PyObject *)EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(refdb, EdsId);
}
- }
- while(0);
+ } while (0);
/* decrement refcount for all temporary objects created */
Py_XDECREF(refdb);
@@ -554,8 +539,8 @@ static PyObject *EdsLib_Python_DatabaseEntry_new(PyTypeObject *obj, PyObject *ar
static int EdsLib_Python_DatabaseEntry_init(PyObject *obj, PyObject *args, PyObject *kwds)
{
- EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
- PyObject *subargs = PyTuple_Pack(1, self->type_base.ht_name);
+ EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
+ PyObject *subargs = PyTuple_Pack(1, self->type_base.ht_name);
if (subargs == NULL)
{
@@ -569,7 +554,7 @@ static int EdsLib_Python_DatabaseEntry_init(PyObject *obj, PyObject *args, PyObj
return 0;
}
-static void EdsLib_Python_DatabaseEntry_dealloc(PyObject * obj)
+static void EdsLib_Python_DatabaseEntry_dealloc(PyObject *obj)
{
EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
Py_XDECREF(self->EdsDb);
@@ -586,12 +571,12 @@ static void EdsLib_Python_DatabaseEntry_dealloc(PyObject * obj)
static Py_ssize_t EdsLib_Python_DatabaseEntry_len(PyObject *obj)
{
- EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t*)obj;
- Py_ssize_t result;
- EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
+ EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
+ Py_ssize_t result;
+ EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
EdsLib_DataTypeDB_GetTypeInfo(self->EdsDb->GD, self->EdsId, &TypeInfo);
- if ((TypeInfo.ElemType == EDSLIB_BASICTYPE_CONTAINER || TypeInfo.ElemType == EDSLIB_BASICTYPE_COMPONENT) &&
- self->SubEntityList != NULL)
+ if ((TypeInfo.ElemType == EDSLIB_BASICTYPE_CONTAINER || TypeInfo.ElemType == EDSLIB_BASICTYPE_COMPONENT)
+ && self->SubEntityList != NULL)
{
/*
* containers are a bit special in that they may have unnamed
@@ -609,10 +594,10 @@ static Py_ssize_t EdsLib_Python_DatabaseEntry_len(PyObject *obj)
static PyObject *EdsLib_Python_DatabaseEntry_seq_item(PyObject *obj, Py_ssize_t idx)
{
- EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t*)obj;
+ EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
EdsLib_DataTypeDB_EntityInfo_t EntityInfo;
- PyObject *attribute = NULL;
- PyObject *result = NULL;
+ PyObject *attribute = NULL;
+ PyObject *result = NULL;
EdsLib_DataTypeDB_TypeInfo_t TypeInfo;
EdsLib_DataTypeDB_GetTypeInfo(self->EdsDb->GD, self->EdsId, &TypeInfo);
@@ -625,11 +610,12 @@ static PyObject *EdsLib_Python_DatabaseEntry_seq_item(PyObject *obj, Py_ssize_t
*/
if (TypeInfo.NumSubElements == 0)
{
- PyErr_Format(PyExc_TypeError, "Attempt to index \'%s\' which is not an EDS sequence type",
- self->type_base.ht_type.tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "Attempt to index \'%s\' which is not an EDS sequence type",
+ self->type_base.ht_type.tp_name);
}
- else if ((TypeInfo.ElemType == EDSLIB_BASICTYPE_CONTAINER || TypeInfo.ElemType == EDSLIB_BASICTYPE_COMPONENT) &&
- self->SubEntityList != NULL)
+ else if ((TypeInfo.ElemType == EDSLIB_BASICTYPE_CONTAINER || TypeInfo.ElemType == EDSLIB_BASICTYPE_COMPONENT)
+ && self->SubEntityList != NULL)
{
attribute = PyList_GetItem(self->SubEntityList, idx);
if (attribute == NULL)
@@ -656,7 +642,7 @@ static PyObject *EdsLib_Python_DatabaseEntry_seq_item(PyObject *obj, Py_ssize_t
return result;
}
-static PyObject * EdsLib_Python_DatabaseEntry_map_subscript(PyObject *obj, PyObject *subscr)
+static PyObject *EdsLib_Python_DatabaseEntry_map_subscript(PyObject *obj, PyObject *subscr)
{
PyObject *result;
@@ -672,25 +658,24 @@ static PyObject * EdsLib_Python_DatabaseEntry_map_subscript(PyObject *obj, PyObj
return result;
}
-static PyObject * EdsLib_Python_DatabaseEntry_repr(PyObject *obj)
+static PyObject *EdsLib_Python_DatabaseEntry_repr(PyObject *obj)
{
- EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
- PyObject *result = NULL;
+ EdsLib_Python_DatabaseEntry_t *self = (EdsLib_Python_DatabaseEntry_t *)obj;
+ PyObject *result = NULL;
- result = PyUnicode_FromFormat("%s(%R,%R)",
- obj->ob_type->tp_name, self->EdsDb->DbName, self->EdsTypeName);
+ result = PyUnicode_FromFormat("%s(%R,%R)", obj->ob_type->tp_name, self->EdsDb->DbName, self->EdsTypeName);
return result;
}
-Py_ssize_t EdsLib_Python_DatabaseEntry_GetMaxSize(PyTypeObject* objtype)
+Py_ssize_t EdsLib_Python_DatabaseEntry_GetMaxSize(PyTypeObject *objtype)
{
- EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)objtype;
+ EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)objtype;
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
if (Py_TYPE(objtype) != &EdsLib_Python_DatabaseEntryType)
{
- PyErr_SetObject(PyExc_TypeError, (PyObject*)objtype);
+ PyErr_SetObject(PyExc_TypeError, (PyObject *)objtype);
return -1;
}
@@ -703,62 +688,64 @@ Py_ssize_t EdsLib_Python_DatabaseEntry_GetMaxSize(PyTypeObject* objtype)
return DerivInfo.MaxSize.Bytes;
}
-static PyObject * EdsLib_Python_DatabaseEntry_iter(PyObject *obj)
+static PyObject *EdsLib_Python_DatabaseEntry_iter(PyObject *obj)
{
- EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj;
+ EdsLib_Python_DatabaseEntry_t *dbent = (EdsLib_Python_DatabaseEntry_t *)obj;
EdsLib_Python_EnumerationIterator_t *EnumIter;
- EdsLib_Python_ContainerIterator_t *ContainerIter;
- EdsLib_DisplayHint_t DisplayHint;
- PyObject *result;
+ EdsLib_Python_ContainerIterator_t *ContainerIter;
+ EdsLib_DisplayHint_t DisplayHint;
+ PyObject *result;
/* sanity check that the db entry is an EDS entry is iterable (Container or Enumeration) */
DisplayHint = EdsLib_DisplayDB_GetDisplayHint(dbent->EdsDb->GD, dbent->EdsId);
- switch(DisplayHint)
+ switch (DisplayHint)
{
- case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
- EnumIter = PyObject_GC_New(EdsLib_Python_EnumerationIterator_t, &EdsLib_Python_EnumEntryIteratorType);
+ case EDSLIB_DISPLAYHINT_ENUM_SYMTABLE:
+ EnumIter = PyObject_GC_New(EdsLib_Python_EnumerationIterator_t, &EdsLib_Python_EnumEntryIteratorType);
- if (EnumIter == NULL)
- {
- return NULL;
- }
+ if (EnumIter == NULL)
+ {
+ return NULL;
+ }
- EnumIter->Index = 0;
- Py_INCREF(obj);
- EnumIter->refobj = obj;
+ EnumIter->Index = 0;
+ Py_INCREF(obj);
+ EnumIter->refobj = obj;
- result = (PyObject *)EnumIter;
- PyObject_GC_Track(result);
+ result = (PyObject *)EnumIter;
+ PyObject_GC_Track(result);
- break;
- case EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE:
- /* sanity check that the db entry has a valid subentry list (it should for all containers) */
- if (dbent->SubEntityList == NULL || !PyList_Check(dbent->SubEntityList))
- {
- return PyErr_Format(PyExc_TypeError, "%s is not a mappable EDS type", Py_TYPE(obj)->tp_name);
- }
- ContainerIter = PyObject_GC_New(EdsLib_Python_ContainerIterator_t, &EdsLib_Python_ContainerEntryIteratorType);
- if (ContainerIter == NULL)
- {
- return NULL;
- }
- ContainerIter->Position = 0;
- Py_INCREF(obj);
- ContainerIter->refobj = obj;
- result = (PyObject *)ContainerIter;
- PyObject_GC_Track(result);
- break;
- default:
- return PyErr_Format(PyExc_TypeError, "%s is not an EDS Iterable type (Container or Enumeration)", Py_TYPE(obj)->tp_name);
+ break;
+ case EDSLIB_DISPLAYHINT_MEMBER_NAMETABLE:
+ /* sanity check that the db entry has a valid subentry list (it should for all containers) */
+ if (dbent->SubEntityList == NULL || !PyList_Check(dbent->SubEntityList))
+ {
+ return PyErr_Format(PyExc_TypeError, "%s is not a mappable EDS type", Py_TYPE(obj)->tp_name);
+ }
+ ContainerIter =
+ PyObject_GC_New(EdsLib_Python_ContainerIterator_t, &EdsLib_Python_ContainerEntryIteratorType);
+ if (ContainerIter == NULL)
+ {
+ return NULL;
+ }
+ ContainerIter->Position = 0;
+ Py_INCREF(obj);
+ ContainerIter->refobj = obj;
+ result = (PyObject *)ContainerIter;
+ PyObject_GC_Track(result);
+ break;
+ default:
+ return PyErr_Format(PyExc_TypeError,
+ "%s is not an EDS Iterable type (Container or Enumeration)",
+ Py_TYPE(obj)->tp_name);
}
return result;
}
-
-static void EdsLib_Python_EnumEntryIterator_dealloc(PyObject * obj)
+static void EdsLib_Python_EnumEntryIterator_dealloc(PyObject *obj)
{
- EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t*)obj;
+ EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t *)obj;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->refobj);
PyObject_GC_Del(self);
@@ -766,57 +753,60 @@ static void EdsLib_Python_EnumEntryIterator_dealloc(PyObject * obj)
static int EdsLib_Python_EnumEntryIterator_traverse(PyObject *obj, visitproc visit, void *arg)
{
- EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t*)obj;
+ EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t *)obj;
Py_VISIT(self->refobj);
return 0;
}
static int EdsLib_Python_EnumEntryIterator_clear(PyObject *obj)
{
- EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t*)obj;
+ EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t *)obj;
Py_CLEAR(self->refobj);
return 0;
}
static PyObject *EdsLib_Python_EnumEntryIterator_iternext(PyObject *obj)
{
- EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t*)obj;
- EdsLib_Python_DatabaseEntry_t *dbent = NULL;
- const char * Label;
- char LabelBuffer[64];
- intmax_t Value;
- PyObject *key = NULL;
- PyObject *value = NULL;
- PyObject *result = NULL;
+ EdsLib_Python_EnumerationIterator_t *self = (EdsLib_Python_EnumerationIterator_t *)obj;
+ EdsLib_Python_DatabaseEntry_t *dbent = NULL;
+ const char *Label;
+ char LabelBuffer[64];
+ intmax_t Value;
+ PyObject *key = NULL;
+ PyObject *value = NULL;
+ PyObject *result = NULL;
do
{
- if (self->refobj == NULL)
+ if (self->refobj == NULL)
{
break;
}
dbent = (EdsLib_Python_DatabaseEntry_t *)self->refobj;
- Label = EdsLib_DisplayDB_GetEnumLabelByIndex(dbent->EdsDb->GD, dbent->EdsId, self->Index, LabelBuffer, sizeof(LabelBuffer));
+ Label = EdsLib_DisplayDB_GetEnumLabelByIndex(dbent->EdsDb->GD,
+ dbent->EdsId,
+ self->Index,
+ LabelBuffer,
+ sizeof(LabelBuffer));
Value = EdsLib_DisplayDB_GetEnumValueByIndex(dbent->EdsDb->GD, dbent->EdsId, self->Index);
- if (strcmp(Label,"UNDEFINED") != 0)
+ if (strcmp(Label, "UNDEFINED") != 0)
{
- key = PyUnicode_FromString(Label);
+ key = PyUnicode_FromString(Label);
value = PyLong_FromLong(Value);
if ((key == NULL) || (value == NULL))
{
- /* end */
- Py_CLEAR(self->refobj);
- break;
+ /* end */
+ Py_CLEAR(self->refobj);
+ break;
}
++self->Index;
result = PyTuple_Pack(2, key, value);
}
- }
- while(0);
+ } while (0);
Py_XDECREF(key);
Py_XDECREF(value);
@@ -824,9 +814,9 @@ static PyObject *EdsLib_Python_EnumEntryIterator_iternext(PyObject *obj)
return result;
}
-static void EdsLib_Python_ContainerEntryIterator_dealloc(PyObject * obj)
+static void EdsLib_Python_ContainerEntryIterator_dealloc(PyObject *obj)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->refobj);
PyObject_GC_Del(self);
@@ -834,36 +824,36 @@ static void EdsLib_Python_ContainerEntryIterator_dealloc(PyObject * obj)
static int EdsLib_Python_ContainerEntryIterator_traverse(PyObject *obj, visitproc visit, void *arg)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
Py_VISIT(self->refobj);
return 0;
}
static int EdsLib_Python_ContainerEntryIterator_clear(PyObject *obj)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
Py_CLEAR(self->refobj);
return 0;
}
static PyObject *EdsLib_Python_ContainerEntryIterator_iternext(PyObject *obj)
{
- EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t*)obj;
- EdsLib_Python_DatabaseEntry_t *dbent = NULL;
+ EdsLib_Python_ContainerIterator_t *self = (EdsLib_Python_ContainerIterator_t *)obj;
+ EdsLib_Python_DatabaseEntry_t *dbent = NULL;
const char *keystr;
EdsLib_DataTypeDB_EntityInfo_t CompInfo;
- PyObject *sub_obj = NULL;
+ PyObject *sub_obj = NULL;
EdsLib_Python_DatabaseEntry_t *sub_dbent = NULL;
- PyObject *key = NULL;
- PyObject *dbname = NULL;
- PyObject *entry = NULL;
- PyObject *result = NULL;
+ PyObject *key = NULL;
+ PyObject *dbname = NULL;
+ PyObject *entry = NULL;
+ PyObject *result = NULL;
do
{
- if (self->refobj == NULL)
+ if (self->refobj == NULL)
{
break;
}
@@ -885,10 +875,10 @@ static PyObject *EdsLib_Python_ContainerEntryIterator_iternext(PyObject *obj)
if (EdsLib_DisplayDB_LocateSubEntity(dbent->EdsDb->GD, dbent->EdsId, keystr, &CompInfo) == EDSLIB_SUCCESS)
{
- sub_obj = (PyObject *)EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(dbent->EdsDb, CompInfo.EdsId);
- sub_dbent = (EdsLib_Python_DatabaseEntry_t *) sub_obj;
- dbname = sub_dbent->EdsDb->DbName;
- entry = sub_dbent->EdsTypeName;
+ sub_obj = (PyObject *)EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(dbent->EdsDb, CompInfo.EdsId);
+ sub_dbent = (EdsLib_Python_DatabaseEntry_t *)sub_obj;
+ dbname = sub_dbent->EdsDb->DbName;
+ entry = sub_dbent->EdsTypeName;
}
if ((entry == NULL) || (dbname == NULL))
@@ -899,8 +889,7 @@ static PyObject *EdsLib_Python_ContainerEntryIterator_iternext(PyObject *obj)
Py_INCREF(dbname);
Py_INCREF(entry);
result = PyTuple_Pack(3, key, dbname, entry);
- }
- while(0);
+ } while (0);
Py_XDECREF(key);
Py_XDECREF(dbname);
diff --git a/edslib/python/src/edslib_python_dynamicarray.c b/edslib/python/src/edslib_python_dynamicarray.c
index dfe8399..d711ab2 100644
--- a/edslib/python/src/edslib_python_dynamicarray.c
+++ b/edslib/python/src/edslib_python_dynamicarray.c
@@ -18,44 +18,39 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_dynamicarray.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement Python type to represent a sequence (array) of other EDS objects
-**
-** This allows an arbitrary multiple of instances of any other EDS object type
-** where the data is stored sequentially in memory. These are arrays that are
-** created dynamically at run time rather than statically sized at compile time.
-**
-** In contrast to static arrays, these instance types are _not_ directly
-** defined in EDS.
+ ** Implement Python type to represent a sequence (array) of other EDS objects
+ **
+ ** This allows an arbitrary multiple of instances of any other EDS object type
+ ** where the data is stored sequentially in memory. These are arrays that are
+ ** created dynamically at run time rather than statically sized at compile time.
+ **
+ ** In contrast to static arrays, these instance types are _not_ directly
+ ** defined in EDS.
*/
#include "edslib_python_internal.h"
+static int EdsLib_Python_DynamicArray_init(PyObject *obj, PyObject *args, PyObject *kwds);
+static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args, PyObject *kwds);
-static int EdsLib_Python_DynamicArray_init(PyObject *obj, PyObject *args, PyObject *kwds);
-static PyObject * EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args, PyObject *kwds);
+PyTypeObject EdsLib_Python_DynamicArrayType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("DynamicArray"),
+ .tp_basicsize = sizeof(EdsLib_Python_ObjectArray_t),
+ .tp_base = &EdsLib_Python_ObjectArrayType,
+ .tp_init = EdsLib_Python_DynamicArray_init,
+ .tp_call = EdsLib_Python_DynamicArray_call,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS Dynamic Array Type") };
-PyTypeObject EdsLib_Python_DynamicArrayType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("DynamicArray"),
- .tp_basicsize = sizeof(EdsLib_Python_ObjectArray_t),
- .tp_base = &EdsLib_Python_ObjectArrayType,
- .tp_init = EdsLib_Python_DynamicArray_init,
- .tp_call = EdsLib_Python_DynamicArray_call,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS Dynamic Array Type")
-};
-
-static int EdsLib_Python_DynamicArray_init(PyObject *obj, PyObject *args, PyObject *kwds)
+static int EdsLib_Python_DynamicArray_init(PyObject *obj, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = { "dbent", "nelem", "elemsz", NULL };
- int result = -1;
+ int result = -1;
kwds = EdsLib_Python_ObjectBase_InitArgsToKwds(args, kwds, kwlist);
if (kwds != NULL)
@@ -70,23 +65,21 @@ static int EdsLib_Python_DynamicArray_init(PyObject *obj, PyObject *arg
static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args, PyObject *kwds)
{
- EdsLib_Python_ObjectArray_t *self = (EdsLib_Python_ObjectArray_t *)obj;
- PyObject *inseq = NULL;
- PyObject *outlist = NULL;
- PyObject *result = NULL;
- PyObject *subarg = NULL;
- PyObject *element = NULL;
- Py_ssize_t idx = 0;
- Py_ssize_t maxlen = -1;
- ternaryfunc callfunc = ((PyTypeObject*)self->RefDbEntry)->tp_call;
-
+ EdsLib_Python_ObjectArray_t *self = (EdsLib_Python_ObjectArray_t *)obj;
+ PyObject *inseq = NULL;
+ PyObject *outlist = NULL;
+ PyObject *result = NULL;
+ PyObject *subarg = NULL;
+ PyObject *element = NULL;
+ Py_ssize_t idx = 0;
+ Py_ssize_t maxlen = -1;
+ ternaryfunc callfunc = ((PyTypeObject *)self->RefDbEntry)->tp_call;
/*
* This function is basically just a "call iterator" that calls
* every element with a corresponding arg from a sequence object.
*/
-
/*
* This functions has two modes:
* - If no arguments are provided, it acts a "getter"
@@ -102,20 +95,20 @@ static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args,
* Not expected to happen, but do not crash it if does.
* Anything inheriting from ObjectBase should implement tp_call.
*/
- PyErr_Format(PyExc_TypeError, "\'%s\' does not implement tp_call()\n",
- ((PyTypeObject*)self->RefDbEntry)->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "\'%s\' does not implement tp_call()\n",
+ ((PyTypeObject *)self->RefDbEntry)->tp_name);
break;
}
- if (args != NULL &&
- !PyArg_UnpackTuple(args, __func__, 0, 1, &inseq))
+ if (args != NULL && !PyArg_UnpackTuple(args, __func__, 0, 1, &inseq))
{
break;
}
if (inseq == NULL)
{
- maxlen = self->ElementCount;
+ maxlen = self->ElementCount;
outlist = PyList_New(self->ElementCount);
if (outlist == NULL)
{
@@ -124,7 +117,10 @@ static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args,
}
else if (!PySequence_Check(inseq))
{
- PyErr_Format(PyExc_TypeError, "%s(): argument type \'%s\' is not a sequence", __func__, Py_TYPE(inseq)->tp_name);
+ PyErr_Format(PyExc_TypeError,
+ "%s(): argument type \'%s\' is not a sequence",
+ __func__,
+ Py_TYPE(inseq)->tp_name);
break;
}
else
@@ -193,7 +189,7 @@ static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args,
}
else
{
- Py_DECREF(outvalue); /* discard ref */
+ Py_DECREF(outvalue); /* discard ref */
}
}
}
@@ -219,8 +215,7 @@ static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args,
result = Py_None;
}
Py_INCREF(result);
- }
- while(0);
+ } while (0);
/*
* DECREF any owned objects used during this procedure.
@@ -232,16 +227,19 @@ static PyObject *EdsLib_Python_DynamicArray_call(PyObject *obj, PyObject *args,
return result;
}
-
-PyObject * EdsLib_Python_DynamicArray_FromPtrAndSize(PyTypeObject *objtype, void *ptr, Py_ssize_t nelem, Py_ssize_t elemsz)
+PyObject *
+EdsLib_Python_DynamicArray_FromPtrAndSize(PyTypeObject *objtype, void *ptr, Py_ssize_t nelem, Py_ssize_t elemsz)
{
static const char *kwlist[] = { "buffer", "dbent", "nelem", "elemsz", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
-
- args = EdsLib_Python_ObjectBase_BuildKwArgs("NOnn", kwlist,
- EdsLib_Python_Buffer_FromPtrAndSize(ptr, nelem * elemsz),
- objtype, nelem, elemsz);
+ PyObject *args = NULL;
+ PyObject *result = NULL;
+
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("NOnn",
+ kwlist,
+ EdsLib_Python_Buffer_FromPtrAndSize(ptr, nelem * elemsz),
+ objtype,
+ nelem,
+ elemsz);
if (args == NULL)
{
return NULL;
@@ -254,15 +252,21 @@ PyObject * EdsLib_Python_DynamicArray_FromPtrAndSize(PyTypeObject *objtype, vo
return result;
}
-PyObject * EdsLib_Python_DynamicArray_FromConstPtrAndSize(PyTypeObject *objtype, const void *ptr, Py_ssize_t nelem, Py_ssize_t elemsz)
+PyObject *EdsLib_Python_DynamicArray_FromConstPtrAndSize(PyTypeObject *objtype,
+ const void *ptr,
+ Py_ssize_t nelem,
+ Py_ssize_t elemsz)
{
static const char *kwlist[] = { "buffer", "dbent", "nelem", "elemsz", NULL };
- PyObject *args = NULL;
- PyObject *result = NULL;
-
- args = EdsLib_Python_ObjectBase_BuildKwArgs("NOnn", kwlist,
- EdsLib_Python_Buffer_FromConstPtrAndSize(ptr, nelem * elemsz),
- objtype, nelem, elemsz);
+ PyObject *args = NULL;
+ PyObject *result = NULL;
+
+ args = EdsLib_Python_ObjectBase_BuildKwArgs("NOnn",
+ kwlist,
+ EdsLib_Python_Buffer_FromConstPtrAndSize(ptr, nelem * elemsz),
+ objtype,
+ nelem,
+ elemsz);
if (args == NULL)
{
return NULL;
@@ -274,7 +278,3 @@ PyObject * EdsLib_Python_DynamicArray_FromConstPtrAndSize(PyTypeObject *objtyp
return result;
}
-
-
-
-
diff --git a/edslib/python/src/edslib_python_internal.h b/edslib/python/src/edslib_python_internal.h
index cb5340c..0b7e70c 100644
--- a/edslib/python/src/edslib_python_internal.h
+++ b/edslib/python/src/edslib_python_internal.h
@@ -19,19 +19,17 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_internal.h
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Internal Header file for Python / EDS bindings
+ ** Internal Header file for Python / EDS bindings
*/
#ifndef _EDSLIB_PYTHON_INTERNAL_H_
#define _EDSLIB_PYTHON_INTERNAL_H_
-
#include "edslib_python.h"
#include
@@ -45,54 +43,50 @@
#include "edslib_binding_objects.h"
-#define EDSLIB_PYTHON_FORMATCODE_LEN 12
+#define EDSLIB_PYTHON_FORMATCODE_LEN 12
typedef struct
{
- PyObject_HEAD
- void *dl;
+ PyObject_HEAD void *dl;
const EdsLib_DatabaseObject_t *GD;
- PyObject *DbName;
+ PyObject *DbName;
/* TypeCache contains weak references to entries in the db, such that they
* will not be re-created each time they are required. This also gives persistence,
* i.e. repeated calls to lookup the same type give the same object, instead of a
* separate-but-equal object. */
- PyObject *TypeCache;
- PyObject *WeakRefList;
+ PyObject *TypeCache;
+ PyObject *WeakRefList;
} EdsLib_Python_Database_t;
typedef struct
{
- PyHeapTypeObject type_base;
+ PyHeapTypeObject type_base;
EdsLib_Python_Database_t *EdsDb;
- PyObject *BaseName;
- PyObject *EdsTypeName;
- EdsLib_Id_t EdsId;
- char FormatInfo[EDSLIB_PYTHON_FORMATCODE_LEN];
- PyObject* SubEntityList;
- PyObject* WeakRefList;
+ PyObject *BaseName;
+ PyObject *EdsTypeName;
+ EdsLib_Id_t EdsId;
+ char FormatInfo[EDSLIB_PYTHON_FORMATCODE_LEN];
+ PyObject *SubEntityList;
+ PyObject *WeakRefList;
} EdsLib_Python_DatabaseEntry_t;
typedef struct
{
- PyObject_HEAD
- Py_ssize_t Position;
- PyObject* refobj;
+ PyObject_HEAD Py_ssize_t Position;
+ PyObject *refobj;
} EdsLib_Python_ContainerIterator_t;
typedef struct
{
- PyObject_HEAD
- uint16_t Index;
- PyObject* refobj;
+ PyObject_HEAD uint16_t Index;
+ PyObject *refobj;
} EdsLib_Python_EnumerationIterator_t;
typedef struct
{
- PyObject_HEAD
- EdsLib_Id_t EdsId;
- Py_ssize_t Offset;
- Py_ssize_t TotalLength;
+ PyObject_HEAD EdsLib_Id_t EdsId;
+ Py_ssize_t Offset;
+ Py_ssize_t TotalLength;
} EdsLib_Python_Accessor_t;
typedef struct
@@ -103,72 +97,72 @@ typedef struct
typedef struct
{
- PyObject_HEAD
- EdsLib_Binding_Buffer_Content_t edsbuf;
- uint8_t is_readonly;
- uint8_t is_dynamic;
- uint8_t is_initialized;
- EdsLib_Python_View_t *bufobj;
+ PyObject_HEAD EdsLib_Binding_Buffer_Content_t edsbuf;
+ uint8_t is_readonly;
+ uint8_t is_dynamic;
+ uint8_t is_initialized;
+ EdsLib_Python_View_t *bufobj;
} EdsLib_Python_Buffer_t;
typedef struct
{
- PyObject_HEAD
- Py_ssize_t Offset;
- Py_ssize_t TotalLength;
- EdsLib_Python_Buffer_t *StorageBuf;
+ PyObject_HEAD Py_ssize_t Offset;
+ Py_ssize_t TotalLength;
+ EdsLib_Python_Buffer_t *StorageBuf;
} EdsLib_Python_ObjectBase_t;
typedef struct
{
- EdsLib_Python_ObjectBase_t objbase;
+ EdsLib_Python_ObjectBase_t objbase;
EdsLib_Python_DatabaseEntry_t *RefDbEntry;
- Py_ssize_t ElementSize;
- Py_ssize_t ElementCount;
+ Py_ssize_t ElementSize;
+ Py_ssize_t ElementCount;
} EdsLib_Python_ObjectArray_t;
extern PyObject *EdsLib_Python_DatabaseCache;
-
PyObject *EdsLib_Python_GetFromCache(PyObject *cachedict, PyObject *idxval, PyTypeObject *reqtype);
-int EdsLib_Python_SaveToCache(PyObject *cachedict, PyObject *idxval, PyObject *saveobj);
+int EdsLib_Python_SaveToCache(PyObject *cachedict, PyObject *idxval, PyObject *saveobj);
-bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *edsobj, PyObject *pyobj);
-bool EdsLib_Python_ConvertPythonToEdsObject(EdsLib_Python_ObjectBase_t *self, PyObject *pyobj);
-PyObject * EdsLib_Python_ConvertEdsScalarToPython(EdsLib_Binding_DescriptorObject_t *edsobj);
-PyObject * EdsLib_Python_ConvertEdsObjectToPython(EdsLib_Python_ObjectBase_t *self);
+bool EdsLib_Python_ConvertPythonToEdsScalar(EdsLib_Binding_DescriptorObject_t *edsobj, PyObject *pyobj);
+bool EdsLib_Python_ConvertPythonToEdsObject(EdsLib_Python_ObjectBase_t *self, PyObject *pyobj);
+PyObject *EdsLib_Python_ConvertEdsScalarToPython(EdsLib_Binding_DescriptorObject_t *edsobj);
+PyObject *EdsLib_Python_ConvertEdsObjectToPython(EdsLib_Python_ObjectBase_t *self);
-EdsLib_Id_t EdsLib_Python_ConvertArgToEdsId(const EdsLib_DatabaseObject_t *GD, PyObject* arg);
+EdsLib_Id_t EdsLib_Python_ConvertArgToEdsId(const EdsLib_DatabaseObject_t *GD, PyObject *arg);
-PyTypeObject* EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Database_t *EdsDb, EdsLib_Id_t EdsId);
+PyTypeObject *EdsLib_Python_DatabaseEntry_GetFromEdsId_Impl(EdsLib_Python_Database_t *EdsDb, EdsLib_Id_t EdsId);
PyObject *EdsLib_Python_ElementAccessor_CreateFromOffsetSize(EdsLib_Id_t EdsId, Py_ssize_t Offset, Py_ssize_t Length);
PyObject *EdsLib_Python_ElementAccessor_CreateFromEntityInfo(const EdsLib_DataTypeDB_EntityInfo_t *EntityInfo);
PyObject *EdsLib_Python_ObjectBase_InitArgsToKwds(PyObject *args, PyObject *kwds, const char **kwlist);
PyObject *EdsLib_Python_ObjectBase_BuildKwArgs(const char *format, const char **kwlist, ...);
-bool EdsLib_Python_ObjectBase_SetKwArg(PyObject *kwds, const char *format, const char *kw, ...);
-bool EdsLib_Python_ObjectBase_GetKwArg(PyObject *kwds, const char *format, const char *kw, void *OutPtr);
+bool EdsLib_Python_ObjectBase_SetKwArg(PyObject *kwds, const char *format, const char *kw, ...);
+bool EdsLib_Python_ObjectBase_GetKwArg(PyObject *kwds, const char *format, const char *kw, void *OutPtr);
PyObject *EdsLib_Python_ObjectBase_GenericNew(PyTypeObject *objtype, PyObject *kwargs);
-PyObject *EdsLib_Python_ObjectBase_NewSubObject(PyObject *obj, PyTypeObject *subobjtype, Py_ssize_t Offset, Py_ssize_t MaxSize);
+PyObject *
+EdsLib_Python_ObjectBase_NewSubObject(PyObject *obj, PyTypeObject *subobjtype, Py_ssize_t Offset, Py_ssize_t MaxSize);
int EdsLib_Python_ObjectBase_InitBufferView(EdsLib_Python_ObjectBase_t *self, Py_buffer *view, int flags);
-int EdsLib_Python_SetupObjectDesciptor(EdsLib_Python_ObjectBase_t *self, EdsLib_Binding_DescriptorObject_t *descobj, int flags);
+int EdsLib_Python_SetupObjectDesciptor(EdsLib_Python_ObjectBase_t *self,
+ EdsLib_Binding_DescriptorObject_t *descobj,
+ int flags);
void EdsLib_Python_ReleaseObjectDesciptor(EdsLib_Binding_DescriptorObject_t *descobj);
/* various methods to construct EDS python object buffers */
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_New(Py_ssize_t len);
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_Copy(const void *buf, Py_ssize_t len);
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int readonly);
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromPtrAndSize(void *buf, Py_ssize_t len);
-EdsLib_Python_Buffer_t* EdsLib_Python_Buffer_FromConstPtrAndSize(const void *buf, Py_ssize_t len);
-const void *EdsLib_Python_Buffer_Peek(EdsLib_Python_Buffer_t* buf);
-Py_ssize_t EdsLib_Python_Buffer_GetMaxSize(EdsLib_Python_Buffer_t* buf);
-bool EdsLib_Python_Buffer_IsInitialized(EdsLib_Python_Buffer_t* buf);
-void EdsLib_Python_Buffer_SetInitialized(EdsLib_Python_Buffer_t* buf);
-
-EdsLib_Binding_Buffer_Content_t* EdsLib_Python_Buffer_GetContentRef(EdsLib_Python_Buffer_t *self, int userflags);
-void EdsLib_Python_Buffer_ReleaseContentRef(EdsLib_Binding_Buffer_Content_t* ref);
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_New(Py_ssize_t len);
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_Copy(const void *buf, Py_ssize_t len);
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_FromObject(PyObject *bufobj, int readonly);
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_FromPtrAndSize(void *buf, Py_ssize_t len);
+EdsLib_Python_Buffer_t *EdsLib_Python_Buffer_FromConstPtrAndSize(const void *buf, Py_ssize_t len);
+const void *EdsLib_Python_Buffer_Peek(EdsLib_Python_Buffer_t *buf);
+Py_ssize_t EdsLib_Python_Buffer_GetMaxSize(EdsLib_Python_Buffer_t *buf);
+bool EdsLib_Python_Buffer_IsInitialized(EdsLib_Python_Buffer_t *buf);
+void EdsLib_Python_Buffer_SetInitialized(EdsLib_Python_Buffer_t *buf);
+
+EdsLib_Binding_Buffer_Content_t *EdsLib_Python_Buffer_GetContentRef(EdsLib_Python_Buffer_t *self, int userflags);
+void EdsLib_Python_Buffer_ReleaseContentRef(EdsLib_Binding_Buffer_Content_t *ref);
/*
* EDS-defined data types are split into three categories for Python purposes-
@@ -199,5 +193,4 @@ extern PyTypeObject EdsLib_Python_ObjectContainerType;
extern PyTypeObject EdsLib_Python_ObjectArrayType;
extern PyTypeObject EdsLib_Python_DynamicArrayType;
-
-#endif /* _EDSLIB_PYTHON_INTERNAL_H_ */
+#endif /* _EDSLIB_PYTHON_INTERNAL_H_ */
diff --git a/edslib/python/src/edslib_python_module.c b/edslib/python/src/edslib_python_module.c
index 0e8439b..00aa737 100644
--- a/edslib/python/src/edslib_python_module.c
+++ b/edslib/python/src/edslib_python_module.c
@@ -18,24 +18,23 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_module.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** A module that implements Python bindings for EDS objects
-**
-** This file is just a thin wrapper that contains a Python-compatible init
-** function for the module. This is expected to be used when the EdsLib
-** module is imported directly in a Python program. No built-in database
-** object will be added. The user is on their own to load a database
-** separately from the EdsLib module.
-**
-** Note that other applications which embed Python would typically
-** _not_ use this entry point. Instead, the EdsLib would be registered
-** as a built-in module using its own customized init, and typically
-** would add an actual database object to the module during that process.
+ ** A module that implements Python bindings for EDS objects
+ **
+ ** This file is just a thin wrapper that contains a Python-compatible init
+ ** function for the module. This is expected to be used when the EdsLib
+ ** module is imported directly in a Python program. No built-in database
+ ** object will be added. The user is on their own to load a database
+ ** separately from the EdsLib module.
+ **
+ ** Note that other applications which embed Python would typically
+ ** _not_ use this entry point. Instead, the EdsLib would be registered
+ ** as a built-in module using its own customized init, and typically
+ ** would add an actual database object to the module during that process.
*/
#include "edslib_python.h"
@@ -85,7 +84,6 @@ PyMODINIT_FUNC PyInit_EdsLib(void)
#define PyMODINIT_FUNC void
#endif
-
PyMODINIT_FUNC initEdsLib(void)
{
/* python2 does not want module object */
@@ -93,4 +91,3 @@ PyMODINIT_FUNC initEdsLib(void)
}
#endif
-
diff --git a/edslib/python/src/edslib_python_number.c b/edslib/python/src/edslib_python_number.c
index 8df855d..2803de9 100644
--- a/edslib/python/src/edslib_python_number.c
+++ b/edslib/python/src/edslib_python_number.c
@@ -18,16 +18,15 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_number.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement Python data type for EDS number objects
-**
-** This extends the base object type and implements the "number protocol"
-** so EDS objects can work with all standard Python functions that accept numbers.
+ ** Implement Python data type for EDS number objects
+ **
+ ** This extends the base object type and implements the "number protocol"
+ ** so EDS objects can work with all standard Python functions that accept numbers.
*/
#include "edslib_python_internal.h"
@@ -36,46 +35,41 @@
* Only implementing the "number conversion" methods.
* This should allow EDS numbers to be coerced into integer or floats as necessary
*/
-static PyObject * EdsLib_Python_NativeObject_NumberAsInt(PyObject *obj);
-static PyObject * EdsLib_Python_NativeObject_NumberAsFloat(PyObject *obj);
-static int EdsLib_Python_NativeObject_NumberAsBool(PyObject *obj);
-
+static PyObject *EdsLib_Python_NativeObject_NumberAsInt(PyObject *obj);
+static PyObject *EdsLib_Python_NativeObject_NumberAsFloat(PyObject *obj);
+static int EdsLib_Python_NativeObject_NumberAsBool(PyObject *obj);
-static PyNumberMethods EdsLib_Python_NumberMethods =
-{
+static PyNumberMethods EdsLib_Python_NumberMethods = {
#if PY_MAJOR_VERSION >= 3
- .nb_bool = EdsLib_Python_NativeObject_NumberAsBool,
- .nb_int = EdsLib_Python_NativeObject_NumberAsInt,
+ .nb_bool = EdsLib_Python_NativeObject_NumberAsBool,
+ .nb_int = EdsLib_Python_NativeObject_NumberAsInt,
#else
- .nb_nonzero = EdsLib_Python_NativeObject_NumberAsBool,
- .nb_long = EdsLib_Python_NativeObject_NumberAsInt,
+ .nb_nonzero = EdsLib_Python_NativeObject_NumberAsBool,
+ .nb_long = EdsLib_Python_NativeObject_NumberAsInt,
#endif
- .nb_float = EdsLib_Python_NativeObject_NumberAsFloat,
- .nb_index = EdsLib_Python_NativeObject_NumberAsInt
+ .nb_float = EdsLib_Python_NativeObject_NumberAsFloat,
+ .nb_index = EdsLib_Python_NativeObject_NumberAsInt
};
-PyTypeObject EdsLib_Python_ObjectNumberType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Number"),
- .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
- .tp_base = &EdsLib_Python_ObjectScalarType,
- .tp_as_number = &EdsLib_Python_NumberMethods,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS Number Value")
-};
+PyTypeObject EdsLib_Python_ObjectNumberType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("Number"),
+ .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
+ .tp_base = &EdsLib_Python_ObjectScalarType,
+ .tp_as_number = &EdsLib_Python_NumberMethods,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS Number Value") };
static void EdsLib_Python_NativeObject_GetValueBuffer(PyObject *obj, EdsLib_GenericValueBuffer_t *ValBuf)
{
- EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
- EdsLib_BasicType_t DesiredValueType;
+ EdsLib_Python_ObjectBase_t *self = (EdsLib_Python_ObjectBase_t *)obj;
+ EdsLib_BasicType_t DesiredValueType;
EdsLib_Binding_DescriptorObject_t viewdesc;
- DesiredValueType = ValBuf->ValueType;
+ DesiredValueType = ValBuf->ValueType;
ValBuf->ValueType = EDSLIB_BASICTYPE_NONE;
- if (!PyType_IsSubtype(Py_TYPE(obj), &EdsLib_Python_ObjectBaseType) ||
- !PyType_IsSubtype(Py_TYPE(obj->ob_type), &EdsLib_Python_DatabaseEntryType))
+ if (!PyType_IsSubtype(Py_TYPE(obj), &EdsLib_Python_ObjectBaseType)
+ || !PyType_IsSubtype(Py_TYPE(obj->ob_type), &EdsLib_Python_DatabaseEntryType))
{
PyErr_SetString(PyExc_TypeError, "Object is not an EDS type");
return;
@@ -98,12 +92,12 @@ static void EdsLib_Python_NativeObject_GetValueBuffer(PyObject *obj, EdsLib_Gene
EdsLib_Python_ReleaseObjectDesciptor(&viewdesc);
}
-static PyObject * EdsLib_Python_NativeObject_NumberAsInt(PyObject *obj)
+static PyObject *EdsLib_Python_NativeObject_NumberAsInt(PyObject *obj)
{
EdsLib_GenericValueBuffer_t ValBuf;
- PyObject *result;
+ PyObject *result;
- ValBuf.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
+ ValBuf.ValueType = EDSLIB_BASICTYPE_SIGNED_INT;
ValBuf.Value.SignedInteger = 0;
EdsLib_Python_NativeObject_GetValueBuffer(obj, &ValBuf);
@@ -125,12 +119,12 @@ static PyObject * EdsLib_Python_NativeObject_NumberAsInt(PyObject *obj)
return result;
}
-static PyObject * EdsLib_Python_NativeObject_NumberAsFloat(PyObject *obj)
+static PyObject *EdsLib_Python_NativeObject_NumberAsFloat(PyObject *obj)
{
EdsLib_GenericValueBuffer_t ValBuf;
- PyObject *result;
+ PyObject *result;
- ValBuf.ValueType = EDSLIB_BASICTYPE_FLOAT;
+ ValBuf.ValueType = EDSLIB_BASICTYPE_FLOAT;
ValBuf.Value.FloatingPoint = 0;
EdsLib_Python_NativeObject_GetValueBuffer(obj, &ValBuf);
@@ -152,15 +146,14 @@ static PyObject * EdsLib_Python_NativeObject_NumberAsFloat(PyObject *obj)
return result;
}
-static int EdsLib_Python_NativeObject_NumberAsBool(PyObject *obj)
+static int EdsLib_Python_NativeObject_NumberAsBool(PyObject *obj)
{
EdsLib_GenericValueBuffer_t ValBuf;
- ValBuf.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
+ ValBuf.ValueType = EDSLIB_BASICTYPE_UNSIGNED_INT;
ValBuf.Value.FloatingPoint = 0;
EdsLib_Python_NativeObject_GetValueBuffer(obj, &ValBuf);
- return (ValBuf.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT &&
- ValBuf.Value.UnsignedInteger != 0);
+ return (ValBuf.ValueType == EDSLIB_BASICTYPE_UNSIGNED_INT && ValBuf.Value.UnsignedInteger != 0);
}
diff --git a/edslib/python/src/edslib_python_packedobject.c b/edslib/python/src/edslib_python_packedobject.c
index d09d6bb..bac647e 100644
--- a/edslib/python/src/edslib_python_packedobject.c
+++ b/edslib/python/src/edslib_python_packedobject.c
@@ -18,17 +18,16 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_packedobject.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement "packed object" type
-**
-** This is just a light wrapper around the standard Python Bytes type. Its
-** main purpose is to tell the difference between native bytes objects and
-** bytes objects which are in the packed form, so they can be converted accordingly.
+ ** Implement "packed object" type
+ **
+ ** This is just a light wrapper around the standard Python Bytes type. Its
+ ** main purpose is to tell the difference between native bytes objects and
+ ** bytes objects which are in the packed form, so they can be converted accordingly.
*/
#include "edslib_python_internal.h"
@@ -37,8 +36,10 @@
* but older versions need a small workaround */
#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
-{ ob->ob_type = type; }
-#define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type)
+{
+ ob->ob_type = type;
+}
+#define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject *)(ob), type)
#endif
/*
* A shared scratch buffer for packing objects...
@@ -50,38 +51,34 @@ static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
typedef struct
{
- void *ScratchPtr;
+ void *ScratchPtr;
Py_ssize_t ScratchSize;
Py_ssize_t ContentSize;
} EdsLib_Python_ObjectScratchArea_t;
-
static EdsLib_Python_ObjectScratchArea_t EdsLib_Python_PackedObject_GLOBAL = { NULL, 0, 0 };
static PyObject *EdsLib_Python_PackedObjectType_new(PyTypeObject *objtype, PyObject *args, PyObject *kwds);
static PyObject *EdsLib_Python_PackedObjectType_repr(PyObject *obj);
-PyTypeObject EdsLib_Python_PackedObjectType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("PackedObject"),
- .tp_basicsize = sizeof(PyBytesObject),
- .tp_itemsize = 1,
- .tp_base = &PyBytes_Type,
- .tp_new = EdsLib_Python_PackedObjectType_new,
- .tp_repr = EdsLib_Python_PackedObjectType_repr,
- .tp_flags = Py_TPFLAGS_DEFAULT,
- .tp_doc = PyDoc_STR("EDS Packed Object Bytes Type")
-};
-
-static int EdsLib_Python_InitScratchAreaFromEdsObject(EdsLib_Python_ObjectBase_t *srcobj,
- EdsLib_Python_ObjectScratchArea_t *scratch)
+PyTypeObject EdsLib_Python_PackedObjectType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("PackedObject"),
+ .tp_basicsize = sizeof(PyBytesObject),
+ .tp_itemsize = 1,
+ .tp_base = &PyBytes_Type,
+ .tp_new = EdsLib_Python_PackedObjectType_new,
+ .tp_repr = EdsLib_Python_PackedObjectType_repr,
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+ .tp_doc = PyDoc_STR("EDS Packed Object Bytes Type") };
+
+static int EdsLib_Python_InitScratchAreaFromEdsObject(EdsLib_Python_ObjectBase_t *srcobj,
+ EdsLib_Python_ObjectScratchArea_t *scratch)
{
- EdsLib_Binding_DescriptorObject_t viewdesc;
- EdsLib_Python_DatabaseEntry_t *dbent;
+ EdsLib_Binding_DescriptorObject_t viewdesc;
+ EdsLib_Python_DatabaseEntry_t *dbent;
EdsLib_DataTypeDB_DerivedTypeInfo_t DerivInfo;
- size_t actualsz;
- int32_t status;
+ size_t actualsz;
+ int32_t status;
if (srcobj->StorageBuf == NULL)
{
@@ -90,7 +87,7 @@ static int EdsLib_Python_InitScratchAreaFromEdsObject(EdsLib_Python_ObjectBase_t
}
scratch->ContentSize = 0;
- dbent = (EdsLib_Python_DatabaseEntry_t *)Py_TYPE(srcobj);
+ dbent = (EdsLib_Python_DatabaseEntry_t *)Py_TYPE(srcobj);
EdsLib_DataTypeDB_GetDerivedInfo(dbent->EdsDb->GD, dbent->EdsId, &DerivInfo);
actualsz = (DerivInfo.MaxSize.Bits + 7) / 8;
@@ -130,8 +127,7 @@ static int EdsLib_Python_InitScratchAreaFromEdsObject(EdsLib_Python_ObjectBase_t
return 0;
}
- status = EdsLib_Binding_ExportToPackedBuffer(&viewdesc,
- scratch->ScratchPtr, actualsz-1);
+ status = EdsLib_Binding_ExportToPackedBuffer(&viewdesc, scratch->ScratchPtr, actualsz - 1);
EdsLib_Python_ReleaseObjectDesciptor(&viewdesc);
@@ -151,14 +147,14 @@ static int EdsLib_Python_InitScratchAreaFromEdsObject(EdsLib_Python_ObjectBase_t
static PyObject *EdsLib_Python_PackedObjectType_new(PyTypeObject *objtype, PyObject *args, PyObject *kwds)
{
- PyObject *argobj;
+ PyObject *argobj;
PyBytesObject *result;
- void *contentdata_src;
- size_t contentdata_size;
+ void *contentdata_src;
+ size_t contentdata_size;
- contentdata_src = NULL;
+ contentdata_src = NULL;
contentdata_size = 0;
- result = NULL;
+ result = NULL;
if (!PyArg_ParseTuple(args, "O:PackedObjectType_new", &argobj))
{
return NULL;
@@ -173,17 +169,16 @@ static PyObject *EdsLib_Python_PackedObjectType_new(PyTypeObject *objtype, PyObj
*/
if (PyObject_TypeCheck(Py_TYPE(argobj), &EdsLib_Python_DatabaseEntryType))
{
- if (EdsLib_Python_InitScratchAreaFromEdsObject(
- (EdsLib_Python_ObjectBase_t *)argobj,
- &EdsLib_Python_PackedObject_GLOBAL))
+ if (EdsLib_Python_InitScratchAreaFromEdsObject((EdsLib_Python_ObjectBase_t *)argobj,
+ &EdsLib_Python_PackedObject_GLOBAL))
{
- contentdata_src = EdsLib_Python_PackedObject_GLOBAL.ScratchPtr;
+ contentdata_src = EdsLib_Python_PackedObject_GLOBAL.ScratchPtr;
contentdata_size = EdsLib_Python_PackedObject_GLOBAL.ContentSize;
}
}
else if (PyObject_TypeCheck(argobj, &PyBytes_Type))
{
- contentdata_src = PyBytes_AS_STRING(argobj);
+ contentdata_src = PyBytes_AS_STRING(argobj);
contentdata_size = PyBytes_GET_SIZE(argobj);
}
else
@@ -194,20 +189,21 @@ static PyObject *EdsLib_Python_PackedObjectType_new(PyTypeObject *objtype, PyObj
if (contentdata_src != NULL)
{
- result = (PyBytesObject*)PyBytes_FromStringAndSize(contentdata_src, contentdata_size);
+ result = (PyBytesObject *)PyBytes_FromStringAndSize(contentdata_src, contentdata_size);
if (result != NULL)
{
- /* This identifies it as an instance of the EdsLib.PackedObject type, as opposed to a vanilla bytes object */
+ /* This identifies it as an instance of the EdsLib.PackedObject type, as opposed to a vanilla bytes object
+ */
Py_SET_TYPE(result, objtype);
}
}
- return (PyObject*)result;
+ return (PyObject *)result;
}
static PyObject *EdsLib_Python_PackedObjectType_repr(PyObject *obj)
{
- PyObject *repr = EdsLib_Python_PackedObjectType.tp_base->tp_repr(obj);
+ PyObject *repr = EdsLib_Python_PackedObjectType.tp_base->tp_repr(obj);
PyObject *result = NULL;
if (repr != NULL)
@@ -218,4 +214,3 @@ static PyObject *EdsLib_Python_PackedObjectType_repr(PyObject *obj)
return result;
}
-
diff --git a/edslib/python/src/edslib_python_scalar.c b/edslib/python/src/edslib_python_scalar.c
index 54e4229..dc35f82 100644
--- a/edslib/python/src/edslib_python_scalar.c
+++ b/edslib/python/src/edslib_python_scalar.c
@@ -18,34 +18,30 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_scalar.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement Python data type for EDS scalar objects.
-**
-** This is to provide a better implementation of the "str" routine, which
-** converts EDS objects into strings. Without this, the "repr" function
-** would be used which produces less useful results for passing into another
-** function which expects a string.
+ ** Implement Python data type for EDS scalar objects.
+ **
+ ** This is to provide a better implementation of the "str" routine, which
+ ** converts EDS objects into strings. Without this, the "repr" function
+ ** would be used which produces less useful results for passing into another
+ ** function which expects a string.
*/
#include "edslib_python_internal.h"
static PyObject *EdsLib_Python_NativeObject_ScalarType_str(PyObject *obj);
-PyTypeObject EdsLib_Python_ObjectScalarType =
-{
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = EDSLIB_PYTHON_ENTITY_NAME("Scalar"),
- .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
- .tp_base = &EdsLib_Python_ObjectBaseType,
- .tp_str = EdsLib_Python_NativeObject_ScalarType_str,
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = PyDoc_STR("EDS ScalarDataType")
-};
+PyTypeObject EdsLib_Python_ObjectScalarType = { PyVarObject_HEAD_INIT(NULL, 0).tp_name =
+ EDSLIB_PYTHON_ENTITY_NAME("Scalar"),
+ .tp_basicsize = sizeof(EdsLib_Python_ObjectBase_t),
+ .tp_base = &EdsLib_Python_ObjectBaseType,
+ .tp_str = EdsLib_Python_NativeObject_ScalarType_str,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ .tp_doc = PyDoc_STR("EDS ScalarDataType") };
static PyObject *EdsLib_Python_NativeObject_ScalarType_str(PyObject *obj)
{
diff --git a/edslib/python/src/edslib_python_setup.c b/edslib/python/src/edslib_python_setup.c
index bf9618c..e06385e 100644
--- a/edslib/python/src/edslib_python_setup.c
+++ b/edslib/python/src/edslib_python_setup.c
@@ -19,13 +19,12 @@
* limitations under the License.
*/
-
/**
* \file edslib_python_setup.c
* \ingroup python
* \author joseph.p.hickey@nasa.gov
*
-** Implement setup function / initializer for EDS/Python module objects
+ ** Implement setup function / initializer for EDS/Python module objects
*/
#include "edslib_python_internal.h"
@@ -39,15 +38,12 @@
*/
#if (PY_MAJOR_VERSION >= 3)
-static PyModuleDef EdsLib_Python_ModuleDef =
-{
- PyModuleDef_HEAD_INIT,
- EDSLIB_PYTHON_MODULE_NAME,
- PyDoc_STR(EDSLIB_PYTHON_DOC),
- -1
-};
+static PyModuleDef EdsLib_Python_ModuleDef = { PyModuleDef_HEAD_INIT,
+ EDSLIB_PYTHON_MODULE_NAME,
+ PyDoc_STR(EDSLIB_PYTHON_DOC),
+ -1 };
-static inline PyObject* EdsLib_Python_InstantiateModule(void)
+static inline PyObject *EdsLib_Python_InstantiateModule(void)
{
/* python3 uses PyModule_Create() API */
return PyModule_Create(&EdsLib_Python_ModuleDef);
@@ -55,7 +51,7 @@ static inline PyObject* EdsLib_Python_InstantiateModule(void)
#else
-static inline PyObject* EdsLib_Python_InstantiateModule(void)
+static inline PyObject *EdsLib_Python_InstantiateModule(void)
{
/* python2 uses Py_InitModule3() API */
return Py_InitModule3(EDSLIB_PYTHON_MODULE_NAME, NULL, EDSLIB_PYTHON_DOC);
@@ -63,8 +59,7 @@ static inline PyObject* EdsLib_Python_InstantiateModule(void)
#endif
-
-PyObject* EdsLib_Python_CreateModule(void)
+PyObject *EdsLib_Python_CreateModule(void)
{
PyObject *m = NULL;
@@ -73,20 +68,16 @@ PyObject* EdsLib_Python_CreateModule(void)
/*
* Prepare all of the types defined here
*/
- if (PyType_Ready(&EdsLib_Python_DatabaseType) != 0 ||
- PyType_Ready(&EdsLib_Python_DatabaseEntryType) != 0 ||
- PyType_Ready(&EdsLib_Python_BufferType) != 0 ||
- PyType_Ready(&EdsLib_Python_AccessorType) != 0 ||
- PyType_Ready(&EdsLib_Python_PackedObjectType) != 0 ||
- PyType_Ready(&EdsLib_Python_ContainerIteratorType) != 0 ||
- PyType_Ready(&EdsLib_Python_EnumEntryIteratorType) != 0 ||
- PyType_Ready(&EdsLib_Python_ContainerEntryIteratorType) != 0 ||
- PyType_Ready(&EdsLib_Python_ObjectBaseType) != 0 ||
- PyType_Ready(&EdsLib_Python_ObjectScalarType) != 0 ||
- PyType_Ready(&EdsLib_Python_ObjectNumberType) != 0 ||
- PyType_Ready(&EdsLib_Python_ObjectContainerType) != 0 ||
- PyType_Ready(&EdsLib_Python_ObjectArrayType) != 0 ||
- PyType_Ready(&EdsLib_Python_DynamicArrayType) != 0)
+ if (PyType_Ready(&EdsLib_Python_DatabaseType) != 0 || PyType_Ready(&EdsLib_Python_DatabaseEntryType) != 0
+ || PyType_Ready(&EdsLib_Python_BufferType) != 0 || PyType_Ready(&EdsLib_Python_AccessorType) != 0
+ || PyType_Ready(&EdsLib_Python_PackedObjectType) != 0
+ || PyType_Ready(&EdsLib_Python_ContainerIteratorType) != 0
+ || PyType_Ready(&EdsLib_Python_EnumEntryIteratorType) != 0
+ || PyType_Ready(&EdsLib_Python_ContainerEntryIteratorType) != 0
+ || PyType_Ready(&EdsLib_Python_ObjectBaseType) != 0 || PyType_Ready(&EdsLib_Python_ObjectScalarType) != 0
+ || PyType_Ready(&EdsLib_Python_ObjectNumberType) != 0
+ || PyType_Ready(&EdsLib_Python_ObjectContainerType) != 0
+ || PyType_Ready(&EdsLib_Python_ObjectArrayType) != 0 || PyType_Ready(&EdsLib_Python_DynamicArrayType) != 0)
{
break;
}
@@ -109,14 +100,12 @@ PyObject* EdsLib_Python_CreateModule(void)
/*
* Add appropriate types so object instances can be constructed
*/
- PyModule_AddObject(m, "Database", (PyObject*)&EdsLib_Python_DatabaseType);
- PyModule_AddObject(m, "DatabaseEntry", (PyObject*)&EdsLib_Python_DatabaseEntryType);
- PyModule_AddObject(m, "PackedObject", (PyObject*)&EdsLib_Python_PackedObjectType);
- PyModule_AddObject(m, "ElementAccessor", (PyObject*)&EdsLib_Python_AccessorType);
- PyModule_AddObject(m, "DynamicArray", (PyObject*)&EdsLib_Python_DynamicArrayType);
- }
- while(0);
+ PyModule_AddObject(m, "Database", (PyObject *)&EdsLib_Python_DatabaseType);
+ PyModule_AddObject(m, "DatabaseEntry", (PyObject *)&EdsLib_Python_DatabaseEntryType);
+ PyModule_AddObject(m, "PackedObject", (PyObject *)&EdsLib_Python_PackedObjectType);
+ PyModule_AddObject(m, "ElementAccessor", (PyObject *)&EdsLib_Python_AccessorType);
+ PyModule_AddObject(m, "DynamicArray", (PyObject *)&EdsLib_Python_DynamicArrayType);
+ } while (0);
return m;
}
-
diff --git a/tool/src/seds_checksum.c b/tool/src/seds_checksum.c
index 1bfe1fd..68fac0d 100644
--- a/tool/src/seds_checksum.c
+++ b/tool/src/seds_checksum.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_checksum.c
* \ingroup tool
@@ -64,7 +63,7 @@
/**
* Polynomial used to initialize the checksum table
*/
-#define SEDS_CHECKSUM_POLY 0x04C11DB70012E321U
+#define SEDS_CHECKSUM_POLY 0x04C11DB70012E321U
/**
* Internal byte-wise checksum table, to speed up calculations
@@ -88,9 +87,9 @@ void seds_checksum_init_table(void)
seds_checksum_t v;
seds_checksum_t mask;
seds_checksum_t result;
- int32_t i, j;
+ int32_t i, j;
- mask = 1;
+ mask = 1;
mask <<= 8 * sizeof(mask) - 1;
/*
* This is a modified / simplified crc-type checksum
@@ -99,9 +98,9 @@ void seds_checksum_init_table(void)
* the table is skewed to place the "no effect" byte at a
* different spot in the table.
*/
- for(i = 0; i < 256; ++i)
+ for (i = 0; i < 256; ++i)
{
- v = i ^ 0x7F;
+ v = i ^ 0x7F;
v <<= 8 * sizeof(v) - 8;
for (j = 0; j < 8; ++j)
{
@@ -118,8 +117,8 @@ void seds_checksum_init_table(void)
result = 0;
for (j = 0; j < (8 * sizeof(v)); ++j)
{
- result = (result << 1) | (v & 1);
- v >>= 1;
+ result = (result << 1) | (v & 1);
+ v >>= 1;
}
SEDS_CHECKSUM_TABLE[i] = result;
@@ -154,14 +153,14 @@ seds_checksum_t seds_update_checksum_numeric(seds_checksum_t sum, uintmax_t loca
while (significant_bits > 0)
{
- sum = (sum >> 8) ^ SEDS_CHECKSUM_TABLE[(sum ^ localvalue) & 0xFF];
+ sum = (sum >> 8) ^ SEDS_CHECKSUM_TABLE[(sum ^ localvalue) & 0xFF];
/*
* In theory the right shift should always insert 0 bits on the left,
* since the argument is unsigned. However, the C spec allows for some
* implementation-defined behavior with right shifts, so....
* Apply a mask to ensure that the leftmost bits are indeed zero.
*/
- localvalue = (localvalue >> 8) & LOCAL_MASK;
+ localvalue = (localvalue >> 8) & LOCAL_MASK;
significant_bits -= 8;
}
@@ -217,4 +216,3 @@ seds_checksum_t seds_update_checksum_int(seds_checksum_t sum, seds_integer_t val
*/
return seds_update_checksum_numeric(sum, value, 64);
}
-
diff --git a/tool/src/seds_checksum.h b/tool/src/seds_checksum.h
index 28c77b5..07ed1e7 100644
--- a/tool/src/seds_checksum.h
+++ b/tool/src/seds_checksum.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_checksum.h
* \ingroup tool
@@ -33,10 +32,8 @@
#ifndef _SEDS_CHECKSUM_H_
#define _SEDS_CHECKSUM_H_
-
#include "seds_global.h"
-
/*******************************************************************************/
/* Macro definitions */
/*******************************************************************************/
@@ -44,8 +41,7 @@
/**
* Initial value to use for checksum calculations
*/
-#define SEDS_CHECKSUM_INITIAL 0x49A42201BE3217D6U
-
+#define SEDS_CHECKSUM_INITIAL 0x49A42201BE3217D6U
/*******************************************************************************/
/* Function documentation and prototypes */
@@ -74,7 +70,8 @@ void seds_checksum_init_table(void);
* @param significant_bits the number of bits in localvalue to consider
* @return updated checksum
*/
-seds_checksum_t seds_update_checksum_numeric(seds_checksum_t sum, uintmax_t localvalue, seds_integer_t significant_bits);
+seds_checksum_t
+seds_update_checksum_numeric(seds_checksum_t sum, uintmax_t localvalue, seds_integer_t significant_bits);
/**
* Update a checksum based on a string value
@@ -106,6 +103,4 @@ seds_checksum_t seds_update_checksum_string(seds_checksum_t sum, const char *cst
*/
seds_checksum_t seds_update_checksum_int(seds_checksum_t sum, seds_integer_t value);
-
-#endif /* _SEDS_CHECKSUM_H_ */
-
+#endif /* _SEDS_CHECKSUM_H_ */
diff --git a/tool/src/seds_generic_props.c b/tool/src/seds_generic_props.c
index 59372e4..5999c52 100644
--- a/tool/src/seds_generic_props.c
+++ b/tool/src/seds_generic_props.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_generic_props.c
* \ingroup tool
@@ -50,8 +49,6 @@ static const char PROPERTY_HISTORY_KEY;
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
-
/* ------------------------------------------------------------------- */
/**
* Lua callable helper function to get the tracking data of a given property name
@@ -129,7 +126,6 @@ static void seds_generic_props_do_tracking(lua_State *lua, const char *action_na
/* (referenced outside this unit and prototyped in a separate header) */
/*******************************************************************************/
-
/*
* ------------------------------------------------------
* External API function - see full details in prototype.
@@ -223,7 +219,6 @@ int seds_generic_props_set_property(lua_State *lua)
seds_generic_props_do_tracking(lua, action_name);
}
-
/*
* Do the actual property value set
*/
@@ -236,7 +231,6 @@ int seds_generic_props_set_property(lua_State *lua)
return 0;
}
-
/*
* ------------------------------------------------------
* External API function - see full details in prototype.
@@ -249,7 +243,7 @@ int seds_generic_props_enumerate_properties(lua_State *lua)
lua_getuservalue(lua, 1);
luaL_checktype(lua, 3, LUA_TTABLE);
lua_pushnil(lua);
- while(lua_next(lua, 3) != 0)
+ while (lua_next(lua, 3) != 0)
{
lua_pushvalue(lua, 4);
lua_rawseti(lua, 2, 1 + lua_rawlen(lua, 2));
diff --git a/tool/src/seds_generic_props.h b/tool/src/seds_generic_props.h
index 963c6fd..295d71a 100644
--- a/tool/src/seds_generic_props.h
+++ b/tool/src/seds_generic_props.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_generic_props.h
* \ingroup tool
@@ -31,7 +30,6 @@
#ifndef _SEDS_GENERIC_PROPS_H_
#define _SEDS_GENERIC_PROPS_H_
-
#include "seds_global.h"
/*******************************************************************************/
@@ -39,7 +37,6 @@
/* (everything referenced outside this unit should be described here) */
/*******************************************************************************/
-
/**
* Lua callable function to get a property of a userdata object
*
@@ -86,12 +83,9 @@ int seds_generic_props_set_property(lua_State *lua);
*/
int seds_generic_props_enumerate_properties(lua_State *lua);
-
/**
* Register any globals associated with this module in the Lua state
*/
void seds_generic_props_register_globals(lua_State *lua);
-
-#endif /* _SEDS_GENERIC_PROPS_H_ */
-
+#endif /* _SEDS_GENERIC_PROPS_H_ */
diff --git a/tool/src/seds_global.h b/tool/src/seds_global.h
index 3eeaa0e..ecf1234 100644
--- a/tool/src/seds_global.h
+++ b/tool/src/seds_global.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_global.h
* \ingroup tool
@@ -38,7 +37,6 @@
#ifndef _SEDS_GLOBAL_H_
#define _SEDS_GLOBAL_H_
-
/* Use C99 standard integer/boolean types. Any viable host/build system must have these headers. */
#include
#include
@@ -61,10 +59,10 @@
* When using GNU C, it can give helpful warnings about mismatched arguments to printf-style calls.
* this macro enables that error checking.
*/
-#if defined (__GNUC__)
-#define SEDS_PRINTF(n,m) __attribute__ ((format (printf, n, m)))
+#if defined(__GNUC__)
+#define SEDS_PRINTF(n, m) __attribute__((format(printf, n, m)))
#else
-#define SEDS_PRINTF(n,m)
+#define SEDS_PRINTF(n, m)
#endif
/**
@@ -83,30 +81,30 @@ typedef uint64_t seds_checksum_t;
/**
* Minimum value for seds_integer_t values
*/
-#define SEDS_INTEGER_MIN INTMAX_MIN
+#define SEDS_INTEGER_MIN INTMAX_MIN
/**
* Maximum value for seds_integer_t values
*/
-#define SEDS_INTEGER_MAX INTMAX_MAX
+#define SEDS_INTEGER_MAX INTMAX_MAX
/** EDS booleans */
-typedef bool seds_boolean_t;
+typedef bool seds_boolean_t;
/** EDS floating-point number values */
-typedef double seds_number_t;
+typedef double seds_number_t;
/**
* Maximum value for seds_number_t values without losing integer precision.
* NOTE - this is not the full range of the data type, but rather a "useful range"
*/
-#define SEDS_NUMBER_MAX ((seds_number_t)((1ULL << DBL_MANT_DIG)))
+#define SEDS_NUMBER_MAX ((seds_number_t)((1ULL << DBL_MANT_DIG)))
/**
* Minimum value for seds_number_t values without losing integer precision.
* NOTE - this is not the full range of the data type, but rather a "useful range"
*/
-#define SEDS_NUMBER_MIN (-SEDS_NUMBER_MAX)
+#define SEDS_NUMBER_MIN (-SEDS_NUMBER_MAX)
/**
* Structure to store the top-level state of the toolchain as a while
@@ -141,11 +139,9 @@ typedef struct
} seds_toplevel_t;
-
/**
* A single global containing the top level state object of the tool.
*/
extern seds_toplevel_t sedstool;
-
-#endif /* _SEDS_GLOBAL_H_ */
+#endif /* _SEDS_GLOBAL_H_ */
diff --git a/tool/src/seds_instance_node.c b/tool/src/seds_instance_node.c
index 8d5473f..51bdc92 100644
--- a/tool/src/seds_instance_node.c
+++ b/tool/src/seds_instance_node.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_instance_node.c
* \ingroup tool
@@ -48,17 +47,13 @@
* This module is loaded when the tree functions are registered.
*/
static const char SEDS_INSTANCE_METHODS_SCRIPT_FILE[] = "seds_instance_methods.lua";
-static const char SEDS_INSTANCE_PROPERTIES_LUA_KEY = '\0';
-
-
+static const char SEDS_INSTANCE_PROPERTIES_LUA_KEY = '\0';
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
-
/* ------------------------------------------------------------------- */
/**
* Helper function to compare two "seds_instance" objects
@@ -81,9 +76,7 @@ static int seds_instance_node_compare(lua_State *lua)
lua_getuservalue(lua, 2);
lua_getfield(lua, 3, "name");
lua_getfield(lua, 4, "name");
- if (lua_isnil(lua, 5) ||
- lua_type(lua, 5) != lua_type(lua, 6) ||
- lua_compare(lua, 5, 6, LUA_OPEQ))
+ if (lua_isnil(lua, 5) || lua_type(lua, 5) != lua_type(lua, 6) || lua_compare(lua, 5, 6, LUA_OPEQ))
{
lua_pop(lua, 2);
lua_getfield(lua, 3, "id");
@@ -156,7 +149,7 @@ static int seds_new_component_instance(lua_State *lua)
seds_node_t *compnode = luaL_checkudata(lua, 1, "seds_node");
seds_node_t *rulenode = luaL_checkudata(lua, 2, "seds_node");
seds_node_t *trigger;
- int instance_pos;
+ int instance_pos;
if (lua_gettop(lua) >= 3)
{
@@ -249,4 +242,3 @@ void seds_instance_node_register_globals(lua_State *lua)
lua_rawsetp(lua, LUA_REGISTRYINDEX, &SEDS_INSTANCE_PROPERTIES_LUA_KEY);
}
-
diff --git a/tool/src/seds_instance_node.h b/tool/src/seds_instance_node.h
index fc58c4e..087ac24 100644
--- a/tool/src/seds_instance_node.h
+++ b/tool/src/seds_instance_node.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_instance_node.h
* \ingroup tool
@@ -38,13 +37,10 @@
/* (everything referenced outside this unit should be described here) */
/*******************************************************************************/
-
/**
* Register the tree functions which are called from Lua
* These are added to a table which is at the top of the stack
*/
void seds_instance_node_register_globals(lua_State *lua);
-
-#endif /* _SEDS_INSTANCE_NODE_H_ */
-
+#endif /* _SEDS_INSTANCE_NODE_H_ */
diff --git a/tool/src/seds_memreq.c b/tool/src/seds_memreq.c
index 42c6c85..f32d48a 100644
--- a/tool/src/seds_memreq.c
+++ b/tool/src/seds_memreq.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_memreq.c
* \ingroup tool
@@ -47,13 +46,11 @@
#include "seds_memreq.h"
-
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
/**
* Lua-callable Helper function to append an element to a container memory requirement
*
@@ -68,7 +65,7 @@
static int seds_memreq_add(lua_State *lua)
{
seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
- seds_memreq_t *padd = luaL_checkudata(lua, 2, "seds_memreq");
+ seds_memreq_t *padd = luaL_checkudata(lua, 2, "seds_memreq");
seds_integer_t start_offset_bytes;
seds_integer_t start_offset_bits;
@@ -97,8 +94,7 @@ static int seds_memreq_add(lua_State *lua)
/* inherit the status of the added element */
psize->packing_status = padd->packing_status;
}
- else if (padd->packing_status != SEDS_BYTEPACK_STATUS_UNDEFINED &&
- psize->packing_status != padd->packing_status)
+ else if (padd->packing_status != SEDS_BYTEPACK_STATUS_UNDEFINED && psize->packing_status != padd->packing_status)
{
psize->packing_status = SEDS_BYTEPACK_STATUS_OTHER;
}
@@ -108,16 +104,16 @@ static int seds_memreq_add(lua_State *lua)
psize->is_variable_size = true;
}
- start_offset_bits = psize->raw_bit_size;
- start_offset_bytes = (psize->endpoint_bytes + padd->local_align_mask) & ~padd->local_align_mask;
+ start_offset_bits = psize->raw_bit_size;
+ start_offset_bytes = (psize->endpoint_bytes + padd->local_align_mask) & ~padd->local_align_mask;
psize->endpoint_bytes = start_offset_bytes + padd->local_storage_bytes;
if (psize->local_align_mask < padd->local_align_mask)
{
psize->local_align_mask = padd->local_align_mask;
}
- psize->raw_bit_size += padd->raw_bit_size;
- psize->local_storage_bytes = (psize->endpoint_bytes + psize->local_align_mask) & ~psize->local_align_mask;
+ psize->raw_bit_size += padd->raw_bit_size;
+ psize->local_storage_bytes = (psize->endpoint_bytes + psize->local_align_mask) & ~psize->local_align_mask;
psize->checksum = seds_update_checksum_int(psize->checksum, psize->raw_bit_size);
psize->checksum = seds_update_checksum_int(psize->checksum, padd->checksum);
@@ -136,7 +132,7 @@ static int seds_memreq_add(lua_State *lua)
static int seds_memreq_union(lua_State *lua)
{
seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
- seds_memreq_t *padd = luaL_checkudata(lua, 2, "seds_memreq");
+ seds_memreq_t *padd = luaL_checkudata(lua, 2, "seds_memreq");
luaL_argcheck(lua, psize != NULL, 1, "memreq argument expected");
luaL_argcheck(lua, padd != NULL, 2, "memreq argument expected");
@@ -150,12 +146,12 @@ static int seds_memreq_union(lua_State *lua)
if (padd->raw_bit_size > psize->raw_bit_size)
{
- psize->raw_bit_size = padd->raw_bit_size;
+ psize->raw_bit_size = padd->raw_bit_size;
psize->is_variable_size = padd->is_variable_size;
}
- psize->packing_status = SEDS_BYTEPACK_STATUS_OTHER;
- psize->checksum ^= padd->checksum;
+ psize->packing_status = SEDS_BYTEPACK_STATUS_OTHER;
+ psize->checksum ^= padd->checksum;
return 0;
}
@@ -167,9 +163,9 @@ static int seds_memreq_union(lua_State *lua)
*/
static int seds_memreq_multiply(lua_State *lua)
{
- seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
+ seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
seds_integer_t multiplier = luaL_checkinteger(lua, 2);
- seds_boolean_t byte_pack = lua_toboolean(lua, 3);
+ seds_boolean_t byte_pack = lua_toboolean(lua, 3);
if (psize->raw_bit_size == 0)
{
@@ -210,24 +206,24 @@ static int seds_memreq_flavor(lua_State *lua)
switch (lua_type(lua, 2))
{
- case LUA_TSTRING:
- psize->checksum += 2;
- psize->checksum = seds_update_checksum_string(psize->checksum, lua_tostring(lua, 2));
- break;
- case LUA_TNUMBER:
- psize->checksum += 3;
- psize->checksum = seds_update_checksum_int(psize->checksum, lua_tointeger(lua, 2));
- break;
- case LUA_TBOOLEAN:
- psize->checksum += 4;
- psize->checksum = seds_update_checksum_int(psize->checksum, lua_toboolean(lua, 2));
- break;
- default:
- /*
- * Causes every pass through this routine to modify the checksum in some way
- */
- ++psize->checksum;
- break;
+ case LUA_TSTRING:
+ psize->checksum += 2;
+ psize->checksum = seds_update_checksum_string(psize->checksum, lua_tostring(lua, 2));
+ break;
+ case LUA_TNUMBER:
+ psize->checksum += 3;
+ psize->checksum = seds_update_checksum_int(psize->checksum, lua_tointeger(lua, 2));
+ break;
+ case LUA_TBOOLEAN:
+ psize->checksum += 4;
+ psize->checksum = seds_update_checksum_int(psize->checksum, lua_toboolean(lua, 2));
+ break;
+ default:
+ /*
+ * Causes every pass through this routine to modify the checksum in some way
+ */
+ ++psize->checksum;
+ break;
}
return 0;
@@ -241,7 +237,7 @@ static int seds_memreq_flavor(lua_State *lua)
*/
static int seds_memreq_setpack(lua_State *lua)
{
- seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
+ seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
seds_bytepack_status_t packstat;
if (lua_isnoneornil(lua, 2))
@@ -267,18 +263,16 @@ static int seds_memreq_setpack(lua_State *lua)
/* if packing status was already set _differently_ then
* set it to OTHER (for mixed values) */
- if (psize->packing_status != SEDS_BYTEPACK_STATUS_UNDEFINED &&
- packstat != SEDS_BYTEPACK_STATUS_UNDEFINED &&
- psize->packing_status != packstat)
+ if (psize->packing_status != SEDS_BYTEPACK_STATUS_UNDEFINED && packstat != SEDS_BYTEPACK_STATUS_UNDEFINED
+ && psize->packing_status != packstat)
{
packstat = SEDS_BYTEPACK_STATUS_OTHER;
}
- if (packstat != SEDS_BYTEPACK_STATUS_UNDEFINED &&
- psize->packing_status != packstat)
+ if (packstat != SEDS_BYTEPACK_STATUS_UNDEFINED && psize->packing_status != packstat)
{
psize->packing_status = packstat;
- psize->checksum = seds_update_checksum_int(psize->checksum, 100 + packstat);
+ psize->checksum = seds_update_checksum_int(psize->checksum, 100 + packstat);
}
return 0;
@@ -305,11 +299,11 @@ static int seds_memreq_setvariable(lua_State *lua)
*/
static int seds_memreq_pad(lua_State *lua)
{
- seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
+ seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
seds_integer_t pad_bits = luaL_checkinteger(lua, 2);
- psize->checksum += 5;
- psize->checksum = seds_update_checksum_int(psize->checksum, pad_bits);
+ psize->checksum += 5;
+ psize->checksum = seds_update_checksum_int(psize->checksum, pad_bits);
psize->raw_bit_size += pad_bits;
/*
@@ -393,7 +387,7 @@ static int seds_memreq_get_property(lua_State *lua)
* Therefore the checksums are returned as a hex string
*/
char stringbuf[20];
- snprintf(stringbuf,sizeof(stringbuf),"%016lx", (unsigned long)psize->checksum);
+ snprintf(stringbuf, sizeof(stringbuf), "%016lx", (unsigned long)psize->checksum);
lua_pushstring(lua, stringbuf);
return 1;
}
@@ -454,14 +448,16 @@ static int seds_memreq_get_property(lua_State *lua)
static int seds_memreq_to_string(lua_State *lua)
{
seds_memreq_t *psize = luaL_checkudata(lua, 1, "seds_memreq");
- char stringbuf[128];
+ char stringbuf[128];
- snprintf(stringbuf, sizeof(stringbuf), "bits=%4ld bytes=%4ld/%-4ld align=0x%lx checksum=%016llx",
- (long)psize->raw_bit_size,
- (long)psize->endpoint_bytes,
- (long)psize->local_storage_bytes,
- (unsigned long)psize->local_align_mask,
- (unsigned long long)psize->checksum);
+ snprintf(stringbuf,
+ sizeof(stringbuf),
+ "bits=%4ld bytes=%4ld/%-4ld align=0x%lx checksum=%016llx",
+ (long)psize->raw_bit_size,
+ (long)psize->endpoint_bytes,
+ (long)psize->local_storage_bytes,
+ (unsigned long)psize->local_align_mask,
+ (unsigned long long)psize->checksum);
lua_pushstring(lua, stringbuf);
return 1;
@@ -496,7 +492,7 @@ int seds_memreq_new_object(lua_State *lua)
if (lua_isnumber(lua, 1))
{
- psize->raw_bit_size = lua_tointeger(lua, 1);
+ psize->raw_bit_size = lua_tointeger(lua, 1);
psize->endpoint_bytes = (psize->raw_bit_size + 7) / 8;
if (lua_isnumber(lua, 2))
@@ -523,8 +519,7 @@ int seds_memreq_new_object(lua_State *lua)
* Calculate the initial alignment mask and storage based on the supplied size
*/
psize->local_align_mask = 1;
- while (psize->local_align_mask < 16 &&
- psize->local_align_mask < psize->endpoint_bytes)
+ while (psize->local_align_mask < 16 && psize->local_align_mask < psize->endpoint_bytes)
{
psize->local_align_mask <<= 1;
}
@@ -532,7 +527,7 @@ int seds_memreq_new_object(lua_State *lua)
}
psize->local_storage_bytes = (psize->endpoint_bytes + psize->local_align_mask) & ~psize->local_align_mask;
- psize->checksum = seds_update_checksum_int(psize->checksum, psize->raw_bit_size);
+ psize->checksum = seds_update_checksum_int(psize->checksum, psize->raw_bit_size);
}
else if (lua_isuserdata(lua, 1))
{
@@ -563,8 +558,8 @@ int seds_memreq_new_object(lua_State *lua)
unsigned int seds_get_binary_digits(double limit, bool twos_complement)
{
unsigned int digits;
- double val;
- int exp;
+ double val;
+ int exp;
val = frexp(fabs(limit), &exp);
if (isinf(val))
@@ -577,12 +572,12 @@ unsigned int seds_get_binary_digits(double limit, bool twos_complement)
digits = exp;
/*
- * Because numbers are internally "double" values in Lua,
- * anything above ~52 bits may result in an extra
- * digit due to rounding up. This adds a "slop factor"
- * to avoid triggering false errors (the cost is that
- * this might not flag a borderline case that is an error)
- */
+ * Because numbers are internally "double" values in Lua,
+ * anything above ~52 bits may result in an extra
+ * digit due to rounding up. This adds a "slop factor"
+ * to avoid triggering false errors (the cost is that
+ * this might not flag a borderline case that is an error)
+ */
if (digits > 52 && val < 0.55)
{
--digits;
@@ -590,7 +585,7 @@ unsigned int seds_get_binary_digits(double limit, bool twos_complement)
else if (twos_complement && val == 0.5 && limit < 0.0)
{
/* special handling for twos complement, has one extra
- * value of range on the negative side */
+ * value of range on the negative side */
--digits;
}
}
@@ -619,7 +614,7 @@ int seds_calulate_range_digits(lua_State *lua)
double min = lua_tonumber(lua, 2);
double posdig;
double negdig;
- bool twos_complement;
+ bool twos_complement;
if (lua_type(lua, 3) == LUA_TSTRING)
{
diff --git a/tool/src/seds_memreq.h b/tool/src/seds_memreq.h
index 120993a..22ff73a 100644
--- a/tool/src/seds_memreq.h
+++ b/tool/src/seds_memreq.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_memreq.h
* \ingroup tool
@@ -31,7 +30,6 @@
#ifndef _SEDS_MEMREQ_H_
#define _SEDS_MEMREQ_H_
-
#include "seds_global.h"
#include "seds_checksum.h"
@@ -74,7 +72,6 @@ typedef enum
SEDS_BYTEPACK_STATUS_OTHER
} seds_bytepack_status_t;
-
/**
* Structure that tracks the size of EDS-defined objects
*
@@ -83,16 +80,16 @@ typedef enum
*/
typedef struct
{
- seds_integer_t raw_bit_size; /**< Total bits consumed by the object */
- seds_integer_t endpoint_bytes; /**< Byte offset of the end of the object */
- seds_integer_t local_storage_bytes; /**< Total byte storage required (may include padding) */
- seds_integer_t local_align_mask; /**< Expected alignment requirements based on typical alignment rules */
- seds_bytepack_status_t packing_status; /**< If the structure is packed efficiently, this allows for some added optimizations */
- seds_checksum_t checksum; /**< Checksum/Hash value for the data type definition */
- seds_boolean_t is_variable_size; /**< Set true if the size is not a fixed quantity of bits */
+ seds_integer_t raw_bit_size; /**< Total bits consumed by the object */
+ seds_integer_t endpoint_bytes; /**< Byte offset of the end of the object */
+ seds_integer_t local_storage_bytes; /**< Total byte storage required (may include padding) */
+ seds_integer_t local_align_mask; /**< Expected alignment requirements based on typical alignment rules */
+ seds_bytepack_status_t
+ packing_status; /**< If the structure is packed efficiently, this allows for some added optimizations */
+ seds_checksum_t checksum; /**< Checksum/Hash value for the data type definition */
+ seds_boolean_t is_variable_size; /**< Set true if the size is not a fixed quantity of bits */
} seds_memreq_t;
-
/*******************************************************************************/
/* Function documentation and prototypes */
/* (everything referenced outside this unit should be described here) */
@@ -104,5 +101,4 @@ typedef struct
*/
void seds_memreq_register_globals(lua_State *lua);
-
-#endif /* _SEDS_MEMREQ_H_ */
+#endif /* _SEDS_MEMREQ_H_ */
diff --git a/tool/src/seds_outputfile.c b/tool/src/seds_outputfile.c
index 5323b32..f9a998b 100644
--- a/tool/src/seds_outputfile.c
+++ b/tool/src/seds_outputfile.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_outputfile.c
* \ingroup tool
@@ -35,7 +34,6 @@
* - Indentation rules
*/
-
#include
#include
#include
@@ -54,26 +52,26 @@
#include "seds_user_message.h"
#include "seds_outputfile.h"
-static const char SEDS_CDECL_OUTPUT_DEFAULT_LINE_ENDING[] = "\n";
+static const char SEDS_CDECL_OUTPUT_DEFAULT_LINE_ENDING[] = "\n";
/**
* Output file record which maps to a Lua userdata filehandle object
*/
typedef struct
{
- FILE *outfp;
- const char *static_line_ending;
- const char *comment_start;
- const char *comment_docstart;
- const char *comment_multiline;
- const char *comment_end;
- long content_start;
- long content_end;
+ FILE *outfp;
+ const char *static_line_ending;
+ const char *comment_start;
+ const char *comment_docstart;
+ const char *comment_multiline;
+ const char *comment_end;
+ long content_start;
+ long content_end;
seds_integer_t indent_depth;
- char output_file_name[256];
- char output_buffer[512];
- char cheader_guard_string[128];
- char user_line_ending[4];
+ char output_file_name[256];
+ char output_buffer[512];
+ char cheader_guard_string[128];
+ char user_line_ending[4];
} seds_output_file_t;
/*******************************************************************************/
@@ -81,7 +79,6 @@ typedef struct
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
/* ------------------------------------------------------------------- */
/**
* Write all pending output to the file.
@@ -96,7 +93,7 @@ void seds_output_file_flush(seds_output_file_t *pfile)
{
if (pfile->indent_depth > 0)
{
- fprintf(pfile->outfp,"%*s", (int)pfile->indent_depth * 3, "");
+ fprintf(pfile->outfp, "%*s", (int)pfile->indent_depth * 3, "");
}
fprintf(pfile->outfp, "%s%s%s", pfile->output_buffer, pfile->user_line_ending, pfile->static_line_ending);
@@ -105,7 +102,6 @@ void seds_output_file_flush(seds_output_file_t *pfile)
pfile->user_line_ending[0] = 0;
}
-
/* ------------------------------------------------------------------- */
/**
* Add whitespace into the output file.
@@ -121,13 +117,12 @@ void seds_output_file_add_whitespace(seds_output_file_t *pfile, seds_integer_t n
{
while (nlines > 0)
{
- fprintf(pfile->outfp,"%s",pfile->static_line_ending);
+ fprintf(pfile->outfp, "%s", pfile->static_line_ending);
--nlines;
}
}
}
-
/* ------------------------------------------------------------------- */
/**
* Modify the line ending of the previously written line
@@ -154,7 +149,6 @@ void seds_output_file_append_previous(seds_output_file_t *pfile, const char *str
pfile->user_line_ending[sizeof(pfile->user_line_ending) - 1] = 0;
}
-
/* ------------------------------------------------------------------- */
/**
* Writes a the line into the output file
@@ -164,7 +158,7 @@ void seds_output_file_append_previous(seds_output_file_t *pfile, const char *str
void seds_output_file_write_line(seds_output_file_t *pfile, const char *format, ...)
{
va_list va;
- int outsz;
+ int outsz;
/* Output any current buffer contents to the actual file */
seds_output_file_flush(pfile);
@@ -179,14 +173,13 @@ void seds_output_file_write_line(seds_output_file_t *pfile, const char *format,
}
/* trim trailing whitespace (including any newlines, which will be replaced with the preferred newline sequence) */
- while(outsz > 0 && isspace((int)pfile->output_buffer[outsz - 1]))
+ while (outsz > 0 && isspace((int)pfile->output_buffer[outsz - 1]))
{
--outsz;
}
pfile->output_buffer[outsz] = 0;
}
-
/* ------------------------------------------------------------------- */
/**
* Open an indented output group
@@ -210,7 +203,6 @@ void seds_output_file_start_indent_group(seds_output_file_t *pfile, const char *
++pfile->indent_depth;
}
-
/* ------------------------------------------------------------------- */
/**
* Close an indented output group
@@ -234,7 +226,6 @@ void seds_output_file_end_indent_group(seds_output_file_t *pfile, const char *st
}
}
-
/* ------------------------------------------------------------------- */
/**
* Add a banner style comment to an output file
@@ -258,12 +249,19 @@ void seds_output_file_section_marker(seds_output_file_t *pfile, const char *sect
seds_output_file_write_line(pfile, "%s", pfile->comment_start);
}
- seds_output_file_write_line(pfile, "%s ******************************************************************************",
- pfile->comment_multiline);
- seds_output_file_write_line(pfile, "%s ** %*s%*s **",
- pfile->comment_multiline,72 - padlen, section_name, padlen, "");
- seds_output_file_write_line(pfile, "%s ******************************************************************************",
- pfile->comment_multiline);
+ seds_output_file_write_line(pfile,
+ "%s ******************************************************************************",
+ pfile->comment_multiline);
+ seds_output_file_write_line(pfile,
+ "%s ** %*s%*s **",
+ pfile->comment_multiline,
+ 72 - padlen,
+ section_name,
+ padlen,
+ "");
+ seds_output_file_write_line(pfile,
+ "%s ******************************************************************************",
+ pfile->comment_multiline);
if (pfile->comment_end)
{
@@ -273,7 +271,6 @@ void seds_output_file_section_marker(seds_output_file_t *pfile, const char *sect
seds_output_file_add_whitespace(pfile, 1);
}
-
/* ------------------------------------------------------------------- */
/**
* Add a documentation style comment to an output file
@@ -282,12 +279,15 @@ void seds_output_file_section_marker(seds_output_file_t *pfile, const char *sect
* particular item in the file. The intent is to be compatible with the "doxygen"
* tool for C code, but other languages could be implemented as well.
*/
-void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shortdesc, const char *longdesc, seds_boolean_t delim)
+void seds_output_file_write_doxytags(seds_output_file_t *pfile,
+ const char *shortdesc,
+ const char *longdesc,
+ seds_boolean_t delim)
{
- char linebuffer[120];
- const char *end;
+ char linebuffer[120];
+ const char *end;
seds_boolean_t shortdesc_present;
- size_t sz;
+ size_t sz;
seds_output_file_flush(pfile);
@@ -297,14 +297,12 @@ void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shor
{
/* add opening delimiter, if indicated */
seds_output_file_add_whitespace(pfile, 1);
- seds_output_file_write_line(pfile, "%s",
- pfile->comment_docstart);
+ seds_output_file_write_line(pfile, "%s", pfile->comment_docstart);
}
if (shortdesc != NULL && *shortdesc != 0 && pfile->comment_multiline != NULL)
{
- seds_output_file_write_line(pfile, "%s@brief %s",
- pfile->comment_multiline, shortdesc);
+ seds_output_file_write_line(pfile, "%s@brief %s", pfile->comment_multiline, shortdesc);
shortdesc_present = true;
}
else
@@ -317,11 +315,10 @@ void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shor
/* if both long and short descriptions are present, add a line between them */
if (shortdesc_present)
{
- seds_output_file_write_line(pfile, "%s",
- pfile->comment_multiline);
+ seds_output_file_write_line(pfile, "%s", pfile->comment_multiline);
}
- sz = 0;
+ sz = 0;
end = longdesc;
while (*end != 0)
{
@@ -335,7 +332,8 @@ void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shor
if (sz >= (sizeof(linebuffer) - 1))
{
/* Back up to a whitespace or punctuation character, if possible */
- while (sz > (sizeof(linebuffer) / 2) && !ispunct(linebuffer[sz-1]) && !isspace(linebuffer[sz-1]))
+ while (sz > (sizeof(linebuffer) / 2) && !ispunct(linebuffer[sz - 1])
+ && !isspace(linebuffer[sz - 1]))
{
--end;
--sz;
@@ -356,13 +354,16 @@ void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shor
++end;
}
/* Trim trailing whitespace */
- while (sz > 0 && isspace(linebuffer[sz-1]))
+ while (sz > 0 && isspace(linebuffer[sz - 1]))
{
--sz;
}
linebuffer[sz] = 0;
- seds_output_file_write_line(pfile,"%s%s%s",
- pfile->comment_multiline, linebuffer, pfile->static_line_ending);
+ seds_output_file_write_line(pfile,
+ "%s%s%s",
+ pfile->comment_multiline,
+ linebuffer,
+ pfile->static_line_ending);
sz = 0;
}
}
@@ -370,15 +371,13 @@ void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shor
if (delim && pfile->comment_end != NULL)
{
/* add closing delimiter, if indicated */
- seds_output_file_write_line(pfile,"%s",
- pfile->comment_end);
+ seds_output_file_write_line(pfile, "%s", pfile->comment_end);
}
}
seds_output_file_flush(pfile);
}
-
/* ------------------------------------------------------------------- */
/**
* Compare a generated output file with a previously-existing copy of the same file.
@@ -399,15 +398,14 @@ void seds_output_file_write_doxytags(seds_output_file_t *pfile, const char *shor
*/
static seds_boolean_t seds_verify_final_file(seds_output_file_t *pfile)
{
- FILE *refp;
- char refline[sizeof(pfile->output_buffer)];
- size_t linelen;
- size_t endlen;
- long ref_start;
- long ref_end;
+ FILE *refp;
+ char refline[sizeof(pfile->output_buffer)];
+ size_t linelen;
+ size_t endlen;
+ long ref_start;
+ long ref_end;
seds_boolean_t result_match;
-
/*
* Now re-read the existing file, if any, to see if it is substantively identical
* i.e. consider it identical if only the initial header comments differ.
@@ -429,7 +427,7 @@ static seds_boolean_t seds_verify_final_file(seds_output_file_t *pfile)
}
result_match = true;
- endlen = strlen(pfile->static_line_ending);
+ endlen = strlen(pfile->static_line_ending);
if (pfile->comment_multiline == NULL)
{
@@ -451,15 +449,14 @@ static seds_boolean_t seds_verify_final_file(seds_output_file_t *pfile)
/* content should be identical. Note that comparing 1+linelen chars
* includes the terminating NUL char, so if one line is longer than the
* other one then this check will fail. */
- if (fgets(pfile->output_buffer, sizeof(pfile->output_buffer), pfile->outfp) == NULL ||
- memcmp(pfile->output_buffer, refline, 1 + linelen) != 0)
+ if (fgets(pfile->output_buffer, sizeof(pfile->output_buffer), pfile->outfp) == NULL
+ || memcmp(pfile->output_buffer, refline, 1 + linelen) != 0)
{
result_match = false;
break;
}
}
- else if (linelen < endlen ||
- memcmp(&refline[linelen - endlen], pfile->static_line_ending, endlen) != 0)
+ else if (linelen < endlen || memcmp(&refline[linelen - endlen], pfile->static_line_ending, endlen) != 0)
{
result_match = false;
break;
@@ -474,7 +471,7 @@ static seds_boolean_t seds_verify_final_file(seds_output_file_t *pfile)
if (result_match)
{
- ref_end = ftell(refp);
+ ref_end = ftell(refp);
result_match = ((ref_end - ref_start) == (pfile->content_end - pfile->content_start));
}
@@ -483,7 +480,6 @@ static seds_boolean_t seds_verify_final_file(seds_output_file_t *pfile)
return result_match;
}
-
/* ------------------------------------------------------------------- */
/**
* Close an output file.
@@ -492,7 +488,7 @@ static seds_boolean_t seds_verify_final_file(seds_output_file_t *pfile)
*/
void seds_output_file_close(seds_output_file_t *pfile)
{
- char namebuf[sizeof(pfile->output_file_name) + 4];
+ char namebuf[sizeof(pfile->output_file_name) + 4];
seds_boolean_t result_match;
if (pfile->outfp != NULL)
@@ -503,8 +499,11 @@ void seds_output_file_close(seds_output_file_t *pfile)
if (pfile->cheader_guard_string[0] != 0)
{
seds_output_file_add_whitespace(pfile, 1);
- seds_output_file_write_line(pfile, "#endif %s _%s_ %s",
- pfile->comment_start, pfile->cheader_guard_string, pfile->comment_end);
+ seds_output_file_write_line(pfile,
+ "#endif %s _%s_ %s",
+ pfile->comment_start,
+ pfile->cheader_guard_string,
+ pfile->comment_end);
pfile->cheader_guard_string[0] = 0;
}
@@ -512,11 +511,11 @@ void seds_output_file_close(seds_output_file_t *pfile)
seds_output_file_flush(pfile);
fflush(pfile->outfp);
pfile->content_end = ftell(pfile->outfp);
- result_match = seds_verify_final_file(pfile);
+ result_match = seds_verify_final_file(pfile);
fclose(pfile->outfp);
pfile->outfp = NULL;
- snprintf(namebuf,sizeof(namebuf),"%s.tmp",pfile->output_file_name);
+ snprintf(namebuf, sizeof(namebuf), "%s.tmp", pfile->output_file_name);
if (result_match)
{
/*
@@ -530,12 +529,11 @@ void seds_output_file_close(seds_output_file_t *pfile)
else
{
/* result file was different, so rename the new one overwriting the old one */
- rename(namebuf,pfile->output_file_name);
+ rename(namebuf, pfile->output_file_name);
}
}
}
-
/* ------------------------------------------------------------------- */
/**
* Open an output file.
@@ -545,9 +543,13 @@ void seds_output_file_close(seds_output_file_t *pfile)
* It actually opens a temporary file with a different name first. Once the file
* is closed, it will replace the existing copy, making the change atomic.
*/
-void seds_output_file_open(seds_output_file_t *pfile, const char *basedir, const char *subdir, const char *destfile, const char *sourcefile)
+void seds_output_file_open(seds_output_file_t *pfile,
+ const char *basedir,
+ const char *subdir,
+ const char *destfile,
+ const char *sourcefile)
{
- char namebuf[sizeof(pfile->output_file_name) + 4];
+ char namebuf[sizeof(pfile->output_file_name) + 4];
time_t nowtime;
seds_output_file_close(pfile);
@@ -561,14 +563,14 @@ void seds_output_file_open(seds_output_file_t *pfile, const char *basedir, const
SEDS_REPORT_ERRNO(FATAL, basedir);
}
- snprintf(namebuf,sizeof(namebuf),"%s/%s",basedir,subdir);
+ snprintf(namebuf, sizeof(namebuf), "%s/%s", basedir, subdir);
if (mkdir(namebuf, 0755) < 0 && errno != EEXIST)
{
SEDS_REPORT_ERRNO(FATAL, namebuf);
}
- snprintf(pfile->output_file_name,sizeof(pfile->output_file_name),"%s/%s/%s",basedir,subdir,destfile);
- snprintf(namebuf,sizeof(namebuf),"%s.tmp",pfile->output_file_name);
+ snprintf(pfile->output_file_name, sizeof(pfile->output_file_name), "%s/%s/%s", basedir, subdir, destfile);
+ snprintf(namebuf, sizeof(namebuf), "%s.tmp", pfile->output_file_name);
pfile->outfp = fopen(namebuf, "w+");
SEDS_ASSERT_ERRNO(pfile->outfp != NULL, namebuf);
@@ -579,8 +581,9 @@ void seds_output_file_open(seds_output_file_t *pfile, const char *basedir, const
seds_output_file_write_line(pfile, "%s", pfile->comment_start);
}
- seds_output_file_write_line(pfile, "%s NOTE -- THIS IS A GENERATED FILE -- DO NOT EDIT",
- pfile->comment_multiline);
+ seds_output_file_write_line(pfile,
+ "%s NOTE -- THIS IS A GENERATED FILE -- DO NOT EDIT",
+ pfile->comment_multiline);
seds_output_file_write_line(pfile, "%s", pfile->comment_multiline);
if (sourcefile != NULL && *sourcefile != 0)
{
@@ -588,7 +591,11 @@ void seds_output_file_open(seds_output_file_t *pfile, const char *basedir, const
}
seds_output_file_write_line(pfile, "%s %16s: %s", pfile->comment_multiline, "Output File", destfile);
nowtime = time(NULL);
- seds_output_file_write_line(pfile, "%s %16s: %s", pfile->comment_multiline, "Generation Time", ctime(&nowtime)); /* note - ctime adds '\n' */
+ seds_output_file_write_line(pfile,
+ "%s %16s: %s",
+ pfile->comment_multiline,
+ "Generation Time",
+ ctime(&nowtime)); /* note - ctime adds '\n' */
if (pfile->comment_end)
{
@@ -610,8 +617,8 @@ void seds_output_file_open(seds_output_file_t *pfile, const char *basedir, const
*/
if (pfile->cheader_guard_string[0] != 0)
{
- seds_output_file_write_line(pfile,"#ifndef _%s_", pfile->cheader_guard_string);
- seds_output_file_write_line(pfile,"#define _%s_", pfile->cheader_guard_string);
+ seds_output_file_write_line(pfile, "#ifndef _%s_", pfile->cheader_guard_string);
+ seds_output_file_write_line(pfile, "#define _%s_", pfile->cheader_guard_string);
seds_output_file_add_whitespace(pfile, 1);
}
}
@@ -692,7 +699,10 @@ static int seds_lua_output_file_section_marker(lua_State *lua)
*/
static int seds_lua_output_documentation(lua_State *lua)
{
- seds_output_file_write_doxytags(luaL_checkudata(lua, 1, "seds_output_file"), luaL_optstring(lua, 2, NULL), luaL_optstring(lua, 3, NULL), true);
+ seds_output_file_write_doxytags(luaL_checkudata(lua, 1, "seds_output_file"),
+ luaL_optstring(lua, 2, NULL),
+ luaL_optstring(lua, 3, NULL),
+ true);
return 0;
}
@@ -795,12 +805,12 @@ static int seds_lua_output_file_set_method(lua_State *lua)
*
* Attempts to call SEDS.get_define() with the given varname, and leaves
* the result on the top of the stack. This adjust the stack such that
- * one (and only one) item is added, and it is either the result from
+ * one (and only one) item is added, and it is either the result from
* get_define or the fallback string.
*
*/
static void seds_get_define_safe(lua_State *lua, const char *varname, const char *fallback)
-{
+{
int stack_top = lua_gettop(lua);
lua_getglobal(lua, "SEDS");
@@ -844,12 +854,12 @@ static void seds_get_define_safe(lua_State *lua, const char *varname, const char
*/
static int seds_lua_output_file_open(lua_State *lua)
{
- const char *destfile = luaL_checkstring(lua, 1);
- const char *sourcefile = luaL_optstring(lua, 2, NULL);
- const char *outlang = luaL_optstring(lua, 3, NULL);
- const char *subdir = ".";
- seds_output_file_t *pfile = lua_newuserdata(lua, sizeof(seds_output_file_t));
- int stack_top = lua_gettop(lua);
+ const char *destfile = luaL_checkstring(lua, 1);
+ const char *sourcefile = luaL_optstring(lua, 2, NULL);
+ const char *outlang = luaL_optstring(lua, 3, NULL);
+ const char *subdir = ".";
+ seds_output_file_t *pfile = lua_newuserdata(lua, sizeof(seds_output_file_t));
+ int stack_top = lua_gettop(lua);
memset(pfile, 0, sizeof(*pfile));
if (luaL_newmetatable(lua, "seds_output_file"))
@@ -897,14 +907,12 @@ static int seds_lua_output_file_open(lua_State *lua)
* this also sets up for a preprocessor guard macro around the whole file
* (only if the filename ends in .h)
*/
- if (strcasecmp(outlang, "c") == 0 ||
- strcasecmp(outlang, "h") == 0 ||
- strcasecmp(outlang, "cpp") == 0 ||
- strcasecmp(outlang, "hpp") == 0)
+ if (strcasecmp(outlang, "c") == 0 || strcasecmp(outlang, "h") == 0 || strcasecmp(outlang, "cpp") == 0
+ || strcasecmp(outlang, "hpp") == 0)
{
- size_t sz = strlen(destfile);
+ size_t sz = strlen(destfile);
const char *inp = destfile + sz;
- char *outp;
+ char *outp;
while (sz > 0)
{
@@ -930,9 +938,9 @@ static int seds_lua_output_file_open(lua_State *lua)
pfile->cheader_guard_string[sizeof(pfile->cheader_guard_string) - 1] = 0;
lua_pop(lua, 1);
- inp = destfile;
- outp = pfile->cheader_guard_string;
- sz = strlen(pfile->cheader_guard_string);
+ inp = destfile;
+ outp = pfile->cheader_guard_string;
+ sz = strlen(pfile->cheader_guard_string);
outp += sz;
while (sz < (sizeof(pfile->cheader_guard_string) - 1) && *inp != 0)
{
@@ -961,49 +969,44 @@ static int seds_lua_output_file_open(lua_State *lua)
/*
* Set up C-style comment blocks
*/
- pfile->comment_start = "/* ";
- pfile->comment_docstart = "/**";
+ pfile->comment_start = "/* ";
+ pfile->comment_docstart = "/**";
pfile->comment_multiline = " * ";
- pfile->comment_end = " */";
+ pfile->comment_end = " */";
}
- else if (strcasecmp(outlang, "make") == 0 ||
- strcasecmp(outlang, "mk") == 0 ||
- strcasecmp(outlang, "shell") == 0 ||
- strcasecmp(outlang, "sh") == 0 ||
- strcasecmp(outlang, "perl") == 0 ||
- strcasecmp(outlang, "pl") == 0 ||
- strcasecmp(outlang, "python") == 0 ||
- strcasecmp(outlang, "py") == 0)
+ else if (strcasecmp(outlang, "make") == 0 || strcasecmp(outlang, "mk") == 0 || strcasecmp(outlang, "shell") == 0
+ || strcasecmp(outlang, "sh") == 0 || strcasecmp(outlang, "perl") == 0 || strcasecmp(outlang, "pl") == 0
+ || strcasecmp(outlang, "python") == 0 || strcasecmp(outlang, "py") == 0)
{
/*
* Set up shell-style comment blocks
* This style is applicable to several interpreted languages,
* including makefiles, perl and python
*/
- pfile->comment_start = "# ";
- pfile->comment_docstart = pfile->comment_start;
+ pfile->comment_start = "# ";
+ pfile->comment_docstart = pfile->comment_start;
pfile->comment_multiline = pfile->comment_start;
- pfile->comment_end = pfile->comment_start;
+ pfile->comment_end = pfile->comment_start;
}
else if (strcasecmp(outlang, "lua") == 0)
{
/*
* Set up lua-style comment blocks
*/
- pfile->comment_start = "-- ";
- pfile->comment_docstart = "---";
+ pfile->comment_start = "-- ";
+ pfile->comment_docstart = "---";
pfile->comment_multiline = pfile->comment_start;
- pfile->comment_end = pfile->comment_start;
+ pfile->comment_end = pfile->comment_start;
}
else if (strcasecmp(outlang, "xml") == 0)
{
/*
* Set up xml-style comment blocks
*/
- pfile->comment_start = "";
+ pfile->comment_end = " -->";
}
lua_rawgetp(lua, LUA_REGISTRYINDEX, &sedstool.GLOBAL_SYMBOL_TABLE_KEY);
@@ -1044,7 +1047,6 @@ static int seds_lua_output_file_mkdir(lua_State *lua)
/* (referenced outside this unit and prototyped in a separate header) */
/*******************************************************************************/
-
void seds_outputfile_register_globals(lua_State *lua)
{
luaL_checktype(lua, -1, LUA_TTABLE);
diff --git a/tool/src/seds_outputfile.h b/tool/src/seds_outputfile.h
index 267e617..13d9880 100644
--- a/tool/src/seds_outputfile.h
+++ b/tool/src/seds_outputfile.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_outputfile.h
* \ingroup tool
@@ -47,5 +46,4 @@
*/
void seds_outputfile_register_globals(lua_State *lua);
-#endif /* _SEDS_OUTPUTFILE_H_ */
-
+#endif /* _SEDS_OUTPUTFILE_H_ */
diff --git a/tool/src/seds_plugin.c b/tool/src/seds_plugin.c
index 19011ca..ad3189a 100644
--- a/tool/src/seds_plugin.c
+++ b/tool/src/seds_plugin.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_plugin.c
* \ingroup tool
@@ -65,11 +64,10 @@
*/
typedef struct
{
- void *dlhandle; /**< actual handle from dlopen() */
+ void *dlhandle; /**< actual handle from dlopen() */
seds_integer_t refcount;
} seds_c_plugin_t;
-
/**
* An object to simplify dynamically loaded symbol lookups
*
@@ -78,8 +76,8 @@ typedef struct
*/
typedef union
{
- void *symaddr; /**< symbol address from dlsym() */
- lua_CFunction lua_func; /**< address as a Lua function */
+ void *symaddr; /**< symbol address from dlsym() */
+ lua_CFunction lua_func; /**< address as a Lua function */
void (*simple_func)(void);
void (*singlearg_func)(void *arg);
void (*dualarg_func)(void *arg1, void *arg2);
@@ -87,16 +85,14 @@ typedef union
/* slight cheat here - default the path to the same place as the C source.
* if not overridden, then this is passed to dirname() to get the default. */
-static char SEDS_DEFAULT_SOURCE_PATH[] = __FILE__;
-static const char SEDS_PLUGIN_TABLE_KEY; /**< Key for Lua registry table containing plugin objects */
+static char SEDS_DEFAULT_SOURCE_PATH[] = __FILE__;
+static const char SEDS_PLUGIN_TABLE_KEY; /**< Key for Lua registry table containing plugin objects */
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
-
/* ------------------------------------------------------------------- */
/**
* Convert a value on the stack into a C pointer object.
@@ -120,36 +116,36 @@ static void *lua_value_to_cptr(lua_State *lua, int narg)
{
union
{
- void *vptr;
- const char *vstr; /* For strings */
- ptrdiff_t vint; /* "ptrdiff_t" should be a signed integer type with the same width as void* */
+ void *vptr;
+ const char *vstr; /* For strings */
+ ptrdiff_t vint; /* "ptrdiff_t" should be a signed integer type with the same width as void* */
} value;
- switch(lua_type(lua,narg))
- {
- case LUA_TBOOLEAN:
- value.vint = lua_toboolean(lua, narg);
- break;
- case LUA_TNUMBER:
- value.vint = lua_tointeger(lua, narg);
- break;
- case LUA_TUSERDATA:
+ switch (lua_type(lua, narg))
{
- EdsLib_LuaBinding_GetNativeObject(lua, narg, &value.vptr, NULL);
- break;
- }
- case LUA_TLIGHTUSERDATA:
- value.vptr = lua_touserdata(lua, narg);
- break;
- case LUA_TSTRING:
- value.vstr = lua_tostring(lua, narg);
- break;
- case LUA_TTABLE:
- case LUA_TNIL:
- case LUA_TFUNCTION:
- default:
- value.vptr = NULL;
- break;
+ case LUA_TBOOLEAN:
+ value.vint = lua_toboolean(lua, narg);
+ break;
+ case LUA_TNUMBER:
+ value.vint = lua_tointeger(lua, narg);
+ break;
+ case LUA_TUSERDATA:
+ {
+ EdsLib_LuaBinding_GetNativeObject(lua, narg, &value.vptr, NULL);
+ break;
+ }
+ case LUA_TLIGHTUSERDATA:
+ value.vptr = lua_touserdata(lua, narg);
+ break;
+ case LUA_TSTRING:
+ value.vstr = lua_tostring(lua, narg);
+ break;
+ case LUA_TTABLE:
+ case LUA_TNIL:
+ case LUA_TFUNCTION:
+ default:
+ value.vptr = NULL;
+ break;
}
return value.vptr;
@@ -178,8 +174,8 @@ static void *lua_value_to_cptr(lua_State *lua, int narg)
*/
static int seds_c_symbol_call(lua_State *lua)
{
- seds_c_symbol_t *c_sym = luaL_checkudata(lua, 1, "c_symbol");
- int stack_top = lua_gettop(lua);
+ seds_c_symbol_t *c_sym = luaL_checkudata(lua, 1, "c_symbol");
+ int stack_top = lua_gettop(lua);
if (stack_top == 1)
{
@@ -191,8 +187,7 @@ static int seds_c_symbol_call(lua_State *lua)
}
else
{
- c_sym->dualarg_func(lua_value_to_cptr(lua, 2),
- lua_value_to_cptr(lua, 3));
+ c_sym->dualarg_func(lua_value_to_cptr(lua, 2), lua_value_to_cptr(lua, 3));
}
return 0;
@@ -231,8 +226,8 @@ static seds_c_symbol_t *seds_new_symbol_obj(lua_State *lua)
static int seds_c_plugin_get_symbol(lua_State *lua)
{
seds_c_plugin_t *plugin = luaL_checkudata(lua, 1, "c_plugin");
- const char *tmpstr;
- void *sym;
+ const char *tmpstr;
+ void *sym;
if (lua_type(lua, 2) != LUA_TSTRING)
{
@@ -240,7 +235,7 @@ static int seds_c_plugin_get_symbol(lua_State *lua)
}
dlerror();
- sym = dlsym(plugin->dlhandle, lua_tostring(lua, 2));
+ sym = dlsym(plugin->dlhandle, lua_tostring(lua, 2));
tmpstr = dlerror();
if (tmpstr != NULL)
{
@@ -258,7 +253,7 @@ static int seds_c_plugin_get_symbol(lua_State *lua)
{
/* Success - return the symbol as a user data */
seds_c_symbol_t *c_sym = seds_new_symbol_obj(lua);
- c_sym->symaddr = sym;
+ c_sym->symaddr = sym;
++plugin->refcount;
}
return 1;
@@ -340,7 +335,6 @@ static int seds_lua_load_plugin_module(lua_State *lua)
/* (referenced outside this unit and prototyped in a separate header) */
/*******************************************************************************/
-
/*
* ------------------------------------------------------
* External API function - see full details in prototype.
@@ -348,14 +342,14 @@ static int seds_lua_load_plugin_module(lua_State *lua)
*/
void seds_plugin_load_so(lua_State *lua, const char *filename)
{
- void *dlhandle;
- const char *tmpstr;
+ void *dlhandle;
+ const char *tmpstr;
seds_c_symbol_t c_sym;
seds_user_message_printf(SEDS_USER_MESSAGE_INFO, NULL, 0, "LOADING PLUGIN: %s", filename);
dlerror();
dlhandle = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
- tmpstr = dlerror();
+ tmpstr = dlerror();
if (dlhandle == NULL && tmpstr == NULL)
{
tmpstr = "Unknown";
@@ -377,7 +371,7 @@ void seds_plugin_load_so(lua_State *lua, const char *filename)
* the value of that symbol as a light user data.
*/
c_sym.symaddr = dlsym(dlhandle, "lua_plugin_init");
- tmpstr = dlerror();
+ tmpstr = dlerror();
if (c_sym.symaddr != NULL && tmpstr == NULL)
{
lua_pushcfunction(lua, c_sym.lua_func);
@@ -386,8 +380,8 @@ void seds_plugin_load_so(lua_State *lua, const char *filename)
else
{
seds_c_plugin_t *plugin = seds_new_plugin_obj(lua);
- plugin->dlhandle = dlhandle;
- plugin->refcount = 0;
+ plugin->dlhandle = dlhandle;
+ plugin->refcount = 0;
}
}
}
@@ -400,15 +394,14 @@ void seds_plugin_load_so(lua_State *lua, const char *filename)
void seds_plugin_load_lua(lua_State *lua, const char *runtime_file)
{
char runtime_file_buffer[512];
- int top_start = lua_gettop(lua);
+ int top_start = lua_gettop(lua);
if (sedstool.user_runtime_path == NULL)
{
sedstool.user_runtime_path = dirname(SEDS_DEFAULT_SOURCE_PATH);
}
- snprintf(runtime_file_buffer, sizeof(runtime_file_buffer), "%s/%s",
- sedstool.user_runtime_path, runtime_file);
+ snprintf(runtime_file_buffer, sizeof(runtime_file_buffer), "%s/%s", sedstool.user_runtime_path, runtime_file);
if (luaL_loadfile(lua, runtime_file_buffer) != LUA_OK)
{
@@ -438,7 +431,7 @@ void seds_plugin_register_globals(lua_State *lua)
*
* This simplifies future symbol lookups.
*/
- mainprog = seds_new_plugin_obj(lua);
+ mainprog = seds_new_plugin_obj(lua);
mainprog->dlhandle = NULL;
lua_pop(lua, 1);
diff --git a/tool/src/seds_plugin.h b/tool/src/seds_plugin.h
index df689c9..3d2d146 100644
--- a/tool/src/seds_plugin.h
+++ b/tool/src/seds_plugin.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_plugin.h
* \ingroup tool
@@ -33,13 +32,11 @@
#include "seds_global.h"
-
/*******************************************************************************/
/* Function documentation and prototypes */
/* (everything referenced outside this unit should be described here) */
/*******************************************************************************/
-
/**
* Load a Lua runtime script plugin from the C source directory.
*
@@ -77,7 +74,4 @@ void seds_plugin_load_so(lua_State *lua, const char *filename);
*/
void seds_plugin_register_globals(lua_State *lua);
-
-
-#endif /* _SEDS_PLUGIN_H_ */
-
+#endif /* _SEDS_PLUGIN_H_ */
diff --git a/tool/src/seds_preprocess.c b/tool/src/seds_preprocess.c
index 074852d..1640803 100644
--- a/tool/src/seds_preprocess.c
+++ b/tool/src/seds_preprocess.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_preprocess.c
* \ingroup tool
@@ -92,7 +91,7 @@ static const char SEDS_PREPROCESS_ENVIRONMENT;
static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
{
seds_boolean_t quoting_required;
- uint32_t token_size;
+ uint32_t token_size;
enum TokenType
{
TOKENTYPE_UNKNOWN,
@@ -100,12 +99,12 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
TOKENTYPE_VALUE,
TOKENTYPE_OPERATOR,
TOKENTYPE_MAX
- } curr_token, prev_token;
-
+ } curr_token,
+ prev_token;
quoting_required = false;
curr_token = prev_token = TOKENTYPE_UNKNOWN;
- token_size = 0;
+ token_size = 0;
while (*p != 0)
{
if (strncasecmp(p, "false", 5) == 0)
@@ -144,8 +143,8 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
token_size = 2;
curr_token = TOKENTYPE_OPERATOR;
}
- else if (strncmp(p, "==", 2) == 0 || strncmp(p, "~=", 2) == 0 ||
- strncmp(p, "<=", 2) == 0 || strncmp(p, ">=", 2) == 0)
+ else if (strncmp(p, "==", 2) == 0 || strncmp(p, "~=", 2) == 0 || strncmp(p, "<=", 2) == 0
+ || strncmp(p, ">=", 2) == 0)
{
/* relational operators */
token_size = 2;
@@ -154,7 +153,8 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
else if (strncmp(p, "${", 2) == 0)
{
token_size = 2;
- while (p[token_size] != '}' && p[token_size] != 0) ++token_size;
+ while (p[token_size] != '}' && p[token_size] != 0)
+ ++token_size;
if (p[token_size] == '}')
{
/* complete reference -- include the terminator itself */
@@ -171,14 +171,16 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
else if (isblank(*p))
{
token_size = 1;
- while (isblank(p[token_size])) ++token_size;
+ while (isblank(p[token_size]))
+ ++token_size;
curr_token = TOKENTYPE_BLANK;
}
else if (strncmp(p, "0x", 2) == 0)
{
/* Hex literals start with 0x and only contain hex digits */
token_size = 2;
- while (isxdigit(p[token_size])) ++token_size;
+ while (isxdigit(p[token_size]))
+ ++token_size;
if (token_size <= 2)
{
/* if not followed by actual hex digits, it is not a valid literal */
@@ -194,7 +196,8 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
{
/* Decimal literals may contain decimal points and/or may be in scientific notation */
token_size = 1;
- while (isdigit(p[token_size]) || p[token_size] == '.') ++token_size;
+ while (isdigit(p[token_size]) || p[token_size] == '.')
+ ++token_size;
if (p[token_size] == 'e')
{
if (isdigit(p[token_size + 1]))
@@ -206,7 +209,8 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
token_size += 3;
}
- while (isdigit(p[token_size])) ++token_size;
+ while (isdigit(p[token_size]))
+ ++token_size;
}
curr_token = TOKENTYPE_VALUE;
}
@@ -235,8 +239,8 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
* Two values next to each other with no operator between them also
* is an indicator that this should be a string
*/
- if (token_size == 0 || curr_token == TOKENTYPE_UNKNOWN ||
- (prev_token == TOKENTYPE_VALUE && curr_token == TOKENTYPE_VALUE))
+ if (token_size == 0 || curr_token == TOKENTYPE_UNKNOWN
+ || (prev_token == TOKENTYPE_VALUE && curr_token == TOKENTYPE_VALUE))
{
quoting_required = true;
break;
@@ -267,12 +271,12 @@ static seds_boolean_t seds_resolve_is_lua_quoting_required(const char *p)
*/
static int seds_resolve_luafy_seds_reference(lua_State *lua)
{
- luaL_Buffer buffer;
- const char *input;
- const char *p, *q;
+ luaL_Buffer buffer;
+ const char *input;
+ const char *p, *q;
seds_boolean_t quoting_required;
- input = lua_tostring(lua, -1);
+ input = lua_tostring(lua, -1);
quoting_required = seds_resolve_is_lua_quoting_required(input);
/* Note - As of Lua 5.4, this may push something onto the stack.
@@ -318,7 +322,8 @@ static int seds_resolve_luafy_seds_reference(lua_State *lua)
if (*p == '{')
{
q = p + 1;
- while (*q != '}' && *q != 0) ++q;
+ while (*q != '}' && *q != 0)
+ ++q;
}
}
@@ -363,7 +368,6 @@ static int seds_resolve_luafy_seds_reference(lua_State *lua)
/* Add concatenation operator and open a new string */
luaL_addstring(&buffer, " .. \"");
}
-
}
else if (isprint(*input))
{
@@ -452,7 +456,6 @@ static int seds_resolve_set_eval_func(lua_State *lua)
/* (referenced outside this unit and prototyped in a separate header) */
/*******************************************************************************/
-
/*
* ------------------------------------------------------
* External API function - see full details in prototype.
diff --git a/tool/src/seds_preprocess.h b/tool/src/seds_preprocess.h
index b510c5d..c7af481 100644
--- a/tool/src/seds_preprocess.h
+++ b/tool/src/seds_preprocess.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_preprocess.h
* \ingroup tool
@@ -31,12 +30,9 @@
#ifndef _SEDS_PREPROCESS_H_
#define _SEDS_PREPROCESS_H_
-
/**
* Register the preprocessor functions in the global Lua state
*/
void seds_preprocess_register_globals(lua_State *lua);
-
-#endif /* _SEDS_PREPROCESS_H_ */
-
+#endif /* _SEDS_PREPROCESS_H_ */
diff --git a/tool/src/seds_range.c b/tool/src/seds_range.c
index 4488730..0a0361a 100644
--- a/tool/src/seds_range.c
+++ b/tool/src/seds_range.c
@@ -340,7 +340,7 @@ static bool seds_rangesegment_is_single_value(const seds_rangesegment_t *pseg)
/**
* Helper function: push a single value onto the stack corresponding to the segment
- *
+ *
* If the segment is a single value, this pushes that value in simple/primitive form.
* For example a single number is pushed as a number. If the value is not actually
* a single, then this depends on the "force" option.
@@ -367,7 +367,7 @@ static void seds_rangesegment_push_as_single_value(lua_State *lua, int arg_idx,
/* push the midpoint as a number, this is reasonable for sorting purposes */
lua_pushnumber(lua, (pseg->min.valx + pseg->max.valx) / 2);
}
- else
+ else
{
/* not able to push as single value, push as nil */
lua_pushnil(lua);
@@ -409,8 +409,8 @@ static void seds_rangesegment_set_empty(seds_rangesegment_t *pseg)
*/
static bool seds_rangesegment_includes_rangesegment(seds_rangesegment_t *pseg1, seds_rangesegment_t *pseg2)
{
- return seds_rangesegment_compare_min(&pseg1->min, &pseg2->min) &&
- seds_rangesegment_compare_max(&pseg1->max, &pseg2->max);
+ return seds_rangesegment_compare_min(&pseg1->min, &pseg2->min)
+ && seds_rangesegment_compare_max(&pseg1->max, &pseg2->max);
}
/**
@@ -533,7 +533,8 @@ static int seds_rangesegment_matches(lua_State *lua)
* NOTE: this will produce an invalid result if the segments
* do not overlap at all (this can be checked for via is_empty)
*/
-static void seds_rangesegment_compute_intersection(seds_rangesegment_t *pcombined, const seds_rangesegment_t *pseg1,
+static void seds_rangesegment_compute_intersection(seds_rangesegment_t *pcombined,
+ const seds_rangesegment_t *pseg1,
const seds_rangesegment_t *pseg2)
{
memset(pcombined, 0, sizeof(*pcombined));
@@ -567,7 +568,8 @@ static void seds_rangesegment_compute_intersection(seds_rangesegment_t *pcombine
* NOTE: this covers any gap between them, the caller should confirm the segments
* are overlapping in some way before bridging if the intent is to create a union
*/
-static void seds_rangesegment_compute_bridge(seds_rangesegment_t *pcombined, const seds_rangesegment_t *pseg1,
+static void seds_rangesegment_compute_bridge(seds_rangesegment_t *pcombined,
+ const seds_rangesegment_t *pseg1,
const seds_rangesegment_t *pseg2)
{
/* get the lesser of the two minimums */
@@ -696,16 +698,16 @@ static int seds_rangesegment_contiguous_with(lua_State *lua)
pseg1 = seds_rangesegment_get_safe(lua, 1, &temp1);
pseg2 = seds_rangesegment_get_safe(lua, 2, &temp2);
- result = (seds_rangelimit_is_contiguous(&pseg1->max, &pseg2->min) ||
- seds_rangelimit_is_contiguous(&pseg1->min, &pseg2->max));
+ result = (seds_rangelimit_is_contiguous(&pseg1->max, &pseg2->min)
+ || seds_rangelimit_is_contiguous(&pseg1->min, &pseg2->max));
lua_pushboolean(lua, result);
return 1;
}
-static bool seds_rangesegment_compute_union(seds_rangesegment_t *pcombined, seds_rangesegment_t *pseg1,
- seds_rangesegment_t *pseg2)
+static bool
+seds_rangesegment_compute_union(seds_rangesegment_t *pcombined, seds_rangesegment_t *pseg1, seds_rangesegment_t *pseg2)
{
seds_rangesegment_t temp;
bool result;
@@ -718,8 +720,8 @@ static bool seds_rangesegment_compute_union(seds_rangesegment_t *pcombined, seds
* the segment(s) are immediately next to eachother even if they do not
* overlap. In this case the union is still representable as a single
* segment. */
- if (!seds_rangesegment_is_empty(&temp) || seds_rangelimit_is_contiguous(&pseg1->max, &pseg2->min) ||
- seds_rangelimit_is_contiguous(&pseg1->min, &pseg2->max))
+ if (!seds_rangesegment_is_empty(&temp) || seds_rangelimit_is_contiguous(&pseg1->max, &pseg2->min)
+ || seds_rangelimit_is_contiguous(&pseg1->min, &pseg2->max))
{
seds_rangesegment_compute_bridge(pcombined, pseg1, pseg2);
result = true;
@@ -977,7 +979,12 @@ static int seds_rangesegment_to_string(lua_State *lua)
snprintf(maxbuf, sizeof(maxbuf), "+inf");
}
- snprintf(stringbuf, sizeof(stringbuf), "%c%s,%s%c", pseg->min.is_inclusive ? '[' : '(', minbuf, maxbuf,
+ snprintf(stringbuf,
+ sizeof(stringbuf),
+ "%c%s,%s%c",
+ pseg->min.is_inclusive ? '[' : '(',
+ minbuf,
+ maxbuf,
pseg->max.is_inclusive ? ']' : ')');
lua_pushstring(lua, stringbuf);
@@ -2351,7 +2358,7 @@ static int seds_rangemap_set_value(lua_State *lua)
static int seds_rangemap_tostring(lua_State *lua)
{
luaL_Buffer buf;
- bool is_empty;
+ bool is_empty;
is_empty = true;
luaL_buffinit(lua, &buf);
@@ -2364,7 +2371,7 @@ static int seds_rangemap_tostring(lua_State *lua)
{
is_empty = false;
}
- else
+ else
{
luaL_addstring(&buf, "+");
}
diff --git a/tool/src/seds_runtime.lua b/tool/src/seds_runtime.lua
index 447cf25..67b62eb 100644
--- a/tool/src/seds_runtime.lua
+++ b/tool/src/seds_runtime.lua
@@ -110,6 +110,12 @@ SEDS.to_macro_name = function(ident)
local result = string.gsub(ident, "%W+", "_") -- first scrub non alphanumeric characters
result = string.gsub(result, "([%u%d])", ".%1") .. "." -- prefix capitalized letters
+
+ -- Recombine plural acronyms that get broken up.
+ -- For example: ActiveAPs is active action points.
+ -- The "A" and "Ps" should not be separated
+ result = string.gsub(result, "(%u)%.(%us)", "%1%2")
+
result = string.upper(result) -- make ALL_UPPERCASE
-- find multiple one-letter words, which most likely are some sort
@@ -120,6 +126,7 @@ SEDS.to_macro_name = function(ident)
while(true) do
local temp = string.gsub(result, "[%.=](%w)%.", "=%1=", 1)
+
if (temp == result) then
-- no replacements made, stop now
break
diff --git a/tool/src/seds_tool_main.c b/tool/src/seds_tool_main.c
index 22734dc..1b6ca7d 100644
--- a/tool/src/seds_tool_main.c
+++ b/tool/src/seds_tool_main.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_tool_main.c
* \ingroup tool
@@ -51,8 +50,6 @@
#include
#include
-
-
/**
* Lua source file containing the main implementation of the SEDS
* tool basic routines. This is loaded at runtime.
@@ -67,24 +64,13 @@ static const char SEDS_RUNTIME_SCRIPT_FILE[] = "seds_runtime.lua";
*/
seds_toplevel_t sedstool;
-
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-static const char *SEDS_REQUIRED_GLOBALS[] =
-{
- "EDSTOOL_OUTPUT_DIR",
- "EDSTOOL_PROJECT_NAME",
- "CC",
- "LD",
- "AR",
- "CFLAGS",
- "LDFLAGS",
- "SRCDIR",
- "INCDIR",
- "OBJDIR"
+static const char *SEDS_REQUIRED_GLOBALS[] = {
+ "EDSTOOL_OUTPUT_DIR", "EDSTOOL_PROJECT_NAME", "CC", "LD", "AR", "CFLAGS", "LDFLAGS", "SRCDIR", "INCDIR", "OBJDIR"
};
static void seds_export_environment(lua_State *lua)
@@ -92,7 +78,7 @@ static void seds_export_environment(lua_State *lua)
int i;
lua_rawgetp(lua, LUA_REGISTRYINDEX, &sedstool.GLOBAL_SYMBOL_TABLE_KEY);
- for (i=0; i < (sizeof(SEDS_REQUIRED_GLOBALS) / sizeof(SEDS_REQUIRED_GLOBALS[0])); ++i)
+ for (i = 0; i < (sizeof(SEDS_REQUIRED_GLOBALS) / sizeof(SEDS_REQUIRED_GLOBALS[0])); ++i)
{
lua_getfield(lua, -1, SEDS_REQUIRED_GLOBALS[i]);
@@ -110,11 +96,11 @@ static void seds_export_environment(lua_State *lua)
static void seds_setup_base_environment(lua_State *lua)
{
const char *env_value;
- size_t i;
+ size_t i;
lua_newtable(lua);
- for (i=0; i < (sizeof(SEDS_REQUIRED_GLOBALS) / sizeof(SEDS_REQUIRED_GLOBALS[0])); ++i)
+ for (i = 0; i < (sizeof(SEDS_REQUIRED_GLOBALS) / sizeof(SEDS_REQUIRED_GLOBALS[0])); ++i)
{
env_value = getenv(SEDS_REQUIRED_GLOBALS[i]);
@@ -136,7 +122,7 @@ static void seds_setup_base_environment(lua_State *lua)
static void seds_parse_commandline_symbol(lua_State *lua, const char *sym)
{
const char *valtxt;
- size_t len;
+ size_t len;
/* Trim any leading space */
while (*sym != 0 && isspace((int)sym[0]))
@@ -182,8 +168,8 @@ static void seds_parse_commandline_files(lua_State *lua, int argc, char **argv)
{
const char *fileext;
const char *filename;
- int arg;
- int sedsmodule_pos;
+ int arg;
+ int sedsmodule_pos;
/*
* At the top of the stack should be the table which reflects
@@ -287,7 +273,7 @@ static void seds_parse_commandline_files(lua_State *lua, int argc, char **argv)
static void seds_gencdecl_initialize_post_processing(lua_State *lua)
{
- const char *verbose_mode;
+ const char *verbose_mode;
seds_integer_t verbosity;
verbose_mode = getenv("VERBOSE");
@@ -412,12 +398,12 @@ static void seds_usage_summary(void)
int main(int argc, char *argv[])
{
lua_State *lua;
- int arg;
+ int arg;
seds_checksum_init_table();
EdsLib_Initialize();
- memset(&sedstool,0,sizeof(sedstool));
+ memset(&sedstool, 0, sizeof(sedstool));
/*
* Create a new Lua state and load the standard libraries
@@ -437,37 +423,39 @@ int main(int argc, char *argv[])
seds_setup_base_environment(lua);
- while ((arg = getopt (argc, argv, "vD:s:")) != -1)
+ while ((arg = getopt(argc, argv, "vD:s:")) != -1)
{
switch (arg)
{
- case 'D':
- lua_rawgetp(lua, LUA_REGISTRYINDEX, &sedstool.GLOBAL_SYMBOL_TABLE_KEY);
- seds_parse_commandline_symbol(lua, optarg);
- lua_rawset(lua, -3);
- lua_pop(lua, 1);
- break;
+ case 'D':
+ lua_rawgetp(lua, LUA_REGISTRYINDEX, &sedstool.GLOBAL_SYMBOL_TABLE_KEY);
+ seds_parse_commandline_symbol(lua, optarg);
+ lua_rawset(lua, -3);
+ lua_pop(lua, 1);
+ break;
- case 'v':
- ++sedstool.verbosity;
- break;
+ case 'v':
+ ++sedstool.verbosity;
+ break;
- case 's':
- sedstool.user_runtime_path = optarg;
- break;
+ case 's':
+ sedstool.user_runtime_path = optarg;
+ break;
- default:
- if (isprint (arg))
- {
- seds_user_message_printf(SEDS_USER_MESSAGE_ERROR, "cmdline", 0,
- "Unknown argument `-%c'.\n", arg);
- }
- else
- {
- seds_user_message_printf(SEDS_USER_MESSAGE_ERROR, "cmdline", 0,
- "Unknown argument character `\\x%x'.\n", arg);
- }
- break;
+ default:
+ if (isprint(arg))
+ {
+ seds_user_message_printf(SEDS_USER_MESSAGE_ERROR, "cmdline", 0, "Unknown argument `-%c'.\n", arg);
+ }
+ else
+ {
+ seds_user_message_printf(SEDS_USER_MESSAGE_ERROR,
+ "cmdline",
+ 0,
+ "Unknown argument character `\\x%x'.\n",
+ arg);
+ }
+ break;
}
}
@@ -525,7 +513,7 @@ int main(int argc, char *argv[])
seds_parse_commandline_files(lua, argc - optind, argv + optind);
- lua_pop(lua, 1); /* SEDS global, not needed on stack anymore */
+ lua_pop(lua, 1); /* SEDS global, not needed on stack anymore */
seds_export_environment(lua);
@@ -537,11 +525,11 @@ int main(int argc, char *argv[])
lua_close(lua);
printf("SEDS tool complete -- %ld error(s) and %ld warning(s)\n",
- (long)seds_user_message_get_count(SEDS_USER_MESSAGE_ERROR),
- (long)seds_user_message_get_count(SEDS_USER_MESSAGE_WARNING));
+ (long)seds_user_message_get_count(SEDS_USER_MESSAGE_ERROR),
+ (long)seds_user_message_get_count(SEDS_USER_MESSAGE_WARNING));
- if (seds_user_message_get_count(SEDS_USER_MESSAGE_ERROR) != 0 ||
- seds_user_message_get_count(SEDS_USER_MESSAGE_FATAL) != 0)
+ if (seds_user_message_get_count(SEDS_USER_MESSAGE_ERROR) != 0
+ || seds_user_message_get_count(SEDS_USER_MESSAGE_FATAL) != 0)
{
return EXIT_FAILURE;
}
diff --git a/tool/src/seds_tree_node.c b/tool/src/seds_tree_node.c
index 93e2c5d..64c81b0 100644
--- a/tool/src/seds_tree_node.c
+++ b/tool/src/seds_tree_node.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_tree_node.c
* \ingroup tool
@@ -49,191 +48,188 @@
* This module is loaded when the tree functions are registered.
*/
static const char SEDS_TREE_METHODS_SCRIPT_FILE[] = "seds_tree_methods.lua";
-static const char SEDS_TREE_PROPERTIES_LUA_KEY = '\0';
+static const char SEDS_TREE_PROPERTIES_LUA_KEY = '\0';
/**
* Local lookup table to get a printable name associated with a node type
*/
-static const char *SEDS_NODETYPE_LOOKUP[SEDS_NODETYPE_MAX] =
-{
- [SEDS_NODETYPE_UNKNOWN] = "UNKNOWN",
- [SEDS_NODETYPE_ROOT] = "ROOT",
- [SEDS_NODETYPE_CCSDS_STANDARD_FIRST] = "CCSDS_STANDARD_FIRST",
- [SEDS_NODETYPE_DATASHEET] = "DATASHEET",
- [SEDS_NODETYPE_PACKAGEFILE] = "PACKAGEFILE",
- [SEDS_NODETYPE_PACKAGE] = "PACKAGE",
- [SEDS_NODETYPE_LONG_DESCRIPTION] = "LONG_DESCRIPTION",
- [SEDS_NODETYPE_SEMANTICS] = "SEMANTICS",
- [SEDS_NODETYPE_SET_NODE_FIRST] = "SET_NODE_FIRST",
- [SEDS_NODETYPE_DATA_TYPE_SET] = "DATA_TYPE_SET",
- [SEDS_NODETYPE_BASE_INTERFACE_SET] = "BASE_INTERFACE_SET",
- [SEDS_NODETYPE_GENERIC_TYPE_SET] = "GENERIC_TYPE_SET",
- [SEDS_NODETYPE_PARAMETER_SET] = "PARAMETER_SET",
- [SEDS_NODETYPE_COMMAND_SET] = "COMMAND_SET",
- [SEDS_NODETYPE_GENERIC_TYPE_MAP_SET] = "GENERIC_TYPE_MAP_SET",
- [SEDS_NODETYPE_CONSTRAINT_SET] = "CONSTRAINT_SET",
- [SEDS_NODETYPE_DECLARED_INTERFACE_SET] = "DECLARED_INTERFACE_SET",
- [SEDS_NODETYPE_PROVIDED_INTERFACE_SET] = "PROVIDED_INTERFACE_SET",
- [SEDS_NODETYPE_REQUIRED_INTERFACE_SET] = "REQUIRED_INTERFACE_SET",
- [SEDS_NODETYPE_COMPONENT_SET] = "COMPONENT_SET",
- [SEDS_NODETYPE_ALTERNATE_SET] = "ALTERNATE_SET",
- [SEDS_NODETYPE_PARAMETER_MAP_SET] = "PARAMETER_MAP_SET",
- [SEDS_NODETYPE_VARIABLE_SET] = "VARIABLE_SET",
- [SEDS_NODETYPE_ACTIVITY_SET] = "ACTIVITY_SET",
- [SEDS_NODETYPE_METADATA_VALUE_SET] = "METADATA_VALUE_SET",
- [SEDS_NODETYPE_NOMINAL_RANGE_SET] = "NOMINAL_RANGE_SET",
- [SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP_SET] = "PARAMETER_ACTIVITY_MAP_SET",
- [SEDS_NODETYPE_RANGE_SET] = "RANGE_SET",
- [SEDS_NODETYPE_STATE_MACHINE_SET] = "STATE_MACHINE_SET",
- [SEDS_NODETYPE_SET_NODE_LAST] = "SET_NODE_LAST",
- [SEDS_NODETYPE_COMPONENT] = "COMPONENT",
- [SEDS_NODETYPE_COMMAND] = "COMMAND",
- [SEDS_NODETYPE_IMPLEMENTATION] = "IMPLEMENTATION",
- [SEDS_NODETYPE_ALTERNATE] = "ALTERNATE",
- [SEDS_NODETYPE_PARAMETER] = "PARAMETER",
- [SEDS_NODETYPE_ARGUMENT] = "ARGUMENT",
- [SEDS_NODETYPE_GENERIC_TYPE_MAP] = "GENERIC_TYPE_MAP",
- [SEDS_NODETYPE_PARAMETER_MAP] = "PARAMETER_MAP",
- [SEDS_NODETYPE_VARIABLE] = "VARIABLE",
- [SEDS_NODETYPE_CONTAINER_ENTRY_LIST] = "CONTAINER_ENTRY_LIST",
- [SEDS_NODETYPE_CONTAINER_TRAILER_ENTRY_LIST] = "CONTAINER_TRAILER_ENTRY_LIST",
- [SEDS_NODETYPE_DIMENSION_LIST] = "DIMENSION_LIST",
- [SEDS_NODETYPE_ENUMERATION_LIST] = "ENUMERATION_LIST",
- [SEDS_NODETYPE_SCALAR_DATATYPE_FIRST] = "SCALAR_DATATYPE_FIRST",
- [SEDS_NODETYPE_INTEGER_DATATYPE] = "INTEGER_DATATYPE",
- [SEDS_NODETYPE_FLOAT_DATATYPE] = "FLOAT_DATATYPE",
- [SEDS_NODETYPE_ENUMERATION_DATATYPE] = "ENUMERATION_DATATYPE",
- [SEDS_NODETYPE_BINARY_DATATYPE] = "BINARY_DATATYPE",
- [SEDS_NODETYPE_STRING_DATATYPE] = "STRING_DATATYPE",
- [SEDS_NODETYPE_BOOLEAN_DATATYPE] = "BOOLEAN_DATATYPE",
- [SEDS_NODETYPE_SUBRANGE_DATATYPE] = "SUBRANGE_DATATYPE",
- [SEDS_NODETYPE_ALIAS_DATATYPE] = "ALIAS_DATATYPE",
- [SEDS_NODETYPE_SCALAR_DATATYPE_LAST] = "SCALAR_DATATYPE_LAST",
- [SEDS_NODETYPE_COMPOUND_DATATYPE_FIRST] = "COMPOUND_DATATYPE_FIRST",
- [SEDS_NODETYPE_ARRAY_DATATYPE] = "ARRAY_DATATYPE",
- [SEDS_NODETYPE_CONTAINER_DATATYPE] = "CONTAINER_DATATYPE",
- [SEDS_NODETYPE_COMPOUND_DATATYPE_LAST] = "COMPOUND_DATATYPE_LAST",
- [SEDS_NODETYPE_DYNAMIC_DATATYPE_FIRST] = "DYNAMIC_DATATYPE_FIRST",
- [SEDS_NODETYPE_GENERIC_TYPE] = "GENERIC_TYPE",
- [SEDS_NODETYPE_DYNAMIC_DATATYPE_LAST] = "DYNAMIC_DATATYPE_LAST",
- [SEDS_NODETYPE_INTERFACE_FIRST] = "INTERFACE_FIRST",
- [SEDS_NODETYPE_INTERFACE] = "INTERFACE",
- [SEDS_NODETYPE_DECLARED_INTERFACE] = "DECLARED_INTERFACE",
- [SEDS_NODETYPE_PROVIDED_INTERFACE] = "PROVIDED_INTERFACE",
- [SEDS_NODETYPE_REQUIRED_INTERFACE] = "REQUIRED_INTERFACE",
- [SEDS_NODETYPE_BASE_INTERFACE] = "BASE_INTERFACE",
- [SEDS_NODETYPE_INTERFACE_LAST] = "INTERFACE_LAST",
- [SEDS_NODETYPE_ENUMERATION_ENTRY] = "ENUMERATION_ENTRY",
- [SEDS_NODETYPE_CONTAINER_ENTRY] = "CONTAINER_ENTRY",
- [SEDS_NODETYPE_CONTAINER_FIXED_VALUE_ENTRY] = "CONTAINER_FIXED_VALUE_ENTRY",
- [SEDS_NODETYPE_CONTAINER_PADDING_ENTRY] = "CONTAINER_PADDING_ENTRY",
- [SEDS_NODETYPE_CONTAINER_LIST_ENTRY] = "CONTAINER_LIST_ENTRY",
- [SEDS_NODETYPE_CONTAINER_LENGTH_ENTRY] = "CONTAINER_LENGTH_ENTRY",
- [SEDS_NODETYPE_CONTAINER_ERROR_CONTROL_ENTRY] = "CONTAINER_ERROR_CONTROL_ENTRY",
- [SEDS_NODETYPE_CONSTRAINT_FIRST] = "CONSTRAINT_FIRST",
- [SEDS_NODETYPE_CONSTRAINT] = "CONSTRAINT",
- [SEDS_NODETYPE_TYPE_CONSTRAINT] = "TYPE_CONSTRAINT",
- [SEDS_NODETYPE_RANGE_CONSTRAINT] = "RANGE_CONSTRAINT",
- [SEDS_NODETYPE_VALUE_CONSTRAINT] = "VALUE_CONSTRAINT",
- [SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT] = "PRESENCE_TYPE_CONSTRAINT",
- [SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT] = "PRESENCE_RANGE_CONSTRAINT",
- [SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT] = "PRESENCE_VALUE_CONSTRAINT",
- [SEDS_NODETYPE_CONSTRAINT_LAST] = "CONSTRAINT_LAST",
- [SEDS_NODETYPE_ENCODING_FIRST] = "ENCODING_FIRST",
- [SEDS_NODETYPE_INTEGER_DATA_ENCODING] = "INTEGER_DATA_ENCODING",
- [SEDS_NODETYPE_FLOAT_DATA_ENCODING] = "FLOAT_DATA_ENCODING",
- [SEDS_NODETYPE_STRING_DATA_ENCODING] = "STRING_DATA_ENCODING",
- [SEDS_NODETYPE_ENCODING_LAST] = "ENCODING_LAST",
- [SEDS_NODETYPE_RANGE_FIRST] = "RANGE_FIRST",
- [SEDS_NODETYPE_MINMAX_RANGE] = "MINMAX_RANGE",
- [SEDS_NODETYPE_PRECISION_RANGE] = "PRECISION_RANGE",
- [SEDS_NODETYPE_ENUMERATED_RANGE] = "ENUMERATED_RANGE",
- [SEDS_NODETYPE_RANGE_LAST] = "RANGE_LAST",
- [SEDS_NODETYPE_RANGE] = "RANGE",
- [SEDS_NODETYPE_VALID_RANGE] = "VALID_RANGE",
- [SEDS_NODETYPE_DIMENSION] = "DIMENSION",
- [SEDS_NODETYPE_ARRAY_DIMENSIONS] = "ARRAY_DIMENSIONS",
- [SEDS_NODETYPE_SPLINE_CALIBRATOR] = "SPLINE_CALIBRATOR",
- [SEDS_NODETYPE_POLYNOMIAL_CALIBRATOR] = "POLYNOMIAL_CALIBRATOR",
- [SEDS_NODETYPE_SPLINE_POINT] = "SPLINE_POINT",
- [SEDS_NODETYPE_POLYNOMIAL_TERM] = "POLYNOMIAL_TERM",
- [SEDS_NODETYPE_ACTIVITY] = "ACTIVITY",
- [SEDS_NODETYPE_ANDED_CONDITIONS] = "ANDED_CONDITIONS",
- [SEDS_NODETYPE_ARGUMENT_VALUE] = "ARGUMENT_VALUE",
- [SEDS_NODETYPE_ARRAY_DATA_TYPE] = "ARRAY_DATA_TYPE",
- [SEDS_NODETYPE_ASSIGNMENT] = "ASSIGNMENT",
- [SEDS_NODETYPE_BODY] = "BODY",
- [SEDS_NODETYPE_BOOLEAN_DATA_ENCODING] = "BOOLEAN_DATA_ENCODING",
- [SEDS_NODETYPE_CALIBRATION] = "CALIBRATION",
- [SEDS_NODETYPE_CALL] = "CALL",
- [SEDS_NODETYPE_CATEGORY] = "CATEGORY",
- [SEDS_NODETYPE_COMPARISON_OPERATOR] = "COMPARISON_OPERATOR",
- [SEDS_NODETYPE_CONDITIONAL] = "CONDITIONAL",
- [SEDS_NODETYPE_CONDITION] = "CONDITION",
- [SEDS_NODETYPE_DATE_VALUE] = "DATE_VALUE",
- [SEDS_NODETYPE_DEVICE] = "DEVICE",
- [SEDS_NODETYPE_DO] = "DO",
- [SEDS_NODETYPE_END_AT] = "END_AT",
- [SEDS_NODETYPE_ENTRY_STATE] = "ENTRY_STATE",
- [SEDS_NODETYPE_EXIT_STATE] = "EXIT_STATE",
- [SEDS_NODETYPE_FIRST_OPERAND] = "FIRST_OPERAND",
- [SEDS_NODETYPE_FLOAT_VALUE] = "FLOAT_VALUE",
- [SEDS_NODETYPE_GET_ACTIVITY] = "GET_ACTIVITY",
- [SEDS_NODETYPE_GUARD] = "GUARD",
- [SEDS_NODETYPE_INTEGER_VALUE] = "INTEGER_VALUE",
- [SEDS_NODETYPE_ITERATION] = "ITERATION",
- [SEDS_NODETYPE_LABEL] = "LABEL",
- [SEDS_NODETYPE_MATH_OPERATION] = "MATH_OPERATION",
- [SEDS_NODETYPE_METADATA] = "METADATA",
- [SEDS_NODETYPE_ON_COMMAND_PRIMITIVE] = "ON_COMMAND_PRIMITIVE",
- [SEDS_NODETYPE_ON_CONDITION_FALSE] = "ON_CONDITION_FALSE",
- [SEDS_NODETYPE_ON_CONDITION_TRUE] = "ON_CONDITION_TRUE",
- [SEDS_NODETYPE_ON_ENTRY] = "ON_ENTRY",
- [SEDS_NODETYPE_ON_EXIT] = "ON_EXIT",
- [SEDS_NODETYPE_ON_PARAMETER_PRIMITIVE] = "ON_PARAMETER_PRIMITIVE",
- [SEDS_NODETYPE_ON_TIMER] = "ON_TIMER",
- [SEDS_NODETYPE_OPERATOR] = "OPERATOR",
- [SEDS_NODETYPE_ORED_CONDITIONS] = "ORED_CONDITIONS",
- [SEDS_NODETYPE_OVER_ARRAY] = "OVER_ARRAY",
- [SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP] = "PARAMETER_ACTIVITY_MAP",
- [SEDS_NODETYPE_PRESENT_WHEN] = "PRESENT_WHEN",
- [SEDS_NODETYPE_PROVIDED] = "PROVIDED",
- [SEDS_NODETYPE_REQUIRED] = "REQUIRED",
- [SEDS_NODETYPE_SECOND_OPERAND] = "SECOND_OPERAND",
- [SEDS_NODETYPE_SEMANTICS_TERM] = "SEMANTICS_TERM",
- [SEDS_NODETYPE_SEND_COMMAND_PRIMITIVE] = "SEND_COMMAND_PRIMITIVE",
- [SEDS_NODETYPE_SEND_PARAMETER_PRIMITIVE] = "SEND_PARAMETER_PRIMITIVE",
- [SEDS_NODETYPE_SET_ACTIVITY_ONLY] = "SET_ACTIVITY_ONLY",
- [SEDS_NODETYPE_SET_ACTIVITY] = "SET_ACTIVITY",
- [SEDS_NODETYPE_START_AT] = "START_AT",
- [SEDS_NODETYPE_STATE_MACHINE] = "STATE_MACHINE",
- [SEDS_NODETYPE_STATE] = "STATE",
- [SEDS_NODETYPE_STEP] = "STEP",
- [SEDS_NODETYPE_STRING_VALUE] = "STRING_VALUE",
- [SEDS_NODETYPE_TRANSITION] = "TRANSITION",
- [SEDS_NODETYPE_TYPE_CONDITION] = "TYPE_CONDITION",
- [SEDS_NODETYPE_TYPE_OPERAND] = "TYPE_OPERAND",
- [SEDS_NODETYPE_VALUE] = "VALUE",
- [SEDS_NODETYPE_VARIABLE_REF] = "VARIABLE_REF",
- [SEDS_NODETYPE_CCSDS_STANDARD_LAST] = "CCSDS_STANDARD_LAST",
- [SEDS_NODETYPE_XINCLUDE_PASSTHRU] = "XINCLUDE_PASSTHRU",
- [SEDS_NODETYPE_DESCRIPTION_PASSTHRU] = "DESCRIPTION_PASSTHRU",
- [SEDS_NODETYPE_DESIGN_PARAMETERS] = "DESIGN_PARAMETERS",
- [SEDS_NODETYPE_DEFINE] = "DEFINE",
- [SEDS_NODETYPE_INSTANCE_RULE_SET] = "INSTANCE_RULE_SET",
- [SEDS_NODETYPE_INSTANCE_RULE] = "INSTANCE_RULE",
- [SEDS_NODETYPE_INTERFACE_MAP_SET] = "INTERFACE_MAP_SET",
- [SEDS_NODETYPE_INTERFACE_MAP] = "INTERFACE_MAP",
- [SEDS_NODETYPE_PARAMETER_VALUE] = "PARAMETER_VALUE",
+static const char *SEDS_NODETYPE_LOOKUP[SEDS_NODETYPE_MAX] = {
+ [SEDS_NODETYPE_UNKNOWN] = "UNKNOWN",
+ [SEDS_NODETYPE_ROOT] = "ROOT",
+ [SEDS_NODETYPE_CCSDS_STANDARD_FIRST] = "CCSDS_STANDARD_FIRST",
+ [SEDS_NODETYPE_DATASHEET] = "DATASHEET",
+ [SEDS_NODETYPE_PACKAGEFILE] = "PACKAGEFILE",
+ [SEDS_NODETYPE_PACKAGE] = "PACKAGE",
+ [SEDS_NODETYPE_LONG_DESCRIPTION] = "LONG_DESCRIPTION",
+ [SEDS_NODETYPE_SEMANTICS] = "SEMANTICS",
+ [SEDS_NODETYPE_SET_NODE_FIRST] = "SET_NODE_FIRST",
+ [SEDS_NODETYPE_DATA_TYPE_SET] = "DATA_TYPE_SET",
+ [SEDS_NODETYPE_BASE_INTERFACE_SET] = "BASE_INTERFACE_SET",
+ [SEDS_NODETYPE_GENERIC_TYPE_SET] = "GENERIC_TYPE_SET",
+ [SEDS_NODETYPE_PARAMETER_SET] = "PARAMETER_SET",
+ [SEDS_NODETYPE_COMMAND_SET] = "COMMAND_SET",
+ [SEDS_NODETYPE_GENERIC_TYPE_MAP_SET] = "GENERIC_TYPE_MAP_SET",
+ [SEDS_NODETYPE_CONSTRAINT_SET] = "CONSTRAINT_SET",
+ [SEDS_NODETYPE_DECLARED_INTERFACE_SET] = "DECLARED_INTERFACE_SET",
+ [SEDS_NODETYPE_PROVIDED_INTERFACE_SET] = "PROVIDED_INTERFACE_SET",
+ [SEDS_NODETYPE_REQUIRED_INTERFACE_SET] = "REQUIRED_INTERFACE_SET",
+ [SEDS_NODETYPE_COMPONENT_SET] = "COMPONENT_SET",
+ [SEDS_NODETYPE_ALTERNATE_SET] = "ALTERNATE_SET",
+ [SEDS_NODETYPE_PARAMETER_MAP_SET] = "PARAMETER_MAP_SET",
+ [SEDS_NODETYPE_VARIABLE_SET] = "VARIABLE_SET",
+ [SEDS_NODETYPE_ACTIVITY_SET] = "ACTIVITY_SET",
+ [SEDS_NODETYPE_METADATA_VALUE_SET] = "METADATA_VALUE_SET",
+ [SEDS_NODETYPE_NOMINAL_RANGE_SET] = "NOMINAL_RANGE_SET",
+ [SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP_SET] = "PARAMETER_ACTIVITY_MAP_SET",
+ [SEDS_NODETYPE_RANGE_SET] = "RANGE_SET",
+ [SEDS_NODETYPE_STATE_MACHINE_SET] = "STATE_MACHINE_SET",
+ [SEDS_NODETYPE_SET_NODE_LAST] = "SET_NODE_LAST",
+ [SEDS_NODETYPE_COMPONENT] = "COMPONENT",
+ [SEDS_NODETYPE_COMMAND] = "COMMAND",
+ [SEDS_NODETYPE_IMPLEMENTATION] = "IMPLEMENTATION",
+ [SEDS_NODETYPE_ALTERNATE] = "ALTERNATE",
+ [SEDS_NODETYPE_PARAMETER] = "PARAMETER",
+ [SEDS_NODETYPE_ARGUMENT] = "ARGUMENT",
+ [SEDS_NODETYPE_GENERIC_TYPE_MAP] = "GENERIC_TYPE_MAP",
+ [SEDS_NODETYPE_PARAMETER_MAP] = "PARAMETER_MAP",
+ [SEDS_NODETYPE_VARIABLE] = "VARIABLE",
+ [SEDS_NODETYPE_CONTAINER_ENTRY_LIST] = "CONTAINER_ENTRY_LIST",
+ [SEDS_NODETYPE_CONTAINER_TRAILER_ENTRY_LIST] = "CONTAINER_TRAILER_ENTRY_LIST",
+ [SEDS_NODETYPE_DIMENSION_LIST] = "DIMENSION_LIST",
+ [SEDS_NODETYPE_ENUMERATION_LIST] = "ENUMERATION_LIST",
+ [SEDS_NODETYPE_SCALAR_DATATYPE_FIRST] = "SCALAR_DATATYPE_FIRST",
+ [SEDS_NODETYPE_INTEGER_DATATYPE] = "INTEGER_DATATYPE",
+ [SEDS_NODETYPE_FLOAT_DATATYPE] = "FLOAT_DATATYPE",
+ [SEDS_NODETYPE_ENUMERATION_DATATYPE] = "ENUMERATION_DATATYPE",
+ [SEDS_NODETYPE_BINARY_DATATYPE] = "BINARY_DATATYPE",
+ [SEDS_NODETYPE_STRING_DATATYPE] = "STRING_DATATYPE",
+ [SEDS_NODETYPE_BOOLEAN_DATATYPE] = "BOOLEAN_DATATYPE",
+ [SEDS_NODETYPE_SUBRANGE_DATATYPE] = "SUBRANGE_DATATYPE",
+ [SEDS_NODETYPE_ALIAS_DATATYPE] = "ALIAS_DATATYPE",
+ [SEDS_NODETYPE_SCALAR_DATATYPE_LAST] = "SCALAR_DATATYPE_LAST",
+ [SEDS_NODETYPE_COMPOUND_DATATYPE_FIRST] = "COMPOUND_DATATYPE_FIRST",
+ [SEDS_NODETYPE_ARRAY_DATATYPE] = "ARRAY_DATATYPE",
+ [SEDS_NODETYPE_CONTAINER_DATATYPE] = "CONTAINER_DATATYPE",
+ [SEDS_NODETYPE_COMPOUND_DATATYPE_LAST] = "COMPOUND_DATATYPE_LAST",
+ [SEDS_NODETYPE_DYNAMIC_DATATYPE_FIRST] = "DYNAMIC_DATATYPE_FIRST",
+ [SEDS_NODETYPE_GENERIC_TYPE] = "GENERIC_TYPE",
+ [SEDS_NODETYPE_DYNAMIC_DATATYPE_LAST] = "DYNAMIC_DATATYPE_LAST",
+ [SEDS_NODETYPE_INTERFACE_FIRST] = "INTERFACE_FIRST",
+ [SEDS_NODETYPE_INTERFACE] = "INTERFACE",
+ [SEDS_NODETYPE_DECLARED_INTERFACE] = "DECLARED_INTERFACE",
+ [SEDS_NODETYPE_PROVIDED_INTERFACE] = "PROVIDED_INTERFACE",
+ [SEDS_NODETYPE_REQUIRED_INTERFACE] = "REQUIRED_INTERFACE",
+ [SEDS_NODETYPE_BASE_INTERFACE] = "BASE_INTERFACE",
+ [SEDS_NODETYPE_INTERFACE_LAST] = "INTERFACE_LAST",
+ [SEDS_NODETYPE_ENUMERATION_ENTRY] = "ENUMERATION_ENTRY",
+ [SEDS_NODETYPE_CONTAINER_ENTRY] = "CONTAINER_ENTRY",
+ [SEDS_NODETYPE_CONTAINER_FIXED_VALUE_ENTRY] = "CONTAINER_FIXED_VALUE_ENTRY",
+ [SEDS_NODETYPE_CONTAINER_PADDING_ENTRY] = "CONTAINER_PADDING_ENTRY",
+ [SEDS_NODETYPE_CONTAINER_LIST_ENTRY] = "CONTAINER_LIST_ENTRY",
+ [SEDS_NODETYPE_CONTAINER_LENGTH_ENTRY] = "CONTAINER_LENGTH_ENTRY",
+ [SEDS_NODETYPE_CONTAINER_ERROR_CONTROL_ENTRY] = "CONTAINER_ERROR_CONTROL_ENTRY",
+ [SEDS_NODETYPE_CONSTRAINT_FIRST] = "CONSTRAINT_FIRST",
+ [SEDS_NODETYPE_CONSTRAINT] = "CONSTRAINT",
+ [SEDS_NODETYPE_TYPE_CONSTRAINT] = "TYPE_CONSTRAINT",
+ [SEDS_NODETYPE_RANGE_CONSTRAINT] = "RANGE_CONSTRAINT",
+ [SEDS_NODETYPE_VALUE_CONSTRAINT] = "VALUE_CONSTRAINT",
+ [SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT] = "PRESENCE_TYPE_CONSTRAINT",
+ [SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT] = "PRESENCE_RANGE_CONSTRAINT",
+ [SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT] = "PRESENCE_VALUE_CONSTRAINT",
+ [SEDS_NODETYPE_CONSTRAINT_LAST] = "CONSTRAINT_LAST",
+ [SEDS_NODETYPE_ENCODING_FIRST] = "ENCODING_FIRST",
+ [SEDS_NODETYPE_INTEGER_DATA_ENCODING] = "INTEGER_DATA_ENCODING",
+ [SEDS_NODETYPE_FLOAT_DATA_ENCODING] = "FLOAT_DATA_ENCODING",
+ [SEDS_NODETYPE_STRING_DATA_ENCODING] = "STRING_DATA_ENCODING",
+ [SEDS_NODETYPE_ENCODING_LAST] = "ENCODING_LAST",
+ [SEDS_NODETYPE_RANGE_FIRST] = "RANGE_FIRST",
+ [SEDS_NODETYPE_MINMAX_RANGE] = "MINMAX_RANGE",
+ [SEDS_NODETYPE_PRECISION_RANGE] = "PRECISION_RANGE",
+ [SEDS_NODETYPE_ENUMERATED_RANGE] = "ENUMERATED_RANGE",
+ [SEDS_NODETYPE_RANGE_LAST] = "RANGE_LAST",
+ [SEDS_NODETYPE_RANGE] = "RANGE",
+ [SEDS_NODETYPE_VALID_RANGE] = "VALID_RANGE",
+ [SEDS_NODETYPE_DIMENSION] = "DIMENSION",
+ [SEDS_NODETYPE_ARRAY_DIMENSIONS] = "ARRAY_DIMENSIONS",
+ [SEDS_NODETYPE_SPLINE_CALIBRATOR] = "SPLINE_CALIBRATOR",
+ [SEDS_NODETYPE_POLYNOMIAL_CALIBRATOR] = "POLYNOMIAL_CALIBRATOR",
+ [SEDS_NODETYPE_SPLINE_POINT] = "SPLINE_POINT",
+ [SEDS_NODETYPE_POLYNOMIAL_TERM] = "POLYNOMIAL_TERM",
+ [SEDS_NODETYPE_ACTIVITY] = "ACTIVITY",
+ [SEDS_NODETYPE_ANDED_CONDITIONS] = "ANDED_CONDITIONS",
+ [SEDS_NODETYPE_ARGUMENT_VALUE] = "ARGUMENT_VALUE",
+ [SEDS_NODETYPE_ARRAY_DATA_TYPE] = "ARRAY_DATA_TYPE",
+ [SEDS_NODETYPE_ASSIGNMENT] = "ASSIGNMENT",
+ [SEDS_NODETYPE_BODY] = "BODY",
+ [SEDS_NODETYPE_BOOLEAN_DATA_ENCODING] = "BOOLEAN_DATA_ENCODING",
+ [SEDS_NODETYPE_CALIBRATION] = "CALIBRATION",
+ [SEDS_NODETYPE_CALL] = "CALL",
+ [SEDS_NODETYPE_CATEGORY] = "CATEGORY",
+ [SEDS_NODETYPE_COMPARISON_OPERATOR] = "COMPARISON_OPERATOR",
+ [SEDS_NODETYPE_CONDITIONAL] = "CONDITIONAL",
+ [SEDS_NODETYPE_CONDITION] = "CONDITION",
+ [SEDS_NODETYPE_DATE_VALUE] = "DATE_VALUE",
+ [SEDS_NODETYPE_DEVICE] = "DEVICE",
+ [SEDS_NODETYPE_DO] = "DO",
+ [SEDS_NODETYPE_END_AT] = "END_AT",
+ [SEDS_NODETYPE_ENTRY_STATE] = "ENTRY_STATE",
+ [SEDS_NODETYPE_EXIT_STATE] = "EXIT_STATE",
+ [SEDS_NODETYPE_FIRST_OPERAND] = "FIRST_OPERAND",
+ [SEDS_NODETYPE_FLOAT_VALUE] = "FLOAT_VALUE",
+ [SEDS_NODETYPE_GET_ACTIVITY] = "GET_ACTIVITY",
+ [SEDS_NODETYPE_GUARD] = "GUARD",
+ [SEDS_NODETYPE_INTEGER_VALUE] = "INTEGER_VALUE",
+ [SEDS_NODETYPE_ITERATION] = "ITERATION",
+ [SEDS_NODETYPE_LABEL] = "LABEL",
+ [SEDS_NODETYPE_MATH_OPERATION] = "MATH_OPERATION",
+ [SEDS_NODETYPE_METADATA] = "METADATA",
+ [SEDS_NODETYPE_ON_COMMAND_PRIMITIVE] = "ON_COMMAND_PRIMITIVE",
+ [SEDS_NODETYPE_ON_CONDITION_FALSE] = "ON_CONDITION_FALSE",
+ [SEDS_NODETYPE_ON_CONDITION_TRUE] = "ON_CONDITION_TRUE",
+ [SEDS_NODETYPE_ON_ENTRY] = "ON_ENTRY",
+ [SEDS_NODETYPE_ON_EXIT] = "ON_EXIT",
+ [SEDS_NODETYPE_ON_PARAMETER_PRIMITIVE] = "ON_PARAMETER_PRIMITIVE",
+ [SEDS_NODETYPE_ON_TIMER] = "ON_TIMER",
+ [SEDS_NODETYPE_OPERATOR] = "OPERATOR",
+ [SEDS_NODETYPE_ORED_CONDITIONS] = "ORED_CONDITIONS",
+ [SEDS_NODETYPE_OVER_ARRAY] = "OVER_ARRAY",
+ [SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP] = "PARAMETER_ACTIVITY_MAP",
+ [SEDS_NODETYPE_PRESENT_WHEN] = "PRESENT_WHEN",
+ [SEDS_NODETYPE_PROVIDED] = "PROVIDED",
+ [SEDS_NODETYPE_REQUIRED] = "REQUIRED",
+ [SEDS_NODETYPE_SECOND_OPERAND] = "SECOND_OPERAND",
+ [SEDS_NODETYPE_SEMANTICS_TERM] = "SEMANTICS_TERM",
+ [SEDS_NODETYPE_SEND_COMMAND_PRIMITIVE] = "SEND_COMMAND_PRIMITIVE",
+ [SEDS_NODETYPE_SEND_PARAMETER_PRIMITIVE] = "SEND_PARAMETER_PRIMITIVE",
+ [SEDS_NODETYPE_SET_ACTIVITY_ONLY] = "SET_ACTIVITY_ONLY",
+ [SEDS_NODETYPE_SET_ACTIVITY] = "SET_ACTIVITY",
+ [SEDS_NODETYPE_START_AT] = "START_AT",
+ [SEDS_NODETYPE_STATE_MACHINE] = "STATE_MACHINE",
+ [SEDS_NODETYPE_STATE] = "STATE",
+ [SEDS_NODETYPE_STEP] = "STEP",
+ [SEDS_NODETYPE_STRING_VALUE] = "STRING_VALUE",
+ [SEDS_NODETYPE_TRANSITION] = "TRANSITION",
+ [SEDS_NODETYPE_TYPE_CONDITION] = "TYPE_CONDITION",
+ [SEDS_NODETYPE_TYPE_OPERAND] = "TYPE_OPERAND",
+ [SEDS_NODETYPE_VALUE] = "VALUE",
+ [SEDS_NODETYPE_VARIABLE_REF] = "VARIABLE_REF",
+ [SEDS_NODETYPE_CCSDS_STANDARD_LAST] = "CCSDS_STANDARD_LAST",
+ [SEDS_NODETYPE_XINCLUDE_PASSTHRU] = "XINCLUDE_PASSTHRU",
+ [SEDS_NODETYPE_DESCRIPTION_PASSTHRU] = "DESCRIPTION_PASSTHRU",
+ [SEDS_NODETYPE_DESIGN_PARAMETERS] = "DESIGN_PARAMETERS",
+ [SEDS_NODETYPE_DEFINE] = "DEFINE",
+ [SEDS_NODETYPE_INSTANCE_RULE_SET] = "INSTANCE_RULE_SET",
+ [SEDS_NODETYPE_INSTANCE_RULE] = "INSTANCE_RULE",
+ [SEDS_NODETYPE_INTERFACE_MAP_SET] = "INTERFACE_MAP_SET",
+ [SEDS_NODETYPE_INTERFACE_MAP] = "INTERFACE_MAP",
+ [SEDS_NODETYPE_PARAMETER_VALUE] = "PARAMETER_VALUE",
};
-
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
/**
* Lua callable function to output a message regarding a SEDS DOM node object
*
@@ -250,7 +246,7 @@ static const char *SEDS_NODETYPE_LOOKUP[SEDS_NODETYPE_MAX] =
*/
static int seds_tree_mark_error(lua_State *lua)
{
- const char *extramsg;
+ const char *extramsg;
seds_user_message_t msgtype = lua_tointeger(lua, lua_upvalueindex(1));
luaL_checkudata(lua, 1, "seds_node");
@@ -269,10 +265,7 @@ static int seds_tree_mark_error(lua_State *lua)
lua_getfield(lua, 1, "xml_filename");
lua_getfield(lua, 1, "xml_linenum");
- seds_user_message_preformat(msgtype,
- lua_tostring(lua, -2),
- lua_tointeger(lua, -1),
- lua_tostring(lua, 2), extramsg);
+ seds_user_message_preformat(msgtype, lua_tostring(lua, -2), lua_tointeger(lua, -1), lua_tostring(lua, 2), extramsg);
if (msgtype == SEDS_USER_MESSAGE_ERROR)
{
@@ -328,11 +321,9 @@ static int seds_tree_node_get_property(lua_State *lua)
lua_settop(lua, 2);
- if (lua_type(lua, 2) == LUA_TSTRING &&
- strcmp(lua_tostring(lua, 2), "entity_type") == 0)
+ if (lua_type(lua, 2) == LUA_TSTRING && strcmp(lua_tostring(lua, 2), "entity_type") == 0)
{
- if (pnode->node_type < SEDS_NODETYPE_MAX &&
- SEDS_NODETYPE_LOOKUP[pnode->node_type] != NULL)
+ if (pnode->node_type < SEDS_NODETYPE_MAX && SEDS_NODETYPE_LOOKUP[pnode->node_type] != NULL)
{
lua_pushstring(lua, SEDS_NODETYPE_LOOKUP[pnode->node_type]);
}
@@ -366,8 +357,8 @@ static int seds_tree_node_get_property(lua_State *lua)
static int seds_tree_node_to_string(lua_State *lua)
{
seds_node_t *pnode = luaL_checkudata(lua, 1, "seds_node");
- int uv_idx;
- luaL_Buffer buf;
+ int uv_idx;
+ luaL_Buffer buf;
/* Note - As of Lua 5.4, this may push something onto the stack.
* Whereas in 5.3 and below, it does not change the stack. */
@@ -406,17 +397,16 @@ static int seds_tree_node_to_string(lua_State *lua)
*/
static int seds_tree_node_new_object(lua_State *lua)
{
- int i;
- int nret;
+ int i;
+ int nret;
const char *nodetype_str = luaL_checkstring(lua, 1);
nret = 0;
if (nodetype_str != NULL)
{
- for (i=0; i < (sizeof(SEDS_NODETYPE_LOOKUP) / sizeof(SEDS_NODETYPE_LOOKUP[0])); ++i)
+ for (i = 0; i < (sizeof(SEDS_NODETYPE_LOOKUP) / sizeof(SEDS_NODETYPE_LOOKUP[0])); ++i)
{
- if (SEDS_NODETYPE_LOOKUP[i] != NULL &&
- strcmp(SEDS_NODETYPE_LOOKUP[i], nodetype_str) == 0)
+ if (SEDS_NODETYPE_LOOKUP[i] != NULL && strcmp(SEDS_NODETYPE_LOOKUP[i], nodetype_str) == 0)
{
seds_tree_node_push_new_object(lua, i);
nret = 1;
@@ -509,5 +499,4 @@ void seds_tree_node_register_globals(lua_State *lua)
lua_setfield(lua, -2, "get_properties");
lua_rawsetp(lua, LUA_REGISTRYINDEX, &SEDS_TREE_PROPERTIES_LUA_KEY);
-
}
diff --git a/tool/src/seds_tree_node.h b/tool/src/seds_tree_node.h
index 3e84112..5c3d68f 100644
--- a/tool/src/seds_tree_node.h
+++ b/tool/src/seds_tree_node.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_tree_node.h
* \ingroup tool
@@ -51,232 +50,235 @@ typedef enum
* unsupported.
*/
- SEDS_NODETYPE_UNKNOWN, /**< Reserved value - for nodes that are ignored */
- SEDS_NODETYPE_ROOT, /**< Root node of entire hierarchy */
- SEDS_NODETYPE_CCSDS_STANDARD_FIRST, /**< Reserved index marker - not used */
-
- /* Basic EDS node types */
- SEDS_NODETYPE_DATASHEET, /**< Opening tag for SEDS datasheet */
- SEDS_NODETYPE_PACKAGEFILE, /**< Opening tag for SEDS packagefile */
- SEDS_NODETYPE_PACKAGE, /**< Package definition */
- SEDS_NODETYPE_LONG_DESCRIPTION, /**< Long description (documentation) node */
- SEDS_NODETYPE_SEMANTICS, /**< Extra usage semantics that are beyond EDS scope (TBD) */
-
- /*
- * SET and LIST EDS nodes: these are structural from the xml file and only exist
- * to contain other nodes of a specific type
- */
- SEDS_NODETYPE_SET_NODE_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_DATA_TYPE_SET, /**< DataTypeSet node */
- SEDS_NODETYPE_BASE_INTERFACE_SET,
- SEDS_NODETYPE_GENERIC_TYPE_SET,
- SEDS_NODETYPE_PARAMETER_SET,
- SEDS_NODETYPE_COMMAND_SET,
- SEDS_NODETYPE_GENERIC_TYPE_MAP_SET,
- SEDS_NODETYPE_CONSTRAINT_SET,
- SEDS_NODETYPE_DECLARED_INTERFACE_SET,
- SEDS_NODETYPE_PROVIDED_INTERFACE_SET,
- SEDS_NODETYPE_REQUIRED_INTERFACE_SET,
- SEDS_NODETYPE_COMPONENT_SET,
- SEDS_NODETYPE_ALTERNATE_SET,
- SEDS_NODETYPE_PARAMETER_MAP_SET,
- SEDS_NODETYPE_VARIABLE_SET,
- SEDS_NODETYPE_ACTIVITY_SET,
- SEDS_NODETYPE_METADATA_VALUE_SET,
- SEDS_NODETYPE_NOMINAL_RANGE_SET,
- SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP_SET,
- SEDS_NODETYPE_RANGE_SET,
- SEDS_NODETYPE_STATE_MACHINE_SET,
- SEDS_NODETYPE_SET_NODE_LAST, /**< Reserved index marker - not used */
-
- SEDS_NODETYPE_COMPONENT,
- SEDS_NODETYPE_COMMAND,
- SEDS_NODETYPE_IMPLEMENTATION,
- SEDS_NODETYPE_ALTERNATE,
- SEDS_NODETYPE_PARAMETER,
- SEDS_NODETYPE_ARGUMENT,
- SEDS_NODETYPE_GENERIC_TYPE_MAP,
- SEDS_NODETYPE_PARAMETER_MAP,
- SEDS_NODETYPE_VARIABLE,
-
- SEDS_NODETYPE_CONTAINER_ENTRY_LIST, /**< EntryList node (container types) */
- SEDS_NODETYPE_CONTAINER_TRAILER_ENTRY_LIST, /**< TrailerEntryList node (container types) */
- SEDS_NODETYPE_DIMENSION_LIST, /**< DimensionList node (array types) */
- SEDS_NODETYPE_ENUMERATION_LIST, /**< EnumerationList node (enumerated types) */
-
- /* Data type definition EDS nodes */
- SEDS_NODETYPE_SCALAR_DATATYPE_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_INTEGER_DATATYPE, /**< Integer Data type */
- SEDS_NODETYPE_FLOAT_DATATYPE, /**< Floating Point Data type */
- SEDS_NODETYPE_ENUMERATION_DATATYPE, /**< Enumerated Data type */
- SEDS_NODETYPE_BINARY_DATATYPE, /**< Binary Blob Data type */
- SEDS_NODETYPE_STRING_DATATYPE, /**< String Data type */
- SEDS_NODETYPE_BOOLEAN_DATATYPE, /**< Boolean Data type */
- SEDS_NODETYPE_SUBRANGE_DATATYPE, /**< SubRange Data type */
- SEDS_NODETYPE_SCALAR_DATATYPE_LAST, /**< Reserved index marker - not used */
-
- SEDS_NODETYPE_COMPOUND_DATATYPE_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_ARRAY_DATATYPE, /**< Array Data type */
- SEDS_NODETYPE_CONTAINER_DATATYPE, /**< Container Data type */
- SEDS_NODETYPE_COMPOUND_DATATYPE_LAST, /**< Reserved index marker - not used */
-
- SEDS_NODETYPE_DYNAMIC_DATATYPE_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_GENERIC_TYPE, /**< Generic Type (deferred definition) */
- SEDS_NODETYPE_ALIAS_DATATYPE, /**< Alias Data type */
- SEDS_NODETYPE_DYNAMIC_DATATYPE_LAST, /**< Reserved index marker - not used */
-
- SEDS_NODETYPE_INTERFACE_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_INTERFACE,
- SEDS_NODETYPE_DECLARED_INTERFACE,
- SEDS_NODETYPE_PROVIDED_INTERFACE,
- SEDS_NODETYPE_REQUIRED_INTERFACE,
- SEDS_NODETYPE_BASE_INTERFACE,
- SEDS_NODETYPE_INTERFACE_LAST, /**< Reserved index marker - not used */
-
- SEDS_NODETYPE_ENUMERATION_ENTRY, /**< Enumeration label node (enumerated types) */
- SEDS_NODETYPE_CONTAINER_ENTRY, /**< Entry node (container types) */
- SEDS_NODETYPE_CONTAINER_FIXED_VALUE_ENTRY, /**< Entry node (container types) */
- SEDS_NODETYPE_CONTAINER_PADDING_ENTRY, /**< Entry node (container types) */
- SEDS_NODETYPE_CONTAINER_LIST_ENTRY, /**< Entry node (container types) */
- SEDS_NODETYPE_CONTAINER_LENGTH_ENTRY, /**< Entry node (container types) */
- SEDS_NODETYPE_CONTAINER_ERROR_CONTROL_ENTRY, /**< Entry node (container types) */
-
- /* Contstraint nodes */
- SEDS_NODETYPE_CONSTRAINT_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_CONSTRAINT,
- SEDS_NODETYPE_TYPE_CONSTRAINT,
- SEDS_NODETYPE_RANGE_CONSTRAINT,
- SEDS_NODETYPE_VALUE_CONSTRAINT,
- SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT,
- SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT,
- SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT,
- SEDS_NODETYPE_CONSTRAINT_LAST, /**< Reserved index marker - not used */
-
- /* Encoding specifiers */
- SEDS_NODETYPE_ENCODING_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_INTEGER_DATA_ENCODING,
- SEDS_NODETYPE_FLOAT_DATA_ENCODING,
- SEDS_NODETYPE_STRING_DATA_ENCODING,
- SEDS_NODETYPE_ENCODING_LAST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_UNKNOWN, /**< Reserved value - for nodes that are ignored */
+ SEDS_NODETYPE_ROOT, /**< Root node of entire hierarchy */
+ SEDS_NODETYPE_CCSDS_STANDARD_FIRST, /**< Reserved index marker - not used */
- /* Range specifiers */
- SEDS_NODETYPE_RANGE_FIRST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_MINMAX_RANGE,
- SEDS_NODETYPE_PRECISION_RANGE,
- SEDS_NODETYPE_ENUMERATED_RANGE,
- SEDS_NODETYPE_RANGE_LAST, /**< Reserved index marker - not used */
+ /* Basic EDS node types */
+ SEDS_NODETYPE_DATASHEET, /**< Opening tag for SEDS datasheet */
+ SEDS_NODETYPE_PACKAGEFILE, /**< Opening tag for SEDS packagefile */
+ SEDS_NODETYPE_PACKAGE, /**< Package definition */
+ SEDS_NODETYPE_LONG_DESCRIPTION, /**< Long description (documentation) node */
+ SEDS_NODETYPE_SEMANTICS, /**< Extra usage semantics that are beyond EDS scope (TBD) */
- SEDS_NODETYPE_RANGE,
- SEDS_NODETYPE_VALID_RANGE,
-
- /* Dimension specifiers */
- SEDS_NODETYPE_DIMENSION, /**< Dimension node (array types) */
- SEDS_NODETYPE_ARRAY_DIMENSIONS,
-
- /* Calibration specifiers */
- SEDS_NODETYPE_SPLINE_CALIBRATOR, /**< Spline calibrator */
- SEDS_NODETYPE_POLYNOMIAL_CALIBRATOR, /**< Polynomial calibrator */
- SEDS_NODETYPE_SPLINE_POINT, /**< Spline point */
- SEDS_NODETYPE_POLYNOMIAL_TERM, /**< Polynomial term */
-
- /* Other SEDS XML elements */
- /* (These are acceptable per SEDS schema but may or may not be utilized) */
- SEDS_NODETYPE_ACTIVITY,
- SEDS_NODETYPE_ANDED_CONDITIONS,
- SEDS_NODETYPE_ARGUMENT_VALUE,
- SEDS_NODETYPE_ARRAY_DATA_TYPE,
- SEDS_NODETYPE_ASSIGNMENT,
- SEDS_NODETYPE_BODY,
- SEDS_NODETYPE_BOOLEAN_DATA_ENCODING,
- SEDS_NODETYPE_CALIBRATION,
- SEDS_NODETYPE_CALL,
- SEDS_NODETYPE_CATEGORY,
- SEDS_NODETYPE_COMPARISON_OPERATOR,
- SEDS_NODETYPE_CONDITIONAL,
- SEDS_NODETYPE_CONDITION,
- SEDS_NODETYPE_DATE_VALUE,
- SEDS_NODETYPE_DEVICE,
- SEDS_NODETYPE_DO,
- SEDS_NODETYPE_END_AT,
- SEDS_NODETYPE_ENTRY_STATE,
- SEDS_NODETYPE_EXIT_STATE,
- SEDS_NODETYPE_FIRST_OPERAND,
- SEDS_NODETYPE_FLOAT_VALUE,
- SEDS_NODETYPE_GET_ACTIVITY,
- SEDS_NODETYPE_GUARD,
- SEDS_NODETYPE_INTEGER_VALUE,
- SEDS_NODETYPE_ITERATION,
- SEDS_NODETYPE_LABEL,
- SEDS_NODETYPE_MATH_OPERATION,
- SEDS_NODETYPE_METADATA,
- SEDS_NODETYPE_ON_COMMAND_PRIMITIVE,
- SEDS_NODETYPE_ON_CONDITION_FALSE,
- SEDS_NODETYPE_ON_CONDITION_TRUE,
- SEDS_NODETYPE_ON_ENTRY,
- SEDS_NODETYPE_ON_EXIT,
- SEDS_NODETYPE_ON_PARAMETER_PRIMITIVE,
- SEDS_NODETYPE_ON_TIMER,
- SEDS_NODETYPE_OPERATOR,
- SEDS_NODETYPE_ORED_CONDITIONS,
- SEDS_NODETYPE_OVER_ARRAY,
- SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP,
- SEDS_NODETYPE_PRESENT_WHEN,
- SEDS_NODETYPE_PROVIDED,
- SEDS_NODETYPE_REQUIRED,
- SEDS_NODETYPE_SECOND_OPERAND,
- SEDS_NODETYPE_SEMANTICS_TERM,
- SEDS_NODETYPE_SEND_COMMAND_PRIMITIVE,
- SEDS_NODETYPE_SEND_PARAMETER_PRIMITIVE,
- SEDS_NODETYPE_SET_ACTIVITY_ONLY,
- SEDS_NODETYPE_SET_ACTIVITY,
- SEDS_NODETYPE_START_AT,
- SEDS_NODETYPE_STATE_MACHINE,
- SEDS_NODETYPE_STATE,
- SEDS_NODETYPE_STEP,
- SEDS_NODETYPE_STRING_VALUE,
- SEDS_NODETYPE_TRANSITION,
- SEDS_NODETYPE_TYPE_CONDITION,
- SEDS_NODETYPE_TYPE_OPERAND,
- SEDS_NODETYPE_VALUE,
- SEDS_NODETYPE_VARIABLE_REF,
-
- SEDS_NODETYPE_CCSDS_STANDARD_LAST, /**< Reserved index marker - not used */
-
- /*
- * ----------------------------------------------------------------------------------
- * Additional node types specific to this NASA cFS toolchain implementation
- *
- * These provide extra necessary information that the CCSDS SEDS specification currently does not cover.
- * These elements would generally be stripped out of XML files that were intended to be CCSDS SEDS-compliant,
- * and/or instantiated via supplemental XML files that are specific to this tool chain.
- * ----------------------------------------------------------------------------------
- */
+ /*
+ * SET and LIST EDS nodes: these are structural from the xml file and only exist
+ * to contain other nodes of a specific type
+ */
+ SEDS_NODETYPE_SET_NODE_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_DATA_TYPE_SET, /**< DataTypeSet node */
+ SEDS_NODETYPE_BASE_INTERFACE_SET,
+ SEDS_NODETYPE_GENERIC_TYPE_SET,
+ SEDS_NODETYPE_PARAMETER_SET,
+ SEDS_NODETYPE_COMMAND_SET,
+ SEDS_NODETYPE_GENERIC_TYPE_MAP_SET,
+ SEDS_NODETYPE_CONSTRAINT_SET,
+ SEDS_NODETYPE_DECLARED_INTERFACE_SET,
+ SEDS_NODETYPE_PROVIDED_INTERFACE_SET,
+ SEDS_NODETYPE_REQUIRED_INTERFACE_SET,
+ SEDS_NODETYPE_COMPONENT_SET,
+ SEDS_NODETYPE_ALTERNATE_SET,
+ SEDS_NODETYPE_PARAMETER_MAP_SET,
+ SEDS_NODETYPE_VARIABLE_SET,
+ SEDS_NODETYPE_ACTIVITY_SET,
+ SEDS_NODETYPE_METADATA_VALUE_SET,
+ SEDS_NODETYPE_NOMINAL_RANGE_SET,
+ SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP_SET,
+ SEDS_NODETYPE_RANGE_SET,
+ SEDS_NODETYPE_STATE_MACHINE_SET,
+ SEDS_NODETYPE_SET_NODE_LAST, /**< Reserved index marker - not used */
+
+ SEDS_NODETYPE_COMPONENT,
+ SEDS_NODETYPE_COMMAND,
+ SEDS_NODETYPE_IMPLEMENTATION,
+ SEDS_NODETYPE_ALTERNATE,
+ SEDS_NODETYPE_PARAMETER,
+ SEDS_NODETYPE_ARGUMENT,
+ SEDS_NODETYPE_GENERIC_TYPE_MAP,
+ SEDS_NODETYPE_PARAMETER_MAP,
+ SEDS_NODETYPE_VARIABLE,
+
+ SEDS_NODETYPE_CONTAINER_ENTRY_LIST, /**< EntryList node (container types) */
+ SEDS_NODETYPE_CONTAINER_TRAILER_ENTRY_LIST, /**< TrailerEntryList node (container types) */
+ SEDS_NODETYPE_DIMENSION_LIST, /**< DimensionList node (array types) */
+ SEDS_NODETYPE_ENUMERATION_LIST, /**< EnumerationList node (enumerated types) */
+
+ /* Data type definition EDS nodes */
+ SEDS_NODETYPE_SCALAR_DATATYPE_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_INTEGER_DATATYPE, /**< Integer Data type */
+ SEDS_NODETYPE_FLOAT_DATATYPE, /**< Floating Point Data type */
+ SEDS_NODETYPE_ENUMERATION_DATATYPE, /**< Enumerated Data type */
+ SEDS_NODETYPE_BINARY_DATATYPE, /**< Binary Blob Data type */
+ SEDS_NODETYPE_STRING_DATATYPE, /**< String Data type */
+ SEDS_NODETYPE_BOOLEAN_DATATYPE, /**< Boolean Data type */
+ SEDS_NODETYPE_SUBRANGE_DATATYPE, /**< SubRange Data type */
+ SEDS_NODETYPE_SCALAR_DATATYPE_LAST, /**< Reserved index marker - not used */
+
+ SEDS_NODETYPE_COMPOUND_DATATYPE_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_ARRAY_DATATYPE, /**< Array Data type */
+ SEDS_NODETYPE_CONTAINER_DATATYPE, /**< Container Data type */
+ SEDS_NODETYPE_COMPOUND_DATATYPE_LAST, /**< Reserved index marker - not used */
+
+ SEDS_NODETYPE_DYNAMIC_DATATYPE_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_GENERIC_TYPE, /**< Generic Type (deferred definition) */
+ SEDS_NODETYPE_ALIAS_DATATYPE, /**< Alias Data type */
+ SEDS_NODETYPE_DYNAMIC_DATATYPE_LAST, /**< Reserved index marker - not used */
+
+ SEDS_NODETYPE_INTERFACE_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_INTERFACE,
+ SEDS_NODETYPE_DECLARED_INTERFACE,
+ SEDS_NODETYPE_PROVIDED_INTERFACE,
+ SEDS_NODETYPE_REQUIRED_INTERFACE,
+ SEDS_NODETYPE_BASE_INTERFACE,
+ SEDS_NODETYPE_INTERFACE_LAST, /**< Reserved index marker - not used */
+
+ SEDS_NODETYPE_ENUMERATION_ENTRY, /**< Enumeration label node (enumerated types) */
+ SEDS_NODETYPE_CONTAINER_ENTRY, /**< Entry node (container types) */
+ SEDS_NODETYPE_CONTAINER_FIXED_VALUE_ENTRY, /**< Entry node (container types) */
+ SEDS_NODETYPE_CONTAINER_PADDING_ENTRY, /**< Entry node (container types) */
+ SEDS_NODETYPE_CONTAINER_LIST_ENTRY, /**< Entry node (container types) */
+ SEDS_NODETYPE_CONTAINER_LENGTH_ENTRY, /**< Entry node (container types) */
+ SEDS_NODETYPE_CONTAINER_ERROR_CONTROL_ENTRY, /**< Entry node (container types) */
+
+ /* Contstraint nodes */
+ SEDS_NODETYPE_CONSTRAINT_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_CONSTRAINT,
+ SEDS_NODETYPE_TYPE_CONSTRAINT,
+ SEDS_NODETYPE_RANGE_CONSTRAINT,
+ SEDS_NODETYPE_VALUE_CONSTRAINT,
+ SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT,
+ SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT,
+ SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT,
+ SEDS_NODETYPE_CONSTRAINT_LAST, /**< Reserved index marker - not used */
+
+ /* Encoding specifiers */
+ SEDS_NODETYPE_ENCODING_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_INTEGER_DATA_ENCODING,
+ SEDS_NODETYPE_FLOAT_DATA_ENCODING,
+ SEDS_NODETYPE_STRING_DATA_ENCODING,
+ SEDS_NODETYPE_ENCODING_LAST, /**< Reserved index marker - not used */
+
+ /* Range specifiers */
+ SEDS_NODETYPE_RANGE_FIRST, /**< Reserved index marker - not used */
+ SEDS_NODETYPE_MINMAX_RANGE,
+ SEDS_NODETYPE_PRECISION_RANGE,
+ SEDS_NODETYPE_ENUMERATED_RANGE,
+ SEDS_NODETYPE_RANGE_LAST, /**< Reserved index marker - not used */
+
+ SEDS_NODETYPE_RANGE,
+ SEDS_NODETYPE_VALID_RANGE,
+
+ /* Dimension specifiers */
+ SEDS_NODETYPE_DIMENSION, /**< Dimension node (array types) */
+ SEDS_NODETYPE_ARRAY_DIMENSIONS,
+
+ /* Calibration specifiers */
+ SEDS_NODETYPE_SPLINE_CALIBRATOR, /**< Spline calibrator */
+ SEDS_NODETYPE_POLYNOMIAL_CALIBRATOR, /**< Polynomial calibrator */
+ SEDS_NODETYPE_SPLINE_POINT, /**< Spline point */
+ SEDS_NODETYPE_POLYNOMIAL_TERM, /**< Polynomial term */
+
+ /* Other SEDS XML elements */
+ /* (These are acceptable per SEDS schema but may or may not be utilized) */
+ SEDS_NODETYPE_ACTIVITY,
+ SEDS_NODETYPE_ANDED_CONDITIONS,
+ SEDS_NODETYPE_ARGUMENT_VALUE,
+ SEDS_NODETYPE_ARRAY_DATA_TYPE,
+ SEDS_NODETYPE_ASSIGNMENT,
+ SEDS_NODETYPE_BODY,
+ SEDS_NODETYPE_BOOLEAN_DATA_ENCODING,
+ SEDS_NODETYPE_CALIBRATION,
+ SEDS_NODETYPE_CALL,
+ SEDS_NODETYPE_CATEGORY,
+ SEDS_NODETYPE_COMPARISON_OPERATOR,
+ SEDS_NODETYPE_CONDITIONAL,
+ SEDS_NODETYPE_CONDITION,
+ SEDS_NODETYPE_DATE_VALUE,
+ SEDS_NODETYPE_DEVICE,
+ SEDS_NODETYPE_DO,
+ SEDS_NODETYPE_END_AT,
+ SEDS_NODETYPE_ENTRY_STATE,
+ SEDS_NODETYPE_EXIT_STATE,
+ SEDS_NODETYPE_FIRST_OPERAND,
+ SEDS_NODETYPE_FLOAT_VALUE,
+ SEDS_NODETYPE_GET_ACTIVITY,
+ SEDS_NODETYPE_GUARD,
+ SEDS_NODETYPE_INTEGER_VALUE,
+ SEDS_NODETYPE_ITERATION,
+ SEDS_NODETYPE_LABEL,
+ SEDS_NODETYPE_MATH_OPERATION,
+ SEDS_NODETYPE_METADATA,
+ SEDS_NODETYPE_ON_COMMAND_PRIMITIVE,
+ SEDS_NODETYPE_ON_CONDITION_FALSE,
+ SEDS_NODETYPE_ON_CONDITION_TRUE,
+ SEDS_NODETYPE_ON_ENTRY,
+ SEDS_NODETYPE_ON_EXIT,
+ SEDS_NODETYPE_ON_PARAMETER_PRIMITIVE,
+ SEDS_NODETYPE_ON_TIMER,
+ SEDS_NODETYPE_OPERATOR,
+ SEDS_NODETYPE_ORED_CONDITIONS,
+ SEDS_NODETYPE_OVER_ARRAY,
+ SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP,
+ SEDS_NODETYPE_PRESENT_WHEN,
+ SEDS_NODETYPE_PROVIDED,
+ SEDS_NODETYPE_REQUIRED,
+ SEDS_NODETYPE_SECOND_OPERAND,
+ SEDS_NODETYPE_SEMANTICS_TERM,
+ SEDS_NODETYPE_SEND_COMMAND_PRIMITIVE,
+ SEDS_NODETYPE_SEND_PARAMETER_PRIMITIVE,
+ SEDS_NODETYPE_SET_ACTIVITY_ONLY,
+ SEDS_NODETYPE_SET_ACTIVITY,
+ SEDS_NODETYPE_START_AT,
+ SEDS_NODETYPE_STATE_MACHINE,
+ SEDS_NODETYPE_STATE,
+ SEDS_NODETYPE_STEP,
+ SEDS_NODETYPE_STRING_VALUE,
+ SEDS_NODETYPE_TRANSITION,
+ SEDS_NODETYPE_TYPE_CONDITION,
+ SEDS_NODETYPE_TYPE_OPERAND,
+ SEDS_NODETYPE_VALUE,
+ SEDS_NODETYPE_VARIABLE_REF,
+
+ SEDS_NODETYPE_CCSDS_STANDARD_LAST, /**< Reserved index marker - not used */
- SEDS_NODETYPE_XINCLUDE_PASSTHRU, /**< For Xinclude elements - ignored by this tool, suppresses warnings */
- SEDS_NODETYPE_DESCRIPTION_PASSTHRU, /**< Long description (documentation) continuation/pass-through node */
- SEDS_NODETYPE_DESIGN_PARAMETERS, /**< Opening tag for SEDS design-time parameter sheet (supplements the data sheet) */
- SEDS_NODETYPE_DEFINE, /**< Equate text name to value during pre-processing */
- SEDS_NODETYPE_INSTANCE_RULE_SET,
- SEDS_NODETYPE_INSTANCE_RULE,
- SEDS_NODETYPE_INTERFACE_MAP_SET,
- SEDS_NODETYPE_INTERFACE_MAP,
- SEDS_NODETYPE_PARAMETER_VALUE,
+ /*
+ * ----------------------------------------------------------------------------------
+ * Additional node types specific to this NASA cFS toolchain implementation
+ *
+ * These provide extra necessary information that the CCSDS SEDS specification currently does not cover.
+ * These elements would generally be stripped out of XML files that were intended to be CCSDS SEDS-compliant,
+ * and/or instantiated via supplemental XML files that are specific to this tool chain.
+ * ----------------------------------------------------------------------------------
+ */
- SEDS_NODETYPE_MAX
+ SEDS_NODETYPE_XINCLUDE_PASSTHRU, /**< For Xinclude elements - ignored by this tool, suppresses warnings */
+ SEDS_NODETYPE_DESCRIPTION_PASSTHRU, /**< Long description (documentation) continuation/pass-through node */
+ SEDS_NODETYPE_DESIGN_PARAMETERS, /**< Opening tag for SEDS design-time parameter sheet (supplements the data sheet)
+ */
+ SEDS_NODETYPE_DEFINE, /**< Equate text name to value during pre-processing */
+ SEDS_NODETYPE_INSTANCE_RULE_SET,
+ SEDS_NODETYPE_INSTANCE_RULE,
+ SEDS_NODETYPE_INTERFACE_MAP_SET,
+ SEDS_NODETYPE_INTERFACE_MAP,
+ SEDS_NODETYPE_PARAMETER_VALUE,
+
+ SEDS_NODETYPE_MAX
} seds_nodetype_t;
-#define SEDSTAG_IN_RANGE(typ,range) (((uint32_t)(typ)) > SEDS_NODETYPE_##range##_FIRST && ((uint32_t)(typ)) < SEDS_NODETYPE_##range##_LAST)
-#define SEDSTAG_IS_SCALAR_DATATYPE(t) SEDSTAG_IN_RANGE(t, SCALAR_DATATYPE)
-#define SEDSTAG_IS_COMPOUND_DATATYPE(t) SEDSTAG_IN_RANGE(t, COMPOUND_DATATYPE)
-#define SEDSTAG_IS_DYNAMIC_DATATYPE(t) SEDSTAG_IN_RANGE(t, DYNAMIC_DATATYPE)
-#define SEDSTAG_IS_NORMAL_DATATYPE(t) (SEDSTAG_IS_SCALAR_DATATYPE(t) || SEDSTAG_IS_COMPOUND_DATATYPE(t))
-#define SEDSTAG_IS_ANY_DATATYPE(t) (SEDSTAG_IS_SCALAR_DATATYPE(t) || SEDSTAG_IS_COMPOUND_DATATYPE(t) || SEDSTAG_IS_DYNAMIC_DATATYPE(t))
-#define SEDSTAG_IS_CONSTRAINT(t) SEDSTAG_IN_RANGE(t, CONSTRAINT)
-#define SEDSTAG_IS_ENCODING(t) SEDSTAG_IN_RANGE(t, ENCODING)
-#define SEDSTAG_IS_RANGE(t) SEDSTAG_IN_RANGE(t, RANGE)
-#define SEDSTAG_IS_INTERFACE(t) SEDSTAG_IN_RANGE(t, INTERFACE)
-#define SEDSTAG_IS_CCSDS_STANDARD(t) SEDSTAG_IN_RANGE(t, CCSDS_STANDARD)
-#define SEDSTAG_IS_VALID(t) ((t) != SEDS_NODETYPE_UNKNOWN && ((uint32_t)(t)) < SEDS_NODETYPE_MAX)
+#define SEDSTAG_IN_RANGE(typ, range) \
+ (((uint32_t)(typ)) > SEDS_NODETYPE_##range##_FIRST && ((uint32_t)(typ)) < SEDS_NODETYPE_##range##_LAST)
+#define SEDSTAG_IS_SCALAR_DATATYPE(t) SEDSTAG_IN_RANGE(t, SCALAR_DATATYPE)
+#define SEDSTAG_IS_COMPOUND_DATATYPE(t) SEDSTAG_IN_RANGE(t, COMPOUND_DATATYPE)
+#define SEDSTAG_IS_DYNAMIC_DATATYPE(t) SEDSTAG_IN_RANGE(t, DYNAMIC_DATATYPE)
+#define SEDSTAG_IS_NORMAL_DATATYPE(t) (SEDSTAG_IS_SCALAR_DATATYPE(t) || SEDSTAG_IS_COMPOUND_DATATYPE(t))
+#define SEDSTAG_IS_ANY_DATATYPE(t) \
+ (SEDSTAG_IS_SCALAR_DATATYPE(t) || SEDSTAG_IS_COMPOUND_DATATYPE(t) || SEDSTAG_IS_DYNAMIC_DATATYPE(t))
+#define SEDSTAG_IS_CONSTRAINT(t) SEDSTAG_IN_RANGE(t, CONSTRAINT)
+#define SEDSTAG_IS_ENCODING(t) SEDSTAG_IN_RANGE(t, ENCODING)
+#define SEDSTAG_IS_RANGE(t) SEDSTAG_IN_RANGE(t, RANGE)
+#define SEDSTAG_IS_INTERFACE(t) SEDSTAG_IN_RANGE(t, INTERFACE)
+#define SEDSTAG_IS_CCSDS_STANDARD(t) SEDSTAG_IN_RANGE(t, CCSDS_STANDARD)
+#define SEDSTAG_IS_VALID(t) ((t) != SEDS_NODETYPE_UNKNOWN && ((uint32_t)(t)) < SEDS_NODETYPE_MAX)
/**
* Basic DOM Node object
@@ -289,7 +291,7 @@ typedef enum
typedef struct
{
seds_nodetype_t node_type;
-} seds_node_t;
+} seds_node_t;
/**
* Push a new node onto the Lua stack.
@@ -314,6 +316,4 @@ seds_nodetype_t seds_tree_node_get_type(lua_State *lua, int pos);
*/
void seds_tree_node_register_globals(lua_State *lua);
-
-#endif /* _SEDS_TREE_NODE_H_ */
-
+#endif /* _SEDS_TREE_NODE_H_ */
diff --git a/tool/src/seds_user_message.c b/tool/src/seds_user_message.c
index bc8858e..fa26183 100644
--- a/tool/src/seds_user_message.c
+++ b/tool/src/seds_user_message.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_user_message.c
* \ingroup tool
@@ -30,7 +29,6 @@
* aids the operator should things go wrong.
*/
-
#include
#include
#include
@@ -43,10 +41,8 @@
#include "seds_user_message.h"
-
static seds_integer_t seds_global_message_counts[SEDS_USER_MESSAGE_MAX];
-
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
@@ -79,7 +75,7 @@ static int seds_lua_user_message(lua_State *lua)
{
const char *full_message = luaL_checkstring(lua, 1);
const char *filename;
- lua_Debug ar;
+ lua_Debug ar;
memset(&ar, 0, sizeof(ar));
lua_getstack(lua, 1, &ar);
@@ -90,8 +86,7 @@ static int seds_lua_user_message(lua_State *lua)
{
++filename;
}
- seds_user_message_preformat(lua_tointeger(lua, lua_upvalueindex(1)),
- filename, ar.currentline, full_message, NULL);
+ seds_user_message_preformat(lua_tointeger(lua, lua_upvalueindex(1)), filename, ar.currentline, full_message, NULL);
return 0;
}
@@ -106,30 +101,34 @@ static int seds_lua_user_message(lua_State *lua)
* External API function - see full details in prototype.
* ------------------------------------------------------
*/
-void seds_user_message_preformat(seds_user_message_t msgtype, const char *file, unsigned long line, const char *message1, const char *message2)
+void seds_user_message_preformat(seds_user_message_t msgtype,
+ const char *file,
+ unsigned long line,
+ const char *message1,
+ const char *message2)
{
const char *msgtag;
- switch(msgtype)
+ switch (msgtype)
{
- case SEDS_USER_MESSAGE_INFO:
- msgtag = "info";
- break;
- case SEDS_USER_MESSAGE_WARNING:
- msgtag = "warning";
- break;
- case SEDS_USER_MESSAGE_ERROR:
- msgtag = "error";
- break;
- case SEDS_USER_MESSAGE_FATAL:
- msgtag = "fatal";
- break;
- case SEDS_USER_MESSAGE_DEBUG:
- msgtag = "debug";
- break;
- default:
- msgtag = NULL;
- break;
+ case SEDS_USER_MESSAGE_INFO:
+ msgtag = "info";
+ break;
+ case SEDS_USER_MESSAGE_WARNING:
+ msgtag = "warning";
+ break;
+ case SEDS_USER_MESSAGE_ERROR:
+ msgtag = "error";
+ break;
+ case SEDS_USER_MESSAGE_FATAL:
+ msgtag = "fatal";
+ break;
+ case SEDS_USER_MESSAGE_DEBUG:
+ msgtag = "debug";
+ break;
+ default:
+ msgtag = NULL;
+ break;
}
if (msgtag == NULL)
@@ -173,9 +172,13 @@ void seds_user_message_preformat(seds_user_message_t msgtype, const char *file,
* External API function - see full details in prototype.
* ------------------------------------------------------
*/
-void seds_user_message_printf(seds_user_message_t msgtype, const char *file, unsigned long line, const char *format, ...)
+void seds_user_message_printf(seds_user_message_t msgtype,
+ const char *file,
+ unsigned long line,
+ const char *format,
+ ...)
{
- char full_message[256];
+ char full_message[256];
va_list va;
va_start(va, format);
diff --git a/tool/src/seds_user_message.h b/tool/src/seds_user_message.h
index 7f544c8..ea72d89 100644
--- a/tool/src/seds_user_message.h
+++ b/tool/src/seds_user_message.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_user_message.h
* \ingroup tool
@@ -43,21 +42,34 @@
* Useful for conditions where there is no valid/useful runtime recovery, e.g. if
* a call to malloc() returns NULL, no sense in going on.
*/
-#define SEDS_ASSERT(condition,message) { if (!(condition)) seds_user_message_preformat(SEDS_USER_MESSAGE_FATAL, __FILE__, __LINE__, "Assertion \'" #condition "\' failed", message); }
+#define SEDS_ASSERT(condition, message) \
+ { \
+ if (!(condition)) \
+ seds_user_message_preformat(SEDS_USER_MESSAGE_FATAL, \
+ __FILE__, \
+ __LINE__, \
+ "Assertion \'" #condition "\' failed", \
+ message); \
+ }
/**
* Report a message based on the host system "errno" value.
* The severity of the message is user-defined.
*/
-#define SEDS_REPORT_ERRNO(mt,x) { seds_user_message_errno(SEDS_USER_MESSAGE_ ## mt, __FILE__, __LINE__, x); }
+#define SEDS_REPORT_ERRNO(mt, x) \
+ { \
+ seds_user_message_errno(SEDS_USER_MESSAGE_##mt, __FILE__, __LINE__, x); \
+ }
/**
* Assert that a condition is true, trigger a "fatal" error and abort if not.
* The reported message to the user will be based on the host system "errno" value.
*/
-#define SEDS_ASSERT_ERRNO(cond,x) { if (!(cond)) SEDS_REPORT_ERRNO(FATAL, "Assertion \'" #cond "\' failed: " #x); }
-
-
+#define SEDS_ASSERT_ERRNO(cond, x) \
+ { \
+ if (!(cond)) \
+ SEDS_REPORT_ERRNO(FATAL, "Assertion \'" #cond "\' failed: " #x); \
+ }
/**
* Classification of various types of user messages.
@@ -90,7 +102,11 @@ typedef enum
* @param message1 the complete error message to display
* @param message2 additional details or context info about the error (may be NULL if no added details)
*/
-void seds_user_message_preformat(seds_user_message_t msgtype, const char *file, unsigned long line, const char *message1, const char *message2);
+void seds_user_message_preformat(seds_user_message_t msgtype,
+ const char *file,
+ unsigned long line,
+ const char *message1,
+ const char *message2);
/**
* Send any message to the user, using a printf-style format specification
@@ -104,7 +120,11 @@ void seds_user_message_preformat(seds_user_message_t msgtype, const char *file,
* @param line passed through to seds_user_message_impl
* @param format printf-style format string
*/
-void seds_user_message_printf(seds_user_message_t msgtype, const char *file, unsigned long line, const char *format, ...) SEDS_PRINTF(4,5);
+void seds_user_message_printf(seds_user_message_t msgtype,
+ const char *file,
+ unsigned long line,
+ const char *format,
+ ...) SEDS_PRINTF(4, 5);
/**
* Send an "errno" message to the user
@@ -121,7 +141,6 @@ void seds_user_message_printf(seds_user_message_t msgtype, const char *file, uns
*/
void seds_user_message_errno(seds_user_message_t msgtype, const char *file, unsigned long line, const char *message);
-
/**
* Return the number of times a message of the given type was generated
*
@@ -138,6 +157,4 @@ seds_integer_t seds_user_message_get_count(seds_user_message_t msgtype);
*/
void seds_user_message_register_globals(lua_State *lua);
-
-#endif /* _SEDS_USER_MESSAGE_H_ */
-
+#endif /* _SEDS_USER_MESSAGE_H_ */
diff --git a/tool/src/seds_xmlparser.c b/tool/src/seds_xmlparser.c
index 40e0927..e4adb53 100644
--- a/tool/src/seds_xmlparser.c
+++ b/tool/src/seds_xmlparser.c
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_xmlparser.c
* \ingroup tool
@@ -56,8 +55,7 @@
* As long as XML_Char type == char type, then this is a pass through
* If XML_Char is something different, this macro should provide a conversion
*/
-#define XML_CHAR_C(x) x
-
+#define XML_CHAR_C(x) x
/*
* Define the functions used for basic string ops on XML strings.
@@ -67,8 +65,8 @@
*
* (Use strcasecmp for case insensitivity during most operations)
*/
-#define XML_strcmp strcasecmp
-#define XML_tolower tolower
+#define XML_strcmp strcasecmp
+#define XML_tolower tolower
/**
* Structure to map between character based XML tags and
@@ -84,164 +82,163 @@ typedef struct
* Mapping table for start tags - comes from the SOIS EDS blue book
* Each defined XML tag should have an entry in this table and an associated enum label for that tag
*/
-static const seds_stringmap_t XML_SEDS_STARTTAG_MAP[] =
-{
-
- /* Element types defined by SEDS and supported by this toolchain */
- { .tag_name = XML_CHAR_C("ActivitySet"), .tag_id = SEDS_NODETYPE_ACTIVITY_SET },
- { .tag_name = XML_CHAR_C("Activity"), .tag_id = SEDS_NODETYPE_ACTIVITY },
- { .tag_name = XML_CHAR_C("AliasDataType"), .tag_id = SEDS_NODETYPE_ALIAS_DATATYPE },
- { .tag_name = XML_CHAR_C("AlternateSet"), .tag_id = SEDS_NODETYPE_ALTERNATE_SET },
- { .tag_name = XML_CHAR_C("Alternate"), .tag_id = SEDS_NODETYPE_ALTERNATE },
- { .tag_name = XML_CHAR_C("ANDedConditions"), .tag_id = SEDS_NODETYPE_ANDED_CONDITIONS },
- { .tag_name = XML_CHAR_C("Argument"), .tag_id = SEDS_NODETYPE_ARGUMENT },
- { .tag_name = XML_CHAR_C("ArgumentValue"), .tag_id = SEDS_NODETYPE_ARGUMENT_VALUE },
- { .tag_name = XML_CHAR_C("ArrayDataType"), .tag_id = SEDS_NODETYPE_ARRAY_DATATYPE },
- { .tag_name = XML_CHAR_C("ArrayDimensions"), .tag_id = SEDS_NODETYPE_ARRAY_DIMENSIONS },
- { .tag_name = XML_CHAR_C("Assignment"), .tag_id = SEDS_NODETYPE_ASSIGNMENT },
- { .tag_name = XML_CHAR_C("BaseInterfaceSet"), .tag_id = SEDS_NODETYPE_BASE_INTERFACE_SET },
- { .tag_name = XML_CHAR_C("BinaryDataType"), .tag_id = SEDS_NODETYPE_BINARY_DATATYPE },
- { .tag_name = XML_CHAR_C("Body"), .tag_id = SEDS_NODETYPE_BODY },
- { .tag_name = XML_CHAR_C("BooleanDataEncoding"), .tag_id = SEDS_NODETYPE_BOOLEAN_DATA_ENCODING },
- { .tag_name = XML_CHAR_C("BooleanDataType"), .tag_id = SEDS_NODETYPE_BOOLEAN_DATATYPE },
- { .tag_name = XML_CHAR_C("Calibration"), .tag_id = SEDS_NODETYPE_CALIBRATION },
- { .tag_name = XML_CHAR_C("Call"), .tag_id = SEDS_NODETYPE_CALL },
- { .tag_name = XML_CHAR_C("Category"), .tag_id = SEDS_NODETYPE_CATEGORY },
- { .tag_name = XML_CHAR_C("CommandSet"), .tag_id = SEDS_NODETYPE_COMMAND_SET },
- { .tag_name = XML_CHAR_C("Command"), .tag_id = SEDS_NODETYPE_COMMAND },
- { .tag_name = XML_CHAR_C("ComparisonOperator"), .tag_id = SEDS_NODETYPE_COMPARISON_OPERATOR },
- { .tag_name = XML_CHAR_C("ComponentSet"), .tag_id = SEDS_NODETYPE_COMPONENT_SET },
- { .tag_name = XML_CHAR_C("Component"), .tag_id = SEDS_NODETYPE_COMPONENT },
- { .tag_name = XML_CHAR_C("Conditional"), .tag_id = SEDS_NODETYPE_CONDITIONAL },
- { .tag_name = XML_CHAR_C("Condition"), .tag_id = SEDS_NODETYPE_CONDITION },
- { .tag_name = XML_CHAR_C("ConstraintSet"), .tag_id = SEDS_NODETYPE_CONSTRAINT_SET },
- { .tag_name = XML_CHAR_C("ContainerDataType"), .tag_id = SEDS_NODETYPE_CONTAINER_DATATYPE },
- { .tag_name = XML_CHAR_C("DataSheet"), .tag_id = SEDS_NODETYPE_DATASHEET },
- { .tag_name = XML_CHAR_C("DataTypeSet"), .tag_id = SEDS_NODETYPE_DATA_TYPE_SET },
- { .tag_name = XML_CHAR_C("DateValue"), .tag_id = SEDS_NODETYPE_DATE_VALUE },
- { .tag_name = XML_CHAR_C("DeclaredInterfaceSet"), .tag_id = SEDS_NODETYPE_DECLARED_INTERFACE_SET },
- { .tag_name = XML_CHAR_C("Device"), .tag_id = SEDS_NODETYPE_DEVICE },
- { .tag_name = XML_CHAR_C("DimensionList"), .tag_id = SEDS_NODETYPE_DIMENSION_LIST },
- { .tag_name = XML_CHAR_C("Dimension"), .tag_id = SEDS_NODETYPE_DIMENSION },
- { .tag_name = XML_CHAR_C("Do"), .tag_id = SEDS_NODETYPE_DO },
- { .tag_name = XML_CHAR_C("EndAt"), .tag_id = SEDS_NODETYPE_END_AT },
- { .tag_name = XML_CHAR_C("EntryList"), .tag_id = SEDS_NODETYPE_CONTAINER_ENTRY_LIST },
- { .tag_name = XML_CHAR_C("EntryState"), .tag_id = SEDS_NODETYPE_ENTRY_STATE },
- { .tag_name = XML_CHAR_C("Entry"), .tag_id = SEDS_NODETYPE_CONTAINER_ENTRY },
- { .tag_name = XML_CHAR_C("EnumeratedDataType"), .tag_id = SEDS_NODETYPE_ENUMERATION_DATATYPE },
- { .tag_name = XML_CHAR_C("EnumeratedRange"), .tag_id = SEDS_NODETYPE_ENUMERATED_RANGE },
- { .tag_name = XML_CHAR_C("EnumerationList"), .tag_id = SEDS_NODETYPE_ENUMERATION_LIST },
- { .tag_name = XML_CHAR_C("Enumeration"), .tag_id = SEDS_NODETYPE_ENUMERATION_ENTRY },
- { .tag_name = XML_CHAR_C("ErrorControlEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_ERROR_CONTROL_ENTRY },
- { .tag_name = XML_CHAR_C("ExitState"), .tag_id = SEDS_NODETYPE_EXIT_STATE },
- { .tag_name = XML_CHAR_C("FirstOperand"), .tag_id = SEDS_NODETYPE_FIRST_OPERAND },
- { .tag_name = XML_CHAR_C("FixedValueEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_FIXED_VALUE_ENTRY },
- { .tag_name = XML_CHAR_C("FloatDataEncoding"), .tag_id = SEDS_NODETYPE_FLOAT_DATA_ENCODING },
- { .tag_name = XML_CHAR_C("FloatDataType"), .tag_id = SEDS_NODETYPE_FLOAT_DATATYPE },
- { .tag_name = XML_CHAR_C("FloatValue"), .tag_id = SEDS_NODETYPE_FLOAT_VALUE },
- { .tag_name = XML_CHAR_C("GenericTypeMapSet"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE_MAP_SET },
- { .tag_name = XML_CHAR_C("GenericTypeMap"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE_MAP },
- { .tag_name = XML_CHAR_C("GenericTypeSet"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE_SET },
- { .tag_name = XML_CHAR_C("GenericType"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE },
- { .tag_name = XML_CHAR_C("GetActivity"), .tag_id = SEDS_NODETYPE_GET_ACTIVITY },
- { .tag_name = XML_CHAR_C("Guard"), .tag_id = SEDS_NODETYPE_GUARD },
- { .tag_name = XML_CHAR_C("Implementation"), .tag_id = SEDS_NODETYPE_IMPLEMENTATION },
- { .tag_name = XML_CHAR_C("IntegerDataEncoding"), .tag_id = SEDS_NODETYPE_INTEGER_DATA_ENCODING },
- { .tag_name = XML_CHAR_C("IntegerDataType"), .tag_id = SEDS_NODETYPE_INTEGER_DATATYPE },
- { .tag_name = XML_CHAR_C("IntegerValue"), .tag_id = SEDS_NODETYPE_INTEGER_VALUE },
- { .tag_name = XML_CHAR_C("Interface"), .tag_id = SEDS_NODETYPE_INTERFACE },
- { .tag_name = XML_CHAR_C("Iteration"), .tag_id = SEDS_NODETYPE_ITERATION },
- { .tag_name = XML_CHAR_C("Label"), .tag_id = SEDS_NODETYPE_LABEL },
- { .tag_name = XML_CHAR_C("LengthEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_LENGTH_ENTRY },
- { .tag_name = XML_CHAR_C("ListEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_LIST_ENTRY },
- { .tag_name = XML_CHAR_C("LongDescription"), .tag_id = SEDS_NODETYPE_LONG_DESCRIPTION },
- { .tag_name = XML_CHAR_C("MathOperation"), .tag_id = SEDS_NODETYPE_MATH_OPERATION },
- { .tag_name = XML_CHAR_C("Metadata"), .tag_id = SEDS_NODETYPE_METADATA },
- { .tag_name = XML_CHAR_C("MetadataValueSet"), .tag_id = SEDS_NODETYPE_METADATA_VALUE_SET },
- { .tag_name = XML_CHAR_C("MinMaxRange"), .tag_id = SEDS_NODETYPE_MINMAX_RANGE },
- { .tag_name = XML_CHAR_C("NominalRangeSet"), .tag_id = SEDS_NODETYPE_NOMINAL_RANGE_SET },
- { .tag_name = XML_CHAR_C("OnCommandPrimitive"), .tag_id = SEDS_NODETYPE_ON_COMMAND_PRIMITIVE },
- { .tag_name = XML_CHAR_C("OnConditionFalse"), .tag_id = SEDS_NODETYPE_ON_CONDITION_FALSE },
- { .tag_name = XML_CHAR_C("OnConditionTrue"), .tag_id = SEDS_NODETYPE_ON_CONDITION_TRUE },
- { .tag_name = XML_CHAR_C("OnEntry"), .tag_id = SEDS_NODETYPE_ON_ENTRY },
- { .tag_name = XML_CHAR_C("OnExit"), .tag_id = SEDS_NODETYPE_ON_EXIT },
- { .tag_name = XML_CHAR_C("OnParameterPrimitive"), .tag_id = SEDS_NODETYPE_ON_PARAMETER_PRIMITIVE },
- { .tag_name = XML_CHAR_C("OnTimer"), .tag_id = SEDS_NODETYPE_ON_TIMER },
- { .tag_name = XML_CHAR_C("Operator"), .tag_id = SEDS_NODETYPE_OPERATOR },
- { .tag_name = XML_CHAR_C("ORedConditions"), .tag_id = SEDS_NODETYPE_ORED_CONDITIONS },
- { .tag_name = XML_CHAR_C("OverArray"), .tag_id = SEDS_NODETYPE_OVER_ARRAY },
- { .tag_name = XML_CHAR_C("PackageFile"), .tag_id = SEDS_NODETYPE_PACKAGEFILE },
- { .tag_name = XML_CHAR_C("Package"), .tag_id = SEDS_NODETYPE_PACKAGE },
- { .tag_name = XML_CHAR_C("PaddingEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_PADDING_ENTRY },
- { .tag_name = XML_CHAR_C("ParameterActivityMapSet"),.tag_id = SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP_SET },
- { .tag_name = XML_CHAR_C("ParameterActivityMap"), .tag_id = SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP },
- { .tag_name = XML_CHAR_C("ParameterMapSet"), .tag_id = SEDS_NODETYPE_PARAMETER_MAP_SET },
- { .tag_name = XML_CHAR_C("ParameterMap"), .tag_id = SEDS_NODETYPE_PARAMETER_MAP },
- { .tag_name = XML_CHAR_C("ParameterSet"), .tag_id = SEDS_NODETYPE_PARAMETER_SET },
- { .tag_name = XML_CHAR_C("Parameter"), .tag_id = SEDS_NODETYPE_PARAMETER },
- { .tag_name = XML_CHAR_C("PolynomialCalibrator"), .tag_id = SEDS_NODETYPE_POLYNOMIAL_CALIBRATOR },
- { .tag_name = XML_CHAR_C("PrecisionRange"), .tag_id = SEDS_NODETYPE_PRECISION_RANGE },
- { .tag_name = XML_CHAR_C("PresentWhen"), .tag_id = SEDS_NODETYPE_PRESENT_WHEN },
- { .tag_name = XML_CHAR_C("ProvidedInterfaceSet"), .tag_id = SEDS_NODETYPE_PROVIDED_INTERFACE_SET },
- { .tag_name = XML_CHAR_C("Provided"), .tag_id = SEDS_NODETYPE_PROVIDED },
- { .tag_name = XML_CHAR_C("RangeConstraint"), .tag_id = SEDS_NODETYPE_RANGE_CONSTRAINT },
- { .tag_name = XML_CHAR_C("RangeSet"), .tag_id = SEDS_NODETYPE_RANGE_SET },
- { .tag_name = XML_CHAR_C("Range"), .tag_id = SEDS_NODETYPE_RANGE },
- { .tag_name = XML_CHAR_C("RequiredInterfaceSet"), .tag_id = SEDS_NODETYPE_REQUIRED_INTERFACE_SET },
- { .tag_name = XML_CHAR_C("Required"), .tag_id = SEDS_NODETYPE_REQUIRED },
- { .tag_name = XML_CHAR_C("SecondOperand"), .tag_id = SEDS_NODETYPE_SECOND_OPERAND },
- { .tag_name = XML_CHAR_C("Semantics"), .tag_id = SEDS_NODETYPE_SEMANTICS },
- { .tag_name = XML_CHAR_C("SemanticsTerm"), .tag_id = SEDS_NODETYPE_SEMANTICS_TERM },
- { .tag_name = XML_CHAR_C("SendCommandPrimitive"), .tag_id = SEDS_NODETYPE_SEND_COMMAND_PRIMITIVE },
- { .tag_name = XML_CHAR_C("SendParameterPrimitive"), .tag_id = SEDS_NODETYPE_SEND_PARAMETER_PRIMITIVE},
- { .tag_name = XML_CHAR_C("SetActivityOnly"), .tag_id = SEDS_NODETYPE_SET_ACTIVITY_ONLY },
- { .tag_name = XML_CHAR_C("SetActivity"), .tag_id = SEDS_NODETYPE_SET_ACTIVITY },
- { .tag_name = XML_CHAR_C("SplineCalibrator"), .tag_id = SEDS_NODETYPE_SPLINE_CALIBRATOR },
- { .tag_name = XML_CHAR_C("SplinePoint"), .tag_id = SEDS_NODETYPE_SPLINE_POINT },
- { .tag_name = XML_CHAR_C("StartAt"), .tag_id = SEDS_NODETYPE_START_AT },
- { .tag_name = XML_CHAR_C("StateMachineSet"), .tag_id = SEDS_NODETYPE_STATE_MACHINE_SET },
- { .tag_name = XML_CHAR_C("StateMachine"), .tag_id = SEDS_NODETYPE_STATE_MACHINE },
- { .tag_name = XML_CHAR_C("State"), .tag_id = SEDS_NODETYPE_STATE },
- { .tag_name = XML_CHAR_C("Step"), .tag_id = SEDS_NODETYPE_STEP },
- { .tag_name = XML_CHAR_C("StringDataEncoding"), .tag_id = SEDS_NODETYPE_STRING_DATA_ENCODING },
- { .tag_name = XML_CHAR_C("StringDataType"), .tag_id = SEDS_NODETYPE_STRING_DATATYPE },
- { .tag_name = XML_CHAR_C("StringValue"), .tag_id = SEDS_NODETYPE_STRING_VALUE },
- { .tag_name = XML_CHAR_C("SubRangeDataType"), .tag_id = SEDS_NODETYPE_SUBRANGE_DATATYPE },
- { .tag_name = XML_CHAR_C("Term"), .tag_id = SEDS_NODETYPE_POLYNOMIAL_TERM },
- { .tag_name = XML_CHAR_C("TrailerEntryList"), .tag_id = SEDS_NODETYPE_CONTAINER_TRAILER_ENTRY_LIST },
- { .tag_name = XML_CHAR_C("Transition"), .tag_id = SEDS_NODETYPE_TRANSITION },
- { .tag_name = XML_CHAR_C("TypeCondition"), .tag_id = SEDS_NODETYPE_TYPE_CONDITION },
- { .tag_name = XML_CHAR_C("TypeConstraint"), .tag_id = SEDS_NODETYPE_TYPE_CONSTRAINT },
- { .tag_name = XML_CHAR_C("TypeOperand"), .tag_id = SEDS_NODETYPE_TYPE_OPERAND },
- { .tag_name = XML_CHAR_C("ValidRange"), .tag_id = SEDS_NODETYPE_VALID_RANGE },
- { .tag_name = XML_CHAR_C("ValueConstraint"), .tag_id = SEDS_NODETYPE_VALUE_CONSTRAINT },
- { .tag_name = XML_CHAR_C("Value"), .tag_id = SEDS_NODETYPE_VALUE },
- { .tag_name = XML_CHAR_C("VariableRef"), .tag_id = SEDS_NODETYPE_VARIABLE_REF },
- { .tag_name = XML_CHAR_C("VariableSet"), .tag_id = SEDS_NODETYPE_VARIABLE_SET },
- { .tag_name = XML_CHAR_C("Variable"), .tag_id = SEDS_NODETYPE_VARIABLE },
-
- /* catch instances of xi:include, these are ignored by this tool but do not generate warnings */
- { .tag_name = XML_CHAR_C("xi:include"), .tag_id = SEDS_NODETYPE_XINCLUDE_PASSTHRU },
-
- /* Extra Element types _not_ defined by SEDS that this toolchain supports (SEDS supplement) */
- { .tag_name = XML_CHAR_C("DesignParameters"), .tag_id = SEDS_NODETYPE_DESIGN_PARAMETERS },
- { .tag_name = XML_CHAR_C("Define"), .tag_id = SEDS_NODETYPE_DEFINE },
- { .tag_name = XML_CHAR_C("InstanceRuleSet"), .tag_id = SEDS_NODETYPE_INSTANCE_RULE_SET },
- { .tag_name = XML_CHAR_C("InstanceRule"), .tag_id = SEDS_NODETYPE_INSTANCE_RULE },
- { .tag_name = XML_CHAR_C("InterfaceMapSet"), .tag_id = SEDS_NODETYPE_INTERFACE_MAP_SET },
- { .tag_name = XML_CHAR_C("InterfaceMap"), .tag_id = SEDS_NODETYPE_INTERFACE_MAP },
- { .tag_name = XML_CHAR_C("ParameterValue"), .tag_id = SEDS_NODETYPE_PARAMETER_VALUE },
- { .tag_name = XML_CHAR_C("DeclaredInterface"), .tag_id = SEDS_NODETYPE_DECLARED_INTERFACE },
- { .tag_name = XML_CHAR_C("ProvidedInterface"), .tag_id = SEDS_NODETYPE_PROVIDED_INTERFACE },
- { .tag_name = XML_CHAR_C("RequiredInterface"), .tag_id = SEDS_NODETYPE_REQUIRED_INTERFACE },
-
- /* these are variations of the constraint elements that appear within PresentWhen elements */
- { .tag_name = XML_CHAR_C("PresenceTypeConstraint"), .tag_id = SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT },
- { .tag_name = XML_CHAR_C("PresenceRangeConstraint"), .tag_id = SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT },
- { .tag_name = XML_CHAR_C("PresenceValueConstraint"), .tag_id = SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT },
-
- /* Keep NULL tag last - absolute end of list marker */
- { .tag_name = NULL, .tag_id = SEDS_NODETYPE_UNKNOWN }
+static const seds_stringmap_t XML_SEDS_STARTTAG_MAP[] = {
+
+ /* Element types defined by SEDS and supported by this toolchain */
+ { .tag_name = XML_CHAR_C("ActivitySet"), .tag_id = SEDS_NODETYPE_ACTIVITY_SET },
+ { .tag_name = XML_CHAR_C("Activity"), .tag_id = SEDS_NODETYPE_ACTIVITY },
+ { .tag_name = XML_CHAR_C("AliasDataType"), .tag_id = SEDS_NODETYPE_ALIAS_DATATYPE },
+ { .tag_name = XML_CHAR_C("AlternateSet"), .tag_id = SEDS_NODETYPE_ALTERNATE_SET },
+ { .tag_name = XML_CHAR_C("Alternate"), .tag_id = SEDS_NODETYPE_ALTERNATE },
+ { .tag_name = XML_CHAR_C("ANDedConditions"), .tag_id = SEDS_NODETYPE_ANDED_CONDITIONS },
+ { .tag_name = XML_CHAR_C("Argument"), .tag_id = SEDS_NODETYPE_ARGUMENT },
+ { .tag_name = XML_CHAR_C("ArgumentValue"), .tag_id = SEDS_NODETYPE_ARGUMENT_VALUE },
+ { .tag_name = XML_CHAR_C("ArrayDataType"), .tag_id = SEDS_NODETYPE_ARRAY_DATATYPE },
+ { .tag_name = XML_CHAR_C("ArrayDimensions"), .tag_id = SEDS_NODETYPE_ARRAY_DIMENSIONS },
+ { .tag_name = XML_CHAR_C("Assignment"), .tag_id = SEDS_NODETYPE_ASSIGNMENT },
+ { .tag_name = XML_CHAR_C("BaseInterfaceSet"), .tag_id = SEDS_NODETYPE_BASE_INTERFACE_SET },
+ { .tag_name = XML_CHAR_C("BinaryDataType"), .tag_id = SEDS_NODETYPE_BINARY_DATATYPE },
+ { .tag_name = XML_CHAR_C("Body"), .tag_id = SEDS_NODETYPE_BODY },
+ { .tag_name = XML_CHAR_C("BooleanDataEncoding"), .tag_id = SEDS_NODETYPE_BOOLEAN_DATA_ENCODING },
+ { .tag_name = XML_CHAR_C("BooleanDataType"), .tag_id = SEDS_NODETYPE_BOOLEAN_DATATYPE },
+ { .tag_name = XML_CHAR_C("Calibration"), .tag_id = SEDS_NODETYPE_CALIBRATION },
+ { .tag_name = XML_CHAR_C("Call"), .tag_id = SEDS_NODETYPE_CALL },
+ { .tag_name = XML_CHAR_C("Category"), .tag_id = SEDS_NODETYPE_CATEGORY },
+ { .tag_name = XML_CHAR_C("CommandSet"), .tag_id = SEDS_NODETYPE_COMMAND_SET },
+ { .tag_name = XML_CHAR_C("Command"), .tag_id = SEDS_NODETYPE_COMMAND },
+ { .tag_name = XML_CHAR_C("ComparisonOperator"), .tag_id = SEDS_NODETYPE_COMPARISON_OPERATOR },
+ { .tag_name = XML_CHAR_C("ComponentSet"), .tag_id = SEDS_NODETYPE_COMPONENT_SET },
+ { .tag_name = XML_CHAR_C("Component"), .tag_id = SEDS_NODETYPE_COMPONENT },
+ { .tag_name = XML_CHAR_C("Conditional"), .tag_id = SEDS_NODETYPE_CONDITIONAL },
+ { .tag_name = XML_CHAR_C("Condition"), .tag_id = SEDS_NODETYPE_CONDITION },
+ { .tag_name = XML_CHAR_C("ConstraintSet"), .tag_id = SEDS_NODETYPE_CONSTRAINT_SET },
+ { .tag_name = XML_CHAR_C("ContainerDataType"), .tag_id = SEDS_NODETYPE_CONTAINER_DATATYPE },
+ { .tag_name = XML_CHAR_C("DataSheet"), .tag_id = SEDS_NODETYPE_DATASHEET },
+ { .tag_name = XML_CHAR_C("DataTypeSet"), .tag_id = SEDS_NODETYPE_DATA_TYPE_SET },
+ { .tag_name = XML_CHAR_C("DateValue"), .tag_id = SEDS_NODETYPE_DATE_VALUE },
+ { .tag_name = XML_CHAR_C("DeclaredInterfaceSet"), .tag_id = SEDS_NODETYPE_DECLARED_INTERFACE_SET },
+ { .tag_name = XML_CHAR_C("Device"), .tag_id = SEDS_NODETYPE_DEVICE },
+ { .tag_name = XML_CHAR_C("DimensionList"), .tag_id = SEDS_NODETYPE_DIMENSION_LIST },
+ { .tag_name = XML_CHAR_C("Dimension"), .tag_id = SEDS_NODETYPE_DIMENSION },
+ { .tag_name = XML_CHAR_C("Do"), .tag_id = SEDS_NODETYPE_DO },
+ { .tag_name = XML_CHAR_C("EndAt"), .tag_id = SEDS_NODETYPE_END_AT },
+ { .tag_name = XML_CHAR_C("EntryList"), .tag_id = SEDS_NODETYPE_CONTAINER_ENTRY_LIST },
+ { .tag_name = XML_CHAR_C("EntryState"), .tag_id = SEDS_NODETYPE_ENTRY_STATE },
+ { .tag_name = XML_CHAR_C("Entry"), .tag_id = SEDS_NODETYPE_CONTAINER_ENTRY },
+ { .tag_name = XML_CHAR_C("EnumeratedDataType"), .tag_id = SEDS_NODETYPE_ENUMERATION_DATATYPE },
+ { .tag_name = XML_CHAR_C("EnumeratedRange"), .tag_id = SEDS_NODETYPE_ENUMERATED_RANGE },
+ { .tag_name = XML_CHAR_C("EnumerationList"), .tag_id = SEDS_NODETYPE_ENUMERATION_LIST },
+ { .tag_name = XML_CHAR_C("Enumeration"), .tag_id = SEDS_NODETYPE_ENUMERATION_ENTRY },
+ { .tag_name = XML_CHAR_C("ErrorControlEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_ERROR_CONTROL_ENTRY },
+ { .tag_name = XML_CHAR_C("ExitState"), .tag_id = SEDS_NODETYPE_EXIT_STATE },
+ { .tag_name = XML_CHAR_C("FirstOperand"), .tag_id = SEDS_NODETYPE_FIRST_OPERAND },
+ { .tag_name = XML_CHAR_C("FixedValueEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_FIXED_VALUE_ENTRY },
+ { .tag_name = XML_CHAR_C("FloatDataEncoding"), .tag_id = SEDS_NODETYPE_FLOAT_DATA_ENCODING },
+ { .tag_name = XML_CHAR_C("FloatDataType"), .tag_id = SEDS_NODETYPE_FLOAT_DATATYPE },
+ { .tag_name = XML_CHAR_C("FloatValue"), .tag_id = SEDS_NODETYPE_FLOAT_VALUE },
+ { .tag_name = XML_CHAR_C("GenericTypeMapSet"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE_MAP_SET },
+ { .tag_name = XML_CHAR_C("GenericTypeMap"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE_MAP },
+ { .tag_name = XML_CHAR_C("GenericTypeSet"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE_SET },
+ { .tag_name = XML_CHAR_C("GenericType"), .tag_id = SEDS_NODETYPE_GENERIC_TYPE },
+ { .tag_name = XML_CHAR_C("GetActivity"), .tag_id = SEDS_NODETYPE_GET_ACTIVITY },
+ { .tag_name = XML_CHAR_C("Guard"), .tag_id = SEDS_NODETYPE_GUARD },
+ { .tag_name = XML_CHAR_C("Implementation"), .tag_id = SEDS_NODETYPE_IMPLEMENTATION },
+ { .tag_name = XML_CHAR_C("IntegerDataEncoding"), .tag_id = SEDS_NODETYPE_INTEGER_DATA_ENCODING },
+ { .tag_name = XML_CHAR_C("IntegerDataType"), .tag_id = SEDS_NODETYPE_INTEGER_DATATYPE },
+ { .tag_name = XML_CHAR_C("IntegerValue"), .tag_id = SEDS_NODETYPE_INTEGER_VALUE },
+ { .tag_name = XML_CHAR_C("Interface"), .tag_id = SEDS_NODETYPE_INTERFACE },
+ { .tag_name = XML_CHAR_C("Iteration"), .tag_id = SEDS_NODETYPE_ITERATION },
+ { .tag_name = XML_CHAR_C("Label"), .tag_id = SEDS_NODETYPE_LABEL },
+ { .tag_name = XML_CHAR_C("LengthEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_LENGTH_ENTRY },
+ { .tag_name = XML_CHAR_C("ListEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_LIST_ENTRY },
+ { .tag_name = XML_CHAR_C("LongDescription"), .tag_id = SEDS_NODETYPE_LONG_DESCRIPTION },
+ { .tag_name = XML_CHAR_C("MathOperation"), .tag_id = SEDS_NODETYPE_MATH_OPERATION },
+ { .tag_name = XML_CHAR_C("Metadata"), .tag_id = SEDS_NODETYPE_METADATA },
+ { .tag_name = XML_CHAR_C("MetadataValueSet"), .tag_id = SEDS_NODETYPE_METADATA_VALUE_SET },
+ { .tag_name = XML_CHAR_C("MinMaxRange"), .tag_id = SEDS_NODETYPE_MINMAX_RANGE },
+ { .tag_name = XML_CHAR_C("NominalRangeSet"), .tag_id = SEDS_NODETYPE_NOMINAL_RANGE_SET },
+ { .tag_name = XML_CHAR_C("OnCommandPrimitive"), .tag_id = SEDS_NODETYPE_ON_COMMAND_PRIMITIVE },
+ { .tag_name = XML_CHAR_C("OnConditionFalse"), .tag_id = SEDS_NODETYPE_ON_CONDITION_FALSE },
+ { .tag_name = XML_CHAR_C("OnConditionTrue"), .tag_id = SEDS_NODETYPE_ON_CONDITION_TRUE },
+ { .tag_name = XML_CHAR_C("OnEntry"), .tag_id = SEDS_NODETYPE_ON_ENTRY },
+ { .tag_name = XML_CHAR_C("OnExit"), .tag_id = SEDS_NODETYPE_ON_EXIT },
+ { .tag_name = XML_CHAR_C("OnParameterPrimitive"), .tag_id = SEDS_NODETYPE_ON_PARAMETER_PRIMITIVE },
+ { .tag_name = XML_CHAR_C("OnTimer"), .tag_id = SEDS_NODETYPE_ON_TIMER },
+ { .tag_name = XML_CHAR_C("Operator"), .tag_id = SEDS_NODETYPE_OPERATOR },
+ { .tag_name = XML_CHAR_C("ORedConditions"), .tag_id = SEDS_NODETYPE_ORED_CONDITIONS },
+ { .tag_name = XML_CHAR_C("OverArray"), .tag_id = SEDS_NODETYPE_OVER_ARRAY },
+ { .tag_name = XML_CHAR_C("PackageFile"), .tag_id = SEDS_NODETYPE_PACKAGEFILE },
+ { .tag_name = XML_CHAR_C("Package"), .tag_id = SEDS_NODETYPE_PACKAGE },
+ { .tag_name = XML_CHAR_C("PaddingEntry"), .tag_id = SEDS_NODETYPE_CONTAINER_PADDING_ENTRY },
+ { .tag_name = XML_CHAR_C("ParameterActivityMapSet"), .tag_id = SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP_SET },
+ { .tag_name = XML_CHAR_C("ParameterActivityMap"), .tag_id = SEDS_NODETYPE_PARAMETER_ACTIVITY_MAP },
+ { .tag_name = XML_CHAR_C("ParameterMapSet"), .tag_id = SEDS_NODETYPE_PARAMETER_MAP_SET },
+ { .tag_name = XML_CHAR_C("ParameterMap"), .tag_id = SEDS_NODETYPE_PARAMETER_MAP },
+ { .tag_name = XML_CHAR_C("ParameterSet"), .tag_id = SEDS_NODETYPE_PARAMETER_SET },
+ { .tag_name = XML_CHAR_C("Parameter"), .tag_id = SEDS_NODETYPE_PARAMETER },
+ { .tag_name = XML_CHAR_C("PolynomialCalibrator"), .tag_id = SEDS_NODETYPE_POLYNOMIAL_CALIBRATOR },
+ { .tag_name = XML_CHAR_C("PrecisionRange"), .tag_id = SEDS_NODETYPE_PRECISION_RANGE },
+ { .tag_name = XML_CHAR_C("PresentWhen"), .tag_id = SEDS_NODETYPE_PRESENT_WHEN },
+ { .tag_name = XML_CHAR_C("ProvidedInterfaceSet"), .tag_id = SEDS_NODETYPE_PROVIDED_INTERFACE_SET },
+ { .tag_name = XML_CHAR_C("Provided"), .tag_id = SEDS_NODETYPE_PROVIDED },
+ { .tag_name = XML_CHAR_C("RangeConstraint"), .tag_id = SEDS_NODETYPE_RANGE_CONSTRAINT },
+ { .tag_name = XML_CHAR_C("RangeSet"), .tag_id = SEDS_NODETYPE_RANGE_SET },
+ { .tag_name = XML_CHAR_C("Range"), .tag_id = SEDS_NODETYPE_RANGE },
+ { .tag_name = XML_CHAR_C("RequiredInterfaceSet"), .tag_id = SEDS_NODETYPE_REQUIRED_INTERFACE_SET },
+ { .tag_name = XML_CHAR_C("Required"), .tag_id = SEDS_NODETYPE_REQUIRED },
+ { .tag_name = XML_CHAR_C("SecondOperand"), .tag_id = SEDS_NODETYPE_SECOND_OPERAND },
+ { .tag_name = XML_CHAR_C("Semantics"), .tag_id = SEDS_NODETYPE_SEMANTICS },
+ { .tag_name = XML_CHAR_C("SemanticsTerm"), .tag_id = SEDS_NODETYPE_SEMANTICS_TERM },
+ { .tag_name = XML_CHAR_C("SendCommandPrimitive"), .tag_id = SEDS_NODETYPE_SEND_COMMAND_PRIMITIVE },
+ { .tag_name = XML_CHAR_C("SendParameterPrimitive"), .tag_id = SEDS_NODETYPE_SEND_PARAMETER_PRIMITIVE },
+ { .tag_name = XML_CHAR_C("SetActivityOnly"), .tag_id = SEDS_NODETYPE_SET_ACTIVITY_ONLY },
+ { .tag_name = XML_CHAR_C("SetActivity"), .tag_id = SEDS_NODETYPE_SET_ACTIVITY },
+ { .tag_name = XML_CHAR_C("SplineCalibrator"), .tag_id = SEDS_NODETYPE_SPLINE_CALIBRATOR },
+ { .tag_name = XML_CHAR_C("SplinePoint"), .tag_id = SEDS_NODETYPE_SPLINE_POINT },
+ { .tag_name = XML_CHAR_C("StartAt"), .tag_id = SEDS_NODETYPE_START_AT },
+ { .tag_name = XML_CHAR_C("StateMachineSet"), .tag_id = SEDS_NODETYPE_STATE_MACHINE_SET },
+ { .tag_name = XML_CHAR_C("StateMachine"), .tag_id = SEDS_NODETYPE_STATE_MACHINE },
+ { .tag_name = XML_CHAR_C("State"), .tag_id = SEDS_NODETYPE_STATE },
+ { .tag_name = XML_CHAR_C("Step"), .tag_id = SEDS_NODETYPE_STEP },
+ { .tag_name = XML_CHAR_C("StringDataEncoding"), .tag_id = SEDS_NODETYPE_STRING_DATA_ENCODING },
+ { .tag_name = XML_CHAR_C("StringDataType"), .tag_id = SEDS_NODETYPE_STRING_DATATYPE },
+ { .tag_name = XML_CHAR_C("StringValue"), .tag_id = SEDS_NODETYPE_STRING_VALUE },
+ { .tag_name = XML_CHAR_C("SubRangeDataType"), .tag_id = SEDS_NODETYPE_SUBRANGE_DATATYPE },
+ { .tag_name = XML_CHAR_C("Term"), .tag_id = SEDS_NODETYPE_POLYNOMIAL_TERM },
+ { .tag_name = XML_CHAR_C("TrailerEntryList"), .tag_id = SEDS_NODETYPE_CONTAINER_TRAILER_ENTRY_LIST },
+ { .tag_name = XML_CHAR_C("Transition"), .tag_id = SEDS_NODETYPE_TRANSITION },
+ { .tag_name = XML_CHAR_C("TypeCondition"), .tag_id = SEDS_NODETYPE_TYPE_CONDITION },
+ { .tag_name = XML_CHAR_C("TypeConstraint"), .tag_id = SEDS_NODETYPE_TYPE_CONSTRAINT },
+ { .tag_name = XML_CHAR_C("TypeOperand"), .tag_id = SEDS_NODETYPE_TYPE_OPERAND },
+ { .tag_name = XML_CHAR_C("ValidRange"), .tag_id = SEDS_NODETYPE_VALID_RANGE },
+ { .tag_name = XML_CHAR_C("ValueConstraint"), .tag_id = SEDS_NODETYPE_VALUE_CONSTRAINT },
+ { .tag_name = XML_CHAR_C("Value"), .tag_id = SEDS_NODETYPE_VALUE },
+ { .tag_name = XML_CHAR_C("VariableRef"), .tag_id = SEDS_NODETYPE_VARIABLE_REF },
+ { .tag_name = XML_CHAR_C("VariableSet"), .tag_id = SEDS_NODETYPE_VARIABLE_SET },
+ { .tag_name = XML_CHAR_C("Variable"), .tag_id = SEDS_NODETYPE_VARIABLE },
+
+ /* catch instances of xi:include, these are ignored by this tool but do not generate warnings */
+ { .tag_name = XML_CHAR_C("xi:include"), .tag_id = SEDS_NODETYPE_XINCLUDE_PASSTHRU },
+
+ /* Extra Element types _not_ defined by SEDS that this toolchain supports (SEDS supplement) */
+ { .tag_name = XML_CHAR_C("DesignParameters"), .tag_id = SEDS_NODETYPE_DESIGN_PARAMETERS },
+ { .tag_name = XML_CHAR_C("Define"), .tag_id = SEDS_NODETYPE_DEFINE },
+ { .tag_name = XML_CHAR_C("InstanceRuleSet"), .tag_id = SEDS_NODETYPE_INSTANCE_RULE_SET },
+ { .tag_name = XML_CHAR_C("InstanceRule"), .tag_id = SEDS_NODETYPE_INSTANCE_RULE },
+ { .tag_name = XML_CHAR_C("InterfaceMapSet"), .tag_id = SEDS_NODETYPE_INTERFACE_MAP_SET },
+ { .tag_name = XML_CHAR_C("InterfaceMap"), .tag_id = SEDS_NODETYPE_INTERFACE_MAP },
+ { .tag_name = XML_CHAR_C("ParameterValue"), .tag_id = SEDS_NODETYPE_PARAMETER_VALUE },
+ { .tag_name = XML_CHAR_C("DeclaredInterface"), .tag_id = SEDS_NODETYPE_DECLARED_INTERFACE },
+ { .tag_name = XML_CHAR_C("ProvidedInterface"), .tag_id = SEDS_NODETYPE_PROVIDED_INTERFACE },
+ { .tag_name = XML_CHAR_C("RequiredInterface"), .tag_id = SEDS_NODETYPE_REQUIRED_INTERFACE },
+
+ /* these are variations of the constraint elements that appear within PresentWhen elements */
+ { .tag_name = XML_CHAR_C("PresenceTypeConstraint"), .tag_id = SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT },
+ { .tag_name = XML_CHAR_C("PresenceRangeConstraint"), .tag_id = SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT },
+ { .tag_name = XML_CHAR_C("PresenceValueConstraint"), .tag_id = SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT },
+
+ /* Keep NULL tag last - absolute end of list marker */
+ { .tag_name = NULL, .tag_id = SEDS_NODETYPE_UNKNOWN }
};
/**
@@ -252,16 +249,14 @@ static const seds_stringmap_t XML_SEDS_STARTTAG_MAP[] =
typedef struct
{
XML_Parser xmlp;
- FILE *fp;
+ FILE *fp;
} seds_parser_t;
-
/*******************************************************************************/
/* Internal / static Helper Functions */
/* (these are not referenced outside this unit) */
/*******************************************************************************/
-
/**
* Helper function to identify an element in an XML file.
*
@@ -273,14 +268,13 @@ typedef struct
static seds_nodetype_t seds_xmlparser_identify_element(seds_nodetype_t parent_node_type, const XML_Char *str)
{
const seds_stringmap_t *mapptr;
- seds_nodetype_t node_type;
+ seds_nodetype_t node_type;
/* if the parent was any "passthru" type, then consider the child to also
* be that same type. This can be used to ignore entire subtrees, for
* unimplemented features */
- if (parent_node_type == SEDS_NODETYPE_UNKNOWN ||
- parent_node_type == SEDS_NODETYPE_XINCLUDE_PASSTHRU ||
- parent_node_type == SEDS_NODETYPE_DESCRIPTION_PASSTHRU)
+ if (parent_node_type == SEDS_NODETYPE_UNKNOWN || parent_node_type == SEDS_NODETYPE_XINCLUDE_PASSTHRU
+ || parent_node_type == SEDS_NODETYPE_DESCRIPTION_PASSTHRU)
{
node_type = parent_node_type;
}
@@ -320,45 +314,45 @@ static seds_nodetype_t seds_xmlparser_identify_element(seds_nodetype_t parent_no
* there are different sets of required attributes and the attribute interpretation
* varies.
*/
- switch(parent_node_type)
+ switch (parent_node_type)
{
- case SEDS_NODETYPE_DECLARED_INTERFACE_SET:
- node_type = SEDS_NODETYPE_DECLARED_INTERFACE;
- break;
- case SEDS_NODETYPE_REQUIRED_INTERFACE_SET:
- node_type = SEDS_NODETYPE_REQUIRED_INTERFACE;
- break;
- case SEDS_NODETYPE_PROVIDED_INTERFACE_SET:
- node_type = SEDS_NODETYPE_PROVIDED_INTERFACE;
- break;
- case SEDS_NODETYPE_BASE_INTERFACE_SET:
- node_type = SEDS_NODETYPE_BASE_INTERFACE;
- break;
- default:
- break;
+ case SEDS_NODETYPE_DECLARED_INTERFACE_SET:
+ node_type = SEDS_NODETYPE_DECLARED_INTERFACE;
+ break;
+ case SEDS_NODETYPE_REQUIRED_INTERFACE_SET:
+ node_type = SEDS_NODETYPE_REQUIRED_INTERFACE;
+ break;
+ case SEDS_NODETYPE_PROVIDED_INTERFACE_SET:
+ node_type = SEDS_NODETYPE_PROVIDED_INTERFACE;
+ break;
+ case SEDS_NODETYPE_BASE_INTERFACE_SET:
+ node_type = SEDS_NODETYPE_BASE_INTERFACE;
+ break;
+ default:
+ break;
}
}
- /*
+ /*
* The same constraint XML elements are also used within PresentWhen, but these
* need to be handled differently from other constraint elements because they are
- * used for a different purpose in this context
+ * used for a different purpose in this context
*/
if (parent_node_type == SEDS_NODETYPE_PRESENT_WHEN)
{
- switch(node_type)
+ switch (node_type)
{
- case SEDS_NODETYPE_VALUE_CONSTRAINT:
- node_type = SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT;
- break;
- case SEDS_NODETYPE_TYPE_CONSTRAINT:
- node_type = SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT;
- break;
- case SEDS_NODETYPE_RANGE_CONSTRAINT:
- node_type = SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT;
- break;
- default:
- break;
+ case SEDS_NODETYPE_VALUE_CONSTRAINT:
+ node_type = SEDS_NODETYPE_PRESENCE_VALUE_CONSTRAINT;
+ break;
+ case SEDS_NODETYPE_TYPE_CONSTRAINT:
+ node_type = SEDS_NODETYPE_PRESENCE_TYPE_CONSTRAINT;
+ break;
+ case SEDS_NODETYPE_RANGE_CONSTRAINT:
+ node_type = SEDS_NODETYPE_PRESENCE_RANGE_CONSTRAINT;
+ break;
+ default:
+ break;
}
}
@@ -382,14 +376,14 @@ static seds_nodetype_t seds_xmlparser_identify_element(seds_nodetype_t parent_no
*/
static void seds_xmlparser_message(lua_State *lua, seds_user_message_t msgtype)
{
- int top_start = lua_gettop(lua); /* top of stack should be the user supplied message */
- const char *element;
- const char *file;
+ int top_start = lua_gettop(lua); /* top of stack should be the user supplied message */
+ const char *element;
+ const char *file;
unsigned long line;
element = NULL;
- file = NULL;
- line = 0;
+ file = NULL;
+ line = 0;
if (luaL_checkudata(lua, top_start - 1, "seds_node"))
{
@@ -397,8 +391,8 @@ static void seds_xmlparser_message(lua_State *lua, seds_user_message_t msgtype)
lua_getfield(lua, top_start - 1, "xml_linenum");
lua_getfield(lua, top_start - 1, "xml_element");
- file = lua_tostring(lua, -3);
- line = lua_tointeger(lua, -2);
+ file = lua_tostring(lua, -3);
+ line = lua_tointeger(lua, -2);
element = lua_tostring(lua, -1);
}
@@ -440,17 +434,17 @@ static int seds_xmlparser_recreate_xml(lua_State *lua)
lua_pushnil(lua);
/*
- * Note - lua_next pops 1 item from the stack, interpreted as the prev table index, nil to start.
- * It then pushes 2 items back on - the next table index, and the corresponding value.
- * At the end of the table it pushes nothing back on, but still pops the last index.
- */
+ * Note - lua_next pops 1 item from the stack, interpreted as the prev table index, nil to start.
+ * It then pushes 2 items back on - the next table index, and the corresponding value.
+ * At the end of the table it pushes nothing back on, but still pops the last index.
+ */
while (lua_next(lua, 2))
{
/*
- * The item at the top should be the value, the item at -1 should be the key.
- * because the next code does multiple pushes, it is easier to capture the stack
- * number as an absolute position rather than using offsets.
- */
+ * The item at the top should be the value, the item at -1 should be the key.
+ * because the next code does multiple pushes, it is easier to capture the stack
+ * number as an absolute position rather than using offsets.
+ */
tbl_val_idx = lua_gettop(lua);
if (lua_type(lua, tbl_val_idx - 1) == LUA_TSTRING)
{
@@ -462,9 +456,9 @@ static int seds_xmlparser_recreate_xml(lua_State *lua)
lua_concat(lua, 5);
/*
- * This puts the concatenated value immediately below the table index.
- * Note that each iteration through this code adds 1 to the stack.
- */
+ * This puts the concatenated value immediately below the table index.
+ * Note that each iteration through this code adds 1 to the stack.
+ */
lua_insert(lua, tbl_val_idx - 2);
}
lua_pop(lua, 1);
@@ -526,11 +520,11 @@ static int seds_xmlparser_recreate_xml(lua_State *lua)
*/
static int seds_xmlparser_breakup_namespace(lua_State *lua)
{
- int stack_top = lua_gettop(lua);
+ int stack_top = lua_gettop(lua);
const char *nspace;
const char *sep;
- while(1)
+ while (1)
{
if (luaL_checkudata(lua, 1, "seds_node") == NULL)
{
@@ -543,7 +537,7 @@ static int seds_xmlparser_breakup_namespace(lua_State *lua)
}
nspace = lua_tostring(lua, stack_top + 1);
- sep = strrchr(nspace, '/');
+ sep = strrchr(nspace, '/');
if (sep == NULL)
{
break;
@@ -607,12 +601,12 @@ static int seds_xmlparser_breakup_namespace(lua_State *lua)
*/
static void seds_xmlparser_starttag(void *data, const XML_Char *el, const XML_Char **xattr)
{
- lua_State *lua = data;
- seds_nodetype_t node_type;
- const char *name_attr;
- char attrib_string[64];
- size_t len;
- int top_start;
+ lua_State *lua = data;
+ seds_nodetype_t node_type;
+ const char *name_attr;
+ char attrib_string[64];
+ size_t len;
+ int top_start;
const XML_Char **iattr;
top_start = lua_gettop(lua);
@@ -657,8 +651,8 @@ static void seds_xmlparser_starttag(void *data, const XML_Char *el, const XML_Ch
if (xattr[0] != NULL && xattr[1] != NULL)
{
iattr = xattr;
- lua_newtable(lua); /* top+2: current node attribute table */
- lua_newtable(lua); /* top+3: current node attribute table */
+ lua_newtable(lua); /* top+2: current node attribute table */
+ lua_newtable(lua); /* top+3: current node attribute table */
while (iattr[0] != NULL && iattr[1] != NULL)
{
lua_pushstring(lua, iattr[0]);
@@ -699,7 +693,7 @@ static void seds_xmlparser_starttag(void *data, const XML_Char *el, const XML_Ch
seds_xmlparser_message(lua, SEDS_USER_MESSAGE_WARNING);
}
- lua_settop(lua, top_start + 1); /* top : current node data table */
+ lua_settop(lua, top_start + 1); /* top : current node data table */
}
/* ------------------------------------------------------------------- */
@@ -718,71 +712,71 @@ static void seds_xmlparser_starttag(void *data, const XML_Char *el, const XML_Ch
*/
static void seds_xmlparser_endtag(void *data, const XML_Char *el)
{
- lua_State *lua = data;
+ lua_State *lua = data;
const char *parent_append_field;
- int parent_append_type;
- int top_start;
+ int parent_append_type;
+ int top_start;
top_start = lua_gettop(lua);
luaL_argcheck(lua, luaL_checkudata(lua, top_start - 1, "seds_node") != NULL, top_start - 1, "seds_node expected");
- switch(seds_tree_node_get_type(lua, top_start))
+ switch (seds_tree_node_get_type(lua, top_start))
{
- case SEDS_NODETYPE_LONG_DESCRIPTION:
- /*
- * concatenate with the "longdescription" of the parent
- */
- parent_append_field = "longdescription";
- parent_append_type = LUA_TSTRING;
- lua_getfield(lua, top_start, "xml_cdata");
- lua_remove(lua, top_start);
- break;
+ case SEDS_NODETYPE_LONG_DESCRIPTION:
+ /*
+ * concatenate with the "longdescription" of the parent
+ */
+ parent_append_field = "longdescription";
+ parent_append_type = LUA_TSTRING;
+ lua_getfield(lua, top_start, "xml_cdata");
+ lua_remove(lua, top_start);
+ break;
- case SEDS_NODETYPE_DESCRIPTION_PASSTHRU:
- /*
- * Re-create an XML tag from the contents,
- * concatenate with the "xml_cdata" of the parent
- */
- parent_append_field = "xml_cdata";
- parent_append_type = LUA_TSTRING;
+ case SEDS_NODETYPE_DESCRIPTION_PASSTHRU:
+ /*
+ * Re-create an XML tag from the contents,
+ * concatenate with the "xml_cdata" of the parent
+ */
+ parent_append_field = "xml_cdata";
+ parent_append_type = LUA_TSTRING;
- lua_pushcfunction(lua, seds_xmlparser_recreate_xml);
- lua_getfield(lua, top_start, "xml_element");
- lua_getfield(lua, top_start, "xml_attrs");
- lua_getfield(lua, top_start, "xml_cdata");
- lua_call(lua, 3, 1);
+ lua_pushcfunction(lua, seds_xmlparser_recreate_xml);
+ lua_getfield(lua, top_start, "xml_element");
+ lua_getfield(lua, top_start, "xml_attrs");
+ lua_getfield(lua, top_start, "xml_cdata");
+ lua_call(lua, 3, 1);
- lua_remove(lua, top_start);
- break;
+ lua_remove(lua, top_start);
+ break;
- case SEDS_NODETYPE_PACKAGE:
- /*
- * Namespaces needs special handling in case they have
- * implicitly nested namespaces within them.
- *
- */
- lua_pushcfunction(lua, seds_xmlparser_breakup_namespace);
- lua_insert(lua, top_start);
- lua_call(lua, 1, 1);
+ case SEDS_NODETYPE_PACKAGE:
+ /*
+ * Namespaces needs special handling in case they have
+ * implicitly nested namespaces within them.
+ *
+ */
+ lua_pushcfunction(lua, seds_xmlparser_breakup_namespace);
+ lua_insert(lua, top_start);
+ lua_call(lua, 1, 1);
- parent_append_field = "subnodes";
- parent_append_type = LUA_TTABLE;
- break;
+ parent_append_field = "subnodes";
+ parent_append_type = LUA_TTABLE;
+ break;
- case SEDS_NODETYPE_UNKNOWN:
- case SEDS_NODETYPE_XINCLUDE_PASSTHRU:
- /* discard the node, do not append it */
- parent_append_field = NULL;
- parent_append_type = LUA_TNONE;
- break;
+ case SEDS_NODETYPE_UNKNOWN:
+ case SEDS_NODETYPE_XINCLUDE_PASSTHRU:
+ /* discard the node, do not append it */
+ parent_append_field = NULL;
+ parent_append_type = LUA_TNONE;
+ break;
- default:
- /*
- * Typical case -- append the current node to the subnodes table of the parent
- */
- parent_append_field = "subnodes";
- parent_append_type = LUA_TTABLE;
- break;
+ default:
+ /*
+ * Typical case -- append the current node to the subnodes table of the parent
+ */
+ parent_append_field = "subnodes";
+ parent_append_type = LUA_TTABLE;
+ break;
}
if (parent_append_field != NULL)
@@ -799,7 +793,7 @@ static void seds_xmlparser_endtag(void *data, const XML_Char *el)
lua_newtable(lua);
}
lua_pushvalue(lua, top_start);
- lua_rawseti(lua, -2, 1 + lua_rawlen(lua, -2));
+ lua_rawseti(lua, -2, 1 + lua_rawlen(lua, -2));
lua_pushinteger(lua, lua_rawlen(lua, -1));
lua_setfield(lua, top_start, "id");
@@ -811,39 +805,39 @@ static void seds_xmlparser_endtag(void *data, const XML_Char *el)
if (lua_type(lua, -1) != parent_append_type)
{
lua_pop(lua, 1);
- switch(parent_append_type)
+ switch (parent_append_type)
{
- case LUA_TTABLE:
- lua_newtable(lua);
- break;
- case LUA_TSTRING:
- lua_pushstring(lua, "");
- break;
- default:
- lua_pushnil(lua);
- break;
+ case LUA_TTABLE:
+ lua_newtable(lua);
+ break;
+ case LUA_TSTRING:
+ lua_pushstring(lua, "");
+ break;
+ default:
+ lua_pushnil(lua);
+ break;
}
}
lua_insert(lua, top_start);
- switch(parent_append_type)
+ switch (parent_append_type)
{
- case LUA_TTABLE:
- lua_rawseti(lua, top_start, 1 + lua_rawlen(lua, top_start));
- break;
- case LUA_TSTRING:
- if (lua_isstring(lua, -1))
- {
- lua_concat(lua, 2);
- }
- else
- {
- lua_pop(lua, 1);
- }
- break;
- default:
- break;
+ case LUA_TTABLE:
+ lua_rawseti(lua, top_start, 1 + lua_rawlen(lua, top_start));
+ break;
+ case LUA_TSTRING:
+ if (lua_isstring(lua, -1))
+ {
+ lua_concat(lua, 2);
+ }
+ else
+ {
+ lua_pop(lua, 1);
+ }
+ break;
+ default:
+ break;
}
lua_setfield(lua, top_start - 1, parent_append_field);
@@ -869,9 +863,8 @@ static void seds_xmlparser_endtag(void *data, const XML_Char *el)
*/
static void seds_xmlparser_cdata(void *data, const XML_Char *s, int len)
{
- lua_State *lua = data;
- int top_start = lua_gettop(lua);
-
+ lua_State *lua = data;
+ int top_start = lua_gettop(lua);
/*
* At the top of the LUA stack should be a table
@@ -952,7 +945,7 @@ static int seds_xmlparser_get_property(lua_State *lua)
/*
*/
seds_parser_t *pself = luaL_checkudata(lua, 1, "seds_parser");
- const char *prop = NULL;
+ const char *prop = NULL;
/*
* note - lua_tostring() possibly converts to a string,
@@ -1047,10 +1040,9 @@ static int seds_xmlparser_set_property(lua_State *lua)
int seds_xmlparser_readfile(lua_State *lua)
{
seds_parser_t *pself = luaL_checkudata(lua, 1, "seds_parser");
- void *xmlbuf;
- size_t len;
- int file_flag;
-
+ void *xmlbuf;
+ size_t len;
+ int file_flag;
luaL_argcheck(lua, pself != NULL, 1, "seds_parser expected");
@@ -1080,7 +1072,7 @@ int seds_xmlparser_readfile(lua_State *lua)
{
fclose(pself->fp);
}
- pself->fp = fopen(lua_tostring(lua, 2), "r"); /* arg2: xml_filename */
+ pself->fp = fopen(lua_tostring(lua, 2), "r"); /* arg2: xml_filename */
if (!pself->fp)
{
lua_pushfstring(lua, "%s: %s", lua_tostring(lua, 2), strerror(errno));
@@ -1103,13 +1095,14 @@ int seds_xmlparser_readfile(lua_State *lua)
xmlbuf = XML_GetBuffer(pself->xmlp, 16384);
if (xmlbuf == NULL)
{
- lua_pushfstring(lua, "%s: XML Buffering Error: %s",
- lua_tostring(lua, 2),
- XML_ErrorString(XML_GetErrorCode(pself->xmlp)));
+ lua_pushfstring(lua,
+ "%s: XML Buffering Error: %s",
+ lua_tostring(lua, 2),
+ XML_ErrorString(XML_GetErrorCode(pself->xmlp)));
return lua_error(lua);
}
- len = fread(xmlbuf, 1, 16384, pself->fp);
+ len = fread(xmlbuf, 1, 16384, pself->fp);
file_flag = ferror(pself->fp);
if (file_flag != 0)
{
@@ -1120,14 +1113,14 @@ int seds_xmlparser_readfile(lua_State *lua)
file_flag = feof(pself->fp);
if (!XML_ParseBuffer(pself->xmlp, len, file_flag))
{
- lua_pushfstring(lua, "%s:%d: XML Parsing Error: %s",
- lua_tostring(lua, 2),
- XML_GetCurrentLineNumber(pself->xmlp),
- XML_ErrorString(XML_GetErrorCode(pself->xmlp)));
+ lua_pushfstring(lua,
+ "%s:%d: XML Parsing Error: %s",
+ lua_tostring(lua, 2),
+ XML_GetCurrentLineNumber(pself->xmlp),
+ XML_ErrorString(XML_GetErrorCode(pself->xmlp)));
return lua_error(lua);
}
- }
- while (!file_flag);
+ } while (!file_flag);
XML_SetUserData(pself->xmlp, NULL);
@@ -1211,14 +1204,24 @@ int seds_xmlparser_finish(lua_State *lua)
return luaL_error(lua, "No XML datasheets parsed");
}
- seds_user_message_printf(SEDS_USER_MESSAGE_DEBUG, __FILE__, __LINE__, "%s(): ROOT=> %d", __func__, (int) lua_rawlen(lua, 3));
+ seds_user_message_printf(SEDS_USER_MESSAGE_DEBUG,
+ __FILE__,
+ __LINE__,
+ "%s(): ROOT=> %d",
+ __func__,
+ (int)lua_rawlen(lua, 3));
lua_pushnil(lua);
while (lua_next(lua, 3))
{
luaL_tolstring(lua, -2, NULL);
luaL_tolstring(lua, -2, NULL);
- seds_user_message_printf(SEDS_USER_MESSAGE_DEBUG, __FILE__, __LINE__, "%s(): %s => %s", __func__,
- lua_tostring(lua, -2), lua_tostring(lua, -1));
+ seds_user_message_printf(SEDS_USER_MESSAGE_DEBUG,
+ __FILE__,
+ __LINE__,
+ "%s(): %s => %s",
+ __func__,
+ lua_tostring(lua, -2),
+ lua_tostring(lua, -1));
lua_pop(lua, 3);
}
lua_pop(lua, 1);
diff --git a/tool/src/seds_xmlparser.h b/tool/src/seds_xmlparser.h
index af66e21..b6d6955 100644
--- a/tool/src/seds_xmlparser.h
+++ b/tool/src/seds_xmlparser.h
@@ -18,7 +18,6 @@
* limitations under the License.
*/
-
/**
* \file seds_xmlparser.h
* \ingroup tool
@@ -51,6 +50,4 @@ int seds_xmlparser_readfile(lua_State *lua);
*/
int seds_xmlparser_finish(lua_State *lua);
-
-#endif /* _SEDS_XMLPARSER_H_ */
-
+#endif /* _SEDS_XMLPARSER_H_ */