Merge pull request #117 from garretfick/feature/STYLE
Style changes for the glue generator to better match the style in other places
This commit is contained in:
commit
a0029a7d8b
|
@ -51,7 +51,7 @@ struct IecVar {
|
|||
/// Write the header to the output stream. The header is common among all
|
||||
/// glueVars files.
|
||||
/// @param glueVars The output stream to write to.
|
||||
void generateHeader(ostream& glueVars) {
|
||||
void generate_header(ostream& glueVars) {
|
||||
glueVars << R"(// This file is responsible for gluing the variables from the IEC program to
|
||||
// the OpenPLC memory pointers. It is automatically generated by the
|
||||
// glue_generator program. PLEASE DON'T EDIT THIS FILE!
|
||||
|
@ -201,12 +201,13 @@ IEC_LINT *special_functions[BUFFER_SIZE];
|
|||
)";
|
||||
}
|
||||
|
||||
int parseIecVars(istream& locatedVars, char *varName, char *varType, md5_state_s& md5_state) {
|
||||
int parse_iec_vars(istream& input_stream, char *var_name, char *var_type, md5_state_s& md5_state) {
|
||||
string line;
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, 1024);
|
||||
|
||||
if (getline(locatedVars, line)) {
|
||||
md5_append(&md5_state, reinterpret_cast<const md5_byte_t*>(line.c_str()), line.length());
|
||||
if (getline(input_stream, line)) {
|
||||
md5_append(&md5_state, reinterpret_cast<const md5_byte_t*>(line.c_str()), static_cast<int>(line.length()));
|
||||
int i = 0, j = 0;
|
||||
strncpy(buffer, line.c_str(), 1024);
|
||||
for (i = 0; buffer[i] != '('; i++) {
|
||||
|
@ -215,17 +216,17 @@ int parseIecVars(istream& locatedVars, char *varName, char *varType, md5_state_s
|
|||
i++;
|
||||
|
||||
while (buffer[i] != ',') {
|
||||
varType[j] = buffer[i];
|
||||
var_type[j] = buffer[i];
|
||||
i++; j++;
|
||||
varType[j] = '\0';
|
||||
var_type[j] = '\0';
|
||||
}
|
||||
i++;
|
||||
j = 0;
|
||||
|
||||
while (buffer[i] != ',') {
|
||||
varName[j] = buffer[i];
|
||||
var_name[j] = buffer[i];
|
||||
i++; j++;
|
||||
varName[j] = '\0';
|
||||
var_name[j] = '\0';
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -234,16 +235,17 @@ int parseIecVars(istream& locatedVars, char *varName, char *varType, md5_state_s
|
|||
}
|
||||
}
|
||||
|
||||
void findPositions(const char *varName, uint16_t *pos1, uint16_t *pos2) {
|
||||
void find_positions(const char *varName, uint16_t *pos1, uint16_t *pos2) {
|
||||
int i = 4, j = 0;
|
||||
char tempBuffer[100];
|
||||
char temp_buffer[100];
|
||||
memset(temp_buffer, 0, 100);
|
||||
|
||||
while (varName[i] != '_' && varName[i] != '\0') {
|
||||
tempBuffer[j] = varName[i];
|
||||
temp_buffer[j] = varName[i];
|
||||
i++; j++;
|
||||
tempBuffer[j] = '\0';
|
||||
temp_buffer[j] = '\0';
|
||||
}
|
||||
*pos1 = atoi(tempBuffer);
|
||||
*pos1 = atoi(temp_buffer);
|
||||
|
||||
if (varName[i] == '\0') {
|
||||
*pos2 = 0;
|
||||
|
@ -253,14 +255,14 @@ void findPositions(const char *varName, uint16_t *pos1, uint16_t *pos2) {
|
|||
j = 0; i++;
|
||||
|
||||
while (varName[i] != '\0') {
|
||||
tempBuffer[j] = varName[i];
|
||||
temp_buffer[j] = varName[i];
|
||||
i++; j++;
|
||||
tempBuffer[j] = '\0';
|
||||
temp_buffer[j] = '\0';
|
||||
}
|
||||
*pos2 = atoi(tempBuffer);
|
||||
*pos2 = atoi(temp_buffer);
|
||||
}
|
||||
|
||||
void glueVar(ostream& glueVars, const char *varName, uint16_t pos1,
|
||||
void generate_glue_var_assignment(ostream& glueVars, const char *varName, uint16_t pos1,
|
||||
uint16_t pos2) {
|
||||
if (pos2 >= 8) {
|
||||
cout << "***Invalid addressing on located variable" << varName;
|
||||
|
@ -322,7 +324,7 @@ void glueVar(ostream& glueVars, const char *varName, uint16_t pos1,
|
|||
}
|
||||
}
|
||||
|
||||
const char* fromDirectionFlag(const char flag) {
|
||||
const char* from_storage_flag(const char flag) {
|
||||
switch (flag) {
|
||||
case 'I':
|
||||
return "IN";
|
||||
|
@ -333,7 +335,7 @@ const char* fromDirectionFlag(const char flag) {
|
|||
}
|
||||
}
|
||||
|
||||
const char* fromSizeFlag(const char flag) {
|
||||
const char* from_size_flag(const char flag) {
|
||||
switch (flag) {
|
||||
// G is a special flag we use to represent a boolean group
|
||||
case 'G':
|
||||
|
@ -351,7 +353,7 @@ const char* fromSizeFlag(const char flag) {
|
|||
}
|
||||
}
|
||||
|
||||
void generateBoolGroups(ostream& glueVars, char direction, map<uint16_t, array<string, 8>>& items) {
|
||||
void generate_bool_groups(ostream& glueVars, char direction, map<uint16_t, array<string, 8>>& items) {
|
||||
if (items.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -380,7 +382,7 @@ void generateBoolGroups(ostream& glueVars, char direction, map<uint16_t, array<s
|
|||
/// are generated as a group and then that group is referred to from
|
||||
/// the integrated glue. This function generates the definitions
|
||||
/// of the bool groups.
|
||||
void generateBoolGroups(ostream& glueVars, list<IecVar>& all_vars) {
|
||||
void generate_bool_groups(ostream& glueVars, list<IecVar>& all_vars) {
|
||||
map<uint16_t, array<string, 8>> inputs;
|
||||
map<uint16_t, array<string, 8>> outputs;
|
||||
map<uint16_t, array<string, 8>> memory;
|
||||
|
@ -433,12 +435,12 @@ void generateBoolGroups(ostream& glueVars, list<IecVar>& all_vars) {
|
|||
|
||||
// Now that we have them grouped into the groups that we care about
|
||||
// generate the intermediate glue bindings for the items
|
||||
generateBoolGroups(glueVars, 'I', inputs);
|
||||
generateBoolGroups(glueVars, 'Q', outputs);
|
||||
generateBoolGroups(glueVars, 'M', memory);
|
||||
generate_bool_groups(glueVars, 'I', inputs);
|
||||
generate_bool_groups(glueVars, 'Q', outputs);
|
||||
generate_bool_groups(glueVars, 'M', memory);
|
||||
}
|
||||
|
||||
void generateIntegratedGlue(ostream& glueVars, const list<IecVar>& all_vars) {
|
||||
void generate_integrated_glue(ostream& glueVars, const list<IecVar>& all_vars) {
|
||||
glueVars << "/// The size of the array of glue variables.\n";
|
||||
glueVars << "extern std::size_t const OPLCGLUE_GLUE_SIZE(";
|
||||
glueVars << all_vars.size() << ");\n";
|
||||
|
@ -451,8 +453,8 @@ void generateIntegratedGlue(ostream& glueVars, const list<IecVar>& all_vars) {
|
|||
const char sizeFlag = it->name[3];
|
||||
|
||||
glueVars << " {";
|
||||
glueVars << " IECLDT_" << fromDirectionFlag(directionFlag) << ",";
|
||||
glueVars << " IECLST_" << fromSizeFlag(sizeFlag) << ",";
|
||||
glueVars << " IECLDT_" << from_storage_flag(directionFlag) << ",";
|
||||
glueVars << " IECLST_" << from_size_flag(sizeFlag) << ",";
|
||||
glueVars << " " << it->pos1 << ",";
|
||||
glueVars << " " << it->pos2 << ",";
|
||||
glueVars << " IECVT_" << it->type << ", ";
|
||||
|
@ -461,7 +463,7 @@ void generateIntegratedGlue(ostream& glueVars, const list<IecVar>& all_vars) {
|
|||
glueVars << "};\n\n";
|
||||
}
|
||||
|
||||
void generateBottom(ostream& glueVars) {
|
||||
void generate_bottom(ostream& glueVars) {
|
||||
glueVars << R"(void updateTime()
|
||||
{
|
||||
__CURRENT_TIME.tv_nsec += common_ticktime__;
|
||||
|
@ -474,8 +476,10 @@ void generateBottom(ostream& glueVars) {
|
|||
}
|
||||
|
||||
/// Generate the body by parsing the located variables and write into the glue variables.
|
||||
/// Write out the main body of the glue variables file using the input stream as the
|
||||
/// source of definitions from the MATIEC ST-to-C compliation.
|
||||
/// @return 0 on success, or non-zero on failure.
|
||||
uint8_t generateBody(istream& locatedVars, ostream& glueVars, md5_byte_t digest[16]) {
|
||||
uint8_t generate_body(istream& locatedVars, ostream& glueVars, md5_byte_t digest[16]) {
|
||||
// We will generate a checksum of the located variables so that
|
||||
// we can detect likely changes (not intended to be cryptographically
|
||||
// secure). This is only to prevent obvious problems.
|
||||
|
@ -494,7 +498,7 @@ uint8_t generateBody(istream& locatedVars, ostream& glueVars, md5_byte_t digest[
|
|||
char iecVar_type[100];
|
||||
int32_t max_index(-1);
|
||||
|
||||
while (parseIecVars(locatedVars, iecVar_name, iecVar_type, md5_state)) {
|
||||
while (parse_iec_vars(locatedVars, iecVar_name, iecVar_type, md5_state)) {
|
||||
cout << "varName: " << iecVar_name << "\tvarType: " << iecVar_type;
|
||||
cout << endl;
|
||||
|
||||
|
@ -503,7 +507,7 @@ uint8_t generateBody(istream& locatedVars, ostream& glueVars, md5_byte_t digest[
|
|||
// value.
|
||||
uint16_t pos1;
|
||||
uint16_t pos2;
|
||||
findPositions(iecVar_name, &pos1, &pos2);
|
||||
find_positions(iecVar_name, &pos1, &pos2);
|
||||
|
||||
if (pos2 > 7) {
|
||||
cout << "Sub-position of variable " << iecVar_name
|
||||
|
@ -519,13 +523,13 @@ uint8_t generateBody(istream& locatedVars, ostream& glueVars, md5_byte_t digest[
|
|||
// Generate the classical glue variables
|
||||
glueVars << "void glueVars()\n{\n";
|
||||
for (auto it = all_vars.begin(); it != all_vars.end(); ++it) {
|
||||
glueVar(glueVars, (*it).name.c_str(), (*it).pos1, (*it).pos2);
|
||||
generate_glue_var_assignment(glueVars, (*it).name.c_str(), (*it).pos1, (*it).pos2);
|
||||
}
|
||||
glueVars << "}\n\n";
|
||||
|
||||
// Generate the unified glue variables
|
||||
generateBoolGroups(glueVars, all_vars);
|
||||
generateIntegratedGlue(glueVars, all_vars);
|
||||
generate_bool_groups(glueVars, all_vars);
|
||||
generate_integrated_glue(glueVars, all_vars);
|
||||
|
||||
// Finish the checksum value
|
||||
md5_finish(&md5_state, digest);
|
||||
|
@ -533,7 +537,7 @@ uint8_t generateBody(istream& locatedVars, ostream& glueVars, md5_byte_t digest[
|
|||
return 0;
|
||||
}
|
||||
|
||||
void generateChecksum(ostream& glueVars, md5_byte_t digest[16]) {
|
||||
void generate_checksum(ostream& glueVars, md5_byte_t digest[16]) {
|
||||
char const hex_chars[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
|
||||
// We do this in a separate step, otherwise every unit test would have
|
||||
|
@ -552,7 +556,8 @@ void generateChecksum(ostream& glueVars, md5_byte_t digest[16]) {
|
|||
/// This is our main function. We define it with a different name and then
|
||||
/// call it from the main function so that we can mock it for the purpose
|
||||
/// of testing.
|
||||
int mainImpl(int argc, char const * const *argv) {
|
||||
/// @return 0 on success. Non-zero if an error occurred.
|
||||
int main_impl(int argc, char const * const *argv) {
|
||||
// Parse the command line arguments - if they exist. Show the help if there
|
||||
// are too many arguments or if the first argument is for help.
|
||||
bool show_help = argc >= 2 \
|
||||
|
@ -581,27 +586,28 @@ int mainImpl(int argc, char const * const *argv) {
|
|||
}
|
||||
|
||||
// Try to open the files for reading and writing.
|
||||
ifstream locatedVars(input_file_name, ios::in);
|
||||
if (!locatedVars.is_open()) {
|
||||
ifstream located_stream(input_file_name, ios::in);
|
||||
if (!located_stream.is_open()) {
|
||||
cout << "Error opening located variables file at " << input_file_name;
|
||||
cout << endl;
|
||||
return 1;
|
||||
}
|
||||
ofstream output_stream(output_file_name, ios::trunc);
|
||||
if (!output_stream.is_open()) {
|
||||
ofstream glue_stream(output_file_name, ios::trunc);
|
||||
if (!glue_stream.is_open()) {
|
||||
cout << "Error opening glue variables file at " << output_file_name;
|
||||
cout << endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
generateHeader(output_stream);
|
||||
generate_header(glue_stream);
|
||||
|
||||
md5_byte_t digest[16];
|
||||
if (generateBody(locatedVars, output_stream, digest) != 0) {
|
||||
if (generate_body(located_stream, glue_stream, digest) != 0) {
|
||||
return 1;
|
||||
}
|
||||
generateChecksum(output_stream, digest);
|
||||
generateBottom(output_stream);
|
||||
|
||||
generate_checksum(glue_stream, digest);
|
||||
generate_bottom(glue_stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -609,7 +615,7 @@ int mainImpl(int argc, char const * const *argv) {
|
|||
// For testing, we need to allow omitting the main function defined here.
|
||||
#ifndef OPLCGLUE_OMIT_MAIN
|
||||
int main(int argc, char *argv[]) {
|
||||
return mainImpl(argc, argv);
|
||||
return main_impl(argc, argv);
|
||||
}
|
||||
#endif // OPLCGLUE_OMIT_MAIN
|
||||
|
||||
|
|
|
@ -51,12 +51,12 @@ SCENARIO("Command line", "[main]") {
|
|||
GIVEN("<no pre-conditions>") {
|
||||
WHEN("-h command line arguments") {
|
||||
const char* args[2] = { "glue_generator", "-h" };
|
||||
REQUIRE(mainImpl(2, args) == 0);
|
||||
REQUIRE(main_impl(2, args) == 0);
|
||||
}
|
||||
|
||||
WHEN("--help command line arguments") {
|
||||
const char* args[2] = { "glue_generator", "--help" };
|
||||
REQUIRE(mainImpl(2, args) == 0);
|
||||
REQUIRE(main_impl(2, args) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,13 +68,13 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single BOOL at %IX0.8 is invalid index") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(BOOL,__IX0,I,X,0, 8)");
|
||||
auto result = generateBody(input_stream, output_stream, digest);
|
||||
auto result = generate_body(input_stream, output_stream, digest);
|
||||
REQUIRE(result != 0);
|
||||
}
|
||||
|
||||
WHEN("Contains single BOOL at %IX0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(BOOL,__IX0_8,I,X,0)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tbool_input[0][0] = __IX0;\n" POSTFIX
|
||||
"GlueBoolGroup ___IG0 { .index=0, .values={ __IX0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, } };\n"
|
||||
"GlueBoolGroup* __IG0(&___IG0);\n"
|
||||
|
@ -89,7 +89,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single BOOL at %QX0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(BOOL,__QX0,Q,X,0)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tbool_output[0][0] = __QX0;\n" POSTFIX
|
||||
"GlueBoolGroup ___QG0 { .index=0, .values={ __QX0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, } };\n"
|
||||
"GlueBoolGroup* __QG0(&___QG0);\n"
|
||||
|
@ -104,7 +104,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains multiple BOOL at %QX0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(BOOL,__QX0_0,Q,X,0,0)\n__LOCATED_VAR(BOOL,__QX0_2,Q,X,0,2)\n__LOCATED_VAR(BOOL,__QX1_3,Q,X,1,3)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tbool_output[0][0] = __QX0_0;\n\tbool_output[0][2] = __QX0_2;\n\tbool_output[1][3] = __QX1_3;\n" POSTFIX
|
||||
"GlueBoolGroup ___QG0 { .index=0, .values={ __QX0_0, nullptr, __QX0_2, nullptr, nullptr, nullptr, nullptr, nullptr, } };\n"
|
||||
"GlueBoolGroup* __QG0(&___QG0);\n"
|
||||
|
@ -122,7 +122,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single BYTE at %IB0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(BYTE,__IB0,I,B,0)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX"\tbyte_input[0] = __IB0;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -134,7 +134,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single SINT at %IB1") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(SINT,__IB1,I,B,1)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tbyte_input[1] = __IB1;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -146,7 +146,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single SINT at %QB1") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(SINT,__QB1,Q,B,1)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tbyte_output[1] = __QB1;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -158,7 +158,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single USINT at %IB2") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(USINT,__IB2,I,B,2)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tbyte_input[2] = __IB2;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -170,7 +170,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single WORD at %IW0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(WORD,__IW0,I,W,0)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tint_input[0] = __IW0;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -182,7 +182,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single WORD at %QW0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(WORD,__QW0,Q,W,0)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tint_output[0] = __QW0;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -194,7 +194,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single INT at %IW1") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(INT,__IW1,I,W,1)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tint_input[1] = __IW1;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -206,7 +206,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single UINT at %IW2") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(UINT,__IW2,I,W,2)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
|
||||
const char* expected = PREFIX "\tint_input[2] = __IW2;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
|
@ -219,7 +219,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains two REAL at %ID0 and %ID10") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(REAL,__ID0,I,D,0)\n__LOCATED_VAR(REAL,__ID10,I,D,10)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
|
||||
// Note that the type-separate glue does not support REAL types
|
||||
const char* expected = PREFIX POSTFIX GLUE_PREFIX
|
||||
|
@ -234,7 +234,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single INT at %MW2") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(INT,__MW2,M,W,2)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tint_memory[2] = __MW2;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -246,7 +246,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single DWORD at %MD0") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(DWORD,__MD2,M,D,2)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tdint_memory[2] = (IEC_DINT *)__MD2;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -258,7 +258,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single LINT at %ML1") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(LINT,__ML1,M,L,1)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tlint_memory[1] = (IEC_LINT *)__ML1;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
@ -270,7 +270,7 @@ SCENARIO("", "") {
|
|||
|
||||
WHEN("Contains single LINT at %ML1024") {
|
||||
std::stringstream input_stream("__LOCATED_VAR(LINT,__ML1024,M,L,1024)");
|
||||
generateBody(input_stream, output_stream, digest);
|
||||
generate_body(input_stream, output_stream, digest);
|
||||
const char* expected = PREFIX "\tspecial_functions[0] = (IEC_LINT *)__ML1024;\n" POSTFIX GLUE_PREFIX
|
||||
"extern std::size_t const OPLCGLUE_GLUE_SIZE(1);\n"
|
||||
"/// The packed glue variables.\n"
|
||||
|
|
Loading…
Reference in New Issue