Skip to content

Commit

Permalink
Misc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Meisrimel authored and Peter Meisrimel committed Aug 7, 2024
1 parent 0f2a8f5 commit 8ed041d
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 21 deletions.
2 changes: 0 additions & 2 deletions src/XML/src/FMI3/fmi3_xml_model_description.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ int fmi3_xml_handle_ModelExchange(fmi3_xml_parser_context_t *context, const char
jm_log_verbose(context->callbacks, module, "Parsing XML element ModelExchange");

// Reset handles for the elements that are specific under ModelExchange
// TODO: Expand the FMI3_XML_ELM_ID macro
fmi3_xml_set_element_handle(context, "SourceFiles", FMI3_ELM(FMI3_XML_ELM_ID(SourceFiles)));
fmi3_xml_set_element_handle(context, "File", FMI3_ELM(FMI3_XML_ELM_ID(File)));

Expand Down Expand Up @@ -584,7 +583,6 @@ int fmi3_xml_handle_CoSimulation(fmi3_xml_parser_context_t *context, const char*
jm_log_verbose(context->callbacks, module, "Parsing XML element CoSimulation");

// Reset handles for the elements that are specific under CoSimulation
// TODO: Expand the FMI3_XML_ELM_ID macro
fmi3_xml_set_element_handle(context, "SourceFiles", FMI3_ELM(FMI3_XML_ELM_ID(SourceFilesCS)));
fmi3_xml_set_element_handle(context, "File", FMI3_ELM(FMI3_XML_ELM_ID(FileCS)));

Expand Down
5 changes: 1 addition & 4 deletions src/XML/src/FMI3/fmi3_xml_model_description_scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ extern "C" {
@multi_elem:
if the parent can have multiple elements of this type
*/
/* scheme_ID, super_type, parent_ID, sib_idx, multi_elem */
/* scheme_ID, super_type, parent_ID, sib_idx, multi_elem */
#define fmi3_xml_scheme_fmiModelDescription {fmi3_xml_elmID_none, fmi3_xml_elmID_none, 0, 0}
#define fmi3_xml_scheme_ModelExchange {fmi3_xml_elmID_none, fmi3_xml_elmID_fmiModelDescription, 0, 0}
#define fmi3_xml_scheme_SourceFiles {fmi3_xml_elmID_none, fmi3_xml_elmID_ModelExchange, 0, 0}
Expand Down Expand Up @@ -256,9 +256,6 @@ extern "C" {
// Not used except for setting up the element handler framework:
#define fmi3_xml_scheme_Start {fmi3_xml_elmID_none, fmi3_xml_elmID_none, 1, 0}

// TODO: List formatting
// TODO: rename to include modelDescription in name?

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 1 addition & 3 deletions src/XML/src/FMI3/fmi3_xml_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef unsigned long long int fmi3_uint_buf_t; /* same size as fmi3_int_buf_t
// TODO: Move these + access functions into the parser_scheme file?
#define ATTR_STR(attr) #attr,
const jm_string fmi3_modelDescription_xmlAttrNames[fmi3_modelDescription_xml_attr_number] = {
FMI3_XML_ATTRLIST(ATTR_STR)
FMI3_XML_ATTRLIST_MODEL_DESCR(ATTR_STR)
};

const jm_string fmi3_termIcon_xmlAttrNames[fmi3_xml_termIcon_attr_number] = {
Expand Down Expand Up @@ -86,7 +86,6 @@ fmi3_xml_termIcon_scheme_info_t fmi_xml_scheme_termIcon_info[fmi_xml_elm_termIco
};

// TODO: Move to more suitable place?
// TODO: possibly non-static
static fmi3_xml_scheme_info_t fmi3_xml_get_scheme_info(fmi3_xml_parser_context_t* context, fmi3_xml_elm_t enu) {
const fmi3_xml_type_t xmlType = context->xmlType;

Expand Down Expand Up @@ -144,7 +143,6 @@ const fmi3_xml_termIcon_element_handle_map_t fmi3_termIcon_element_handle_map[fm
};

// TODO: Move to more suitable place?
// TODO: possibly non-static
static fmi3_xml_element_handle_map_t fmi3_xml_get_element_handle(fmi3_xml_parser_context_t* context, fmi3_xml_elm_t enu) {
const fmi3_xml_type_t xmlType = context->xmlType;

Expand Down
2 changes: 0 additions & 2 deletions src/XML/src/FMI3/fmi3_xml_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ typedef struct {
int multipleAllowed; /* multiple elements of this kind kan come in a sequence as siblings*/
} fmi3_xml_modelDescription_scheme_info_t;

// TODO
typedef struct {
fmi_xml_elm_termIcon_enu_t superID; /* ID of super type or NULL if none */
fmi_xml_elm_termIcon_enu_t parentID; /* expected parent ID for an element */
Expand All @@ -66,7 +65,6 @@ typedef struct {

#define fmi3_xml_diff_elmName(a, b) strcmp(a.elementName,b.elementName)

// TODO
jm_define_comp_f(fmi3_xml_compare_elmName, fmi3_xml_element_handle_map_t, fmi3_xml_diff_elmName)

#define XML_BLOCK_SIZE 16000
Expand Down
10 changes: 1 addition & 9 deletions src/XML/src/FMI3/fmi3_xml_parser_scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,9 @@ related to parsing XML elements and their attributes
extern "C" {
#endif

// TODO: Duplicate the common ones, for simplicity
/** \brief Attributes names common to modelDescription.xml & terminalsAndIcons.xml */

// TODO: Eliminate this list, once terminalsAndIcons has been properly separated
/** \brief Attribute names used in XML */
#define FMI3_XML_ATTRLIST(EXPAND_XML_ATTRNAME) \
FMI3_XML_ATTRLIST_MODEL_DESCR(EXPAND_XML_ATTRNAME)

#define FMI3_XML_ATTR_ID(attr) fmi_attr_id_##attr,
typedef enum fmi3_xml_attr_modelDescription_enu_t {
FMI3_XML_ATTRLIST(FMI3_XML_ATTR_ID)
FMI3_XML_ATTRLIST_MODEL_DESCR(FMI3_XML_ATTR_ID)
fmi3_modelDescription_xml_attr_number
} fmi3_xml_attr_modelDescription_enu_t;

Expand Down
1 change: 0 additions & 1 deletion src/XML/src/FMI3/fmi3_xml_variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,6 @@ void fmi3_xml_free_variable(jm_callbacks* callbacks, fmi3_xml_variable_t* var) {
*
* The attributes are error checked. On success, the parsed variable is updated with them.
*/
// TODO: These are deeply rooted in modelDescription territory; use modelDescription_elm_enu_t here?
static int fmi3_xml_variable_process_attr_causality_variability_initial(fmi3_xml_parser_context_t* context,
fmi3_xml_variable_t* variable, fmi3_xml_elm_t elm_id)
{
Expand Down

0 comments on commit 8ed041d

Please sign in to comment.