Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/cbexigen/datatype_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,8 @@
fragment_type = fragment.name

prefixed_type = f'{self.parameters["prefix"]}{fragment_type}'
if fragment_type in self.analyzer_data.known_elements.values():
elements.append((prefixed_type, fragment.name))
else:
elements.append((prefixed_type, fragment.name))
if not fragment_type in self.analyzer_data.known_elements.values():

Check notice on line 427 in src/cbexigen/datatype_classes.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/cbexigen/datatype_classes.py#L427

test for membership should be 'not in' (E713)
log_write_error(f'Fragment {fragment.name} ({fragment.type}) '
f'is not in the list of known elements.')

Expand Down
65 changes: 61 additions & 4 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# With the fragment coder, the type for the ambiguous element must be specified
# here so that the correct decoder or encoder is called.
iso2_ambiguous_element_names = {
'eMAID': 'EMAIDType',
'eMAID': 'EXISchemaInformedElementFragmentGrammar',
}

# optimizations for arrays and structs
Expand Down Expand Up @@ -395,7 +395,7 @@
'filename': 'iso2_msgDefDatatypes.h',
'identifier': 'ISO2_MSG_DEF_DATATYPES_H',
'include_std_lib': ['stdint.h'],
'include_other': ['exi_basetypes.h']
'include_other': ['exi_basetypes.h', 'iso2_CustomEXIDatatypes.h']
},
'c': {
'filename': 'iso2_msgDefDatatypes.c',
Expand All @@ -420,7 +420,7 @@
'identifier': 'ISO2_MSG_DEF_DECODER_C',
'include_std_lib': ['stdint.h'],
'include_other': ['exi_basetypes.h', 'exi_basetypes_decoder.h', 'exi_error_codes.h', 'exi_header.h',
'exi_types_decoder.h', 'iso2_msgDefDatatypes.h', 'iso2_msgDefDecoder.h']
'exi_types_decoder.h', 'iso2_msgDefDatatypes.h', 'iso2_msgDefDecoder.h', 'iso2_CustomEXIDatatypesDecoder.h']
}
},
'iso2_msgDefEncoder': {
Expand All @@ -439,7 +439,64 @@
'identifier': 'ISO2_MSG_DEF_ENCODER_C',
'include_std_lib': ['stdint.h'],
'include_other': ['exi_basetypes.h', 'exi_basetypes_encoder.h', 'exi_error_codes.h', 'exi_header.h',
'iso2_msgDefDatatypes.h', 'iso2_msgDefEncoder.h']
'iso2_msgDefDatatypes.h', 'iso2_msgDefEncoder.h', 'iso2_CustomEXIDatatypesEncoder.h']
}
},
'iso2_CustomEXIDatatypes': {
'prefix': '',
'type': 'static',
'folder': 'iso-2',
'h': {
'template': 'custom_types/iso2/iso2CustomEXIDatatypes.h.jinja',
'filename': 'iso2_CustomEXIDatatypes.h',
'identifier': 'ISO2_CUSTOM_EXI_DATATYPES_H',
'include_std_lib': [],
'include_lib': []
},
'c': {
'template': 'custom_types/iso2/iso2CustomEXIDatatypes.c.jinja',
'filename': 'iso2_CustomEXIDatatypes.c',
'identifier': 'ISO2_CUSTOM_EXI_DATATYPES_C',
'include_std_lib': [],
'include_lib': []
}
},
'iso2_CustomEXIDatatypesEncoder': {
'prefix': '',
'type': 'static',
'folder': 'iso-2',
'h': {
'template': 'custom_types/iso2/iso2CustomEXIDatatypesEncoder.h.jinja',
'filename': 'iso2_CustomEXIDatatypesEncoder.h',
'identifier': 'ISO2_CUSTOM_EXI_DATATYPES_ENCODER_H',
'include_std_lib': [],
'include_lib': []
},
'c': {
'template': 'custom_types/iso2/iso2CustomEXIDatatypesEncoder.c.jinja',
'filename': 'iso2_CustomEXIDatatypesEncoder.c',
'identifier': 'ISO2_CUSTOM_EXI_DATATYPES_ENCODER_C',
'include_std_lib': [],
'include_lib': []
}
},
'iso2_CustomEXIDatatypesDecoder': {
'prefix': '',
'type': 'static',
'folder': 'iso-2',
'h': {
'template': 'custom_types/iso2/iso2CustomEXIDatatypesDecoder.h.jinja',
'filename': 'iso2_CustomEXIDatatypesDecoder.h',
'identifier': 'ISO2_CUSTOM_EXI_DATATYPES_DECODER_H',
'include_std_lib': [],
'include_lib': []
},
'c': {
'template': 'custom_types/iso2/iso2CustomEXIDatatypesDecoder.c.jinja',
'filename': 'iso2_CustomEXIDatatypesDecoder.c',
'identifier': 'ISO2_CUSTOM_EXI_DATATYPES_DECODER_C',
'include_std_lib': [],
'include_lib': []
}
},
'iso20_CommonMessages_Datatypes': {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends "BaseCode.jinja" %}
{% block includes %}
#include <iso2_CustomEXIDatatypes.h>
{% endblock %}

