/* Build a textual presenation of the provided scope stack taking the language keyword identifier translation into account. Further the function equals "idl_scopeStack". */ c_char * idl_scopeStackLanguage( idl_scope scope, const char *name) { c_char *id = NULL; switch (lang) { case IDL_LANG_C: id = idl_scopeStackC (scope, "_", name); break; case IDL_LANG_CXX: id = idl_scopeStackCxx (scope, "::", name); break; case IDL_LANG_JAVA: id = idl_scopeStackJava (scope, ".", name); break; case IDL_LANG_UNKNOWN: default: break; } return id; }
/* Return the standalone C specific type identifier for the specified type specification */ c_char * idl_sacTypeFromTypeSpec ( const idl_typeSpec typeSpec) { c_char *typeName; /* QAC EXPECT 3416; No side effects here */ if (idl_typeSpecType(typeSpec) == idl_tbasic) { /* if the specified type is a basic type */ switch (idl_typeBasicType(idl_typeBasic(typeSpec))) { case idl_short: typeName = os_strdup("DDS_short"); break; case idl_ushort: typeName = os_strdup("DDS_unsigned_short"); break; case idl_long: typeName = os_strdup("DDS_long"); break; case idl_ulong: typeName = os_strdup("DDS_unsigned_long"); break; case idl_longlong: typeName = os_strdup("DDS_long_long"); break; case idl_ulonglong: typeName = os_strdup("DDS_unsigned_long_long"); break; case idl_float: typeName = os_strdup("DDS_float"); break; case idl_double: typeName = os_strdup("DDS_double"); break; case idl_char: typeName = os_strdup("DDS_char"); break; case idl_string: typeName = os_strdup("DDS_string"); break; case idl_boolean: typeName = os_strdup("DDS_boolean"); break; case idl_octet: typeName = os_strdup("DDS_octet"); break; default: /* No processing required, empty statement to satisfy QAC */ break; /* QAC EXPECT 2016; Default case must be empty here */ } /* QAC EXPECT 3416; No side effects here */ } else if (idl_typeSpecType(typeSpec) == idl_tseq) { /* sequence does not have an identification */ typeName = os_strdup (""); printf ("idl_sacTypeFromTypeSpec: Unexpected sequence type handled\n"); } else if (idl_typeSpecType(typeSpec) == idl_tarray) { typeName = os_strdup (""); printf ("idl_sacTypeFromTypeSpec: Unexpected array type handled\n"); } else { /* if a user type is specified build it from its scope and its name. The type should be one of idl_ttypedef, idl_tenum, idl_tstruct, idl_tunion. */ typeName = idl_scopeStackC ( idl_typeUserScope(idl_typeUser(typeSpec)), "_", idl_typeSpecName(typeSpec)); } return typeName; /* QAC EXPECT 5101; The switch statement is simple, therefor the total complexity is low */ }