Skip to content

Commit 58548b9

Browse files
committed
Inluded check of operation call definition in operation body section of configuration file
1 parent d191baf commit 58548b9

2 files changed

Lines changed: 46 additions & 3 deletions

File tree

MCG/MCG_CC/mcg_cc_module_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# for conversion of module content into configuration file format.
66
#
77
# COPYRIGHT: Copyright (C) 2021-2024 Kamil Deć github.com/deckamil
8-
# DATE: 5 FEB 2024
8+
# DATE: 25 FEB 2024
99
#
1010
# LICENSE:
1111
# This file is part of Mod Code Generator (MCG).
@@ -234,7 +234,7 @@ def convert_operation_interfaces(self):
234234
# This method converts operation node from activity diagram into configuration file.
235235
def convert_operation_node(self, sorted_node):
236236

237-
# append operation invocation to configuration file
237+
# append operation call to configuration file
238238
configuration_file_line = str("$OPE ") + str(sorted_node.interaction)
239239
self.append_to_configuration_file(configuration_file_line, True)
240240

MCG/MCG_CGC/mcg_cgc_config_checker.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# responsible for verification of the configuration file data.
66
#
77
# COPYRIGHT: Copyright (C) 2022-2024 Kamil Deć github.com/deckamil
8-
# DATE: 8 FEB 2024
8+
# DATE: 25 FEB 2024
99
#
1010
# LICENSE:
1111
# This file is part of Mod Code Generator (MCG).
@@ -552,6 +552,20 @@ def check_operation_body_details(operation_body_start_index, operation_body_end_
552552
operation_body_section = ConfigChecker.config_file[operation_body_start_index:
553553
operation_body_end_index]
554554

555+
# get first line of operation body section
556+
operation_body_first_line = operation_body_section[0]
557+
558+
# if first line contains unexpected operation body marker
559+
if (operation_body_first_line.find("$EIF ") == ConfigChecker.BASE_MARKER_POSITION) or \
560+
(operation_body_first_line.find("$ELS") == ConfigChecker.BASE_MARKER_POSITION) or \
561+
(operation_body_first_line.find("$INP ") == ConfigChecker.BASE_MARKER_POSITION) or \
562+
(operation_body_first_line.find("$OUT ") == ConfigChecker.BASE_MARKER_POSITION) or \
563+
(operation_body_first_line.find("$OPE -end") == ConfigChecker.BASE_MARKER_POSITION) or \
564+
(operation_body_first_line.find("$IFC -end") == ConfigChecker.BASE_MARKER_POSITION):
565+
566+
# record error
567+
ErrorHandler.record_error(ErrorHandler.CHK_ERR_FAULTY_BODY, operation_body_start_index+1, "")
568+
555569
# get last line of operation body section
556570
operation_body_last_line = operation_body_section[-1]
557571

@@ -568,6 +582,35 @@ def check_operation_body_details(operation_body_start_index, operation_body_end_
568582
# record error
569583
ErrorHandler.record_error(ErrorHandler.CHK_ERR_FAULTY_BODY, operation_body_end_index, "")
570584

585+
# check corrects of operation call definition
586+
for i in range(0, len(operation_body_section)-1):
587+
588+
# if operation call marker is found and next line does not contain operation input interface marker
589+
if ((operation_body_section[i].find("$OPE ") == ConfigChecker.BASE_MARKER_POSITION) and
590+
(operation_body_section[i].find("$OPE -end") != ConfigChecker.BASE_MARKER_POSITION) and
591+
(operation_body_section[i+1].find("$INP ") != ConfigChecker.BASE_MARKER_POSITION)):
592+
593+
# record error
594+
ErrorHandler.record_error(ErrorHandler.CHK_ERR_FAULTY_BODY, operation_body_start_index+i+2, "")
595+
596+
# if operation input interface marker is found and next line does not contain
597+
# operation input interface marker or operation output interface marker
598+
if ((operation_body_section[i].find("$INP ") == ConfigChecker.BASE_MARKER_POSITION) and
599+
((operation_body_section[i+1].find("$INP ") != ConfigChecker.BASE_MARKER_POSITION) and
600+
(operation_body_section[i+1].find("$OUT ") != ConfigChecker.BASE_MARKER_POSITION))):
601+
602+
# record error
603+
ErrorHandler.record_error(ErrorHandler.CHK_ERR_FAULTY_BODY, operation_body_start_index+i+2, "")
604+
605+
# if operation output interface marker is found and next line does not contain
606+
# operation output interface marker or operation call end marker
607+
if ((operation_body_section[i].find("$OUT ") == ConfigChecker.BASE_MARKER_POSITION) and
608+
((operation_body_section[i+1].find("$OUT ") != ConfigChecker.BASE_MARKER_POSITION) and
609+
(operation_body_section[i+1].find("$OPE -end") != ConfigChecker.BASE_MARKER_POSITION))):
610+
611+
# record error
612+
ErrorHandler.record_error(ErrorHandler.CHK_ERR_FAULTY_BODY, operation_body_start_index+i+2, "")
613+
571614
# Description:
572615
# This method checks correctness of module end section in the configuration file.
573616
@staticmethod

0 commit comments

Comments
 (0)