{% block content %}
void init_iso2_EXISchemaInformedElementFragmentGrammar(struct iso2_EXISchemaInformedElementFragmentGrammar* exiFrag) {
exiFrag->Id_isUsed = 0u;
exiFrag->CHARACTERS_GENERIC_isUsed = 0u;
}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% extends "BaseHeader.jinja" %}

{% block description %}
/**
* @file {{ filename }}
* @brief Custom data types for ISO 15118-2 EXI parser
*
**/
{% endblock description %}

{% block includes %}
#include <exi_basetypes.h>
{% endblock %}

{% block defines %}
#define exiElementFrag_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
#define exiElementFrag_CHARACTERS_GENERIC_CHARACTERS_SIZE 50 + EXTRA_CHAR
{% endblock %}

{% block content %}
struct iso2_EXISchemaInformedElementFragmentGrammar {
/* Schema-informed Element Fragment Grammar for START_ELEMENT({urn:iso:15118:2:2013:MsgBody}eMAID) */
/* 4 ATTRIBUTE[STRING]({urn:iso:15118:2:2013:MsgDataTypes}Id) */
unsigned int Id_isUsed:1;
struct {
char characters[exiElementFrag_Id_CHARACTERS_SIZE];
uint16_t charactersLen;
} Id ;
/* 247 START_ELEMENT({urn:iso:15118:2:2013:MsgBody}eMAID) */
unsigned int CHARACTERS_GENERIC_isUsed:1;
struct {
char characters[exiElementFrag_CHARACTERS_GENERIC_CHARACTERS_SIZE];
uint16_t charactersLen;
} CHARACTERS_GENERIC ;


int _warning_;
};

void init_iso2_EXISchemaInformedElementFragmentGrammar(struct iso2_EXISchemaInformedElementFragmentGrammar* exiFrag);

{% endblock %}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "BaseHeader.jinja" %}

{% block description %}
/**
* @file {{ filename }}
* @brief Decoder of custom data types for ISO 15118-2 EXI parser
*
**/
{% endblock description %}

{% block includes %}
#include <iso2_CustomEXIDatatypes.h>
#include <exi_bitstream.h>
{% endblock %}

{% block content %}
int decode_iso2_EXISchemaInformedElementFragmentGrammar(exi_bitstream_t* stream, struct iso2_EXISchemaInformedElementFragmentGrammar* exiElementFrag);
{% endblock %}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "BaseHeader.jinja" %}

{% block description %}
/**
* @file {{ filename }}
* @brief Encoding of custom data types for ISO 15118-2 EXI parser
*
**/
{% endblock description %}

{% block includes %}
#include <iso2_CustomEXIDatatypes.h>
#include <exi_bitstream.h>
{% endblock %}

{% block content %}
int encode_iso2_EXISchemaInformedElementFragmentGrammar(exi_bitstream_t* stream, struct iso2_EXISchemaInformedElementFragmentGrammar* exiElementFrag);
{% endblock %}