diff --git a/VandMC_testing/mctest/string_return_test/.cproject b/VandMC_testing/mctest/string_return_test/.cproject index d6c2b25d8..f7d00bacb 100644 --- a/VandMC_testing/mctest/string_return_test/.cproject +++ b/VandMC_testing/mctest/string_return_test/.cproject @@ -44,9 +44,6 @@ - - - @@ -92,9 +89,6 @@ - - - diff --git a/VandMC_testing/mctest/string_return_test/.externalToolBuilders/Model Compiler.launch b/VandMC_testing/mctest/string_return_test/.externalToolBuilders/Model Compiler.launch index 6e56de944..46f6c44cd 100644 --- a/VandMC_testing/mctest/string_return_test/.externalToolBuilders/Model Compiler.launch +++ b/VandMC_testing/mctest/string_return_test/.externalToolBuilders/Model Compiler.launch @@ -1,5 +1,4 @@ - - + @@ -7,9 +6,9 @@ - + - + - + \ No newline at end of file diff --git a/VandMC_testing/mctest/string_return_test/.project b/VandMC_testing/mctest/string_return_test/.project index dbbc11fe5..c4b7ac6e5 100644 --- a/VandMC_testing/mctest/string_return_test/.project +++ b/VandMC_testing/mctest/string_return_test/.project @@ -6,13 +6,12 @@ - com.mentor.nucleus.bp.mc.c.binary.export_builder + com.mentor.nucleus.bp.mc.c.source.export_builder org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, LaunchConfigHandle @@ -43,10 +42,10 @@ com.mentor.nucleus.bp.core.xtumlnature - com.mentor.nucleus.bp.mc.c.binary.MCNature org.eclipse.cdt.core.cnature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + com.mentor.nucleus.bp.mc.c.source.MCNature diff --git a/VandMC_testing/mctest/string_return_test/gen/domain.mark b/VandMC_testing/mctest/string_return_test/gen/domain.mark index 9823faa2b..85ffd27e3 100644 --- a/VandMC_testing/mctest/string_return_test/gen/domain.mark +++ b/VandMC_testing/mctest/string_return_test/gen/domain.mark @@ -1,5 +1,6 @@ -.invoke TagMaximumStringLength( 250 ) -.invoke MarkInitializationFunction( "stringtest", "init" ) -.invoke MarkStateTransitionTracingOn( "*" ) -.//.invoke MarkActionStatementTracingOn( "*" ) -.invoke MarkEmptyHandleDetectionOn( "*" ) \ No newline at end of file +.invoke TagMaximumStringLength( 250 ) +.invoke MarkInitializationFunction( "stringtest", "init" ) +.invoke MarkStateTransitionTracingOn( "*" ) +.//.invoke MarkActionStatementTracingOn( "*" ) +.invoke MarkEmptyHandleDetectionOn( "*" ) +.// diff --git a/VandMC_testing/mctest/string_return_test/models/string_return_test/Shared EEs/Shared EEs.xtuml b/VandMC_testing/mctest/string_return_test/models/string_return_test/Shared EEs/Shared EEs.xtuml index c242f8e0e..257e3cc3c 100644 --- a/VandMC_testing/mctest/string_return_test/models/string_return_test/Shared EEs/Shared EEs.xtuml +++ b/VandMC_testing/mctest/string_return_test/models/string_return_test/Shared EEs/Shared EEs.xtuml @@ -184,7 +184,7 @@ INSERT INTO S_BRG '', 0, "ba5eda7a-def5-0000-0000-000000000000", - '', + 'return;', 1, ''); INSERT INTO S_BPARM @@ -414,7 +414,7 @@ INSERT INTO S_BRG '', 1, "ba5eda7a-def5-0000-0000-000000000002", - '', + 'return 0;', 1, ''); INSERT INTO S_BPARM diff --git a/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/buffer/buffer.xtuml b/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/buffer/buffer.xtuml index 30370f169..56e3853e5 100644 --- a/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/buffer/buffer.xtuml +++ b/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/buffer/buffer.xtuml @@ -25,7 +25,7 @@ if ( s1 == s2 ) count = count - 1; ss1 = s1; ss2 = s2; - c = buffer::twist( s1:jstr1, s2:ss2, s3:sum, s4:ss1 ); + c = buffer::twist( s1:jstr1, s2:ss2, s3:sum, s4:buffer::justone( one:ss1,two:ss2 ) ); end while; return c; else @@ -66,6 +66,7 @@ INSERT INTO O_TFR a = s1 + s2; b = s3 + s4; c = a + b; +//LOG::LogInfo( message:buffer::simple() ); return s4;', 1, '', @@ -106,6 +107,46 @@ INSERT INTO O_TPARM '', "5e057ea7-3e2d-4745-a862-216a67ff88b2", ''); +INSERT INTO O_TFR + VALUES ("888cc0ef-dfcc-4955-b78b-c4988cd3326c", + "ad7bde67-c984-44e4-9a4b-9656b30a88be", + 'simple', + '', + "ba5eda7a-def5-0000-0000-000000000004", + 0, + 'return "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";', + 1, + '', + "ae57f5c4-7345-4cbb-9347-07f390179995"); +INSERT INTO O_TFR + VALUES ("7daec356-fdbb-45cb-b22b-dcc549e855b0", + "ad7bde67-c984-44e4-9a4b-9656b30a88be", + 'justone', + '', + "ba5eda7a-def5-0000-0000-000000000004", + 0, + 'return param.one;', + 1, + '', + "888cc0ef-dfcc-4955-b78b-c4988cd3326c"); +INSERT INTO O_TPARM + VALUES ("fd76d66a-c81c-4f26-b09a-d5b1807c9d0b", + "7daec356-fdbb-45cb-b22b-dcc549e855b0", + 'one', + "ba5eda7a-def5-0000-0000-000000000004", + 0, + '', + "00000000-0000-0000-0000-000000000000", + ''); +INSERT INTO O_TPARM + VALUES ("5f06bd90-152f-4b27-b277-a7eb7b6d08fc", + "7daec356-fdbb-45cb-b22b-dcc549e855b0", + 'two', + "ba5eda7a-def5-0000-0000-000000000004", + 0, + '', + "fd76d66a-c81c-4f26-b09a-d5b1807c9d0b", + ''); INSERT INTO O_NBATTR VALUES ("879907b8-a0c3-4d6d-b737-a554bc320f09", "ad7bde67-c984-44e4-9a4b-9656b30a88be"); diff --git a/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/classes.xtuml b/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/classes.xtuml index 0befb3ff6..8bbb677dd 100644 --- a/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/classes.xtuml +++ b/VandMC_testing/mctest/string_return_test/models/string_return_test/components/stringtest/classes/classes.xtuml @@ -819,6 +819,7 @@ generate spin1( spun:spun2 ) to spin1; generate spun1( spin:spin1 ) to spun2; LOG::LogInfo( message:"done with init" ); + ', "ba5eda7a-def5-0000-0000-000000000000", 1, diff --git a/VandMC_testing/mctest/string_return_test/src/string_return_test_sys_types.h b/VandMC_testing/mctest/string_return_test/src/string_return_test_sys_types.h index 24be13a96..c75d53899 100644 --- a/VandMC_testing/mctest/string_return_test/src/string_return_test_sys_types.h +++ b/VandMC_testing/mctest/string_return_test/src/string_return_test_sys_types.h @@ -9,7 +9,7 @@ * Model Compiler Product Information: * Product: * System default/colored values: - * MaxStringLen: 250 + * MaxStringLen: 32 * MaxObjExtent: 0 * MaxRelExtent: 0 * MaxSelectExtent: 0 @@ -75,7 +75,7 @@ typedef unsigned char bool; #define FALSE ( (bool) 0 ) #define TRUE ( (bool) (!FALSE) ) -#define ESCHER_SYS_MAX_STRING_LEN 250 +#define ESCHER_SYS_MAX_STRING_LEN 32 #define ESCHER_PERSIST_INST_CACHE_DEPTH 128 #define ESCHER_PERSIST_LINK_CACHE_DEPTH 128 #define ESCHER_SYS_MAX_ASSOCIATION_EXTENT 0 @@ -108,6 +108,7 @@ typedef double r_t; typedef float r4_t; typedef double r8_t; typedef /*size_t*/ u4_t Escher_size_t; +typedef struct { char s[ ESCHER_SYS_MAX_STRING_LEN ]; } xtuml_string; /* * These are some of the fundamental types used universally. diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest.c b/VandMC_testing/mctest/string_return_test/src/stringtest.c index d307f3344..09174c9ec 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest.c @@ -34,7 +34,7 @@ stringtest_INSTR_start() void stringtest_init() { - stringtest_spun * spun2;stringtest_spin * spin1;stringtest_pong * p2;stringtest_ping * p1;stringtest_buffer * b;stringtest_device * d;stringtest_host * h; + stringtest_host * h;stringtest_device * d;stringtest_buffer * b;stringtest_ping * p1;stringtest_pong * p2;stringtest_spin * spin1;stringtest_spun * spun2; /* LOG::LogInfo( message:starting init ) */ LOG_LogInfo( "starting init" ); /* CREATE OBJECT INSTANCE h OF host */ @@ -50,9 +50,9 @@ stringtest_init() /* ASSIGN b.cache = ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ */ Escher_strcpy( b->cache, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); /* RELATE h TO b ACROSS R1 */ - stringtest_buffer_R1_Link( h, b ); + stringtest_host_R1_Link( b, h ); /* RELATE d TO b ACROSS R2 */ - stringtest_buffer_R2_Link( d, b ); + stringtest_device_R2_Link( b, d ); /* GENERATE host1:get(s:d.lower, d:d) TO h */ { stringtest_hostevent1 * e = (stringtest_hostevent1 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent1c ); Escher_strcpy( e->p_s, d->lower ); e->p_d = d; diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.c index f3dcecec5..563e445d3 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.c @@ -14,10 +14,10 @@ /* * class operation: scmp */ -c_t * +xtuml_string stringtest_buffer_op_scmp( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_SYS_MAX_STRING_LEN] ) { - c_t s2[ESCHER_SYS_MAX_STRING_LEN];c_t s1[ESCHER_SYS_MAX_STRING_LEN];c_t sum[ESCHER_SYS_MAX_STRING_LEN];c_t jstr2[ESCHER_SYS_MAX_STRING_LEN];c_t jstr1[ESCHER_SYS_MAX_STRING_LEN]; + c_t jstr1[ESCHER_SYS_MAX_STRING_LEN];c_t jstr2[ESCHER_SYS_MAX_STRING_LEN];c_t sum[ESCHER_SYS_MAX_STRING_LEN];c_t s1[ESCHER_SYS_MAX_STRING_LEN];c_t s2[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN jstr1 = hello */ Escher_strcpy( jstr1, "hello" ); /* ASSIGN jstr2 = world */ @@ -30,25 +30,26 @@ stringtest_buffer_op_scmp( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_ Escher_strcpy( s2, p_s2 ); /* IF ( ( s1 == s2 ) ) */ if ( ( Escher_strcmp( s1, s2 ) == 0 ) ) { - i_t count;c_t c[ESCHER_SYS_MAX_STRING_LEN]; + c_t c[ESCHER_SYS_MAX_STRING_LEN];i_t count; /* ASSIGN c = */ Escher_strcpy( c, "" ); /* ASSIGN count = 2000 */ count = 2000; /* WHILE ( ( count > 0 ) ) */ while ( ( count > 0 ) ) { - c_t ss2[ESCHER_SYS_MAX_STRING_LEN];c_t ss1[ESCHER_SYS_MAX_STRING_LEN]; + c_t ss1[ESCHER_SYS_MAX_STRING_LEN];c_t ss2[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN count = ( count - 1 ) */ count = ( count - 1 ); /* ASSIGN ss1 = s1 */ Escher_strcpy( ss1, s1 ); /* ASSIGN ss2 = s2 */ Escher_strcpy( ss2, s2 ); - /* ASSIGN c = buffer::twist(s1:jstr1, s2:ss2, s3:sum, s4:ss1) */ - Escher_strcpy2( c, stringtest_buffer_op_twist(jstr1, ss2, sum, ss1) ); + /* ASSIGN c = buffer::twist(s1:jstr1, s2:ss2, s3:sum, s4:) */ + Escher_strcpy( c, stringtest_buffer_op_twist(jstr1, ss2, sum, stringtest_buffer_op_justone(ss1, ss2).s).s ); } /* RETURN c */ - {c_t * xtumlOALrv = c; + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, c ); return xtumlOALrv;} } else { @@ -58,7 +59,8 @@ stringtest_buffer_op_scmp( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_ while ( TRUE ) { } /* RETURN junk */ - {c_t * xtumlOALrv = "junk"; + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, "junk" ); return xtumlOALrv;} } @@ -67,10 +69,10 @@ stringtest_buffer_op_scmp( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_ /* * class operation: twist */ -c_t * +xtuml_string stringtest_buffer_op_twist( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_SYS_MAX_STRING_LEN], c_t p_s3[ESCHER_SYS_MAX_STRING_LEN], c_t p_s4[ESCHER_SYS_MAX_STRING_LEN] ) { - c_t c[ESCHER_SYS_MAX_STRING_LEN];c_t b[ESCHER_SYS_MAX_STRING_LEN];c_t a[ESCHER_SYS_MAX_STRING_LEN];c_t s4[ESCHER_SYS_MAX_STRING_LEN];c_t s3[ESCHER_SYS_MAX_STRING_LEN];c_t s2[ESCHER_SYS_MAX_STRING_LEN];c_t s1[ESCHER_SYS_MAX_STRING_LEN]; + c_t s1[ESCHER_SYS_MAX_STRING_LEN];c_t s2[ESCHER_SYS_MAX_STRING_LEN];c_t s3[ESCHER_SYS_MAX_STRING_LEN];c_t s4[ESCHER_SYS_MAX_STRING_LEN];c_t a[ESCHER_SYS_MAX_STRING_LEN];c_t b[ESCHER_SYS_MAX_STRING_LEN];c_t c[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN s1 = PARAM.s1 */ Escher_strcpy( s1, p_s1 ); /* ASSIGN s2 = PARAM.s2 */ @@ -86,41 +88,40 @@ stringtest_buffer_op_twist( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER /* ASSIGN c = ( a + b ) */ Escher_strcpy( c, Escher_stradd( a, b ) ); /* RETURN s4 */ - {c_t * xtumlOALrv = s4; + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, s4 ); return xtumlOALrv;} } - /* - * RELATE host TO buffer ACROSS R1 + * class operation: simple */ -void -stringtest_buffer_R1_Link( stringtest_host * part, stringtest_buffer * form ) +xtuml_string +stringtest_buffer_op_simple() { - if ( (part == 0) || (form == 0) ) { - XTUML_EMPTY_HANDLE_TRACE( "buffer", "stringtest_buffer_R1_Link" ); - return; - } - /* Note: buffer->host[R1] not navigated */ - /* Note: host->buffer[R1] not navigated */ + /* RETURN XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ); + return xtumlOALrv;} + } /* - * RELATE device TO buffer ACROSS R2 + * class operation: justone */ -void -stringtest_buffer_R2_Link( stringtest_device * part, stringtest_buffer * form ) +xtuml_string +stringtest_buffer_op_justone( c_t p_one[ESCHER_SYS_MAX_STRING_LEN], c_t p_two[ESCHER_SYS_MAX_STRING_LEN] ) { - if ( (part == 0) || (form == 0) ) { - XTUML_EMPTY_HANDLE_TRACE( "buffer", "stringtest_buffer_R2_Link" ); - return; - } - /* Note: buffer->device[R2] not navigated */ - /* Note: device->buffer[R2] not navigated */ + /* RETURN PARAM.one */ + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, p_one ); + return xtumlOALrv;} + } + /*---------------------------------------------------------------------------- * Operation action methods implementation for the following class: * diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.h index e97caa7ca..a68c0d22f 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_buffer_class.h @@ -27,13 +27,11 @@ struct stringtest_buffer { /* Note: No storage needed for buffer->host[R1] */ /* Note: No storage needed for buffer->device[R2] */ }; -c_t * stringtest_buffer_op_scmp( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); -c_t * stringtest_buffer_op_twist( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); +xtuml_string stringtest_buffer_op_scmp( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); +xtuml_string stringtest_buffer_op_twist( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); +xtuml_string stringtest_buffer_op_simple( void ); +xtuml_string stringtest_buffer_op_justone( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void stringtest_buffer_R1_Link( stringtest_host *, stringtest_buffer * ); -/* Note: host<-R1->buffer unrelate accessor not needed */ -void stringtest_buffer_R2_Link( stringtest_device *, stringtest_buffer * ); -/* Note: device<-R2->buffer unrelate accessor not needed */ #define stringtest_buffer_MAX_EXTENT_SIZE 10 diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.c index 7c4a2520f..1861e1e8a 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.c @@ -14,16 +14,31 @@ /* * instance operation: rstr */ -c_t * +xtuml_string stringtest_device_op_rstr( stringtest_device * self) { /* RETURN self.lower */ - {c_t * xtumlOALrv = self->lower; + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, self->lower ); return xtumlOALrv;} } +/* + * RELATE buffer TO device ACROSS R2 + */ +void +stringtest_device_R2_Link( stringtest_buffer * part, stringtest_device * form ) +{ + if ( (part == 0) || (form == 0) ) { + XTUML_EMPTY_HANDLE_TRACE( "device", "stringtest_device_R2_Link" ); + return; + } + /* Note: device->buffer[R2] not navigated */ + /* Note: buffer->device[R2] not navigated */ +} + /*---------------------------------------------------------------------------- * Operation action methods implementation for the following class: @@ -59,13 +74,13 @@ static void stringtest_device_act1( stringtest_device * self, const Escher_xtUMLEvent_t * const event ) { stringtest_deviceevent1 * rcvd_evt = (stringtest_deviceevent1 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t l[ESCHER_SYS_MAX_STRING_LEN];stringtest_host * h; + stringtest_host * h;c_t l[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN h = PARAM.h */ h = rcvd_evt->p_h; /* ASSIGN l = buffer::scmp(s1:h.upper, s2:PARAM.s) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s) ); - /* ASSIGN l = buffer::scmp(s1:self.lower, self.rstr()) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, Escher_strcpy( v_sretval5trv34, stringtest_device_op_rstr(self))) ); + Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s).s ); + /* ASSIGN l = buffer::scmp(s1:self.lower, s2:) */ + Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, stringtest_device_op_rstr(self).s).s ); /* GENERATE host1:get(s:l, d:self) TO h */ { stringtest_hostevent1 * e = (stringtest_hostevent1 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent1c ); Escher_strcpy( e->p_s, l ); e->p_d = self; @@ -81,13 +96,13 @@ static void stringtest_device_act2( stringtest_device * self, const Escher_xtUMLEvent_t * const event ) { stringtest_deviceevent2 * rcvd_evt = (stringtest_deviceevent2 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t l[ESCHER_SYS_MAX_STRING_LEN];stringtest_host * h; + stringtest_host * h;c_t l[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN h = PARAM.h */ h = rcvd_evt->p_h; /* ASSIGN l = buffer::scmp(s1:h.upper, s2:PARAM.s) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s) ); - /* ASSIGN l = buffer::scmp(s1:self.lower, self.rstr()) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, Escher_strcpy( v_sretval5trv34, stringtest_device_op_rstr(self))) ); + Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s).s ); + /* ASSIGN l = buffer::scmp(s1:self.lower, s2:) */ + Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, stringtest_device_op_rstr(self).s).s ); /* GENERATE host2:put(s:l, d:self) TO h */ { stringtest_hostevent2 * e = (stringtest_hostevent2 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent2c ); Escher_strcpy( e->p_s, l ); e->p_d = self; diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.h index 00da07cc8..07cb72c2b 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_device_class.h @@ -26,8 +26,10 @@ struct stringtest_device { /* relationship storage */ /* Note: No storage needed for device->buffer[R2] */ }; -c_t * stringtest_device_op_rstr( stringtest_device * ); +xtuml_string stringtest_device_op_rstr( stringtest_device * ); +void stringtest_device_R2_Link( stringtest_buffer *, stringtest_device * ); +/* Note: buffer<-R2->device unrelate accessor not needed */ #define stringtest_device_MAX_EXTENT_SIZE 10 @@ -57,8 +59,8 @@ extern const Escher_xtUMLEventConstant_t stringtest_deviceevent2c; * union of events targeted towards 'device' state machine */ typedef union { - stringtest_deviceevent1 device11; - stringtest_deviceevent2 device22; + stringtest_deviceevent1 device1_1; + stringtest_deviceevent2 device2_2; } stringtest_device_Events_u; /* diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.c index 81e8f7d07..0677810e5 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.c @@ -14,16 +14,31 @@ /* * instance operation: rstr */ -c_t * +xtuml_string stringtest_host_op_rstr( stringtest_host * self) { /* RETURN self.upper */ - {c_t * xtumlOALrv = self->upper; + {xtuml_string xtumlOALrv; + Escher_strcpy( xtumlOALrv.s, self->upper ); return xtumlOALrv;} } +/* + * RELATE buffer TO host ACROSS R1 + */ +void +stringtest_host_R1_Link( stringtest_buffer * part, stringtest_host * form ) +{ + if ( (part == 0) || (form == 0) ) { + XTUML_EMPTY_HANDLE_TRACE( "host", "stringtest_host_R1_Link" ); + return; + } + /* Note: host->buffer[R1] not navigated */ + /* Note: buffer->host[R1] not navigated */ +} + /*---------------------------------------------------------------------------- * Operation action methods implementation for the following class: @@ -59,13 +74,13 @@ static void stringtest_host_act1( stringtest_host * self, const Escher_xtUMLEvent_t * const event ) { stringtest_hostevent2 * rcvd_evt = (stringtest_hostevent2 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t u[ESCHER_SYS_MAX_STRING_LEN];stringtest_device * d; + stringtest_device * d;c_t u[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN d = PARAM.d */ d = rcvd_evt->p_d; /* ASSIGN u = buffer::scmp(s1:d.lower, s2:PARAM.s) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s) ); - /* ASSIGN u = buffer::scmp(s1:self.upper, self.rstr()) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, Escher_strcpy( v_sretval5trv34, stringtest_host_op_rstr(self))) ); + Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s).s ); + /* ASSIGN u = buffer::scmp(s1:self.upper, s2:) */ + Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, stringtest_host_op_rstr(self).s).s ); /* GENERATE device1:send(s:u, h:self) TO d */ { stringtest_deviceevent1 * e = (stringtest_deviceevent1 *) Escher_NewxtUMLEvent( d, &stringtest_deviceevent1c ); Escher_strcpy( e->p_s, u ); e->p_h = self; @@ -81,13 +96,13 @@ static void stringtest_host_act2( stringtest_host * self, const Escher_xtUMLEvent_t * const event ) { stringtest_hostevent1 * rcvd_evt = (stringtest_hostevent1 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t u[ESCHER_SYS_MAX_STRING_LEN];stringtest_device * d; + stringtest_device * d;c_t u[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN d = PARAM.d */ d = rcvd_evt->p_d; /* ASSIGN u = buffer::scmp(s1:d.lower, s2:PARAM.s) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s) ); - /* ASSIGN u = buffer::scmp(s1:self.upper, self.rstr()) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, Escher_strcpy( v_sretval5trv34, stringtest_host_op_rstr(self))) ); + Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s).s ); + /* ASSIGN u = buffer::scmp(s1:self.upper, s2:) */ + Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, stringtest_host_op_rstr(self).s).s ); /* GENERATE device2:recv(s:u, h:self) TO d */ { stringtest_deviceevent2 * e = (stringtest_deviceevent2 *) Escher_NewxtUMLEvent( d, &stringtest_deviceevent2c ); Escher_strcpy( e->p_s, u ); e->p_h = self; diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.h index 8f4a715f2..f24c22c97 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_host_class.h @@ -26,8 +26,10 @@ struct stringtest_host { /* relationship storage */ /* Note: No storage needed for host->buffer[R1] */ }; -c_t * stringtest_host_op_rstr( stringtest_host * ); +xtuml_string stringtest_host_op_rstr( stringtest_host * ); +void stringtest_host_R1_Link( stringtest_buffer *, stringtest_host * ); +/* Note: buffer<-R1->host unrelate accessor not needed */ #define stringtest_host_MAX_EXTENT_SIZE 10 @@ -57,8 +59,8 @@ extern const Escher_xtUMLEventConstant_t stringtest_hostevent2c; * union of events targeted towards 'host' state machine */ typedef union { - stringtest_hostevent1 host11; - stringtest_hostevent2 host22; + stringtest_hostevent1 host1_1; + stringtest_hostevent2 host2_2; } stringtest_host_Events_u; /* diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.c index 9a04e4fb0..5d3a7c1d5 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.c @@ -40,7 +40,7 @@ static void stringtest_ping_act1( stringtest_ping * self, const Escher_xtUMLEvent_t * const event ) { stringtest_pingevent1 * rcvd_evt = (stringtest_pingevent1 *) event; - c_t r[ESCHER_SYS_MAX_STRING_LEN];c_t t[ESCHER_SYS_MAX_STRING_LEN];stringtest_pong * p;c_t s[ESCHER_SYS_MAX_STRING_LEN]; + c_t s[ESCHER_SYS_MAX_STRING_LEN];stringtest_pong * p;c_t t[ESCHER_SYS_MAX_STRING_LEN];c_t r[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN s = PARAM.s */ Escher_strcpy( s, rcvd_evt->p_s ); /* ASSIGN p = PARAM.p */ @@ -48,7 +48,7 @@ stringtest_ping_act1( stringtest_ping * self, const Escher_xtUMLEvent_t * const /* ASSIGN t = ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string */ Escher_strcpy( t, "ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string" ); /* ASSIGN r = buffer::scmp(s1:s, s2:t) */ - Escher_strcpy( r, stringtest_buffer_op_scmp(s, t) ); + Escher_strcpy( r, stringtest_buffer_op_scmp(s, t).s ); /* GENERATE pong1:fly(p:self, s:s) TO p */ { stringtest_pongevent1 * e = (stringtest_pongevent1 *) Escher_NewxtUMLEvent( p, &stringtest_pongevent1c ); e->p_p = self; Escher_strcpy( e->p_s, s ); diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.h index 36b513364..f374af5c3 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_ping_class.h @@ -43,7 +43,7 @@ extern const Escher_xtUMLEventConstant_t stringtest_pingevent1c; * union of events targeted towards 'ping' state machine */ typedef union { - stringtest_pingevent1 ping11; + stringtest_pingevent1 ping1_1; } stringtest_ping_Events_u; /* diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.c index a24e1196b..906273395 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.c @@ -40,13 +40,13 @@ static void stringtest_pong_act1( stringtest_pong * self, const Escher_xtUMLEvent_t * const event ) { stringtest_pongevent1 * rcvd_evt = (stringtest_pongevent1 *) event; - c_t r[ESCHER_SYS_MAX_STRING_LEN];stringtest_ping * p;c_t s[ESCHER_SYS_MAX_STRING_LEN]; + c_t s[ESCHER_SYS_MAX_STRING_LEN];stringtest_ping * p;c_t r[ESCHER_SYS_MAX_STRING_LEN]; /* ASSIGN s = PARAM.s */ Escher_strcpy( s, rcvd_evt->p_s ); /* ASSIGN p = PARAM.p */ p = rcvd_evt->p_p; /* ASSIGN r = buffer::scmp(s1:s, s2:ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string) */ - Escher_strcpy( r, stringtest_buffer_op_scmp(s, "ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string") ); + Escher_strcpy( r, stringtest_buffer_op_scmp(s, "ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string ping pong string").s ); /* GENERATE ping1:bounce(p:self, s:r) TO p */ { stringtest_pingevent1 * e = (stringtest_pingevent1 *) Escher_NewxtUMLEvent( p, &stringtest_pingevent1c ); e->p_p = self; Escher_strcpy( e->p_s, r ); diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.h index 05b4bcd4a..67e1c97ce 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_pong_class.h @@ -43,7 +43,7 @@ extern const Escher_xtUMLEventConstant_t stringtest_pongevent1c; * union of events targeted towards 'pong' state machine */ typedef union { - stringtest_pongevent1 pong11; + stringtest_pongevent1 pong1_1; } stringtest_pong_Events_u; /* diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.c index 9bbf06b67..d146f37a8 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.c @@ -40,7 +40,7 @@ static void stringtest_spin_act1( stringtest_spin * self, const Escher_xtUMLEvent_t * const event ) { stringtest_spinevent1 * rcvd_evt = (stringtest_spinevent1 *) event; - stringtest_spun * spun;i_t count;c_t t[ESCHER_SYS_MAX_STRING_LEN];c_t s[ESCHER_SYS_MAX_STRING_LEN]; + c_t s[ESCHER_SYS_MAX_STRING_LEN];c_t t[ESCHER_SYS_MAX_STRING_LEN];i_t count;stringtest_spun * spun; /* ASSIGN s = A 10 20 . 30 40 . 50 60 . 70 80 . 90 00 . 10 20 . 30 40 . 50 60 . 70 80 . 90 00 */ Escher_strcpy( s, "A 10 20 . 30 40 . 50 60 . 70 80 . 90 00 . 10 20 . 30 40 . 50 60 . 70 80 . 90 00" ); /* ASSIGN t = B 10 20 . 30 40 . 50 60 . 70 80 . 90 00 . 10 20 . 30 40 . 50 60 . 70 80 . 90 00 */ @@ -53,7 +53,7 @@ stringtest_spin_act1( stringtest_spin * self, const Escher_xtUMLEvent_t * const /* ASSIGN count = ( count - 1 ) */ count = ( count - 1 ); /* ASSIGN u = buffer::twist(s1:0, s2:1, s3:s, s4:t) */ - Escher_strcpy2( u, stringtest_buffer_op_twist("0", "1", s, t) ); + Escher_strcpy( u, stringtest_buffer_op_twist("0", "1", s, t).s ); } /* ASSIGN spun = PARAM.spun */ spun = rcvd_evt->p_spun; diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.h index 466b66085..e4db16eb9 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_spin_class.h @@ -42,7 +42,7 @@ extern const Escher_xtUMLEventConstant_t stringtest_spinevent1c; * union of events targeted towards 'spin' state machine */ typedef union { - stringtest_spinevent1 spin11; + stringtest_spinevent1 spin1_1; } stringtest_spin_Events_u; /* diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.c b/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.c index 4d7581fa2..13b161751 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.c +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.c @@ -40,7 +40,7 @@ static void stringtest_spun_act1( stringtest_spun * self, const Escher_xtUMLEvent_t * const event ) { stringtest_spunevent1 * rcvd_evt = (stringtest_spunevent1 *) event; - stringtest_spin * spin;i_t count;c_t t[ESCHER_SYS_MAX_STRING_LEN];c_t s[ESCHER_SYS_MAX_STRING_LEN]; + c_t s[ESCHER_SYS_MAX_STRING_LEN];c_t t[ESCHER_SYS_MAX_STRING_LEN];i_t count;stringtest_spin * spin; /* ASSIGN s = C 10 20 . 30 40 . 50 60 . 70 80 . 90 00 . 10 20 . 30 40 . 50 60 . 70 80 . 90 00 */ Escher_strcpy( s, "C 10 20 . 30 40 . 50 60 . 70 80 . 90 00 . 10 20 . 30 40 . 50 60 . 70 80 . 90 00" ); /* ASSIGN t = D 10 20 . 30 40 . 50 60 . 70 80 . 90 00 . 10 20 . 30 40 . 50 60 . 70 80 . 90 00 */ @@ -53,7 +53,7 @@ stringtest_spun_act1( stringtest_spun * self, const Escher_xtUMLEvent_t * const /* ASSIGN count = ( count - 1 ) */ count = ( count - 1 ); /* ASSIGN u = buffer::twist(s1:1, s2:t, s3:0, s4:s) */ - Escher_strcpy2( u, stringtest_buffer_op_twist("1", t, "0", s) ); + Escher_strcpy( u, stringtest_buffer_op_twist("1", t, "0", s).s ); } /* ASSIGN spin = PARAM.spin */ spin = rcvd_evt->p_spin; diff --git a/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.h b/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.h index 79a783898..0c443e6fd 100644 --- a/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.h +++ b/VandMC_testing/mctest/string_return_test/src/stringtest_spun_class.h @@ -42,7 +42,7 @@ extern const Escher_xtUMLEventConstant_t stringtest_spunevent1c; * union of events targeted towards 'spun' state machine */ typedef union { - stringtest_spunevent1 spun11; + stringtest_spunevent1 spun1_1; } stringtest_spun_Events_u; /* diff --git a/VandMC_testing/mctest/string_return_test/src/sys_xtuml.c b/VandMC_testing/mctest/string_return_test/src/sys_xtuml.c index 6893bcdad..9c08f7bc9 100644 --- a/VandMC_testing/mctest/string_return_test/src/sys_xtuml.c +++ b/VandMC_testing/mctest/string_return_test/src/sys_xtuml.c @@ -130,6 +130,7 @@ Escher_SetContains( if ( node->object == element ) { return node; } /* found */ node = node->next; } + if ( 0 == element ) return ( const void * ) 1; /* every set contains null */ return 0; /* absent */ } @@ -230,36 +231,6 @@ Escher_memmove( void * const dst, const void * const src, Escher_size_t len ) } } -/* - * Copy characters and be paranoid about null delimiter. - */ -c_t * -Escher_strcpy2( c_t * dst, const c_t * src ) -{ - c_t * s = dst; - double pi1 = 3.14, pi2 = 2.78, pi3 = 3.10, pi4 = 7.7; - static double pi; - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; - if ( ( 0 != src ) && ( 0 != dst ) ) { - while ( ( i > 0 ) && ( *src != '\0' ) ) { - int i; - for ( i = 0; i < 99; i++ ) { - pi = pi1 * pi2; - pi = pi + pi3 * pi4; - if ( pi > 777.7753 ) - pi = pi - 1; - else - pi = pi + 1; - } - --i; - *dst++ = *src++; - } - *dst = '\0'; /* Ensure delimiter. */ - } - return s; -} - - /* * Copy characters and be paranoid about null delimiter. */ @@ -267,7 +238,7 @@ c_t * Escher_strcpy( c_t * dst, const c_t * src ) { c_t * s = dst; - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; + Escher_size_t i = ESCHER_SYS_MAX_STRING_LEN - 1; if ( ( 0 != src ) && ( 0 != dst ) ) { while ( ( i > 0 ) && ( *src != '\0' ) ) { --i; @@ -284,7 +255,7 @@ Escher_strcpy( c_t * dst, const c_t * src ) c_t * Escher_stradd( const c_t * left, const c_t * right ) { - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; + Escher_size_t i = ESCHER_SYS_MAX_STRING_LEN - 1; c_t * s = Escher_strget(); c_t * dst = s; if ( 0 == left ) left = ""; @@ -384,13 +355,18 @@ Escher_DeleteInstance( { Escher_SetElement_s * node; Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - Escher_mutex_lock( SEMAPHORE_FLAVOR_INSTANCE ); - node = Escher_SetRemoveNode( &dci->active, instance ); - node->next = dci->inactive.head; - dci->inactive.head = node; - /* Initialize storage to zero. */ - Escher_memset( instance, 0, dci->size ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_INSTANCE ); + if ( 0 != instance ) { + Escher_mutex_lock( SEMAPHORE_FLAVOR_INSTANCE ); + node = Escher_SetRemoveNode( &dci->active, instance ); + node->next = dci->inactive.head; + dci->inactive.head = node; + /* Initialize storage to zero. */ + Escher_memset( instance, 0, dci->size ); + if ( ( 0 != dci->size ) && ( 0 != dci->initial_state ) ) { + instance->current_state = -1; /* 0xff max for error detection */ + } + Escher_mutex_unlock( SEMAPHORE_FLAVOR_INSTANCE ); + } } /* diff --git a/VandMC_testing/mctest/string_return_test/src/sys_xtuml.h b/VandMC_testing/mctest/string_return_test/src/sys_xtuml.h index e28615b38..efc1d0cc8 100644 --- a/VandMC_testing/mctest/string_return_test/src/sys_xtuml.h +++ b/VandMC_testing/mctest/string_return_test/src/sys_xtuml.h @@ -107,7 +107,6 @@ void Escher_memset( void * const, const u1_t, Escher_size_t ); that invoked the compiler (C library) supplied memmove. */ void Escher_memmove( void * const, const void * const, Escher_size_t ); c_t * Escher_strcpy( c_t *, const c_t * ); -c_t * Escher_strcpy2( c_t *, const c_t * ); c_t * Escher_stradd( const c_t *, const c_t * ); /* We could easily replace this function declaration with a macro that invoked the compiler (C library) supplied strcmp. */ diff --git a/VandMC_testing/mctest/string_return_test/src2/LOG_bridge.c b/VandMC_testing/mctest/string_return_test/src2/LOG_bridge.c deleted file mode 100644 index 18f11c219..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/LOG_bridge.c +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: LOG_bridge.c - * - * Description: - * Methods for bridging to an external entity. - * - * External Entity: Logging (LOG) - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "LOG_bridge.h" -#include "string_return_test_sys_types.h" - -/* - * Bridge: LogSuccess - */ -void -LOG_LogSuccess( c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - printf( "LogSuccess %s\n", p_message ); -} - - -/* - * Bridge: LogFailure - */ -void -LOG_LogFailure( c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - printf( "LogFailure %s\n", p_message ); -} - - -/* - * Bridge: LogInfo - */ -void -LOG_LogInfo( c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - printf( "LogInfo %s\n", p_message ); -} - - -/* - * Bridge: LogDate - */ -void -LOG_LogDate( Escher_Date_t p_d, c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - /* Replace/Insert your implementation code here... */ -} - - -/* - * Bridge: LogTime - */ -void -LOG_LogTime( c_t p_message[ESCHER_SYS_MAX_STRING_LEN], Escher_TimeStamp_t p_t ) -{ - /* Replace/Insert your implementation code here... */ -} - - -/* - * Bridge: LogReal - */ -void -LOG_LogReal( c_t p_message[ESCHER_SYS_MAX_STRING_LEN], const r_t p_r ) -{ - /* Replace/Insert your implementation code here... */ -} - - -/* - * Bridge: LogInteger - */ -void -LOG_LogInteger( const i_t p_message ) -{ - /* Replace/Insert your implementation code here... */ -} - - diff --git a/VandMC_testing/mctest/string_return_test/src2/LOG_bridge.h b/VandMC_testing/mctest/string_return_test/src2/LOG_bridge.h deleted file mode 100644 index e0605b43f..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/LOG_bridge.h +++ /dev/null @@ -1,31 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: LOG_bridge.h - * - * Description: - * Methods for bridging to an external entity. - * - * External Entity: Logging (LOG) - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef LOG_BRIDGE_H -#define LOG_BRIDGE_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "string_return_test_sys_types.h" - -void LOG_LogSuccess( c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogFailure( c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogInfo( c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogDate( Escher_Date_t, c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogTime( c_t[ESCHER_SYS_MAX_STRING_LEN], Escher_TimeStamp_t ); -void LOG_LogReal( c_t[ESCHER_SYS_MAX_STRING_LEN], const r_t ); -void LOG_LogInteger( const i_t ); - -#ifdef __cplusplus -} -#endif -#endif /* LOG_BRIDGE_H */ diff --git a/VandMC_testing/mctest/string_return_test/src2/string_return_test_sys_main.c b/VandMC_testing/mctest/string_return_test/src2/string_return_test_sys_main.c deleted file mode 100644 index 66cb96c97..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/string_return_test_sys_main.c +++ /dev/null @@ -1,59 +0,0 @@ -/*-------------------------------------------------------------------------- - * File: string_return_test_sys_main.c - * - * Description: main, system initialization (and idle loop) - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "stringtest_classes.h" - -unsigned char gc = 0; - -/* - * Run application level initialization by initializing the - * collection of instances for each class and calling domain - * specific initialization. - */ -static void ApplicationLevelInitialization( void ); -static void ApplicationLevelInitialization( void ) -{ - Escher_DomainNumber_t d; - Escher_ClassNumber_t c; - - static const Escher_ClassNumber_t domain_class_count[ SYSTEM_DOMAIN_COUNT ] = { - stringtest_MAX_CLASS_NUMBERS - }; - for ( d = 0; d < SYSTEM_DOMAIN_COUNT; d++ ) { - for ( c = 0; c < domain_class_count[ d ]; c++ ) { - Escher_ClassFactoryInit( d, c ); - } - } -} - -/* - * - * main (although perhaps under a different name) - * - * Bring the system up and start the event dispatch loops. - * Make invocations to the user hooks during the different phases - * of bringup, run and shutdown. - * - */ -int -main( int argc, char ** argv ) -{ - UserInitializationCallout(); - Escher_SetFactoryInit( SYS_MAX_CONTAINERS ); - Escher_InitializeThreading(); - InitializeOoaEventPool(); - ApplicationLevelInitialization(); - UserPreOoaInitializationCallout(); - stringtest_execute_initialization(); - UserPostOoaInitializationCallout(); - Escher_xtUML_run(); /* This is the primary event dispatch loop. */ - UserPreShutdownCallout(); - UserPostShutdownCallout(); - Escher_thread_shutdown(); - return 0; -} diff --git a/VandMC_testing/mctest/string_return_test/src2/string_return_test_sys_types.h b/VandMC_testing/mctest/string_return_test/src2/string_return_test_sys_types.h deleted file mode 100644 index eb5202ff3..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/string_return_test_sys_types.h +++ /dev/null @@ -1,419 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: string_return_test_sys_types.h - * - * your copyright statement can go here (from te_copyright.body) - * - * - * System Name: - * System ID: 1 - * Model Compiler Product Information: - * Product: - * System default/colored values: - * MaxStringLen: 32 - * MaxObjExtent: 0 - * MaxRelExtent: 0 - * MaxSelectExtent: 0 - * MaxSelfEvents: 0 - * MaxNonSelfEvents: 0 - * MaxTimers: 0 - * MaxInterleavedBridges: 0 - * MaxInterleavedBridgeDataSize: 8 - * CollectionsFlavor: 0 - * ForcePriorityEvents: FALSE - * PEIClassCount: 0 - * PersistentClassCount: 0 - * PersistInstanceCacheDepth: 128 - * PersistLinkCacheDepth: 128 - * - * Component Name: stringtest - * MaxObjExtent: 50 - * MaxRelExtent: 0 - * MaxSelectExtent: 0 - * MaxSelfEvents: 0 - * MaxNonSelfEvents: 2 - * MaxPriorityEvents: 0 - * MaxTimers: 0 - * InterleavedBridges: 0 - * PEIClassCount: 0 - * PersistentClassCount: 0 - * InterleavedDataSize: 8 - * CollectionsFlavor: 0 - *--------------------------------------------------------------------------*/ - -#ifndef STRING_RETURN_TEST_SYS_TYPES_H -#define STRING_RETURN_TEST_SYS_TYPES_H -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Shore up C by declaring our own version of bool. - */ -#ifndef __cplusplus -typedef unsigned char bool; - -#ifdef false -#undef false -#endif - -#ifdef true -#undef true -#endif - -#define false ( (bool) 0 ) -#define true ( (bool) (!false) ) -#endif - -#ifdef FALSE -#undef FALSE -#endif - -#ifdef TRUE -#undef TRUE -#endif - -#define FALSE ( (bool) 0 ) -#define TRUE ( (bool) (!FALSE) ) - -#define ESCHER_SYS_MAX_STRING_LEN 32 -#define ESCHER_PERSIST_INST_CACHE_DEPTH 128 -#define ESCHER_PERSIST_LINK_CACHE_DEPTH 128 -#define ESCHER_SYS_MAX_ASSOCIATION_EXTENT 0 -#define ESCHER_SYS_MAX_TRANSIENT_EXTENT 0 -#define SYS_MAX_CONTAINERS ( ESCHER_SYS_MAX_ASSOCIATION_EXTENT + ESCHER_SYS_MAX_TRANSIENT_EXTENT ) -#define ESCHER_SYS_MAX_SELF_EVENTS 0 -#define ESCHER_SYS_MAX_NONSELF_EVENTS 6 -#define ESCHER_SYS_MAX_XTUML_EVENTS ( ESCHER_SYS_MAX_SELF_EVENTS + ESCHER_SYS_MAX_NONSELF_EVENTS ) -#define ESCHER_SYS_MAX_XTUML_TIMERS 0 -#define ESCHER_SYS_MAX_INTERLEAVED_BRIDGES 0 -#define ESCHER_SYS_MAX_INTERLEAVED_BRIDGE_DATA 8 - - -/* - * Core types with byte widths defined for MISRA-C compliance. - */ -typedef char c_t; -typedef unsigned char uc_t; -typedef int i_t; -typedef unsigned int ui_t; -typedef long l_t; -typedef unsigned long ul_t; -typedef signed char s1_t; -typedef unsigned char u1_t; -typedef signed short s2_t; -typedef unsigned short u2_t; -typedef signed long s4_t; -typedef unsigned long u4_t; -typedef double r_t; -typedef float r4_t; -typedef double r8_t; -typedef /*size_t*/ u4_t Escher_size_t; - -/* - * These are some of the fundamental types used universally. - */ -typedef u1_t Escher_DomainNumber_t; -typedef u2_t Escher_ClassNumber_t; -typedef Escher_size_t Escher_ClassSize_t; -typedef u2_t Escher_InstanceIndex_t; -typedef u1_t Escher_StateNumber_t; -typedef u1_t Escher_EventNumber_t; -typedef u1_t Escher_EventFlags_t; -typedef u1_t Escher_EventPriority_t; -typedef u1_t Escher_SEMcell_t; -typedef struct { - Escher_DomainNumber_t domainnum; - Escher_ClassNumber_t classnum; - Escher_InstanceIndex_t index; -} InstanceIdentifier_t; - -typedef struct { - Escher_StateNumber_t current_state; -} Escher_InstanceBase_t; -typedef Escher_InstanceBase_t * Escher_iHandle_t; -typedef Escher_iHandle_t Escher_UniqueID_t; -typedef void (*Escher_idf)( Escher_iHandle_t ); - -/* Return code type for dispatch of a polymorphic event (see sys_events.h). */ -typedef u1_t Escher_PolyEventRC_t; - -/* Interleaved bridge node base type. */ -typedef struct Escher_ilb_s Escher_ilb_t; -typedef void ( * Escher_ilb_fp_t )( Escher_ilb_t * ); -struct Escher_ilb_s { Escher_ilb_fp_t f; }; - -/* - * Time and date core types. - */ -typedef l_t Escher_Date_t; -typedef u4_t Escher_TimeStamp_t; -typedef u4_t Escher_uSec_t; - -#define DomainMultiplier 1 - -/* - * Allow for compilerisms (such as 8051 Tasking) to use memory model - * hints to the compiler. - */ -#ifndef _reentrant -#define _reentrant -#endif - -/* - * Note we include stdio.h for printf. Otherwise, it is not needed. - */ -#include -#include "sys_xtuml.h" -#include "sys_user_co.h" -/* - * Data structures and methods associated with the event base class of this - * model compiler. - */ -/* Escher_EventFlags_t bit masks */ -#define ESCHER_IS_INSTANCE_EVENT 0x01 -#define ESCHER_IS_CREATION_EVENT 0x02 -#define ESCHER_IS_ASSIGNER_EVENT 0x04 -#define ESCHER_IS_DELAYED_EVENT 0x08 -#define ESCHER_NO_FSM_RELEASE_EVENT 0x10 -#define ESCHER_IS_POLYMORPHIC_EVENT 0x20 -#define ESCHER_IS_TRUE_EVENT 0x40 -#define ESCHER_IS_POLY_IN_FLIGHT 0x80 - -#define UNINITIALIZED_STATE 0 -#define EVENT_CANT_HAPPEN ((Escher_StateNumber_t) -1) -#define EVENT_IS_IGNORED ((Escher_StateNumber_t) -2) - -/* This represents the constant part of the event structure. */ -typedef struct { - Escher_DomainNumber_t destination_domain_number; - Escher_ClassNumber_t destination_object_number; - Escher_EventNumber_t event_number; - Escher_EventFlags_t event_flags; -} Escher_xtUMLEventConstant_t; - -/* Structure: Escher_xtUMLEvent_t - * Base class of application analysis xtUML events. */ -#define EVENT_BASE_ATTRIBUTE_LIST \ - struct Escher_xtUMLevent_s * next;\ - Escher_iHandle_t object_instance;\ - Escher_DomainNumber_t destination_domain_number;\ - Escher_ClassNumber_t destination_object_number;\ - Escher_EventNumber_t event_number;\ - Escher_EventFlags_t event_flags;\ - -struct Escher_xtUMLevent_s { - EVENT_BASE_ATTRIBUTE_LIST -}; -typedef struct Escher_xtUMLevent_s Escher_xtUMLEvent_t; - -typedef unsigned long ETimer_time_t; - -typedef void Escher_Timer_t; - -/* - * Event Macros - */ -#define GetOoaEventFlags(X) (((X))->event_flags) -#define SetOoaEventFlags(X, Y) (((X))->event_flags = Y) - -#define GetIsInstanceEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_INSTANCE_EVENT) -#define SetIsInstanceEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_INSTANCE_EVENT) - -#define GetIsCreationEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_CREATION_EVENT) -#define SetIsCreationEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_CREATION_EVENT) - -#define GetIsAssignerEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_ASSIGNER_EVENT) -#define SetIsAssignerEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_ASSIGNER_EVENT) - -#define GetIsDelayedEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_DELAYED_EVENT) -#define SetIsDelayedEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_DELAYED_EVENT) - -#define GetIsPolymorphicEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_POLYMORPHIC_EVENT) -#define SetIsPolymorphicEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_POLYMORPHIC_EVENT) -#define ClearIsPolymorphicEvent(X) (GetOoaEventFlags(X) &= ~(Escher_EventFlags_t)ESCHER_IS_POLYMORPHIC_EVENT) - -#define GetFsmReleasesEvent(X) (GetOoaEventFlags(X) & ESCHER_NO_FSM_RELEASE_EVENT) -#define SetFsmReleasesEvent(X) (GetOoaEventFlags(X) |= ESCHER_NO_FSM_RELEASE_EVENT) - -#define GetOoaEventNumber(X) (((X))->event_number) -#define SetOoaEventNumber(X, Y) (((X))->event_number = (Y)) - -#define GetEventTargetInstance(X) (((X))->object_instance) -#define SetEventTargetInstance(X, Y) (((X))->object_instance = (Escher_iHandle_t)(Y)) - -#define GetEventSendingInstance(X) (((X))->sending_instance) -#define SetEventSendingInstance(X, Y) (((X))->sending_instance = (Escher_iHandle_t)(Y)) - -#define GetEventDestDomainNumber(X) (((X))->destination_domain_number) -#define SetEventDestDomainNumber(X, Y) (((X))->destination_domain_number = (Y)) - -#define GetEventDestObjectNumber(X) (((X))->destination_object_number) -#define SetEventDestObjectNumber(X, Y) (((X))->destination_object_number = (Y)) - -/* Opaque type definition of a translated state action member function. */ -typedef _reentrant void (*StateAction_t)( Escher_iHandle_t, const Escher_xtUMLEvent_t * const ); - -/* Opaque type definition of class event dispatcher member function. */ -typedef _reentrant void (*EventTaker_t)( Escher_xtUMLEvent_t * ); - -/* Opaque type definition of domain level event dispatcher member function. */ -typedef _reentrant void (*DomainDispatcher_t)( Escher_xtUMLEvent_t * ); - - - -Escher_xtUMLEvent_t * Escher_AllocatextUMLEvent( void ); -Escher_xtUMLEvent_t * Escher_NewxtUMLEvent( const void * const, const Escher_xtUMLEventConstant_t * const ); -Escher_xtUMLEvent_t * Escher_ModifyxtUMLEvent( Escher_xtUMLEvent_t *, const Escher_xtUMLEventConstant_t * const ); -void Escher_DeletextUMLEvent( Escher_xtUMLEvent_t * ); -void InitializeOoaEventPool( void ); -void Escher_xtUML_run( void ); -void * Escher_GetSelf( void ); -void Escher_SendEvent( Escher_xtUMLEvent_t * ); -void Escher_SendSelfEvent( Escher_xtUMLEvent_t * ); - -/* - * Delcarations for multi-tasking/threading services. - */ - - -#define ESCHER_TASKING_POSIX 1 -#define NUM_OF_XTUML_CLASS_THREADS 3 -#define NUM_OF_TOTAL_THREADS NUM_OF_XTUML_CLASS_THREADS -#define SEMAPHORE_FLAVOR_IQUEUE 0 -#define SEMAPHORE_FLAVOR_SQUEUE 1 -#define SEMAPHORE_FLAVOR_FREELIST 2 -#define SEMAPHORE_FLAVOR_NONBUSY 3 -#define SEMAPHORE_FLAVOR_INSTANCE 4 -#define SEMAPHORE_FLAVOR_TIMER 5 -#define SEMAPHORE_FLAVOR_ILB 6 -#define SEMAPHORE_FLAVOR_MAX 7 - -void Escher_InitializeThreading( void ); -void Escher_thread_create( void *(f)(void *), const u1_t ); -void Escher_mutex_lock( const u1_t ); -void Escher_mutex_unlock( const u1_t ); -void Escher_nonbusy_wait( const u1_t ); -void Escher_nonbusy_wake( const u1_t ); -void Escher_thread_shutdown( void ); - -#ifdef NOMUTEX_DEBUG -#define pthread_mutex_lock( X ) 0 -#define pthread_mutex_unlock( X ) 0 -#endif - - - - -#define SYSTEM_DOMAIN_COUNT 1 -/* xtUML domain identification numbers */ -#define stringtest_DOMAIN_ID 0 -#define stringtest_DOMAIN_ID_text "stringtest" -#include "stringtest_classes.h" - -/*---------------------------------------------------------------------------- - * - * Run time instrumentation and tracing declarations are defined here. - * - * Note: - * Multi-line macros use the do {...} while (0) construct recommended - * by cert.org (PRE10-C, PRE10-CPP). - * - * Users may copy this file to the /gen folder and modify these macros - * as desired to change the way tracing works. - * - *--------------------------------------------------------------------------*/ - -#define XTUML_TRACE_FLUSH( i ) fflush( i ) - -/* - * State transition start tracing: - */ -/* To suppress source identification in tracing, uncomment the following macro */ -/* #define XTUML_SOURCE_PROLOGUE */ - -#ifndef XTUML_SOURCE_PROLOGUE -#define XTUML_SOURCE_PROLOGUE printf( "%s #%6u: ", __FILE__, __LINE__ ); XTUML_TRACE_FLUSH( 0 ) -#endif - -/* To suppress state transition start tracing, uncomment the following macro */ -/* #define STATE_TXN_START_TRACE( obj_kl, state_num, state_name ) */ - -#ifndef STATE_TXN_START_TRACE -#define STATE_TXN_START_TRACE( obj_kl, state_num, state_name ) do { XTUML_SOURCE_PROLOGUE; if ! gc++ printf( "Transition started: %s State [%u] %s\n", obj_kl, state_num, state_name ); } while (0) -#endif - -/* - * State transition complete tracing: - */ -/* To suppress state transition complete tracing, uncomment the following macro */ -/* #define STATE_TXN_END_TRACE( obj_kl, state_num, state_name ) */ - -#ifndef STATE_TXN_END_TRACE -#define STATE_TXN_END_TRACE( obj_kl, state_num, state_name ) do { XTUML_SOURCE_PROLOGUE; printf( "Transition complete: %s State [%u] %s\n", obj_kl, state_num, state_name ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Event ignored tracing: - */ -/* To unsuppress event ignored tracing, comment out the following macro. */ -#define STATE_TXN_IG_TRACE( obj_kl, state_num ) - -#ifndef STATE_TXN_IG_TRACE -#define STATE_TXN_IG_TRACE( obj_kl, state_num ) do { XTUML_SOURCE_PROLOGUE; printf( "Event ignored: %s current_state = %u\n", obj_kl, state_num ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Event can't happen tracing: - */ -/* To suppress can't happen tracing, uncomment the following macro */ -/* #define STATE_TXN_CH_TRACE( obj_kl, state_num ) */ - -#ifndef STATE_TXN_CH_TRACE -#define STATE_TXN_CH_TRACE( obj_kl, state_num ) do { XTUML_SOURCE_PROLOGUE; printf( "Event cannot happen: %s current_state = %u\n", obj_kl, state_num ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Component message start tracing: - */ -/* To suppress component message start tracing, uncomment the following macro */ -/* #define COMP_MSG_START_TRACE( arg_format, component_number, port_number, message_number, args... ) */ - -#ifndef COMP_MSG_START_TRACE -#define COMP_MSG_START_TRACE( arg_format, component_number, port_number, message_number, args... ) do { XTUML_SOURCE_PROLOGUE; printf( "component %d port %d message %d " arg_format "\n", component_number, port_number, message_number, ## args ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Component message end tracing: - */ - - -/* - * Object Action Language (OAL) statement level tracing: - */ - -/* To suppress statement source identification, uncomment the following macro */ -/* #define XTUML_OAL_STMT_TRACE( blck_level, stmt_action ) */ - -#ifndef XTUML_OAL_STMT_TRACE -#define XTUML_OAL_STMT_TRACE( blck_level, stmt_action ) do { XTUML_SOURCE_PROLOGUE; { /* indenting */ s1_t i; for ( i = 0; i < blck_level; i++ ) printf( " " ); } printf( "%s\n", stmt_action ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* To suppress empty handle detection, modify the following macro. */ - -#ifndef XTUML_EMPTY_HANDLE_TRACE -#define XTUML_EMPTY_HANDLE_TRACE( object_keyletters, s ) do { UserEmptyHandleDetectedCallout( object_keyletters, s ); } while (0) -#endif - -/* - * Declare state information structure. - */ -typedef struct Escher_StateInfo_s Escher_StateInfo_s; -struct Escher_StateInfo_s { - Escher_StateNumber_t state_number; /* 'real' state number */ - c_t * state_name; -}; - -#ifdef __cplusplus -} -#endif -#endif /* STRING_RETURN_TEST_SYS_TYPES_H */ diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest.c b/VandMC_testing/mctest/string_return_test/src2/stringtest.c deleted file mode 100644 index a8663248b..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest.c +++ /dev/null @@ -1,98 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest.c - * - * UML Component Port Messages - * Component/Module Name: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "stringtest.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * Interface: instr - * Provided Port: INSTR - * To Provider Message: start - */ -void -stringtest_INSTR_start() -{ - /* ::init( ) */ - stringtest_init(); -} - -/* - * UML Domain Functions (Synchronous Services) - */ - -/* - * Domain Function: init - */ -void -stringtest_init() -{ - stringtest_pong * p2;stringtest_ping * p1;stringtest_buffer * b;stringtest_device * d;stringtest_host * h; - /* LOG::LogInfo( message:intializing ) */ - LOG_LogInfo( "intializing" ); - /* CREATE OBJECT INSTANCE h OF host */ - h = (stringtest_host *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_host_CLASS_NUMBER ); - /* ASSIGN h.upper = upper information */ - Escher_strcpy( h->upper, "upper information" ); - /* CREATE OBJECT INSTANCE d OF device */ - d = (stringtest_device *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_device_CLASS_NUMBER ); - /* ASSIGN d.lower = lower storage area */ - Escher_strcpy( d->lower, "lower storage area" ); - /* CREATE OBJECT INSTANCE b OF buffer */ - b = (stringtest_buffer *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_buffer_CLASS_NUMBER ); - /* ASSIGN b.cache = ABCDEFGHIJKLMNOPQRSTUVWXYZ */ - Escher_strcpy( b->cache, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); - /* RELATE h TO b ACROSS R1 */ - stringtest_buffer_R1_Link( h, b ); - /* RELATE d TO b ACROSS R2 */ - stringtest_buffer_R2_Link( d, b ); - /* GENERATE host1:get(s:d.lower, d:d) TO h */ - { stringtest_hostevent1 * e = (stringtest_hostevent1 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent1c ); - Escher_strcpy( e->p_s, d->lower ); e->p_d = d; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } - /* CREATE OBJECT INSTANCE p1 OF ping */ - p1 = (stringtest_ping *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_ping_CLASS_NUMBER ); - /* CREATE OBJECT INSTANCE p2 OF pong */ - p2 = (stringtest_pong *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_pong_CLASS_NUMBER ); - /* GENERATE ping1:bounce(p:p2, s:ping pong string) TO p1 */ - { stringtest_pingevent1 * e = (stringtest_pingevent1 *) Escher_NewxtUMLEvent( p1, &stringtest_pingevent1c ); - e->p_p = p2; Escher_strcpy( e->p_s, "ping pong string" ); - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } - -} - -/* xtUML class info (collections, sizes, etc.) */ -Escher_Extent_t * const stringtest_class_info[ stringtest_MAX_CLASS_NUMBERS ] = { - &pG_stringtest_host_extent, - &pG_stringtest_device_extent, - &pG_stringtest_ping_extent, - &pG_stringtest_pong_extent, - &pG_stringtest_buffer_extent -}; - -/* - * Array of pointers to the class event dispatcher method. - * Index is the (model compiler enumerated) number of the state model. - */ -const EventTaker_t stringtest_EventDispatcher[ stringtest_STATE_MODELS ] = { - stringtest_class_dispatchers -}; - -void stringtest_execute_initialization() -{ - /* - * Initialization Function: init - * Component: stringtest - */ - stringtest_init(); - -} diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest.h b/VandMC_testing/mctest/string_return_test/src2/stringtest.h deleted file mode 100644 index 245e80f1b..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest.h +++ /dev/null @@ -1,22 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest.h - * - * UML Component (Module) Declaration (Operations and Signals) - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_H -#define STRINGTEST_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "string_return_test_sys_types.h" -void stringtest_INSTR_start( void ); - - -#ifdef __cplusplus -} -#endif -#endif /* STRINGTEST_H */ diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_buffer_class.c b/VandMC_testing/mctest/string_return_test/src2/stringtest_buffer_class.c deleted file mode 100644 index f4e0b9ed2..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_buffer_class.c +++ /dev/null @@ -1,100 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_buffer_class.c - * - * Class: buffer (buffer) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * class operation: scmp - */ -c_t * -stringtest_buffer_op_scmp( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_SYS_MAX_STRING_LEN] ) -{ - c_t s2[ESCHER_SYS_MAX_STRING_LEN];c_t s1[ESCHER_SYS_MAX_STRING_LEN];c_t sum[ESCHER_SYS_MAX_STRING_LEN];c_t jstr2[ESCHER_SYS_MAX_STRING_LEN];c_t jstr1[ESCHER_SYS_MAX_STRING_LEN]; - /* ASSIGN jstr1 = hello */ - Escher_strcpy( jstr1, "hello" ); - /* ASSIGN jstr2 = world */ - Escher_strcpy( jstr2, "world" ); - /* ASSIGN sum = ( jstr1 + jstr2 ) */ - Escher_strcpy( sum, Escher_stradd( jstr1, jstr2 ) ); - /* ASSIGN s1 = PARAM.s1 */ - Escher_strcpy( s1, p_s1 ); - /* ASSIGN s2 = PARAM.s2 */ - Escher_strcpy( s2, p_s2 ); - /* IF ( ( s1 == s2 ) ) */ - if ( ( Escher_strcmp( s1, s2 ) == 0 ) ) { - /* RETURN s1 */ - {c_t * xtumlOALrv = s1; - return xtumlOALrv;} - } - else { - /* LOG::LogFailure( message:FAIL ) */ - LOG_LogFailure( "FAIL" ); - /* WHILE ( TRUE ) */ - while ( TRUE ) { - } - /* RETURN junk */ - {c_t * xtumlOALrv = "junk"; - return xtumlOALrv;} - } - -} - - -/* - * RELATE host TO buffer ACROSS R1 - */ -void -stringtest_buffer_R1_Link( stringtest_host * part, stringtest_buffer * form ) -{ - if ( (part == 0) || (form == 0) ) { - XTUML_EMPTY_HANDLE_TRACE( "buffer", "stringtest_buffer_R1_Link" ); - return; - } - /* Note: buffer->host[R1] not navigated */ - /* Note: host->buffer[R1] not navigated */ -} - -/* - * RELATE device TO buffer ACROSS R2 - */ -void -stringtest_buffer_R2_Link( stringtest_device * part, stringtest_buffer * form ) -{ - if ( (part == 0) || (form == 0) ) { - XTUML_EMPTY_HANDLE_TRACE( "buffer", "stringtest_buffer_R2_Link" ); - return; - } - /* Note: buffer->device[R2] not navigated */ - /* Note: device->buffer[R2] not navigated */ -} - - -/*---------------------------------------------------------------------------- - * Operation action methods implementation for the following class: - * - * Class: buffer (buffer) - * Component: stringtest - *--------------------------------------------------------------------------*/ -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_buffer_container[ stringtest_buffer_MAX_EXTENT_SIZE ]; -static stringtest_buffer stringtest_buffer_instances[ stringtest_buffer_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_buffer_extent = { - {0}, {0}, &stringtest_buffer_container[ 0 ], - (Escher_iHandle_t) &stringtest_buffer_instances, - sizeof( stringtest_buffer ), 0, stringtest_buffer_MAX_EXTENT_SIZE - }; - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_buffer_class.h b/VandMC_testing/mctest/string_return_test/src2/stringtest_buffer_class.h deleted file mode 100644 index d4180bda7..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_buffer_class.h +++ /dev/null @@ -1,47 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_buffer_class.h - * - * Class: buffer (buffer) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_BUFFER_CLASS_H -#define STRINGTEST_BUFFER_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * buffer (buffer) - */ -struct stringtest_buffer { - - /* application analysis class attributes */ - c_t cache[ESCHER_SYS_MAX_STRING_LEN]; /* - cache */ - - /* relationship storage */ - /* Note: No storage needed for buffer->host[R1] */ - /* Note: No storage needed for buffer->device[R2] */ -}; -c_t * stringtest_buffer_op_scmp( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); - -void stringtest_buffer_R1_Link( stringtest_host *, stringtest_buffer * ); -/* Note: host<-R1->buffer unrelate accessor not needed */ -void stringtest_buffer_R2_Link( stringtest_device *, stringtest_buffer * ); -/* Note: device<-R2->buffer unrelate accessor not needed */ - - -#define stringtest_buffer_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_buffer_extent; - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_BUFFER_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_classes.h b/VandMC_testing/mctest/string_return_test/src2/stringtest_classes.h deleted file mode 100644 index 1c1321260..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_classes.h +++ /dev/null @@ -1,81 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_classes.h - * - * This file defines the object type identification numbers for all classes - * in the component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_CLASSES_H -#define STRINGTEST_CLASSES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Initialization services for component: stringtest - */ -extern Escher_Extent_t * const stringtest_class_info[]; -extern const EventTaker_t stringtest_EventDispatcher[]; -void stringtest_execute_initialization( void ); - -#define stringtest_STATE_MODELS 4 -/* Define constants to map to class numbers. */ -#define stringtest_host_CLASS_NUMBER 0 -#define stringtest_device_CLASS_NUMBER 1 -#define stringtest_ping_CLASS_NUMBER 2 -#define stringtest_pong_CLASS_NUMBER 3 -#define stringtest_buffer_CLASS_NUMBER 4 -#define stringtest_MAX_CLASS_NUMBERS 5 - -/* Provide a map of classes to task numbers. */ -#define stringtest_TASK_NUMBERS 1, 1, 2, 2 - -#define stringtest_class_dispatchers\ - stringtest_host_Dispatch,\ - stringtest_device_Dispatch,\ - stringtest_ping_Dispatch,\ - stringtest_pong_Dispatch - -/* Provide definitions of the shapes of the class structures. */ - -typedef struct stringtest_host stringtest_host; -typedef struct stringtest_device stringtest_device; -typedef struct stringtest_ping stringtest_ping; -typedef struct stringtest_pong stringtest_pong; -typedef struct stringtest_buffer stringtest_buffer; - -/* union of class declarations so we may derive largest class size */ -#define stringtest_CLASS_U \ - char stringtest_dummy;\ - -/* - * UML Domain Functions (Synchronous Services) - */ -void stringtest_init( void ); - - -#include "LOG_bridge.h" -#include "stringtest.h" -#include "stringtest_host_class.h" -#include "stringtest_device_class.h" -#include "stringtest_buffer_class.h" -#include "stringtest_ping_class.h" -#include "stringtest_pong_class.h" -/* - * roll-up of all events (with their parameters) for component stringtest - */ -typedef union { - stringtest_host_Events_u stringtest_host_Events_u_namespace; - stringtest_device_Events_u stringtest_device_Events_u_namespace; - stringtest_ping_Events_u stringtest_ping_Events_u_namespace; - stringtest_pong_Events_u stringtest_pong_Events_u_namespace; -} stringtest_DomainEvents_u; - -#ifdef __cplusplus -} -#endif -#endif /* STRINGTEST_CLASSES_H */ - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_device_class.c b/VandMC_testing/mctest/string_return_test/src2/stringtest_device_class.c deleted file mode 100644 index a1326c8e3..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_device_class.c +++ /dev/null @@ -1,165 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_device_class.c - * - * Class: device (device) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * instance operation: rstr - */ -c_t * -stringtest_device_op_rstr( stringtest_device * self) -{ - /* RETURN self.lower */ - {c_t * xtumlOALrv = self->lower; - return xtumlOALrv;} - -} - - - -/*---------------------------------------------------------------------------- - * Operation action methods implementation for the following class: - * - * Class: device (device) - * Component: stringtest - *--------------------------------------------------------------------------*/ -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_device_container[ stringtest_device_MAX_EXTENT_SIZE ]; -static stringtest_device stringtest_device_instances[ stringtest_device_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_device_extent = { - {0}, {0}, &stringtest_device_container[ 0 ], - (Escher_iHandle_t) &stringtest_device_instances, - sizeof( stringtest_device ), stringtest_device_STATE_1, stringtest_device_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: device (device) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [putting] - */ -static void stringtest_device_act1( stringtest_device *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_device_act1( stringtest_device * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_deviceevent1 * rcvd_evt = (stringtest_deviceevent1 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t l[ESCHER_SYS_MAX_STRING_LEN];stringtest_host * h; - /* ASSIGN h = PARAM.h */ - h = rcvd_evt->p_h; - /* ASSIGN l = buffer::scmp(s1:h.upper, s2:PARAM.s) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s) ); - /* ASSIGN l = buffer::scmp(s1:self.lower, self.rstr()) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, Escher_strcpy( v_sretval5trv34, stringtest_device_op_rstr(self))) ); - /* GENERATE host1:get(s:l, d:self) TO h */ - { stringtest_hostevent1 * e = (stringtest_hostevent1 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent1c ); - Escher_strcpy( e->p_s, l ); e->p_d = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -/* - * State 2: [getting] - */ -static void stringtest_device_act2( stringtest_device *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_device_act2( stringtest_device * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_deviceevent2 * rcvd_evt = (stringtest_deviceevent2 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t l[ESCHER_SYS_MAX_STRING_LEN];stringtest_host * h; - /* ASSIGN h = PARAM.h */ - h = rcvd_evt->p_h; - /* ASSIGN l = buffer::scmp(s1:h.upper, s2:PARAM.s) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s) ); - /* ASSIGN l = buffer::scmp(s1:self.lower, self.rstr()) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, Escher_strcpy( v_sretval5trv34, stringtest_device_op_rstr(self))) ); - /* GENERATE host2:put(s:l, d:self) TO h */ - { stringtest_hostevent2 * e = (stringtest_hostevent2 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent2c ); - Escher_strcpy( e->p_s, l ); e->p_d = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_deviceevent1c = { - stringtest_DOMAIN_ID, stringtest_device_CLASS_NUMBER, STRINGTEST_DEVICEEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - -const Escher_xtUMLEventConstant_t stringtest_deviceevent2c = { - stringtest_DOMAIN_ID, stringtest_device_CLASS_NUMBER, STRINGTEST_DEVICEEVENT2NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_device_StateEventMatrix[ 2 + 1 ][ 2 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN, EVENT_CANT_HAPPEN }, - /* row 1: stringtest_device_STATE_1 (putting) */ - { EVENT_CANT_HAPPEN, stringtest_device_STATE_2 }, - /* row 2: stringtest_device_STATE_2 (getting) */ - { stringtest_device_STATE_1, EVENT_CANT_HAPPEN } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_device_acts[ 3 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_device_act1, /* putting */ - (StateAction_t) stringtest_device_act2 /* getting */ - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_device_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 2 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_device_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 2 ) { - /* Execute the state action and update the current state. */ - ( *stringtest_device_acts[ next_state ] )( instance, event ); - instance->current_state = next_state; - } else if ( next_state == EVENT_CANT_HAPPEN ) { - /* event cant happen */ - UserEventCantHappenCallout( current_state, next_state, event_number ); - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_device_class.h b/VandMC_testing/mctest/string_return_test/src2/stringtest_device_class.h deleted file mode 100644 index 00da07cc8..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_device_class.h +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_device_class.h - * - * Class: device (device) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_DEVICE_CLASS_H -#define STRINGTEST_DEVICE_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * device (device) - */ -struct stringtest_device { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - c_t lower[ESCHER_SYS_MAX_STRING_LEN]; /* - lower */ - - /* relationship storage */ - /* Note: No storage needed for device->buffer[R2] */ -}; -c_t * stringtest_device_op_rstr( stringtest_device * ); - - - -#define stringtest_device_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_device_extent; - -/* - * instance event: device1:'send' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_host * p_h; /* h */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_deviceevent1; -extern const Escher_xtUMLEventConstant_t stringtest_deviceevent1c; - -/* - * instance event: device2:'recv' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_host * p_h; /* h */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_deviceevent2; -extern const Escher_xtUMLEventConstant_t stringtest_deviceevent2c; - -/* - * union of events targeted towards 'device' state machine - */ -typedef union { - stringtest_deviceevent1 device11; - stringtest_deviceevent2 device22; -} stringtest_device_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_device_STATE_1 1 /* state [1]: (putting) */ -#define stringtest_device_STATE_2 2 /* state [2]: (getting) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_DEVICEEVENT1NUM 0 /* device1:'send' */ -#define STRINGTEST_DEVICEEVENT2NUM 1 /* device2:'recv' */ -extern void stringtest_device_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_DEVICE_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_host_class.c b/VandMC_testing/mctest/string_return_test/src2/stringtest_host_class.c deleted file mode 100644 index 05e1c5407..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_host_class.c +++ /dev/null @@ -1,165 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_host_class.c - * - * Class: host (host) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * instance operation: rstr - */ -c_t * -stringtest_host_op_rstr( stringtest_host * self) -{ - /* RETURN self.upper */ - {c_t * xtumlOALrv = self->upper; - return xtumlOALrv;} - -} - - - -/*---------------------------------------------------------------------------- - * Operation action methods implementation for the following class: - * - * Class: host (host) - * Component: stringtest - *--------------------------------------------------------------------------*/ -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_host_container[ stringtest_host_MAX_EXTENT_SIZE ]; -static stringtest_host stringtest_host_instances[ stringtest_host_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_host_extent = { - {0}, {0}, &stringtest_host_container[ 0 ], - (Escher_iHandle_t) &stringtest_host_instances, - sizeof( stringtest_host ), stringtest_host_STATE_1, stringtest_host_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: host (host) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [sending] - */ -static void stringtest_host_act1( stringtest_host *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_host_act1( stringtest_host * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_hostevent2 * rcvd_evt = (stringtest_hostevent2 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t u[ESCHER_SYS_MAX_STRING_LEN];stringtest_device * d; - /* ASSIGN d = PARAM.d */ - d = rcvd_evt->p_d; - /* ASSIGN u = buffer::scmp(s1:d.lower, s2:PARAM.s) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s) ); - /* ASSIGN u = buffer::scmp(s1:self.upper, self.rstr()) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, Escher_strcpy( v_sretval5trv34, stringtest_host_op_rstr(self))) ); - /* GENERATE device1:send(s:u, h:self) TO d */ - { stringtest_deviceevent1 * e = (stringtest_deviceevent1 *) Escher_NewxtUMLEvent( d, &stringtest_deviceevent1c ); - Escher_strcpy( e->p_s, u ); e->p_h = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -/* - * State 2: [receiving] - */ -static void stringtest_host_act2( stringtest_host *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_host_act2( stringtest_host * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_hostevent1 * rcvd_evt = (stringtest_hostevent1 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t u[ESCHER_SYS_MAX_STRING_LEN];stringtest_device * d; - /* ASSIGN d = PARAM.d */ - d = rcvd_evt->p_d; - /* ASSIGN u = buffer::scmp(s1:d.lower, s2:PARAM.s) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s) ); - /* ASSIGN u = buffer::scmp(s1:self.upper, self.rstr()) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, Escher_strcpy( v_sretval5trv34, stringtest_host_op_rstr(self))) ); - /* GENERATE device2:recv(s:u, h:self) TO d */ - { stringtest_deviceevent2 * e = (stringtest_deviceevent2 *) Escher_NewxtUMLEvent( d, &stringtest_deviceevent2c ); - Escher_strcpy( e->p_s, u ); e->p_h = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_hostevent1c = { - stringtest_DOMAIN_ID, stringtest_host_CLASS_NUMBER, STRINGTEST_HOSTEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - -const Escher_xtUMLEventConstant_t stringtest_hostevent2c = { - stringtest_DOMAIN_ID, stringtest_host_CLASS_NUMBER, STRINGTEST_HOSTEVENT2NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_host_StateEventMatrix[ 2 + 1 ][ 2 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN, EVENT_CANT_HAPPEN }, - /* row 1: stringtest_host_STATE_1 (sending) */ - { stringtest_host_STATE_2, EVENT_CANT_HAPPEN }, - /* row 2: stringtest_host_STATE_2 (receiving) */ - { EVENT_CANT_HAPPEN, stringtest_host_STATE_1 } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_host_acts[ 3 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_host_act1, /* sending */ - (StateAction_t) stringtest_host_act2 /* receiving */ - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_host_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 2 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_host_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 2 ) { - /* Execute the state action and update the current state. */ - ( *stringtest_host_acts[ next_state ] )( instance, event ); - instance->current_state = next_state; - } else if ( next_state == EVENT_CANT_HAPPEN ) { - /* event cant happen */ - UserEventCantHappenCallout( current_state, next_state, event_number ); - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_host_class.h b/VandMC_testing/mctest/string_return_test/src2/stringtest_host_class.h deleted file mode 100644 index 8f4a715f2..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_host_class.h +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_host_class.h - * - * Class: host (host) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_HOST_CLASS_H -#define STRINGTEST_HOST_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * host (host) - */ -struct stringtest_host { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - c_t upper[ESCHER_SYS_MAX_STRING_LEN]; /* - upper */ - - /* relationship storage */ - /* Note: No storage needed for host->buffer[R1] */ -}; -c_t * stringtest_host_op_rstr( stringtest_host * ); - - - -#define stringtest_host_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_host_extent; - -/* - * instance event: host1:'get' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_device * p_d; /* d */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_hostevent1; -extern const Escher_xtUMLEventConstant_t stringtest_hostevent1c; - -/* - * instance event: host2:'put' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_device * p_d; /* d */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_hostevent2; -extern const Escher_xtUMLEventConstant_t stringtest_hostevent2c; - -/* - * union of events targeted towards 'host' state machine - */ -typedef union { - stringtest_hostevent1 host11; - stringtest_hostevent2 host22; -} stringtest_host_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_host_STATE_1 1 /* state [1]: (sending) */ -#define stringtest_host_STATE_2 2 /* state [2]: (receiving) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_HOSTEVENT1NUM 0 /* host1:'get' */ -#define STRINGTEST_HOSTEVENT2NUM 1 /* host2:'put' */ -extern void stringtest_host_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_HOST_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_ping_class.c b/VandMC_testing/mctest/string_return_test/src2/stringtest_ping_class.c deleted file mode 100644 index 00f6e46bb..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_ping_class.c +++ /dev/null @@ -1,114 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_ping_class.c - * - * Class: ping (ping) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - - -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_ping_container[ stringtest_ping_MAX_EXTENT_SIZE ]; -static stringtest_ping stringtest_ping_instances[ stringtest_ping_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_ping_extent = { - {0}, {0}, &stringtest_ping_container[ 0 ], - (Escher_iHandle_t) &stringtest_ping_instances, - sizeof( stringtest_ping ), stringtest_ping_STATE_1, stringtest_ping_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: ping (ping) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [pinging] - */ -static void stringtest_ping_act1( stringtest_ping *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_ping_act1( stringtest_ping * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_pingevent1 * rcvd_evt = (stringtest_pingevent1 *) event; - c_t r[ESCHER_SYS_MAX_STRING_LEN];stringtest_pong * p;c_t s[ESCHER_SYS_MAX_STRING_LEN]; - /* ASSIGN s = PARAM.s */ - Escher_strcpy( s, rcvd_evt->p_s ); - /* ASSIGN p = PARAM.p */ - p = rcvd_evt->p_p; - /* ASSIGN r = buffer::scmp(s1:s, s2:ping pong string) */ - Escher_strcpy( r, stringtest_buffer_op_scmp(s, "ping pong string") ); - /* GENERATE pong1:fly(p:self, s:s) TO p */ - { stringtest_pongevent1 * e = (stringtest_pongevent1 *) Escher_NewxtUMLEvent( p, &stringtest_pongevent1c ); - e->p_p = self; Escher_strcpy( e->p_s, s ); - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_pingevent1c = { - stringtest_DOMAIN_ID, stringtest_ping_CLASS_NUMBER, STRINGTEST_PINGEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_ping_StateEventMatrix[ 1 + 1 ][ 1 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN }, - /* row 1: stringtest_ping_STATE_1 (pinging) */ - { stringtest_ping_STATE_1 } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_ping_acts[ 2 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_ping_act1 /* pinging */ - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_ping_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 1 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_ping_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 1 ) { - /* Execute the state action and update the current state. */ - ( *stringtest_ping_acts[ next_state ] )( instance, event ); - instance->current_state = next_state; - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_ping_class.h b/VandMC_testing/mctest/string_return_test/src2/stringtest_ping_class.h deleted file mode 100644 index 36b513364..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_ping_class.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_ping_class.h - * - * Class: ping (ping) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_PING_CLASS_H -#define STRINGTEST_PING_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * ping (ping) - */ -struct stringtest_ping { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - -}; - - - -#define stringtest_ping_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_ping_extent; - -/* - * instance event: ping1:'bounce' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_pong * p_p; /* p */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_pingevent1; -extern const Escher_xtUMLEventConstant_t stringtest_pingevent1c; - -/* - * union of events targeted towards 'ping' state machine - */ -typedef union { - stringtest_pingevent1 ping11; -} stringtest_ping_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_ping_STATE_1 1 /* state [1]: (pinging) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_PINGEVENT1NUM 0 /* ping1:'bounce' */ -extern void stringtest_ping_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_PING_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_pong_class.c b/VandMC_testing/mctest/string_return_test/src2/stringtest_pong_class.c deleted file mode 100644 index bd01f5213..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_pong_class.c +++ /dev/null @@ -1,114 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_pong_class.c - * - * Class: pong (pong) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - - -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_pong_container[ stringtest_pong_MAX_EXTENT_SIZE ]; -static stringtest_pong stringtest_pong_instances[ stringtest_pong_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_pong_extent = { - {0}, {0}, &stringtest_pong_container[ 0 ], - (Escher_iHandle_t) &stringtest_pong_instances, - sizeof( stringtest_pong ), stringtest_pong_STATE_1, stringtest_pong_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: pong (pong) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [ponging] - */ -static void stringtest_pong_act1( stringtest_pong *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_pong_act1( stringtest_pong * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_pongevent1 * rcvd_evt = (stringtest_pongevent1 *) event; - c_t r[ESCHER_SYS_MAX_STRING_LEN];stringtest_ping * p;c_t s[ESCHER_SYS_MAX_STRING_LEN]; - /* ASSIGN s = PARAM.s */ - Escher_strcpy( s, rcvd_evt->p_s ); - /* ASSIGN p = PARAM.p */ - p = rcvd_evt->p_p; - /* ASSIGN r = buffer::scmp(s1:s, s2:ping pong string) */ - Escher_strcpy( r, stringtest_buffer_op_scmp(s, "ping pong string") ); - /* GENERATE ping1:bounce(p:self, s:r) TO p */ - { stringtest_pingevent1 * e = (stringtest_pingevent1 *) Escher_NewxtUMLEvent( p, &stringtest_pingevent1c ); - e->p_p = self; Escher_strcpy( e->p_s, r ); - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_pongevent1c = { - stringtest_DOMAIN_ID, stringtest_pong_CLASS_NUMBER, STRINGTEST_PONGEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_pong_StateEventMatrix[ 1 + 1 ][ 1 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN }, - /* row 1: stringtest_pong_STATE_1 (ponging) */ - { stringtest_pong_STATE_1 } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_pong_acts[ 2 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_pong_act1 /* ponging */ - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_pong_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 1 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_pong_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 1 ) { - /* Execute the state action and update the current state. */ - ( *stringtest_pong_acts[ next_state ] )( instance, event ); - instance->current_state = next_state; - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src2/stringtest_pong_class.h b/VandMC_testing/mctest/string_return_test/src2/stringtest_pong_class.h deleted file mode 100644 index 05b4bcd4a..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/stringtest_pong_class.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_pong_class.h - * - * Class: pong (pong) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_PONG_CLASS_H -#define STRINGTEST_PONG_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * pong (pong) - */ -struct stringtest_pong { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - -}; - - - -#define stringtest_pong_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_pong_extent; - -/* - * instance event: pong1:'fly' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_ping * p_p; /* p */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_pongevent1; -extern const Escher_xtUMLEventConstant_t stringtest_pongevent1c; - -/* - * union of events targeted towards 'pong' state machine - */ -typedef union { - stringtest_pongevent1 pong11; -} stringtest_pong_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_pong_STATE_1 1 /* state [1]: (ponging) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_PONGEVENT1NUM 0 /* pong1:'fly' */ -extern void stringtest_pong_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_PONG_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src2/sys_thread.c b/VandMC_testing/mctest/string_return_test/src2/sys_thread.c deleted file mode 100644 index 040f2b49f..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/sys_thread.c +++ /dev/null @@ -1,107 +0,0 @@ -/*--------------------------------------------------------------------- - * File: sys_thread.c - * - * Description: - * This file provides implementation of multi-tasking/threading - * capabilities allowing classes/subsystems to run in different - * threads on a multi-tasking/threading OS/RTOS. - * - * your copyright statement can go here (from te_copyright.body) - *-------------------------------------------------------------------*/ - -#include /* POSIX thread declarations */ -#include "string_return_test_sys_types.h" - -static pthread_mutex_t mutices[ SEMAPHORE_FLAVOR_MAX ]; -static pthread_cond_t nonbusy_wait_cond[ NUM_OF_TOTAL_THREADS ]; -static u1_t threadnumber[ NUM_OF_TOTAL_THREADS ]; - -/* - * Initialize those structures that need to be set up once at system - * bring-up time. - */ -void Escher_InitializeThreading( void ) -{ - u1_t i; - int rc; - for ( i = 0; i < NUM_OF_TOTAL_THREADS; i++ ) { - threadnumber[ i ] = i; - rc = pthread_cond_init( &nonbusy_wait_cond[ i ], 0 ); - } - for ( i = 0; i < SEMAPHORE_FLAVOR_MAX; i++ ) { - rc = pthread_mutex_init( &mutices[ i ], 0 ); - } - rc = rc; -} - -/* - * Obtain a resource lock so that this thread has mutually exclusive - * access. - */ -void Escher_mutex_lock( const u1_t flavor ) -{ - int rc = pthread_mutex_lock( &mutices[ flavor ] ); - rc = rc; -} - -/* - * Release a resource lock that was obtained with the lock method. - */ -void Escher_mutex_unlock( const u1_t flavor ) -{ - int rc = pthread_mutex_unlock( &mutices[ flavor ] ); - rc = rc; -} - -/* - * Go into a non-busy wait state waiting on someone to wake us - * up with the nonbusy_wake method. - */ -void Escher_nonbusy_wait( const u1_t thread ) -{ - int rc; - void * vp = 0; - pthread_cond_t * dwc = &nonbusy_wait_cond[ thread ]; - Escher_mutex_lock( SEMAPHORE_FLAVOR_NONBUSY ); - if ( ( thread != 0 ) || ( vp == 0 ) ) { - rc = pthread_cond_wait( dwc, &mutices[ SEMAPHORE_FLAVOR_NONBUSY ] ); - } - Escher_mutex_unlock( SEMAPHORE_FLAVOR_NONBUSY ); -} - -/* - * Wake up a thread that went to sleep waiting for something to happen. - */ -void Escher_nonbusy_wake( const u1_t thread ) -{ - int rc; - pthread_cond_t * dwc = &nonbusy_wait_cond[ thread ]; - Escher_mutex_lock( SEMAPHORE_FLAVOR_NONBUSY ); - rc = pthread_cond_broadcast( dwc ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_NONBUSY ); -} - -/* - * Create and spin off a task/thread to run the input routine. - */ -void Escher_thread_create( void *(routine)(void *), const u1_t i ) -{ - static pthread_t pthread[ NUM_OF_TOTAL_THREADS ]; - int rc = pthread_create( &pthread[ i - 1 ], 0, routine, &threadnumber[ i ] ); - rc = rc; -} - -/* - * Cleanup the structures initialized in Escher_InitializeThreading. - */ -void Escher_thread_shutdown( void ) -{ - u1_t i; - int rc; - for ( i = 0; i < NUM_OF_TOTAL_THREADS; i++ ) { - rc = pthread_cond_destroy( &nonbusy_wait_cond[ i ] ); - } - for ( i = 0; i < SEMAPHORE_FLAVOR_MAX; i++ ) { - rc = pthread_mutex_destroy( &mutices[ i ] ); - } -} diff --git a/VandMC_testing/mctest/string_return_test/src2/sys_user_co.c b/VandMC_testing/mctest/string_return_test/src2/sys_user_co.c deleted file mode 100644 index 34f20c1af..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/sys_user_co.c +++ /dev/null @@ -1,253 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: sys_user_co.c - * - * Description: - * Interface call-outs allow the user to capture execution control of the - * generated system running on a target. - * Especially in the deeply embedded software/hardware development world, - * it may be necessary to tightly interface the xtUML system to the - * surrounding/containing system. MC-3020 provides callout routines - * that enable the user to easily interface code generated by the model - * compiler with other system code. These callout routines are empty when - * generated by the model compiler. It is up to the user to define - * additional functionality (if necessary) to be performed at these - * callout points. - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "sys_user_co.h" - -#ifdef SYS_USER_CO_PRINTF_ON -#include -#define SYS_USER_CO_PRINTF( s ) printf( s ); -#else -#define SYS_USER_CO_PRINTF( s ) -#endif - -/* - * UserInitializationCallout - * - * This function is invoked at the immediate beginning of application - * initialization. It is the very first function to be executed at system - * startup. - * User supplied implementation of this function should be restricted to - * things like memory initialization, early hardware duties, etc. - */ -void -UserInitializationCalloutf( void ) -{ -/* Activate this invocation to initialize the example simple TIM. */ - #if ESCHER_SYS_MAX_XTUML_TIMERS > 0 - TIM_init(); - #endif - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserInitializationCallout\n" ) -} - -/* - * UserPreOoaInitializationCallout - * - * This function is invoked immediately prior to executing any xtUML - * initialization functions. - */ -void -UserPreOoaInitializationCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPreOoaInitializationCallout\n" ) -} - -/* - * UserPostOoaInitializationCallout - * - * This function is invoked immediately after executing any xtUML - * initialization functions. - * When this callout function returns, the system dispatcher will allow the - * xtUML application analysis state models to start consuming events. - */ -void -UserPostOoaInitializationCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPostOoaInitializationCallout\n" ) -} - -/* - * UserBackgroundProcessingCallout - * - * This function is invoked once during each loop execution of the system - * dispather. - * It is invoked at the 'top' of the system dispatcher loop, immediately - * prior to dispatching any xtUML application analysis events. - */ -void -UserBackgroundProcessingCalloutf( void ) -{ - /* Activate this invocation to periodically tick the example simple TIM. */ - #if ESCHER_SYS_MAX_XTUML_TIMERS > 0 - TIM_tick(); - #endif - /* Insert implementation specific code here. */ -} - -/* - * UserPreShutdownCallout - * - * This function is invoked at termination of the system dispatcher, but - * prior to performing any xtUML application analysis shutdown sequencing. - */ -void -UserPreShutdownCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPreShutdownCallout\n" ) -} - -/* - * UserPostShutdownCallout - * - * This function is invoked immediately before application exit. - */ -void -UserPostShutdownCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPostShutdownCallout\n" ) -} - -/* - * UserEventCantHappenCallout - * - * This function is invoked any time that an event is received that - * results in a "cant happen" transition. - */ -void -UserEventCantHappenCalloutf( - const Escher_StateNumber_t current_state, - const Escher_StateNumber_t next_state, - const Escher_EventNumber_t event_number ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEventCantHappenCallout\n" ) -} - -/* - * UserEventNoInstanceCallout - * - * This function is invoked when we failed to validate the instance - * to which an event was directed. This can happen in normal operation - * when the instance was deleted while the event was in flight (analysis - * error). - */ -void -UserEventNoInstanceCalloutf( - const Escher_EventNumber_t event_number ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEventNoInstanceCallout\n" ) -} - -/* - * UserEventFreeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate an - * event, but there are no more left. - */ -void -UserEventFreeListEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEventFreeListEmptyCallout\n" ) -} - -/* - * UserEmptyHandleDetectedCallout - * - * This function is invoked when an attempt is made to use an instance - * reference variable (handle) that is null (empty). - */ -void -UserEmptyHandleDetectedCalloutf( c_t * object_keyletters, c_t * s ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEmptyHandleDetectedCallout\n" ) -} - -/* - * UserObjectPoolEmptyCallout - * - * This function is invoked when an attempt is made to create an - * instance of an object, but there are no instances available. - */ -void -UserObjectPoolEmptyCalloutf( const Escher_DomainNumber_t component_number, const Escher_ClassNumber_t class_number ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserObjectPoolEmptyCallout\n" ) -} - -/* - * UserNodeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate a - * node, but there are no more left. - */ -void -UserNodeListEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserNodeListEmptyCallout\n" ) -} - -/* - * UserInterleavedBridgeOverflowCallout - * - * This function is invoked when an attempt is made to post too many - * interleaved bridges. The depth of this list is defined by - * SYS_MAX_INTERLEAVED_BRIDGES (unless changed in the archetype). - */ -void -UserInterleavedBridgeOverflowCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserInterleavedBridgeOverflowCallout\n" ) -} - -/* - * UserSelfEventQueueEmptyCallout - * - * This function is invoked when the events to self queue is - * interrogated and found to be empty. - */ -void -UserSelfEventQueueEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ -} - -/* - * UserNonSelfEventQueueEmptyCallout - * - * This function is invoked when the events to instance queue is - * interrogated and found to be empty. - */ -void -UserNonSelfEventQueueEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ -} - -/* - * UserPersistenceErrorCallout - * - * This function is invoked when the events to instance queue is - * interrogated and found to be empty. - */ -void -UserPersistenceErrorCalloutf( i_t error_code ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPersistenceErrorCallout\n" ) -} diff --git a/VandMC_testing/mctest/string_return_test/src2/sys_user_co.h b/VandMC_testing/mctest/string_return_test/src2/sys_user_co.h deleted file mode 100644 index 2202f397f..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/sys_user_co.h +++ /dev/null @@ -1,296 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: sys_user_co.h - * - * Description: - * Function declarations for user supplied (non-translated) call out entry - * points in the generated application. - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef SYS_USER_CO_H -#define SYS_USER_CO_H -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned char gc; - -/* - * UserInitializationCallout - * - * This function is invoked at the immediate beginning of application - * initialization. It is the very first function to be executed at system - * startup. - * User supplied implementation of this function should be restricted to - * things like memory initialization, early hardware duties, etc. - * - */ -void UserInitializationCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. - (activated by default... Uncomment to deactivate.) -#define UserInitializationCallout() - */ - -#ifndef UserInitializationCallout -#define UserInitializationCallout() UserInitializationCalloutf() -#endif - -/* - * UserPreOoaInitializationCallout - * - * This function is invoked immediately prior to executing any xtUML - * initialization functions. - */ -void UserPreOoaInitializationCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPreOoaInitializationCallout() - -#ifndef UserPreOoaInitializationCallout -#define UserPreOoaInitializationCallout() UserPreOoaInitializationCalloutf() -#endif - -/* - * UserPostOoaInitializationCallout - * - * This function is invoked immediately after executing any xtUML - * initialization functions. - * When this callout function returns, the system dispatcher will allow the - * xtUML application analysis state models to start consuming events. - */ -void UserPostOoaInitializationCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPostOoaInitializationCallout() - -#ifndef UserPostOoaInitializationCallout -#define UserPostOoaInitializationCallout() UserPostOoaInitializationCalloutf() -#endif - -/* - * UserBackgroundProcessingCallout - * - * This function is invoked once during each loop execution of the system - * dispather. - * It is invoked at the 'top' of the system dispatcher loop, immediately - * prior to dispatching any xtUML application analysis events. - */ -void UserBackgroundProcessingCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. - (activated by default... Uncomment to deactivate.) -#define UserBackgroundProcessingCallout() - */ - -#ifndef UserBackgroundProcessingCallout -#define UserBackgroundProcessingCallout() UserBackgroundProcessingCalloutf() -#endif - -/* - * UserPreShutdownCallout - * - * This function is invoked at termination of the system dispatcher, but - * prior to performing any xtUML application analysis shutdown sequencing. - */ -void UserPreShutdownCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPreShutdownCallout() - -#ifndef UserPreShutdownCallout -#define UserPreShutdownCallout() UserPreShutdownCalloutf() -#endif - -/* - * UserPostShutdownCallout - * - * This function is invoked immediately before application exit. - */ -void UserPostShutdownCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPostShutdownCallout() - -#ifndef UserPostShutdownCallout -#define UserPostShutdownCallout() UserPostShutdownCalloutf() -#endif - -/* - * UserEventCantHappenCallout - * - * This function is invoked any time that an event is received that - * results in a "cant happen" transition. - */ -void UserEventCantHappenCalloutf( const Escher_StateNumber_t, - const Escher_StateNumber_t, - const Escher_EventNumber_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEventCantHappenCallout( s1, s2, e ) - -#ifndef UserEventCantHappenCallout -#define UserEventCantHappenCallout( s1, s2, e ) UserEventCantHappenCalloutf( s1, s2, e ) -#endif - -/* - * UserEventNoInstanceCallout - * - * This function is invoked when we failed to validate the instance - * to which an event was directed. This can happen in normal operation - * when the instance was deleted while the event was in flight (analysis - * error). - */ -void UserEventNoInstanceCalloutf( const Escher_EventNumber_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEventNoInstanceCallout( e ) - -#ifndef UserEventNoInstanceCallout -#define UserEventNoInstanceCallout( e ) UserEventNoInstanceCalloutf( e ) -#endif - -/* - * UserEventFreeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate an - * event, but there are no more left. - */ -void UserEventFreeListEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEventFreeListEmptyCallout() - -#ifndef UserEventFreeListEmptyCallout -#define UserEventFreeListEmptyCallout() UserEventFreeListEmptyCalloutf() -#endif - -/* - * UserEmptyHandleDetectedCallout - * - * This function is invoked when an attempt is made to use an instance - * reference variable (handle) that is null (empty). - */ -void UserEmptyHandleDetectedCalloutf( c_t *, c_t * ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEmptyHandleDetectedCallout( s1, s2 ) - -#ifndef UserEmptyHandleDetectedCallout -#define UserEmptyHandleDetectedCallout( s1, s2 ) UserEmptyHandleDetectedCalloutf( (c_t *) s1, (c_t *) s2 ) -#endif - -/* - * UserObjectPoolEmptyCallout - * - * This function is invoked when an attempt is made to create an - * instance of an object, but there are no instances available. - */ -void UserObjectPoolEmptyCalloutf( const Escher_DomainNumber_t, const Escher_ClassNumber_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. - (activated by default... Uncomment to deactivate.) -#define UserObjectPoolEmptyCallout( s1, s2 ) - */ - -#ifndef UserObjectPoolEmptyCallout -#define UserObjectPoolEmptyCallout( s1, s2 ) UserObjectPoolEmptyCalloutf( s1, s2 ) -#endif - -/* - * UserNodeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate a - * node, but there are no more left. - */ -void UserNodeListEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserNodeListEmptyCallout() - -#ifndef UserNodeListEmptyCallout -#define UserNodeListEmptyCallout() UserNodeListEmptyCalloutf() -#endif - -/* - * UserInterleavedBridgeOverflowCallout - * - * This function is invoked when an attempt is made to post too many - * interleaved bridges. The depth of this list is defined by - * SYS_MAX_INTERLEAVED_BRIDGES (unless changed in the archetype). - */ -void UserInterleavedBridgeOverflowCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserInterleavedBridgeOverflowCallout() - -#ifndef UserInterleavedBridgeOverflowCallout -#define UserInterleavedBridgeOverflowCallout() UserInterleavedBridgeOverflowCalloutf() -#endif - -/* - * UserSelfEventQueueEmptyCallout - * - * This function is invoked when the events to self queue is - * interrogated and found to be empty. - */ -void UserSelfEventQueueEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserSelfEventQueueEmptyCallout() - -#ifndef UserSelfEventQueueEmptyCallout -#define UserSelfEventQueueEmptyCallout() UserSelfEventQueueEmptyCalloutf() -#endif - -/* - * UserNonSelfEventQueueEmptyCallout - * - * This function is invoked when the events to instance queue is - * interrogated and found to be empty. - */ -void UserNonSelfEventQueueEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserNonSelfEventQueueEmptyCallout() - -#ifndef UserNonSelfEventQueueEmptyCallout -#define UserNonSelfEventQueueEmptyCallout() UserNonSelfEventQueueEmptyCalloutf() -#endif - -/* - * UserPersistenceErrorCallout - * - * This function is invoked when trouble is detected reading from - * or writing to persistent storage. - */ -void UserPersistenceErrorCalloutf( i_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPersistenceErrorCallout( i1 ) - -#ifndef UserPersistenceErrorCallout -#define UserPersistenceErrorCallout( i1 ) UserPersistenceErrorCalloutf( i1 ) -#endif - -#ifdef __cplusplus -} -#endif -#endif /* SYS_USER_CO_H */ diff --git a/VandMC_testing/mctest/string_return_test/src2/sys_xtuml.c b/VandMC_testing/mctest/string_return_test/src2/sys_xtuml.c deleted file mode 100644 index 0960cfa4d..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/sys_xtuml.c +++ /dev/null @@ -1,606 +0,0 @@ -/*-------------------------------------------------------------------------- - * File: sys_xtuml.c - * - * Description: - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "stringtest_classes.h" - - -/* No containers allocated. */ - -/* - * Initialize the node1 instances by linking them into a collection. - * These containoids will be collected into a null-terminated, - * singly linked list (slist). - * This needs to be called during architecture initialization. - */ -void -Escher_SetFactoryInit( const i_t n1_size ) -{ - /* Set factory initialization optimized out. */ -} - -/* - * This will copy all of the elements from one set into another - * set. If the target set is not empty, it will be cleared - * before the copy operation occurs freeing any nodes in that set. - * The new set will use containoids from the free list. - */ -/* Set copy code optimized out. */ - -/* - * Release all nodes in the given set back to the free pool. - */ -/* Set clearing code optimized out. */ - -/* - * Insert a single element into the set in no particular order. - * The element is a data item. A container node will be allocated - * to link in the element. - */ -/* Set insertion code optimized out. */ - -/* - * Insert a block of objects into the given set in sequence. Link the - * data into the supplied containers. - * Return a pointer to the linked set. - */ -Escher_SetElement_s * -Escher_SetInsertBlock( Escher_SetElement_s * container, - const u1_t * instance, - const Escher_size_t length, - Escher_size_t count ) -{ - Escher_SetElement_s * head = ( count > 0 ) ? container : 0; - while ( count > 0 ) { - count--; - container->object = (void *) instance; /* Link in the object data. */ - instance = instance + length; /* Bump to next object image. */ - /* String together or ground containoids. */ - container->next = ( count > 0 ) ? container + 1 : 0; - container++; - } - return head; -} - -/* - * Remove an instance from an instance collection. - */ -/* Signature: void Escher_SetRemoveInstance( pextent, instance, slot, container, pool ) */ - -/* - * Insert an instance onto an extent. - */ -/* Signature: void Escher_SetInsertInstance( pextent, node ) */ - - -/* - * Remove a data item from the given set. This requires searching - * the set for the item, unlinking the item (if found) and returning - * the pointer to the removed node. SetRemoveNode is used - * when some knowledge of the linking mechanism is required (as - * in extent management). SetRemoveElement is used whenever - * possible. - */ -Escher_SetElement_s * -Escher_SetRemoveNode( - Escher_ObjectSet_s * set, - const void * const d -) -{ - Escher_SetElement_s * t = set->head; /* Start with first node. */ - /* Find node containing data and unlink from list. */ - if ( t->object == d ) { /* Element found at head. */ - set->head = t->next; /* Unlink it from the list. */ - } else { - Escher_SetElement_s * t_old; - do { /* Search for data element. */ - t_old = t; - t = t->next; - if ( t == 0 ) { return 0; } /* absent */ - } while ( t->object != d ); - t_old->next = t->next; /* Unlink element from the list. */ - } - return t; -} - -/* - * This interface is used more often to remove an element. This is - * used when maximum anonymity is required. Escher_SetRemoveNode is - * used when some knowledge of the linking mechanism is required (as - * in extent management). - */ -/* Set remove element code optimized out. */ - -/* - * Return a pointer to the found element when the set contains the - * given data element. - */ -const void * -Escher_SetContains( - const Escher_ObjectSet_s * const set, - const void * const element -) -{ - const Escher_SetElement_s * node = set->head; - while ( node != 0 ) { - if ( node->object == element ) { return node; } /* found */ - node = node->next; - } - return 0; /* absent */ -} - -/* - * Count the elements in the set. Return that count. - * This routine counts nodes. - */ -Escher_size_t -Escher_SetCardinality( const Escher_ObjectSet_s * const set ) -{ - Escher_size_t result = 0; - const Escher_SetElement_s * node = set->head; - while ( node != 0 ) { - result++; - node = node->next; - } - return result; -} - -/* - * Return true when the left and right set are equivalent. - * Note: This currently is not implemented. - */ -bool -Escher_SetEquality( Escher_ObjectSet_s * const left_set, - Escher_ObjectSet_s * const right_set ) -{ - bool rc = false; - if ( (left_set->head == 0) && (right_set->head == 0) ) { - rc = true; - } else if ( ( (left_set->head != 0) && (right_set->head != 0) ) && - (Escher_SetCardinality( left_set ) == Escher_SetCardinality( right_set )) ) { - rc = true; - } else { /* nop */ } - return rc; -} - -/* - * Initialize a set variable. - */ -/* Signature: void Escher_InitSet( Escher_ObjectSet_s * set ) */ - -/* - * Get any element (1st) from a collection. - */ -/* Signature: void * Escher_SetGetAny( Escher_ObjectSet_s * const set ) */ - -/* - * Return true if set is empty. - */ -/* Signature: bool Escher_SetIsEmpty( const Escher_ObjectSet_s * const set ) */ - -/* - * Use this method to reset the cursor. - */ -/* Signature: void Escher_IteratorReset( Escher_Iterator_s * const iterator, - * Escher_ObjectSet_s * const set ) - */ - -/* - * Interate to the next element and return it. - */ -void * -Escher_IteratorNext( Escher_Iterator_s * const iter ) -{ - void * element = 0; - if ( iter->cursor != 0 ) { - element = iter->cursor->object; - iter->cursor = iter->cursor->next; - } - return element; -} - -/* - * Set memory bytes to value at destination. - */ -void -Escher_memset( void * const dst, const u1_t val, Escher_size_t len ) -{ - u1_t * d = (u1_t *) dst; - while ( len > 0 ) { - len--; - *d++ = val; - } -} - -/* - * Move memory bytes from source to destination. - */ -void -Escher_memmove( void * const dst, const void * const src, Escher_size_t len ) -{ - u1_t * s = (u1_t *) src; - u1_t * d = (u1_t *) dst; - while ( len > 0 ) { - len--; - *d++ = *s++; - } -} - -/* - * Copy characters and be paranoid about null delimiter. - */ -c_t * -Escher_strcpy( c_t * dst, const c_t * src ) -{ - c_t * s = dst; - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; - if ( ( 0 != src ) && ( 0 != dst ) ) { - while ( ( i > 0 ) && ( *src != '\0' ) ) { - --i; - *dst++ = *src++; - } - *dst = '\0'; /* Ensure delimiter. */ - } - return s; -} - -/* - * Add two strings. Allocate a temporary memory variable to return the value. - */ -c_t * -Escher_stradd( const c_t * left, const c_t * right ) -{ - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; - c_t * s = Escher_strget(); - c_t * dst = s; - if ( 0 == left ) left = ""; - if ( 0 == right ) right = ""; - while ( ( i > 0 ) && ( *left != '\0' ) ) { - --i; - *dst++ = *left++; - } - while ( ( i > 0 ) && ( *right != '\0' ) ) { - --i; - *dst++ = *right++; - } - *dst = '\0'; /* Ensure delimiter. */ - return s; -} - -/* - * Compare two strings. - * Return negative number if s1 < s2. - * Return zero if s1 == s2. - * Return postive number if s1 > s2. - */ -c_t -Escher_strcmp( const c_t *p1, const c_t *p2 ) -{ - const c_t *s1 = p1; - const c_t *s2 = p2; - c_t c1, c2; - i_t i = ESCHER_SYS_MAX_STRING_LEN; - do { - c1 = *s1++; - c2 = *s2++; - if ( c1 == 0 ) { break; } - --i; - } while ( ( c1 == c2 ) && ( i >= 0 ) ); - return ( c1 - c2 ); -} - -/* - * Return a string buffer. Rotate through a pool. - */ -c_t * -Escher_strget( void ) -{ - static u1_t i = 0; - static c_t s[ 16 ][ ESCHER_SYS_MAX_STRING_LEN ]; - i = ( i + 1 ) % 16; - s[ i ][ 0 ] = 0; - return ( &s[ i ][ 0 ] ); -} - - -/* xtUML class info for all of the components (collections, sizes, etc.) */ -Escher_Extent_t * const * const domain_class_info[ SYSTEM_DOMAIN_COUNT ] = { - &stringtest_class_info[0] -}; - -/* - * Create an instance of the class numbered on the input. - * Return the handle of the created instance. - */ -Escher_iHandle_t -Escher_CreateInstance( - const Escher_DomainNumber_t domain_num, - const Escher_ClassNumber_t class_num -) -{ - Escher_SetElement_s * node; - Escher_iHandle_t instance; - Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - Escher_mutex_lock( SEMAPHORE_FLAVOR_INSTANCE ); - node = dci->inactive.head; - - if ( 0 == node ) { - UserObjectPoolEmptyCallout( domain_num, class_num ); - } - - dci->inactive.head = dci->inactive.head->next; - instance = (Escher_iHandle_t) node->object; - if ( 0 != dci->initial_state ) { - instance->current_state = dci->initial_state; - } - Escher_SetInsertInstance( &dci->active, node ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_INSTANCE ); - return instance; -} - -/* - * Delete an instance of the class passed and numbered on the input. - */ -void -Escher_DeleteInstance( - Escher_iHandle_t instance, - const Escher_DomainNumber_t domain_num, - const Escher_ClassNumber_t class_num -) -{ - Escher_SetElement_s * node; - Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - Escher_mutex_lock( SEMAPHORE_FLAVOR_INSTANCE ); - node = Escher_SetRemoveNode( &dci->active, instance ); - node->next = dci->inactive.head; - dci->inactive.head = node; - /* Initialize storage to zero. */ - Escher_memset( instance, 0, dci->size ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_INSTANCE ); -} - -/* - * Initialize object factory services. - * Initialize class instance storage free pool (inanimate list) - * by linking the empty instances into a collection. - */ -void -Escher_ClassFactoryInit( - const Escher_DomainNumber_t domain_num, - const Escher_ClassNumber_t class_num ) -{ - Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - if ( 0 != dci ) { - dci->active.head = 0; - dci->inactive.head = Escher_SetInsertBlock( - dci->container, - (const u1_t *) dci->pool, - dci->size, - dci->population ); - } -} -/* - * Following provides the dispatcher loops for the xtUML event queues. - */ - - -bool Escher_run_flag = true; /* Turn this off to exit dispatch loop(s). */ -/* Map the classes to the tasks/threads for each domain. */ -static const Escher_ClassNumber_t stringtest_task_numbers[ stringtest_STATE_MODELS ] = { - stringtest_TASK_NUMBERS -}; -static const Escher_ClassNumber_t * const class_thread_assignment[ SYSTEM_DOMAIN_COUNT ] = { - &stringtest_task_numbers[0] -}; - -/* Structure: Escher_systemxtUMLevents - * _Super-union_ of all xtUML events in the system. For translation - * patterns which can not accept dynamic memory allocation for - * xtUML events, this union is used to predetermine the maximum - * size of any xtUML event in the system. */ -typedef union { - Escher_xtUMLEvent_t mc_event_base; - stringtest_DomainEvents_u mc_events_in_domain_stringtest; -} Escher_systemxtUMLevents_t; - -/* anchor declaration for front and back of list of events */ -typedef struct { - Escher_xtUMLEvent_t * head, * tail; -} xtUMLEventQueue_t; - -/* Pointer to head of list of available event nodes. */ -static Escher_xtUMLEvent_t * free_event_list = 0; -static xtUMLEventQueue_t non_self_event_queue[ NUM_OF_XTUML_CLASS_THREADS ]; - -/* - * Link the event skeleton nodes together on the free list ready - * for allocation. - */ -void -InitializeOoaEventPool( void ) -{ - /* Pre-allocated memory pool for xtUML events. */ - static Escher_systemxtUMLevents_t Escher_xtUML_event_pool[ ESCHER_SYS_MAX_XTUML_EVENTS ]; - u2_t i; - Escher_run_flag = true; /* Default running enabled. */ - for ( i = 0; i < NUM_OF_XTUML_CLASS_THREADS; i++ ) { - non_self_event_queue[ i ].head = 0; non_self_event_queue[ i ].tail = 0; - } - /* String events together into a singly linked list. */ - free_event_list = (Escher_xtUMLEvent_t *) &Escher_xtUML_event_pool[ 0 ]; - for ( i = 0; i < ESCHER_SYS_MAX_XTUML_EVENTS - 1; i++ ) { - Escher_xtUML_event_pool[ i ].mc_event_base.next = - (Escher_xtUMLEvent_t *) &(Escher_xtUML_event_pool[ i + 1 ]); - } - Escher_xtUML_event_pool[ ESCHER_SYS_MAX_XTUML_EVENTS - 1 ].mc_event_base.next = 0; -} - -/* - * Obtain an empty event from the free list. - */ -Escher_xtUMLEvent_t * Escher_AllocatextUMLEvent( void ) -{ - Escher_xtUMLEvent_t * event = 0; - Escher_mutex_lock( SEMAPHORE_FLAVOR_FREELIST ); - if ( 0 == free_event_list ) { - UserEventFreeListEmptyCallout(); /* Bad news! No more events. */ - } else { - event = free_event_list; /* Grab front of the free list. */ - free_event_list = event->next; /* Unlink from front of free list. */ - } - Escher_mutex_unlock( SEMAPHORE_FLAVOR_FREELIST ); - return event; -} - -/* - * Allocate the event and initialize the base attributes. - */ -Escher_xtUMLEvent_t * -Escher_NewxtUMLEvent( const void * const destination, - const Escher_xtUMLEventConstant_t * const event_info ) -{ - Escher_xtUMLEvent_t * event = Escher_AllocatextUMLEvent(); - SetEventTargetInstance( event, destination ); - SetEventDestDomainNumber( event, event_info->destination_domain_number ); - SetEventDestObjectNumber( event, event_info->destination_object_number ); - SetOoaEventNumber( event, event_info->event_number ); - SetOoaEventFlags( event, event_info->event_flags ); - return event; -} - -/* - * Update the base attributes of an event for polymorphic processing. - */ -Escher_xtUMLEvent_t * -Escher_ModifyxtUMLEvent( Escher_xtUMLEvent_t * event, - const Escher_xtUMLEventConstant_t * const event_info ) -{ - SetEventDestDomainNumber( event, event_info->destination_domain_number ); - SetEventDestObjectNumber( event, event_info->destination_object_number ); - SetOoaEventNumber( event, event_info->event_number ); - SetOoaEventFlags( event, event_info->event_flags ); - return event; -} - -/* - * Delete an event by moving it onto the free list. - */ -void -Escher_DeletextUMLEvent( Escher_xtUMLEvent_t * event ) -{ - Escher_mutex_lock( SEMAPHORE_FLAVOR_FREELIST ); - event->next = free_event_list; - free_event_list = event; - Escher_mutex_unlock( SEMAPHORE_FLAVOR_FREELIST ); -} - -/* - * Send an event to the instance queue. Use priority where applicable. - * - * The following table summarizes the construction of events - * as expected in Escher. For each type of object that - * may be the source or target of an event, the expected - * value of the source and destination handles in the event are - * given. - * - * object type | as event source | as destination - * ------------+---------------------+---------------------- - * instance | handle | handle - * class | manufactured handle | 0 - * creator | manufactured handle | 0 - */ -void -Escher_SendEvent( Escher_xtUMLEvent_t * event ) -{ - u1_t t = *( class_thread_assignment[ GetEventDestDomainNumber( event ) ] - + GetEventDestObjectNumber( event ) ); - xtUMLEventQueue_t * q = &non_self_event_queue[ t ]; - event->next = 0; - /* Append the event to the tail end of the queue. */ - /* No need to maintain prev pointers when not prioritizing. */ - Escher_mutex_lock( SEMAPHORE_FLAVOR_IQUEUE ); - if ( q->tail == 0 ) { - q->head = event; - } else { - q->tail->next = event; - } - q->tail = event; - Escher_mutex_unlock( SEMAPHORE_FLAVOR_IQUEUE ); - Escher_nonbusy_wake( t ); -} - -/* - * Drag an event from the instance directed queue if there is one. This - * routine also serves as the IsQueueEmpty routine. A null return code - * indicates that the queue is empty. Otherwise the handle to the - * event will be returned. - */ -static Escher_xtUMLEvent_t * DequeueOoaNonSelfEvent( const u1_t ); -static Escher_xtUMLEvent_t * DequeueOoaNonSelfEvent( const u1_t t ) -{ - Escher_xtUMLEvent_t * event; - xtUMLEventQueue_t * q = &non_self_event_queue[ t ]; - Escher_mutex_lock( SEMAPHORE_FLAVOR_IQUEUE ); - /* Assign the event from the head of the queue. */ - event = q->head; - /* If the list is not empty, bump the head. */ - if ( event != 0 ) { - q->head = event->next; - /* If empty, nullify tail. Link prev pointers (if needed). */ - if ( q->head == 0 ) { - q->tail = 0; - } - } else { - UserNonSelfEventQueueEmptyCallout(); - } - Escher_mutex_unlock( SEMAPHORE_FLAVOR_IQUEUE ); - return event; -} -/* - * Loop on the event queues dispatching events for this thread. - */ -static void * ooa_loop( void * ); -static void * ooa_loop( void * thread ) -{ - /* class dispatch table - */ - static const EventTaker_t * DomainClassDispatcherTable[ 1 ] = - { - stringtest_EventDispatcher - }; - Escher_xtUMLEvent_t * event; - u1_t t = *( (u1_t *) thread ); - /* Start consuming events and dispatching background processes. */ - while ( true == Escher_run_flag ) { - event = DequeueOoaNonSelfEvent(t); /* Instance next. */ - if ( 0 != event ) { - ( *( DomainClassDispatcherTable[ GetEventDestDomainNumber( event ) ] )[ GetEventDestObjectNumber( event ) ] )( event ); - Escher_DeletextUMLEvent( event ); - } else { - Escher_nonbusy_wait( t ); - } - if ( t == 0 ) { /* Is this the default task/thread? */ - UserBackgroundProcessingCallout(); - } - } - return 0; -} - -/* - * Load up the threads with event dispatchers and/or specific functionality. - */ -void Escher_xtUML_run( void ) -{ - void * vp; - u1_t i; - /* Create threads in reverse order saving thread 0 for default. */ - for ( i = NUM_OF_XTUML_CLASS_THREADS - 1; i > 0; i-- ) { - Escher_thread_create( ooa_loop, i ); - } - i = 0; - vp = ooa_loop( (void *) &i ); -} diff --git a/VandMC_testing/mctest/string_return_test/src2/sys_xtuml.h b/VandMC_testing/mctest/string_return_test/src2/sys_xtuml.h deleted file mode 100644 index efc1d0cc8..000000000 --- a/VandMC_testing/mctest/string_return_test/src2/sys_xtuml.h +++ /dev/null @@ -1,128 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: sys_xtuml.h - * - * Description: - * Here we have the system-level instance create and delete declaration. - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef SYS_XTUML_H -#define SYS_XTUML_H -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This is the most simple and basic container class and - * represents elements in the set (nodes in the list). - */ -typedef struct Escher_SetElement_s Escher_SetElement_s; -struct Escher_SetElement_s { - Escher_SetElement_s * next; - void * object; -}; - -/* - * This is the set class and may contain attributes that apply - * to the set as a whole. - */ -typedef struct { - Escher_SetElement_s * head; -} Escher_ObjectSet_s; - -/* - * Notice the symmetry between the object containoid, the - * head of set structure and the set node containoid. - */ -typedef struct { - Escher_SetElement_s * next; -} Escher_Object_s; - -/* - * Here is the shape of the general class extent. This array contains list - * heads for both active (animate) and inactive (inanimate) instances. - */ -typedef struct { - Escher_ObjectSet_s active, inactive; - Escher_SetElement_s* container; - Escher_iHandle_t pool; - Escher_ClassSize_t size; - Escher_StateNumber_t initial_state; - Escher_InstanceIndex_t population; -} Escher_Extent_t; - -void Escher_SetFactoryInit( const i_t ); -void Escher_CopySet( Escher_ObjectSet_s *, - Escher_ObjectSet_s * const ); -void Escher_ClearSet( Escher_ObjectSet_s * ); -void Escher_SetInsertElement( Escher_ObjectSet_s *, - void * const ); -Escher_SetElement_s * -Escher_SetInsertBlock( Escher_SetElement_s *, - const u1_t *, - const Escher_size_t, - Escher_size_t ); -#define Escher_SetRemoveInstance( pextent, instance, slot, container, pool ) \ - slot = Escher_SetRemoveNode( pextent, instance ) -#define Escher_SetInsertInstance( pextent, node ) \ - node->next = (pextent)->head; \ - (pextent)->head = node - - -Escher_SetElement_s * -Escher_SetRemoveNode( Escher_ObjectSet_s *, - const void * const ); -void Escher_SetRemoveElement( Escher_ObjectSet_s *, - const void * const ); -const void * Escher_SetContains( const Escher_ObjectSet_s * const, - const void * const ); -Escher_size_t Escher_SetCardinality( const Escher_ObjectSet_s * const ); -bool Escher_SetEquality( Escher_ObjectSet_s * const, - Escher_ObjectSet_s * const ); -#define Escher_InitSet( S ) (S)->head = 0 -#define Escher_SetGetAny( S ) ( ((S)->head != 0) ? (S)->head->object : 0 ) -#define Escher_SetIsEmpty( S ) ( (S)->head == 0 ) - -/* - * Collection Iteration - * The iterator uses a cursor external to the set (or extent). - * This cursor maintains a flavor of current element. - */ -typedef struct Escher_Iterator_s Escher_Iterator_s; -struct Escher_Iterator_s { - Escher_SetElement_s * cursor; -}; -#define Escher_IteratorReset( I, S ) ( ((I)->cursor = (S)->head) ) -void * Escher_IteratorNext( Escher_Iterator_s * const ); - -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied strlen. */ -Escher_size_t Escher_strlen( const c_t * ); - -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied memset. */ -void Escher_memset( void * const, const u1_t, Escher_size_t ); - -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied memmove. */ -void Escher_memmove( void * const, const void * const, Escher_size_t ); -c_t * Escher_strcpy( c_t *, const c_t * ); -c_t * Escher_stradd( const c_t *, const c_t * ); -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied strcmp. */ -c_t Escher_strcmp( const c_t *, const c_t * ); -c_t * Escher_strget( void ); - -Escher_iHandle_t Escher_CreateInstance( const Escher_DomainNumber_t, const Escher_ClassNumber_t ); -void Escher_DeleteInstance( Escher_iHandle_t, const Escher_DomainNumber_t, const Escher_ClassNumber_t ); -/* - * Initialize object factory services. - * Initialize class instance storage free pool (inanimate list) - * by linking the empty instances into a collection. - */ -void Escher_ClassFactoryInit( const Escher_DomainNumber_t, const Escher_ClassNumber_t ); - -#ifdef __cplusplus -} -#endif -#endif /* SYS_XTUML_H */ diff --git a/VandMC_testing/mctest/string_return_test/src3/LOG_bridge.c b/VandMC_testing/mctest/string_return_test/src3/LOG_bridge.c deleted file mode 100644 index 18f11c219..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/LOG_bridge.c +++ /dev/null @@ -1,86 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: LOG_bridge.c - * - * Description: - * Methods for bridging to an external entity. - * - * External Entity: Logging (LOG) - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "LOG_bridge.h" -#include "string_return_test_sys_types.h" - -/* - * Bridge: LogSuccess - */ -void -LOG_LogSuccess( c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - printf( "LogSuccess %s\n", p_message ); -} - - -/* - * Bridge: LogFailure - */ -void -LOG_LogFailure( c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - printf( "LogFailure %s\n", p_message ); -} - - -/* - * Bridge: LogInfo - */ -void -LOG_LogInfo( c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - printf( "LogInfo %s\n", p_message ); -} - - -/* - * Bridge: LogDate - */ -void -LOG_LogDate( Escher_Date_t p_d, c_t p_message[ESCHER_SYS_MAX_STRING_LEN] ) -{ - /* Replace/Insert your implementation code here... */ -} - - -/* - * Bridge: LogTime - */ -void -LOG_LogTime( c_t p_message[ESCHER_SYS_MAX_STRING_LEN], Escher_TimeStamp_t p_t ) -{ - /* Replace/Insert your implementation code here... */ -} - - -/* - * Bridge: LogReal - */ -void -LOG_LogReal( c_t p_message[ESCHER_SYS_MAX_STRING_LEN], const r_t p_r ) -{ - /* Replace/Insert your implementation code here... */ -} - - -/* - * Bridge: LogInteger - */ -void -LOG_LogInteger( const i_t p_message ) -{ - /* Replace/Insert your implementation code here... */ -} - - diff --git a/VandMC_testing/mctest/string_return_test/src3/LOG_bridge.h b/VandMC_testing/mctest/string_return_test/src3/LOG_bridge.h deleted file mode 100644 index e0605b43f..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/LOG_bridge.h +++ /dev/null @@ -1,31 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: LOG_bridge.h - * - * Description: - * Methods for bridging to an external entity. - * - * External Entity: Logging (LOG) - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef LOG_BRIDGE_H -#define LOG_BRIDGE_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "string_return_test_sys_types.h" - -void LOG_LogSuccess( c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogFailure( c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogInfo( c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogDate( Escher_Date_t, c_t[ESCHER_SYS_MAX_STRING_LEN] ); -void LOG_LogTime( c_t[ESCHER_SYS_MAX_STRING_LEN], Escher_TimeStamp_t ); -void LOG_LogReal( c_t[ESCHER_SYS_MAX_STRING_LEN], const r_t ); -void LOG_LogInteger( const i_t ); - -#ifdef __cplusplus -} -#endif -#endif /* LOG_BRIDGE_H */ diff --git a/VandMC_testing/mctest/string_return_test/src3/string_return_test_sys_main.c b/VandMC_testing/mctest/string_return_test/src3/string_return_test_sys_main.c deleted file mode 100644 index 87fcbe8fc..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/string_return_test_sys_main.c +++ /dev/null @@ -1,57 +0,0 @@ -/*-------------------------------------------------------------------------- - * File: string_return_test_sys_main.c - * - * Description: main, system initialization (and idle loop) - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "stringtest_classes.h" - -/* - * Run application level initialization by initializing the - * collection of instances for each class and calling domain - * specific initialization. - */ -static void ApplicationLevelInitialization( void ); -static void ApplicationLevelInitialization( void ) -{ - Escher_DomainNumber_t d; - Escher_ClassNumber_t c; - - static const Escher_ClassNumber_t domain_class_count[ SYSTEM_DOMAIN_COUNT ] = { - stringtest_MAX_CLASS_NUMBERS - }; - for ( d = 0; d < SYSTEM_DOMAIN_COUNT; d++ ) { - for ( c = 0; c < domain_class_count[ d ]; c++ ) { - Escher_ClassFactoryInit( d, c ); - } - } -} - -/* - * - * main (although perhaps under a different name) - * - * Bring the system up and start the event dispatch loops. - * Make invocations to the user hooks during the different phases - * of bringup, run and shutdown. - * - */ -int -main( int argc, char ** argv ) -{ - UserInitializationCallout(); - Escher_SetFactoryInit( SYS_MAX_CONTAINERS ); - Escher_InitializeThreading(); - InitializeOoaEventPool(); - ApplicationLevelInitialization(); - UserPreOoaInitializationCallout(); - stringtest_execute_initialization(); - UserPostOoaInitializationCallout(); - Escher_xtUML_run(); /* This is the primary event dispatch loop. */ - UserPreShutdownCallout(); - UserPostShutdownCallout(); - Escher_thread_shutdown(); - return 0; -} diff --git a/VandMC_testing/mctest/string_return_test/src3/string_return_test_sys_types.h b/VandMC_testing/mctest/string_return_test/src3/string_return_test_sys_types.h deleted file mode 100644 index 2dbe342d8..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/string_return_test_sys_types.h +++ /dev/null @@ -1,420 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: string_return_test_sys_types.h - * - * your copyright statement can go here (from te_copyright.body) - * - * - * System Name: - * System ID: 1 - * Model Compiler Product Information: - * Product: - * System default/colored values: - * MaxStringLen: 32 - * MaxObjExtent: 0 - * MaxRelExtent: 0 - * MaxSelectExtent: 0 - * MaxSelfEvents: 0 - * MaxNonSelfEvents: 0 - * MaxTimers: 0 - * MaxInterleavedBridges: 0 - * MaxInterleavedBridgeDataSize: 8 - * CollectionsFlavor: 0 - * ForcePriorityEvents: FALSE - * PEIClassCount: 0 - * PersistentClassCount: 0 - * PersistInstanceCacheDepth: 128 - * PersistLinkCacheDepth: 128 - * - * Component Name: stringtest - * MaxObjExtent: 50 - * MaxRelExtent: 0 - * MaxSelectExtent: 0 - * MaxSelfEvents: 0 - * MaxNonSelfEvents: 2 - * MaxPriorityEvents: 0 - * MaxTimers: 0 - * InterleavedBridges: 0 - * PEIClassCount: 0 - * PersistentClassCount: 0 - * InterleavedDataSize: 8 - * CollectionsFlavor: 0 - *--------------------------------------------------------------------------*/ - -#ifndef STRING_RETURN_TEST_SYS_TYPES_H -#define STRING_RETURN_TEST_SYS_TYPES_H -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Shore up C by declaring our own version of bool. - */ -#ifndef __cplusplus -typedef unsigned char bool; - -#ifdef false -#undef false -#endif - -#ifdef true -#undef true -#endif - -#define false ( (bool) 0 ) -#define true ( (bool) (!false) ) -#endif - -#ifdef FALSE -#undef FALSE -#endif - -#ifdef TRUE -#undef TRUE -#endif - -#define FALSE ( (bool) 0 ) -#define TRUE ( (bool) (!FALSE) ) - -#define ESCHER_SYS_MAX_STRING_LEN 32 -#define ESCHER_PERSIST_INST_CACHE_DEPTH 128 -#define ESCHER_PERSIST_LINK_CACHE_DEPTH 128 -#define ESCHER_SYS_MAX_ASSOCIATION_EXTENT 0 -#define ESCHER_SYS_MAX_TRANSIENT_EXTENT 0 -#define SYS_MAX_CONTAINERS ( ESCHER_SYS_MAX_ASSOCIATION_EXTENT + ESCHER_SYS_MAX_TRANSIENT_EXTENT ) -#define ESCHER_SYS_MAX_SELF_EVENTS 0 -#define ESCHER_SYS_MAX_NONSELF_EVENTS 6 -#define ESCHER_SYS_MAX_XTUML_EVENTS ( ESCHER_SYS_MAX_SELF_EVENTS + ESCHER_SYS_MAX_NONSELF_EVENTS ) -#define ESCHER_SYS_MAX_XTUML_TIMERS 0 -#define ESCHER_SYS_MAX_INTERLEAVED_BRIDGES 0 -#define ESCHER_SYS_MAX_INTERLEAVED_BRIDGE_DATA 8 - - -/* - * Core types with byte widths defined for MISRA-C compliance. - */ -typedef char c_t; -typedef unsigned char uc_t; -typedef int i_t; -typedef unsigned int ui_t; -typedef long l_t; -typedef unsigned long ul_t; -typedef signed char s1_t; -typedef unsigned char u1_t; -typedef signed short s2_t; -typedef unsigned short u2_t; -typedef signed long s4_t; -typedef unsigned long u4_t; -typedef double r_t; -typedef float r4_t; -typedef double r8_t; -typedef /*size_t*/ u4_t Escher_size_t; - -/* - * These are some of the fundamental types used universally. - */ -typedef u1_t Escher_DomainNumber_t; -typedef u2_t Escher_ClassNumber_t; -typedef Escher_size_t Escher_ClassSize_t; -typedef u2_t Escher_InstanceIndex_t; -typedef u1_t Escher_StateNumber_t; -typedef u1_t Escher_EventNumber_t; -typedef u1_t Escher_EventFlags_t; -typedef u1_t Escher_EventPriority_t; -typedef u1_t Escher_SEMcell_t; -typedef struct { - Escher_DomainNumber_t domainnum; - Escher_ClassNumber_t classnum; - Escher_InstanceIndex_t index; -} InstanceIdentifier_t; - -typedef struct { - Escher_StateNumber_t current_state; -} Escher_InstanceBase_t; -typedef Escher_InstanceBase_t * Escher_iHandle_t; -typedef Escher_iHandle_t Escher_UniqueID_t; -typedef void (*Escher_idf)( Escher_iHandle_t ); - -/* Return code type for dispatch of a polymorphic event (see sys_events.h). */ -typedef u1_t Escher_PolyEventRC_t; - -/* Interleaved bridge node base type. */ -typedef struct Escher_ilb_s Escher_ilb_t; -typedef void ( * Escher_ilb_fp_t )( Escher_ilb_t * ); -struct Escher_ilb_s { Escher_ilb_fp_t f; }; - -/* - * Time and date core types. - */ -typedef l_t Escher_Date_t; -typedef u4_t Escher_TimeStamp_t; -typedef u4_t Escher_uSec_t; - -#define DomainMultiplier 1 - -/* - * Allow for compilerisms (such as 8051 Tasking) to use memory model - * hints to the compiler. - */ -#ifndef _reentrant -#define _reentrant -#endif - -/* - * Note we include stdio.h for printf. Otherwise, it is not needed. - */ -#include -#include "sys_xtuml.h" -#include "sys_user_co.h" -/* - * Data structures and methods associated with the event base class of this - * model compiler. - */ -/* Escher_EventFlags_t bit masks */ -#define ESCHER_IS_INSTANCE_EVENT 0x01 -#define ESCHER_IS_CREATION_EVENT 0x02 -#define ESCHER_IS_ASSIGNER_EVENT 0x04 -#define ESCHER_IS_DELAYED_EVENT 0x08 -#define ESCHER_NO_FSM_RELEASE_EVENT 0x10 -#define ESCHER_IS_POLYMORPHIC_EVENT 0x20 -#define ESCHER_IS_TRUE_EVENT 0x40 -#define ESCHER_IS_POLY_IN_FLIGHT 0x80 - -#define UNINITIALIZED_STATE 0 -#define EVENT_CANT_HAPPEN ((Escher_StateNumber_t) -1) -#define EVENT_IS_IGNORED ((Escher_StateNumber_t) -2) - -/* This represents the constant part of the event structure. */ -typedef struct { - Escher_DomainNumber_t destination_domain_number; - Escher_ClassNumber_t destination_object_number; - Escher_EventNumber_t event_number; - Escher_EventFlags_t event_flags; -} Escher_xtUMLEventConstant_t; - -/* Structure: Escher_xtUMLEvent_t - * Base class of application analysis xtUML events. */ -#define EVENT_BASE_ATTRIBUTE_LIST \ - struct Escher_xtUMLevent_s * next;\ - Escher_iHandle_t object_instance;\ - Escher_DomainNumber_t destination_domain_number;\ - Escher_ClassNumber_t destination_object_number;\ - Escher_EventNumber_t event_number;\ - Escher_EventFlags_t event_flags;\ - -struct Escher_xtUMLevent_s { - EVENT_BASE_ATTRIBUTE_LIST -}; -typedef struct Escher_xtUMLevent_s Escher_xtUMLEvent_t; - -typedef unsigned long ETimer_time_t; - -typedef void Escher_Timer_t; - -/* - * Event Macros - */ -#define GetOoaEventFlags(X) (((X))->event_flags) -#define SetOoaEventFlags(X, Y) (((X))->event_flags = Y) - -#define GetIsInstanceEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_INSTANCE_EVENT) -#define SetIsInstanceEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_INSTANCE_EVENT) - -#define GetIsCreationEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_CREATION_EVENT) -#define SetIsCreationEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_CREATION_EVENT) - -#define GetIsAssignerEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_ASSIGNER_EVENT) -#define SetIsAssignerEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_ASSIGNER_EVENT) - -#define GetIsDelayedEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_DELAYED_EVENT) -#define SetIsDelayedEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_DELAYED_EVENT) - -#define GetIsPolymorphicEvent(X) (GetOoaEventFlags(X) & ESCHER_IS_POLYMORPHIC_EVENT) -#define SetIsPolymorphicEvent(X) (GetOoaEventFlags(X) |= ESCHER_IS_POLYMORPHIC_EVENT) -#define ClearIsPolymorphicEvent(X) (GetOoaEventFlags(X) &= ~(Escher_EventFlags_t)ESCHER_IS_POLYMORPHIC_EVENT) - -#define GetFsmReleasesEvent(X) (GetOoaEventFlags(X) & ESCHER_NO_FSM_RELEASE_EVENT) -#define SetFsmReleasesEvent(X) (GetOoaEventFlags(X) |= ESCHER_NO_FSM_RELEASE_EVENT) - -#define GetOoaEventNumber(X) (((X))->event_number) -#define SetOoaEventNumber(X, Y) (((X))->event_number = (Y)) - -#define GetEventTargetInstance(X) (((X))->object_instance) -#define SetEventTargetInstance(X, Y) (((X))->object_instance = (Escher_iHandle_t)(Y)) - -#define GetEventSendingInstance(X) (((X))->sending_instance) -#define SetEventSendingInstance(X, Y) (((X))->sending_instance = (Escher_iHandle_t)(Y)) - -#define GetEventDestDomainNumber(X) (((X))->destination_domain_number) -#define SetEventDestDomainNumber(X, Y) (((X))->destination_domain_number = (Y)) - -#define GetEventDestObjectNumber(X) (((X))->destination_object_number) -#define SetEventDestObjectNumber(X, Y) (((X))->destination_object_number = (Y)) - -/* Opaque type definition of a translated state action member function. */ -typedef _reentrant void (*StateAction_t)( Escher_iHandle_t, const Escher_xtUMLEvent_t * const ); - -/* Opaque type definition of class event dispatcher member function. */ -typedef _reentrant void (*EventTaker_t)( Escher_xtUMLEvent_t * ); - -/* Opaque type definition of domain level event dispatcher member function. */ -typedef _reentrant void (*DomainDispatcher_t)( Escher_xtUMLEvent_t * ); - - - -Escher_xtUMLEvent_t * Escher_AllocatextUMLEvent( void ); -Escher_xtUMLEvent_t * Escher_NewxtUMLEvent( const void * const, const Escher_xtUMLEventConstant_t * const ); -Escher_xtUMLEvent_t * Escher_ModifyxtUMLEvent( Escher_xtUMLEvent_t *, const Escher_xtUMLEventConstant_t * const ); -void Escher_DeletextUMLEvent( Escher_xtUMLEvent_t * ); -void InitializeOoaEventPool( void ); -void Escher_xtUML_run( void ); -void * Escher_GetSelf( void ); -void Escher_SendEvent( Escher_xtUMLEvent_t * ); -void Escher_SendSelfEvent( Escher_xtUMLEvent_t * ); - -/* - * Delcarations for multi-tasking/threading services. - */ - - -#define ESCHER_TASKING_POSIX 1 -#define NUM_OF_XTUML_CLASS_THREADS 3 -#define NUM_OF_TOTAL_THREADS NUM_OF_XTUML_CLASS_THREADS -#define SEMAPHORE_FLAVOR_IQUEUE 0 -#define SEMAPHORE_FLAVOR_SQUEUE 1 -#define SEMAPHORE_FLAVOR_FREELIST 2 -#define SEMAPHORE_FLAVOR_NONBUSY 3 -#define SEMAPHORE_FLAVOR_INSTANCE 4 -#define SEMAPHORE_FLAVOR_TIMER 5 -#define SEMAPHORE_FLAVOR_ILB 6 -#define SEMAPHORE_FLAVOR_MAX 7 - -void Escher_InitializeThreading( void ); -void Escher_thread_create( void *(f)(void *), const u1_t ); -void Escher_mutex_lock( const u1_t ); -void Escher_mutex_unlock( const u1_t ); -void Escher_nonbusy_wait( const u1_t ); -void Escher_nonbusy_wake( const u1_t ); -void Escher_thread_shutdown( void ); - -#ifdef NOMUTEX_DEBUG -#define pthread_mutex_lock( X ) 0 -#define pthread_mutex_unlock( X ) 0 -#endif - - - - -#define SYSTEM_DOMAIN_COUNT 1 -/* xtUML domain identification numbers */ -#define stringtest_DOMAIN_ID 0 -#define stringtest_DOMAIN_ID_text "stringtest" -#include "stringtest_classes.h" - -/*---------------------------------------------------------------------------- - * - * Run time instrumentation and tracing declarations are defined here. - * - * Note: - * Multi-line macros use the do {...} while (0) construct recommended - * by cert.org (PRE10-C, PRE10-CPP). - * - * Users may copy this file to the /gen folder and modify these macros - * as desired to change the way tracing works. - * - *--------------------------------------------------------------------------*/ - -#define XTUML_TRACE_FLUSH( i ) fflush( i ) - -/* - * State transition start tracing: - */ -/* To suppress source identification in tracing, uncomment the following macro */ -/* #define XTUML_SOURCE_PROLOGUE */ - -#ifndef XTUML_SOURCE_PROLOGUE -#define XTUML_SOURCE_PROLOGUE printf( "%s #%6u: ", __FILE__, __LINE__ ); XTUML_TRACE_FLUSH( 0 ) -#endif - -/* To suppress state transition start tracing, uncomment the following macro */ -/* #define STATE_TXN_START_TRACE( obj_kl, state_num, state_name ) */ - -#ifndef STATE_TXN_START_TRACE -#define STATE_TXN_START_TRACE( obj_kl, state_num, state_name ) do { static unsigned short gc; if ( ! gc++ ) { XTUML_SOURCE_PROLOGUE; printf( "Transition started: %s State [%u] %s\n", obj_kl, state_num, state_name ); } } while (0) -#endif - -/* - * State transition complete tracing: - */ -/* To suppress state transition complete tracing, uncomment the following macro */ -/* #define STATE_TXN_END_TRACE( obj_kl, state_num, state_name ) */ - -#ifndef STATE_TXN_END_TRACE -//#define STATE_TXN_END_TRACE( obj_kl, state_num, state_name ) do { XTUML_SOURCE_PROLOGUE; printf( "Transition complete: %s State [%u] %s\n", obj_kl, state_num, state_name ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#define STATE_TXN_END_TRACE( obj_kl, state_num, state_name ) -#endif - -/* - * Event ignored tracing: - */ -/* To unsuppress event ignored tracing, comment out the following macro. */ -#define STATE_TXN_IG_TRACE( obj_kl, state_num ) - -#ifndef STATE_TXN_IG_TRACE -#define STATE_TXN_IG_TRACE( obj_kl, state_num ) do { XTUML_SOURCE_PROLOGUE; printf( "Event ignored: %s current_state = %u\n", obj_kl, state_num ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Event can't happen tracing: - */ -/* To suppress can't happen tracing, uncomment the following macro */ -/* #define STATE_TXN_CH_TRACE( obj_kl, state_num ) */ - -#ifndef STATE_TXN_CH_TRACE -#define STATE_TXN_CH_TRACE( obj_kl, state_num ) do { XTUML_SOURCE_PROLOGUE; printf( "Event cannot happen: %s current_state = %u\n", obj_kl, state_num ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Component message start tracing: - */ -/* To suppress component message start tracing, uncomment the following macro */ -/* #define COMP_MSG_START_TRACE( arg_format, component_number, port_number, message_number, args... ) */ - -#ifndef COMP_MSG_START_TRACE -#define COMP_MSG_START_TRACE( arg_format, component_number, port_number, message_number, args... ) do { XTUML_SOURCE_PROLOGUE; printf( "component %d port %d message %d " arg_format "\n", component_number, port_number, message_number, ## args ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* - * Component message end tracing: - */ - - -/* - * Object Action Language (OAL) statement level tracing: - */ - -/* To suppress statement source identification, uncomment the following macro */ -/* #define XTUML_OAL_STMT_TRACE( blck_level, stmt_action ) */ - -#ifndef XTUML_OAL_STMT_TRACE -#define XTUML_OAL_STMT_TRACE( blck_level, stmt_action ) do { XTUML_SOURCE_PROLOGUE; { /* indenting */ s1_t i; for ( i = 0; i < blck_level; i++ ) printf( " " ); } printf( "%s\n", stmt_action ); XTUML_TRACE_FLUSH( 0 ); } while (0) -#endif - -/* To suppress empty handle detection, modify the following macro. */ - -#ifndef XTUML_EMPTY_HANDLE_TRACE -#define XTUML_EMPTY_HANDLE_TRACE( object_keyletters, s ) do { UserEmptyHandleDetectedCallout( object_keyletters, s ); } while (0) -#endif - -/* - * Declare state information structure. - */ -typedef struct Escher_StateInfo_s Escher_StateInfo_s; -struct Escher_StateInfo_s { - Escher_StateNumber_t state_number; /* 'real' state number */ - c_t * state_name; -}; - -#ifdef __cplusplus -} -#endif -#endif /* STRING_RETURN_TEST_SYS_TYPES_H */ diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest.c b/VandMC_testing/mctest/string_return_test/src3/stringtest.c deleted file mode 100644 index a8663248b..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest.c +++ /dev/null @@ -1,98 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest.c - * - * UML Component Port Messages - * Component/Module Name: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "stringtest.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * Interface: instr - * Provided Port: INSTR - * To Provider Message: start - */ -void -stringtest_INSTR_start() -{ - /* ::init( ) */ - stringtest_init(); -} - -/* - * UML Domain Functions (Synchronous Services) - */ - -/* - * Domain Function: init - */ -void -stringtest_init() -{ - stringtest_pong * p2;stringtest_ping * p1;stringtest_buffer * b;stringtest_device * d;stringtest_host * h; - /* LOG::LogInfo( message:intializing ) */ - LOG_LogInfo( "intializing" ); - /* CREATE OBJECT INSTANCE h OF host */ - h = (stringtest_host *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_host_CLASS_NUMBER ); - /* ASSIGN h.upper = upper information */ - Escher_strcpy( h->upper, "upper information" ); - /* CREATE OBJECT INSTANCE d OF device */ - d = (stringtest_device *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_device_CLASS_NUMBER ); - /* ASSIGN d.lower = lower storage area */ - Escher_strcpy( d->lower, "lower storage area" ); - /* CREATE OBJECT INSTANCE b OF buffer */ - b = (stringtest_buffer *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_buffer_CLASS_NUMBER ); - /* ASSIGN b.cache = ABCDEFGHIJKLMNOPQRSTUVWXYZ */ - Escher_strcpy( b->cache, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); - /* RELATE h TO b ACROSS R1 */ - stringtest_buffer_R1_Link( h, b ); - /* RELATE d TO b ACROSS R2 */ - stringtest_buffer_R2_Link( d, b ); - /* GENERATE host1:get(s:d.lower, d:d) TO h */ - { stringtest_hostevent1 * e = (stringtest_hostevent1 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent1c ); - Escher_strcpy( e->p_s, d->lower ); e->p_d = d; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } - /* CREATE OBJECT INSTANCE p1 OF ping */ - p1 = (stringtest_ping *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_ping_CLASS_NUMBER ); - /* CREATE OBJECT INSTANCE p2 OF pong */ - p2 = (stringtest_pong *) Escher_CreateInstance( stringtest_DOMAIN_ID, stringtest_pong_CLASS_NUMBER ); - /* GENERATE ping1:bounce(p:p2, s:ping pong string) TO p1 */ - { stringtest_pingevent1 * e = (stringtest_pingevent1 *) Escher_NewxtUMLEvent( p1, &stringtest_pingevent1c ); - e->p_p = p2; Escher_strcpy( e->p_s, "ping pong string" ); - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } - -} - -/* xtUML class info (collections, sizes, etc.) */ -Escher_Extent_t * const stringtest_class_info[ stringtest_MAX_CLASS_NUMBERS ] = { - &pG_stringtest_host_extent, - &pG_stringtest_device_extent, - &pG_stringtest_ping_extent, - &pG_stringtest_pong_extent, - &pG_stringtest_buffer_extent -}; - -/* - * Array of pointers to the class event dispatcher method. - * Index is the (model compiler enumerated) number of the state model. - */ -const EventTaker_t stringtest_EventDispatcher[ stringtest_STATE_MODELS ] = { - stringtest_class_dispatchers -}; - -void stringtest_execute_initialization() -{ - /* - * Initialization Function: init - * Component: stringtest - */ - stringtest_init(); - -} diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest.h b/VandMC_testing/mctest/string_return_test/src3/stringtest.h deleted file mode 100644 index 245e80f1b..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest.h +++ /dev/null @@ -1,22 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest.h - * - * UML Component (Module) Declaration (Operations and Signals) - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_H -#define STRINGTEST_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "string_return_test_sys_types.h" -void stringtest_INSTR_start( void ); - - -#ifdef __cplusplus -} -#endif -#endif /* STRINGTEST_H */ diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_buffer_class.c b/VandMC_testing/mctest/string_return_test/src3/stringtest_buffer_class.c deleted file mode 100644 index f4e0b9ed2..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_buffer_class.c +++ /dev/null @@ -1,100 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_buffer_class.c - * - * Class: buffer (buffer) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * class operation: scmp - */ -c_t * -stringtest_buffer_op_scmp( c_t p_s1[ESCHER_SYS_MAX_STRING_LEN], c_t p_s2[ESCHER_SYS_MAX_STRING_LEN] ) -{ - c_t s2[ESCHER_SYS_MAX_STRING_LEN];c_t s1[ESCHER_SYS_MAX_STRING_LEN];c_t sum[ESCHER_SYS_MAX_STRING_LEN];c_t jstr2[ESCHER_SYS_MAX_STRING_LEN];c_t jstr1[ESCHER_SYS_MAX_STRING_LEN]; - /* ASSIGN jstr1 = hello */ - Escher_strcpy( jstr1, "hello" ); - /* ASSIGN jstr2 = world */ - Escher_strcpy( jstr2, "world" ); - /* ASSIGN sum = ( jstr1 + jstr2 ) */ - Escher_strcpy( sum, Escher_stradd( jstr1, jstr2 ) ); - /* ASSIGN s1 = PARAM.s1 */ - Escher_strcpy( s1, p_s1 ); - /* ASSIGN s2 = PARAM.s2 */ - Escher_strcpy( s2, p_s2 ); - /* IF ( ( s1 == s2 ) ) */ - if ( ( Escher_strcmp( s1, s2 ) == 0 ) ) { - /* RETURN s1 */ - {c_t * xtumlOALrv = s1; - return xtumlOALrv;} - } - else { - /* LOG::LogFailure( message:FAIL ) */ - LOG_LogFailure( "FAIL" ); - /* WHILE ( TRUE ) */ - while ( TRUE ) { - } - /* RETURN junk */ - {c_t * xtumlOALrv = "junk"; - return xtumlOALrv;} - } - -} - - -/* - * RELATE host TO buffer ACROSS R1 - */ -void -stringtest_buffer_R1_Link( stringtest_host * part, stringtest_buffer * form ) -{ - if ( (part == 0) || (form == 0) ) { - XTUML_EMPTY_HANDLE_TRACE( "buffer", "stringtest_buffer_R1_Link" ); - return; - } - /* Note: buffer->host[R1] not navigated */ - /* Note: host->buffer[R1] not navigated */ -} - -/* - * RELATE device TO buffer ACROSS R2 - */ -void -stringtest_buffer_R2_Link( stringtest_device * part, stringtest_buffer * form ) -{ - if ( (part == 0) || (form == 0) ) { - XTUML_EMPTY_HANDLE_TRACE( "buffer", "stringtest_buffer_R2_Link" ); - return; - } - /* Note: buffer->device[R2] not navigated */ - /* Note: device->buffer[R2] not navigated */ -} - - -/*---------------------------------------------------------------------------- - * Operation action methods implementation for the following class: - * - * Class: buffer (buffer) - * Component: stringtest - *--------------------------------------------------------------------------*/ -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_buffer_container[ stringtest_buffer_MAX_EXTENT_SIZE ]; -static stringtest_buffer stringtest_buffer_instances[ stringtest_buffer_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_buffer_extent = { - {0}, {0}, &stringtest_buffer_container[ 0 ], - (Escher_iHandle_t) &stringtest_buffer_instances, - sizeof( stringtest_buffer ), 0, stringtest_buffer_MAX_EXTENT_SIZE - }; - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_buffer_class.h b/VandMC_testing/mctest/string_return_test/src3/stringtest_buffer_class.h deleted file mode 100644 index d4180bda7..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_buffer_class.h +++ /dev/null @@ -1,47 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_buffer_class.h - * - * Class: buffer (buffer) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_BUFFER_CLASS_H -#define STRINGTEST_BUFFER_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * buffer (buffer) - */ -struct stringtest_buffer { - - /* application analysis class attributes */ - c_t cache[ESCHER_SYS_MAX_STRING_LEN]; /* - cache */ - - /* relationship storage */ - /* Note: No storage needed for buffer->host[R1] */ - /* Note: No storage needed for buffer->device[R2] */ -}; -c_t * stringtest_buffer_op_scmp( c_t[ESCHER_SYS_MAX_STRING_LEN], c_t[ESCHER_SYS_MAX_STRING_LEN] ); - -void stringtest_buffer_R1_Link( stringtest_host *, stringtest_buffer * ); -/* Note: host<-R1->buffer unrelate accessor not needed */ -void stringtest_buffer_R2_Link( stringtest_device *, stringtest_buffer * ); -/* Note: device<-R2->buffer unrelate accessor not needed */ - - -#define stringtest_buffer_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_buffer_extent; - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_BUFFER_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_classes.h b/VandMC_testing/mctest/string_return_test/src3/stringtest_classes.h deleted file mode 100644 index 1c1321260..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_classes.h +++ /dev/null @@ -1,81 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_classes.h - * - * This file defines the object type identification numbers for all classes - * in the component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_CLASSES_H -#define STRINGTEST_CLASSES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Initialization services for component: stringtest - */ -extern Escher_Extent_t * const stringtest_class_info[]; -extern const EventTaker_t stringtest_EventDispatcher[]; -void stringtest_execute_initialization( void ); - -#define stringtest_STATE_MODELS 4 -/* Define constants to map to class numbers. */ -#define stringtest_host_CLASS_NUMBER 0 -#define stringtest_device_CLASS_NUMBER 1 -#define stringtest_ping_CLASS_NUMBER 2 -#define stringtest_pong_CLASS_NUMBER 3 -#define stringtest_buffer_CLASS_NUMBER 4 -#define stringtest_MAX_CLASS_NUMBERS 5 - -/* Provide a map of classes to task numbers. */ -#define stringtest_TASK_NUMBERS 1, 1, 2, 2 - -#define stringtest_class_dispatchers\ - stringtest_host_Dispatch,\ - stringtest_device_Dispatch,\ - stringtest_ping_Dispatch,\ - stringtest_pong_Dispatch - -/* Provide definitions of the shapes of the class structures. */ - -typedef struct stringtest_host stringtest_host; -typedef struct stringtest_device stringtest_device; -typedef struct stringtest_ping stringtest_ping; -typedef struct stringtest_pong stringtest_pong; -typedef struct stringtest_buffer stringtest_buffer; - -/* union of class declarations so we may derive largest class size */ -#define stringtest_CLASS_U \ - char stringtest_dummy;\ - -/* - * UML Domain Functions (Synchronous Services) - */ -void stringtest_init( void ); - - -#include "LOG_bridge.h" -#include "stringtest.h" -#include "stringtest_host_class.h" -#include "stringtest_device_class.h" -#include "stringtest_buffer_class.h" -#include "stringtest_ping_class.h" -#include "stringtest_pong_class.h" -/* - * roll-up of all events (with their parameters) for component stringtest - */ -typedef union { - stringtest_host_Events_u stringtest_host_Events_u_namespace; - stringtest_device_Events_u stringtest_device_Events_u_namespace; - stringtest_ping_Events_u stringtest_ping_Events_u_namespace; - stringtest_pong_Events_u stringtest_pong_Events_u_namespace; -} stringtest_DomainEvents_u; - -#ifdef __cplusplus -} -#endif -#endif /* STRINGTEST_CLASSES_H */ - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_device_class.c b/VandMC_testing/mctest/string_return_test/src3/stringtest_device_class.c deleted file mode 100644 index 7c4a2520f..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_device_class.c +++ /dev/null @@ -1,178 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_device_class.c - * - * Class: device (device) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * instance operation: rstr - */ -c_t * -stringtest_device_op_rstr( stringtest_device * self) -{ - /* RETURN self.lower */ - {c_t * xtumlOALrv = self->lower; - return xtumlOALrv;} - -} - - - -/*---------------------------------------------------------------------------- - * Operation action methods implementation for the following class: - * - * Class: device (device) - * Component: stringtest - *--------------------------------------------------------------------------*/ -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_device_container[ stringtest_device_MAX_EXTENT_SIZE ]; -static stringtest_device stringtest_device_instances[ stringtest_device_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_device_extent = { - {0}, {0}, &stringtest_device_container[ 0 ], - (Escher_iHandle_t) &stringtest_device_instances, - sizeof( stringtest_device ), stringtest_device_STATE_1, stringtest_device_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: device (device) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [putting] - */ -static void stringtest_device_act1( stringtest_device *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_device_act1( stringtest_device * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_deviceevent1 * rcvd_evt = (stringtest_deviceevent1 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t l[ESCHER_SYS_MAX_STRING_LEN];stringtest_host * h; - /* ASSIGN h = PARAM.h */ - h = rcvd_evt->p_h; - /* ASSIGN l = buffer::scmp(s1:h.upper, s2:PARAM.s) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s) ); - /* ASSIGN l = buffer::scmp(s1:self.lower, self.rstr()) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, Escher_strcpy( v_sretval5trv34, stringtest_device_op_rstr(self))) ); - /* GENERATE host1:get(s:l, d:self) TO h */ - { stringtest_hostevent1 * e = (stringtest_hostevent1 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent1c ); - Escher_strcpy( e->p_s, l ); e->p_d = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -/* - * State 2: [getting] - */ -static void stringtest_device_act2( stringtest_device *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_device_act2( stringtest_device * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_deviceevent2 * rcvd_evt = (stringtest_deviceevent2 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t l[ESCHER_SYS_MAX_STRING_LEN];stringtest_host * h; - /* ASSIGN h = PARAM.h */ - h = rcvd_evt->p_h; - /* ASSIGN l = buffer::scmp(s1:h.upper, s2:PARAM.s) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(h->upper, rcvd_evt->p_s) ); - /* ASSIGN l = buffer::scmp(s1:self.lower, self.rstr()) */ - Escher_strcpy( l, stringtest_buffer_op_scmp(self->lower, Escher_strcpy( v_sretval5trv34, stringtest_device_op_rstr(self))) ); - /* GENERATE host2:put(s:l, d:self) TO h */ - { stringtest_hostevent2 * e = (stringtest_hostevent2 *) Escher_NewxtUMLEvent( h, &stringtest_hostevent2c ); - Escher_strcpy( e->p_s, l ); e->p_d = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_deviceevent1c = { - stringtest_DOMAIN_ID, stringtest_device_CLASS_NUMBER, STRINGTEST_DEVICEEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - -const Escher_xtUMLEventConstant_t stringtest_deviceevent2c = { - stringtest_DOMAIN_ID, stringtest_device_CLASS_NUMBER, STRINGTEST_DEVICEEVENT2NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_device_StateEventMatrix[ 2 + 1 ][ 2 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN, EVENT_CANT_HAPPEN }, - /* row 1: stringtest_device_STATE_1 (putting) */ - { EVENT_CANT_HAPPEN, stringtest_device_STATE_2 }, - /* row 2: stringtest_device_STATE_2 (getting) */ - { stringtest_device_STATE_1, EVENT_CANT_HAPPEN } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_device_acts[ 3 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_device_act1, /* putting */ - (StateAction_t) stringtest_device_act2 /* getting */ - }; - - /* - * Array of string names of the state machine names. - * Index is the (MC enumerated) number of the state. - */ - static const c_t * const state_name_strings[ 3 ] = { - "", - "putting", - "getting" - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_device_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 2 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_device_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 2 ) { - STATE_TXN_START_TRACE( "device", current_state, state_name_strings[ current_state ] ); - /* Execute the state action and update the current state. */ - ( *stringtest_device_acts[ next_state ] )( instance, event ); - STATE_TXN_END_TRACE( "device", next_state, state_name_strings[ next_state ] ); - instance->current_state = next_state; - } else if ( next_state == EVENT_CANT_HAPPEN ) { - /* event cant happen */ - UserEventCantHappenCallout( current_state, next_state, event_number ); - STATE_TXN_CH_TRACE( "device", current_state ); - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_device_class.h b/VandMC_testing/mctest/string_return_test/src3/stringtest_device_class.h deleted file mode 100644 index 00da07cc8..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_device_class.h +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_device_class.h - * - * Class: device (device) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_DEVICE_CLASS_H -#define STRINGTEST_DEVICE_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * device (device) - */ -struct stringtest_device { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - c_t lower[ESCHER_SYS_MAX_STRING_LEN]; /* - lower */ - - /* relationship storage */ - /* Note: No storage needed for device->buffer[R2] */ -}; -c_t * stringtest_device_op_rstr( stringtest_device * ); - - - -#define stringtest_device_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_device_extent; - -/* - * instance event: device1:'send' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_host * p_h; /* h */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_deviceevent1; -extern const Escher_xtUMLEventConstant_t stringtest_deviceevent1c; - -/* - * instance event: device2:'recv' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_host * p_h; /* h */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_deviceevent2; -extern const Escher_xtUMLEventConstant_t stringtest_deviceevent2c; - -/* - * union of events targeted towards 'device' state machine - */ -typedef union { - stringtest_deviceevent1 device11; - stringtest_deviceevent2 device22; -} stringtest_device_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_device_STATE_1 1 /* state [1]: (putting) */ -#define stringtest_device_STATE_2 2 /* state [2]: (getting) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_DEVICEEVENT1NUM 0 /* device1:'send' */ -#define STRINGTEST_DEVICEEVENT2NUM 1 /* device2:'recv' */ -extern void stringtest_device_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_DEVICE_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_host_class.c b/VandMC_testing/mctest/string_return_test/src3/stringtest_host_class.c deleted file mode 100644 index 81e8f7d07..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_host_class.c +++ /dev/null @@ -1,178 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_host_class.c - * - * Class: host (host) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - -/* - * instance operation: rstr - */ -c_t * -stringtest_host_op_rstr( stringtest_host * self) -{ - /* RETURN self.upper */ - {c_t * xtumlOALrv = self->upper; - return xtumlOALrv;} - -} - - - -/*---------------------------------------------------------------------------- - * Operation action methods implementation for the following class: - * - * Class: host (host) - * Component: stringtest - *--------------------------------------------------------------------------*/ -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_host_container[ stringtest_host_MAX_EXTENT_SIZE ]; -static stringtest_host stringtest_host_instances[ stringtest_host_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_host_extent = { - {0}, {0}, &stringtest_host_container[ 0 ], - (Escher_iHandle_t) &stringtest_host_instances, - sizeof( stringtest_host ), stringtest_host_STATE_1, stringtest_host_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: host (host) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [sending] - */ -static void stringtest_host_act1( stringtest_host *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_host_act1( stringtest_host * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_hostevent2 * rcvd_evt = (stringtest_hostevent2 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t u[ESCHER_SYS_MAX_STRING_LEN];stringtest_device * d; - /* ASSIGN d = PARAM.d */ - d = rcvd_evt->p_d; - /* ASSIGN u = buffer::scmp(s1:d.lower, s2:PARAM.s) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s) ); - /* ASSIGN u = buffer::scmp(s1:self.upper, self.rstr()) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, Escher_strcpy( v_sretval5trv34, stringtest_host_op_rstr(self))) ); - /* GENERATE device1:send(s:u, h:self) TO d */ - { stringtest_deviceevent1 * e = (stringtest_deviceevent1 *) Escher_NewxtUMLEvent( d, &stringtest_deviceevent1c ); - Escher_strcpy( e->p_s, u ); e->p_h = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -/* - * State 2: [receiving] - */ -static void stringtest_host_act2( stringtest_host *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_host_act2( stringtest_host * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_hostevent1 * rcvd_evt = (stringtest_hostevent1 *) event; - c_t v_sretval5trv34[ESCHER_SYS_MAX_STRING_LEN];c_t u[ESCHER_SYS_MAX_STRING_LEN];stringtest_device * d; - /* ASSIGN d = PARAM.d */ - d = rcvd_evt->p_d; - /* ASSIGN u = buffer::scmp(s1:d.lower, s2:PARAM.s) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(d->lower, rcvd_evt->p_s) ); - /* ASSIGN u = buffer::scmp(s1:self.upper, self.rstr()) */ - Escher_strcpy( u, stringtest_buffer_op_scmp(self->upper, Escher_strcpy( v_sretval5trv34, stringtest_host_op_rstr(self))) ); - /* GENERATE device2:recv(s:u, h:self) TO d */ - { stringtest_deviceevent2 * e = (stringtest_deviceevent2 *) Escher_NewxtUMLEvent( d, &stringtest_deviceevent2c ); - Escher_strcpy( e->p_s, u ); e->p_h = self; - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_hostevent1c = { - stringtest_DOMAIN_ID, stringtest_host_CLASS_NUMBER, STRINGTEST_HOSTEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - -const Escher_xtUMLEventConstant_t stringtest_hostevent2c = { - stringtest_DOMAIN_ID, stringtest_host_CLASS_NUMBER, STRINGTEST_HOSTEVENT2NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_host_StateEventMatrix[ 2 + 1 ][ 2 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN, EVENT_CANT_HAPPEN }, - /* row 1: stringtest_host_STATE_1 (sending) */ - { stringtest_host_STATE_2, EVENT_CANT_HAPPEN }, - /* row 2: stringtest_host_STATE_2 (receiving) */ - { EVENT_CANT_HAPPEN, stringtest_host_STATE_1 } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_host_acts[ 3 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_host_act1, /* sending */ - (StateAction_t) stringtest_host_act2 /* receiving */ - }; - - /* - * Array of string names of the state machine names. - * Index is the (MC enumerated) number of the state. - */ - static const c_t * const state_name_strings[ 3 ] = { - "", - "sending", - "receiving" - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_host_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 2 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_host_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 2 ) { - STATE_TXN_START_TRACE( "host", current_state, state_name_strings[ current_state ] ); - /* Execute the state action and update the current state. */ - ( *stringtest_host_acts[ next_state ] )( instance, event ); - STATE_TXN_END_TRACE( "host", next_state, state_name_strings[ next_state ] ); - instance->current_state = next_state; - } else if ( next_state == EVENT_CANT_HAPPEN ) { - /* event cant happen */ - UserEventCantHappenCallout( current_state, next_state, event_number ); - STATE_TXN_CH_TRACE( "host", current_state ); - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_host_class.h b/VandMC_testing/mctest/string_return_test/src3/stringtest_host_class.h deleted file mode 100644 index 8f4a715f2..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_host_class.h +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_host_class.h - * - * Class: host (host) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_HOST_CLASS_H -#define STRINGTEST_HOST_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * host (host) - */ -struct stringtest_host { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - c_t upper[ESCHER_SYS_MAX_STRING_LEN]; /* - upper */ - - /* relationship storage */ - /* Note: No storage needed for host->buffer[R1] */ -}; -c_t * stringtest_host_op_rstr( stringtest_host * ); - - - -#define stringtest_host_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_host_extent; - -/* - * instance event: host1:'get' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_device * p_d; /* d */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_hostevent1; -extern const Escher_xtUMLEventConstant_t stringtest_hostevent1c; - -/* - * instance event: host2:'put' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_device * p_d; /* d */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_hostevent2; -extern const Escher_xtUMLEventConstant_t stringtest_hostevent2c; - -/* - * union of events targeted towards 'host' state machine - */ -typedef union { - stringtest_hostevent1 host11; - stringtest_hostevent2 host22; -} stringtest_host_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_host_STATE_1 1 /* state [1]: (sending) */ -#define stringtest_host_STATE_2 2 /* state [2]: (receiving) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_HOSTEVENT1NUM 0 /* host1:'get' */ -#define STRINGTEST_HOSTEVENT2NUM 1 /* host2:'put' */ -extern void stringtest_host_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_HOST_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_ping_class.c b/VandMC_testing/mctest/string_return_test/src3/stringtest_ping_class.c deleted file mode 100644 index 1c126e51e..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_ping_class.c +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_ping_class.c - * - * Class: ping (ping) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - - -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_ping_container[ stringtest_ping_MAX_EXTENT_SIZE ]; -static stringtest_ping stringtest_ping_instances[ stringtest_ping_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_ping_extent = { - {0}, {0}, &stringtest_ping_container[ 0 ], - (Escher_iHandle_t) &stringtest_ping_instances, - sizeof( stringtest_ping ), stringtest_ping_STATE_1, stringtest_ping_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: ping (ping) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [pinging] - */ -static void stringtest_ping_act1( stringtest_ping *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_ping_act1( stringtest_ping * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_pingevent1 * rcvd_evt = (stringtest_pingevent1 *) event; - c_t r[ESCHER_SYS_MAX_STRING_LEN];stringtest_pong * p;c_t s[ESCHER_SYS_MAX_STRING_LEN]; - /* ASSIGN s = PARAM.s */ - Escher_strcpy( s, rcvd_evt->p_s ); - /* ASSIGN p = PARAM.p */ - p = rcvd_evt->p_p; - /* ASSIGN r = buffer::scmp(s1:s, s2:ping pong string) */ - Escher_strcpy( r, stringtest_buffer_op_scmp(s, "ping pong string") ); - /* GENERATE pong1:fly(p:self, s:s) TO p */ - { stringtest_pongevent1 * e = (stringtest_pongevent1 *) Escher_NewxtUMLEvent( p, &stringtest_pongevent1c ); - e->p_p = self; Escher_strcpy( e->p_s, s ); - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_pingevent1c = { - stringtest_DOMAIN_ID, stringtest_ping_CLASS_NUMBER, STRINGTEST_PINGEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_ping_StateEventMatrix[ 1 + 1 ][ 1 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN }, - /* row 1: stringtest_ping_STATE_1 (pinging) */ - { stringtest_ping_STATE_1 } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_ping_acts[ 2 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_ping_act1 /* pinging */ - }; - - /* - * Array of string names of the state machine names. - * Index is the (MC enumerated) number of the state. - */ - static const c_t * const state_name_strings[ 2 ] = { - "", - "pinging" - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_ping_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 1 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_ping_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 1 ) { - STATE_TXN_START_TRACE( "ping", current_state, state_name_strings[ current_state ] ); - /* Execute the state action and update the current state. */ - ( *stringtest_ping_acts[ next_state ] )( instance, event ); - STATE_TXN_END_TRACE( "ping", next_state, state_name_strings[ next_state ] ); - instance->current_state = next_state; - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_ping_class.h b/VandMC_testing/mctest/string_return_test/src3/stringtest_ping_class.h deleted file mode 100644 index 36b513364..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_ping_class.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_ping_class.h - * - * Class: ping (ping) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_PING_CLASS_H -#define STRINGTEST_PING_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * ping (ping) - */ -struct stringtest_ping { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - -}; - - - -#define stringtest_ping_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_ping_extent; - -/* - * instance event: ping1:'bounce' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_pong * p_p; /* p */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_pingevent1; -extern const Escher_xtUMLEventConstant_t stringtest_pingevent1c; - -/* - * union of events targeted towards 'ping' state machine - */ -typedef union { - stringtest_pingevent1 ping11; -} stringtest_ping_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_ping_STATE_1 1 /* state [1]: (pinging) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_PINGEVENT1NUM 0 /* ping1:'bounce' */ -extern void stringtest_ping_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_PING_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_pong_class.c b/VandMC_testing/mctest/string_return_test/src3/stringtest_pong_class.c deleted file mode 100644 index f3587f1d0..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_pong_class.c +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_pong_class.c - * - * Class: pong (pong) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "LOG_bridge.h" -#include "stringtest_classes.h" - - -/* - * Statically allocate space for the instance population for this class. - * Allocate space for the class instance and its attribute values. - * Depending upon the collection scheme, allocate containoids (collection - * nodes) for gathering instances into free and active extents. - */ -static Escher_SetElement_s stringtest_pong_container[ stringtest_pong_MAX_EXTENT_SIZE ]; -static stringtest_pong stringtest_pong_instances[ stringtest_pong_MAX_EXTENT_SIZE ]; -Escher_Extent_t pG_stringtest_pong_extent = { - {0}, {0}, &stringtest_pong_container[ 0 ], - (Escher_iHandle_t) &stringtest_pong_instances, - sizeof( stringtest_pong ), stringtest_pong_STATE_1, stringtest_pong_MAX_EXTENT_SIZE - }; -/*---------------------------------------------------------------------------- - * State and transition action implementations for the following class: - * - * Class: pong (pong) - * Component: stringtest - *--------------------------------------------------------------------------*/ - -/* - * State 1: [ponging] - */ -static void stringtest_pong_act1( stringtest_pong *, const Escher_xtUMLEvent_t * const ); -static void -stringtest_pong_act1( stringtest_pong * self, const Escher_xtUMLEvent_t * const event ) -{ - stringtest_pongevent1 * rcvd_evt = (stringtest_pongevent1 *) event; - c_t r[ESCHER_SYS_MAX_STRING_LEN];stringtest_ping * p;c_t s[ESCHER_SYS_MAX_STRING_LEN]; - /* ASSIGN s = PARAM.s */ - Escher_strcpy( s, rcvd_evt->p_s ); - /* ASSIGN p = PARAM.p */ - p = rcvd_evt->p_p; - /* ASSIGN r = buffer::scmp(s1:s, s2:ping pong string) */ - Escher_strcpy( r, stringtest_buffer_op_scmp(s, "ping pong string") ); - /* GENERATE ping1:bounce(p:self, s:r) TO p */ - { stringtest_pingevent1 * e = (stringtest_pingevent1 *) Escher_NewxtUMLEvent( p, &stringtest_pingevent1c ); - e->p_p = self; Escher_strcpy( e->p_s, r ); - Escher_SendEvent( (Escher_xtUMLEvent_t *) e ); - } -} - -const Escher_xtUMLEventConstant_t stringtest_pongevent1c = { - stringtest_DOMAIN_ID, stringtest_pong_CLASS_NUMBER, STRINGTEST_PONGEVENT1NUM, - ESCHER_IS_INSTANCE_EVENT }; - - - -/* - * State-Event Matrix (SEM) - * Row index is object (MC enumerated) current state. - * Row zero is the uninitialized state (e.g., for creation event transitions). - * Column index is (MC enumerated) state machine events. - */ -static const Escher_SEMcell_t stringtest_pong_StateEventMatrix[ 1 + 1 ][ 1 ] = { - /* row 0: uninitialized state (for creation events) */ - { EVENT_CANT_HAPPEN }, - /* row 1: stringtest_pong_STATE_1 (ponging) */ - { stringtest_pong_STATE_1 } -}; - - /* - * Array of pointers to the class state action procedures. - * Index is the (MC enumerated) number of the state action to execute. - */ - static const StateAction_t stringtest_pong_acts[ 2 ] = { - (StateAction_t) 0, - (StateAction_t) stringtest_pong_act1 /* ponging */ - }; - - /* - * Array of string names of the state machine names. - * Index is the (MC enumerated) number of the state. - */ - static const c_t * const state_name_strings[ 2 ] = { - "", - "ponging" - }; - -/* - * instance state machine event dispatching - */ -void -stringtest_pong_Dispatch( Escher_xtUMLEvent_t * event ) -{ - Escher_iHandle_t instance = GetEventTargetInstance( event ); - Escher_EventNumber_t event_number = GetOoaEventNumber( event ); - Escher_StateNumber_t current_state; - Escher_StateNumber_t next_state; - - if ( 0 != instance ) { - current_state = instance->current_state; - if ( current_state > 1 ) { - /* instance validation failure (object deleted while event in flight) */ - UserEventNoInstanceCallout( event_number ); - } else { - next_state = stringtest_pong_StateEventMatrix[ current_state ][ event_number ]; - if ( next_state <= 1 ) { - STATE_TXN_START_TRACE( "pong", current_state, state_name_strings[ current_state ] ); - /* Execute the state action and update the current state. */ - ( *stringtest_pong_acts[ next_state ] )( instance, event ); - STATE_TXN_END_TRACE( "pong", next_state, state_name_strings[ next_state ] ); - instance->current_state = next_state; - } else { - /* empty else */ - } - } - } -} - - diff --git a/VandMC_testing/mctest/string_return_test/src3/stringtest_pong_class.h b/VandMC_testing/mctest/string_return_test/src3/stringtest_pong_class.h deleted file mode 100644 index 05b4bcd4a..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/stringtest_pong_class.h +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: stringtest_pong_class.h - * - * Class: pong (pong) - * Component: stringtest - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef STRINGTEST_PONG_CLASS_H -#define STRINGTEST_PONG_CLASS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Structural representation of application analysis class: - * pong (pong) - */ -struct stringtest_pong { - Escher_StateNumber_t current_state; - /* application analysis class attributes */ - -}; - - - -#define stringtest_pong_MAX_EXTENT_SIZE 10 -extern Escher_Extent_t pG_stringtest_pong_extent; - -/* - * instance event: pong1:'fly' - */ -typedef struct { - EVENT_BASE_ATTRIBUTE_LIST /* base attributes of all event classes */ - stringtest_ping * p_p; /* p */ - c_t p_s[ESCHER_SYS_MAX_STRING_LEN]; /* s */ -} stringtest_pongevent1; -extern const Escher_xtUMLEventConstant_t stringtest_pongevent1c; - -/* - * union of events targeted towards 'pong' state machine - */ -typedef union { - stringtest_pongevent1 pong11; -} stringtest_pong_Events_u; - -/* - * enumeration of state model states for class - */ -#define stringtest_pong_STATE_1 1 /* state [1]: (ponging) */ -/* - * enumeration of state model event numbers - */ -#define STRINGTEST_PONGEVENT1NUM 0 /* pong1:'fly' */ -extern void stringtest_pong_Dispatch( Escher_xtUMLEvent_t * ); - -#ifdef __cplusplus -} -#endif - -#endif /* STRINGTEST_PONG_CLASS_H */ - - diff --git a/VandMC_testing/mctest/string_return_test/src3/sys_thread.c b/VandMC_testing/mctest/string_return_test/src3/sys_thread.c deleted file mode 100644 index 040f2b49f..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/sys_thread.c +++ /dev/null @@ -1,107 +0,0 @@ -/*--------------------------------------------------------------------- - * File: sys_thread.c - * - * Description: - * This file provides implementation of multi-tasking/threading - * capabilities allowing classes/subsystems to run in different - * threads on a multi-tasking/threading OS/RTOS. - * - * your copyright statement can go here (from te_copyright.body) - *-------------------------------------------------------------------*/ - -#include /* POSIX thread declarations */ -#include "string_return_test_sys_types.h" - -static pthread_mutex_t mutices[ SEMAPHORE_FLAVOR_MAX ]; -static pthread_cond_t nonbusy_wait_cond[ NUM_OF_TOTAL_THREADS ]; -static u1_t threadnumber[ NUM_OF_TOTAL_THREADS ]; - -/* - * Initialize those structures that need to be set up once at system - * bring-up time. - */ -void Escher_InitializeThreading( void ) -{ - u1_t i; - int rc; - for ( i = 0; i < NUM_OF_TOTAL_THREADS; i++ ) { - threadnumber[ i ] = i; - rc = pthread_cond_init( &nonbusy_wait_cond[ i ], 0 ); - } - for ( i = 0; i < SEMAPHORE_FLAVOR_MAX; i++ ) { - rc = pthread_mutex_init( &mutices[ i ], 0 ); - } - rc = rc; -} - -/* - * Obtain a resource lock so that this thread has mutually exclusive - * access. - */ -void Escher_mutex_lock( const u1_t flavor ) -{ - int rc = pthread_mutex_lock( &mutices[ flavor ] ); - rc = rc; -} - -/* - * Release a resource lock that was obtained with the lock method. - */ -void Escher_mutex_unlock( const u1_t flavor ) -{ - int rc = pthread_mutex_unlock( &mutices[ flavor ] ); - rc = rc; -} - -/* - * Go into a non-busy wait state waiting on someone to wake us - * up with the nonbusy_wake method. - */ -void Escher_nonbusy_wait( const u1_t thread ) -{ - int rc; - void * vp = 0; - pthread_cond_t * dwc = &nonbusy_wait_cond[ thread ]; - Escher_mutex_lock( SEMAPHORE_FLAVOR_NONBUSY ); - if ( ( thread != 0 ) || ( vp == 0 ) ) { - rc = pthread_cond_wait( dwc, &mutices[ SEMAPHORE_FLAVOR_NONBUSY ] ); - } - Escher_mutex_unlock( SEMAPHORE_FLAVOR_NONBUSY ); -} - -/* - * Wake up a thread that went to sleep waiting for something to happen. - */ -void Escher_nonbusy_wake( const u1_t thread ) -{ - int rc; - pthread_cond_t * dwc = &nonbusy_wait_cond[ thread ]; - Escher_mutex_lock( SEMAPHORE_FLAVOR_NONBUSY ); - rc = pthread_cond_broadcast( dwc ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_NONBUSY ); -} - -/* - * Create and spin off a task/thread to run the input routine. - */ -void Escher_thread_create( void *(routine)(void *), const u1_t i ) -{ - static pthread_t pthread[ NUM_OF_TOTAL_THREADS ]; - int rc = pthread_create( &pthread[ i - 1 ], 0, routine, &threadnumber[ i ] ); - rc = rc; -} - -/* - * Cleanup the structures initialized in Escher_InitializeThreading. - */ -void Escher_thread_shutdown( void ) -{ - u1_t i; - int rc; - for ( i = 0; i < NUM_OF_TOTAL_THREADS; i++ ) { - rc = pthread_cond_destroy( &nonbusy_wait_cond[ i ] ); - } - for ( i = 0; i < SEMAPHORE_FLAVOR_MAX; i++ ) { - rc = pthread_mutex_destroy( &mutices[ i ] ); - } -} diff --git a/VandMC_testing/mctest/string_return_test/src3/sys_user_co.c b/VandMC_testing/mctest/string_return_test/src3/sys_user_co.c deleted file mode 100644 index 34f20c1af..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/sys_user_co.c +++ /dev/null @@ -1,253 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: sys_user_co.c - * - * Description: - * Interface call-outs allow the user to capture execution control of the - * generated system running on a target. - * Especially in the deeply embedded software/hardware development world, - * it may be necessary to tightly interface the xtUML system to the - * surrounding/containing system. MC-3020 provides callout routines - * that enable the user to easily interface code generated by the model - * compiler with other system code. These callout routines are empty when - * generated by the model compiler. It is up to the user to define - * additional functionality (if necessary) to be performed at these - * callout points. - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "sys_user_co.h" - -#ifdef SYS_USER_CO_PRINTF_ON -#include -#define SYS_USER_CO_PRINTF( s ) printf( s ); -#else -#define SYS_USER_CO_PRINTF( s ) -#endif - -/* - * UserInitializationCallout - * - * This function is invoked at the immediate beginning of application - * initialization. It is the very first function to be executed at system - * startup. - * User supplied implementation of this function should be restricted to - * things like memory initialization, early hardware duties, etc. - */ -void -UserInitializationCalloutf( void ) -{ -/* Activate this invocation to initialize the example simple TIM. */ - #if ESCHER_SYS_MAX_XTUML_TIMERS > 0 - TIM_init(); - #endif - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserInitializationCallout\n" ) -} - -/* - * UserPreOoaInitializationCallout - * - * This function is invoked immediately prior to executing any xtUML - * initialization functions. - */ -void -UserPreOoaInitializationCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPreOoaInitializationCallout\n" ) -} - -/* - * UserPostOoaInitializationCallout - * - * This function is invoked immediately after executing any xtUML - * initialization functions. - * When this callout function returns, the system dispatcher will allow the - * xtUML application analysis state models to start consuming events. - */ -void -UserPostOoaInitializationCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPostOoaInitializationCallout\n" ) -} - -/* - * UserBackgroundProcessingCallout - * - * This function is invoked once during each loop execution of the system - * dispather. - * It is invoked at the 'top' of the system dispatcher loop, immediately - * prior to dispatching any xtUML application analysis events. - */ -void -UserBackgroundProcessingCalloutf( void ) -{ - /* Activate this invocation to periodically tick the example simple TIM. */ - #if ESCHER_SYS_MAX_XTUML_TIMERS > 0 - TIM_tick(); - #endif - /* Insert implementation specific code here. */ -} - -/* - * UserPreShutdownCallout - * - * This function is invoked at termination of the system dispatcher, but - * prior to performing any xtUML application analysis shutdown sequencing. - */ -void -UserPreShutdownCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPreShutdownCallout\n" ) -} - -/* - * UserPostShutdownCallout - * - * This function is invoked immediately before application exit. - */ -void -UserPostShutdownCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPostShutdownCallout\n" ) -} - -/* - * UserEventCantHappenCallout - * - * This function is invoked any time that an event is received that - * results in a "cant happen" transition. - */ -void -UserEventCantHappenCalloutf( - const Escher_StateNumber_t current_state, - const Escher_StateNumber_t next_state, - const Escher_EventNumber_t event_number ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEventCantHappenCallout\n" ) -} - -/* - * UserEventNoInstanceCallout - * - * This function is invoked when we failed to validate the instance - * to which an event was directed. This can happen in normal operation - * when the instance was deleted while the event was in flight (analysis - * error). - */ -void -UserEventNoInstanceCalloutf( - const Escher_EventNumber_t event_number ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEventNoInstanceCallout\n" ) -} - -/* - * UserEventFreeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate an - * event, but there are no more left. - */ -void -UserEventFreeListEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEventFreeListEmptyCallout\n" ) -} - -/* - * UserEmptyHandleDetectedCallout - * - * This function is invoked when an attempt is made to use an instance - * reference variable (handle) that is null (empty). - */ -void -UserEmptyHandleDetectedCalloutf( c_t * object_keyletters, c_t * s ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserEmptyHandleDetectedCallout\n" ) -} - -/* - * UserObjectPoolEmptyCallout - * - * This function is invoked when an attempt is made to create an - * instance of an object, but there are no instances available. - */ -void -UserObjectPoolEmptyCalloutf( const Escher_DomainNumber_t component_number, const Escher_ClassNumber_t class_number ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserObjectPoolEmptyCallout\n" ) -} - -/* - * UserNodeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate a - * node, but there are no more left. - */ -void -UserNodeListEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserNodeListEmptyCallout\n" ) -} - -/* - * UserInterleavedBridgeOverflowCallout - * - * This function is invoked when an attempt is made to post too many - * interleaved bridges. The depth of this list is defined by - * SYS_MAX_INTERLEAVED_BRIDGES (unless changed in the archetype). - */ -void -UserInterleavedBridgeOverflowCalloutf( void ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserInterleavedBridgeOverflowCallout\n" ) -} - -/* - * UserSelfEventQueueEmptyCallout - * - * This function is invoked when the events to self queue is - * interrogated and found to be empty. - */ -void -UserSelfEventQueueEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ -} - -/* - * UserNonSelfEventQueueEmptyCallout - * - * This function is invoked when the events to instance queue is - * interrogated and found to be empty. - */ -void -UserNonSelfEventQueueEmptyCalloutf( void ) -{ - /* Insert implementation specific code here. */ -} - -/* - * UserPersistenceErrorCallout - * - * This function is invoked when the events to instance queue is - * interrogated and found to be empty. - */ -void -UserPersistenceErrorCalloutf( i_t error_code ) -{ - /* Insert implementation specific code here. */ - SYS_USER_CO_PRINTF( "UserPersistenceErrorCallout\n" ) -} diff --git a/VandMC_testing/mctest/string_return_test/src3/sys_user_co.h b/VandMC_testing/mctest/string_return_test/src3/sys_user_co.h deleted file mode 100644 index da7b72863..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/sys_user_co.h +++ /dev/null @@ -1,294 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: sys_user_co.h - * - * Description: - * Function declarations for user supplied (non-translated) call out entry - * points in the generated application. - * - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef SYS_USER_CO_H -#define SYS_USER_CO_H -#ifdef __cplusplus -extern "C" { -#endif - -/* - * UserInitializationCallout - * - * This function is invoked at the immediate beginning of application - * initialization. It is the very first function to be executed at system - * startup. - * User supplied implementation of this function should be restricted to - * things like memory initialization, early hardware duties, etc. - * - */ -void UserInitializationCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. - (activated by default... Uncomment to deactivate.) -#define UserInitializationCallout() - */ - -#ifndef UserInitializationCallout -#define UserInitializationCallout() UserInitializationCalloutf() -#endif - -/* - * UserPreOoaInitializationCallout - * - * This function is invoked immediately prior to executing any xtUML - * initialization functions. - */ -void UserPreOoaInitializationCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPreOoaInitializationCallout() - -#ifndef UserPreOoaInitializationCallout -#define UserPreOoaInitializationCallout() UserPreOoaInitializationCalloutf() -#endif - -/* - * UserPostOoaInitializationCallout - * - * This function is invoked immediately after executing any xtUML - * initialization functions. - * When this callout function returns, the system dispatcher will allow the - * xtUML application analysis state models to start consuming events. - */ -void UserPostOoaInitializationCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPostOoaInitializationCallout() - -#ifndef UserPostOoaInitializationCallout -#define UserPostOoaInitializationCallout() UserPostOoaInitializationCalloutf() -#endif - -/* - * UserBackgroundProcessingCallout - * - * This function is invoked once during each loop execution of the system - * dispather. - * It is invoked at the 'top' of the system dispatcher loop, immediately - * prior to dispatching any xtUML application analysis events. - */ -void UserBackgroundProcessingCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. - (activated by default... Uncomment to deactivate.) -#define UserBackgroundProcessingCallout() - */ - -#ifndef UserBackgroundProcessingCallout -#define UserBackgroundProcessingCallout() UserBackgroundProcessingCalloutf() -#endif - -/* - * UserPreShutdownCallout - * - * This function is invoked at termination of the system dispatcher, but - * prior to performing any xtUML application analysis shutdown sequencing. - */ -void UserPreShutdownCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPreShutdownCallout() - -#ifndef UserPreShutdownCallout -#define UserPreShutdownCallout() UserPreShutdownCalloutf() -#endif - -/* - * UserPostShutdownCallout - * - * This function is invoked immediately before application exit. - */ -void UserPostShutdownCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPostShutdownCallout() - -#ifndef UserPostShutdownCallout -#define UserPostShutdownCallout() UserPostShutdownCalloutf() -#endif - -/* - * UserEventCantHappenCallout - * - * This function is invoked any time that an event is received that - * results in a "cant happen" transition. - */ -void UserEventCantHappenCalloutf( const Escher_StateNumber_t, - const Escher_StateNumber_t, - const Escher_EventNumber_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEventCantHappenCallout( s1, s2, e ) - -#ifndef UserEventCantHappenCallout -#define UserEventCantHappenCallout( s1, s2, e ) UserEventCantHappenCalloutf( s1, s2, e ) -#endif - -/* - * UserEventNoInstanceCallout - * - * This function is invoked when we failed to validate the instance - * to which an event was directed. This can happen in normal operation - * when the instance was deleted while the event was in flight (analysis - * error). - */ -void UserEventNoInstanceCalloutf( const Escher_EventNumber_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEventNoInstanceCallout( e ) - -#ifndef UserEventNoInstanceCallout -#define UserEventNoInstanceCallout( e ) UserEventNoInstanceCalloutf( e ) -#endif - -/* - * UserEventFreeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate an - * event, but there are no more left. - */ -void UserEventFreeListEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEventFreeListEmptyCallout() - -#ifndef UserEventFreeListEmptyCallout -#define UserEventFreeListEmptyCallout() UserEventFreeListEmptyCalloutf() -#endif - -/* - * UserEmptyHandleDetectedCallout - * - * This function is invoked when an attempt is made to use an instance - * reference variable (handle) that is null (empty). - */ -void UserEmptyHandleDetectedCalloutf( c_t *, c_t * ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserEmptyHandleDetectedCallout( s1, s2 ) - -#ifndef UserEmptyHandleDetectedCallout -#define UserEmptyHandleDetectedCallout( s1, s2 ) UserEmptyHandleDetectedCalloutf( (c_t *) s1, (c_t *) s2 ) -#endif - -/* - * UserObjectPoolEmptyCallout - * - * This function is invoked when an attempt is made to create an - * instance of an object, but there are no instances available. - */ -void UserObjectPoolEmptyCalloutf( const Escher_DomainNumber_t, const Escher_ClassNumber_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. - (activated by default... Uncomment to deactivate.) -#define UserObjectPoolEmptyCallout( s1, s2 ) - */ - -#ifndef UserObjectPoolEmptyCallout -#define UserObjectPoolEmptyCallout( s1, s2 ) UserObjectPoolEmptyCalloutf( s1, s2 ) -#endif - -/* - * UserNodeListEmptyCallout - * - * This function is invoked when an attempt is made to allocate a - * node, but there are no more left. - */ -void UserNodeListEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserNodeListEmptyCallout() - -#ifndef UserNodeListEmptyCallout -#define UserNodeListEmptyCallout() UserNodeListEmptyCalloutf() -#endif - -/* - * UserInterleavedBridgeOverflowCallout - * - * This function is invoked when an attempt is made to post too many - * interleaved bridges. The depth of this list is defined by - * SYS_MAX_INTERLEAVED_BRIDGES (unless changed in the archetype). - */ -void UserInterleavedBridgeOverflowCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserInterleavedBridgeOverflowCallout() - -#ifndef UserInterleavedBridgeOverflowCallout -#define UserInterleavedBridgeOverflowCallout() UserInterleavedBridgeOverflowCalloutf() -#endif - -/* - * UserSelfEventQueueEmptyCallout - * - * This function is invoked when the events to self queue is - * interrogated and found to be empty. - */ -void UserSelfEventQueueEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserSelfEventQueueEmptyCallout() - -#ifndef UserSelfEventQueueEmptyCallout -#define UserSelfEventQueueEmptyCallout() UserSelfEventQueueEmptyCalloutf() -#endif - -/* - * UserNonSelfEventQueueEmptyCallout - * - * This function is invoked when the events to instance queue is - * interrogated and found to be empty. - */ -void UserNonSelfEventQueueEmptyCalloutf( void ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserNonSelfEventQueueEmptyCallout() - -#ifndef UserNonSelfEventQueueEmptyCallout -#define UserNonSelfEventQueueEmptyCallout() UserNonSelfEventQueueEmptyCalloutf() -#endif - -/* - * UserPersistenceErrorCallout - * - * This function is invoked when trouble is detected reading from - * or writing to persistent storage. - */ -void UserPersistenceErrorCalloutf( i_t ); -/* The following empty definition renders the callout hook invisible. - Delete or comment out the following define to activate the in line - hook for this callout. */ -#define UserPersistenceErrorCallout( i1 ) - -#ifndef UserPersistenceErrorCallout -#define UserPersistenceErrorCallout( i1 ) UserPersistenceErrorCalloutf( i1 ) -#endif - -#ifdef __cplusplus -} -#endif -#endif /* SYS_USER_CO_H */ diff --git a/VandMC_testing/mctest/string_return_test/src3/sys_xtuml.c b/VandMC_testing/mctest/string_return_test/src3/sys_xtuml.c deleted file mode 100644 index 0960cfa4d..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/sys_xtuml.c +++ /dev/null @@ -1,606 +0,0 @@ -/*-------------------------------------------------------------------------- - * File: sys_xtuml.c - * - * Description: - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#include "string_return_test_sys_types.h" -#include "stringtest_classes.h" - - -/* No containers allocated. */ - -/* - * Initialize the node1 instances by linking them into a collection. - * These containoids will be collected into a null-terminated, - * singly linked list (slist). - * This needs to be called during architecture initialization. - */ -void -Escher_SetFactoryInit( const i_t n1_size ) -{ - /* Set factory initialization optimized out. */ -} - -/* - * This will copy all of the elements from one set into another - * set. If the target set is not empty, it will be cleared - * before the copy operation occurs freeing any nodes in that set. - * The new set will use containoids from the free list. - */ -/* Set copy code optimized out. */ - -/* - * Release all nodes in the given set back to the free pool. - */ -/* Set clearing code optimized out. */ - -/* - * Insert a single element into the set in no particular order. - * The element is a data item. A container node will be allocated - * to link in the element. - */ -/* Set insertion code optimized out. */ - -/* - * Insert a block of objects into the given set in sequence. Link the - * data into the supplied containers. - * Return a pointer to the linked set. - */ -Escher_SetElement_s * -Escher_SetInsertBlock( Escher_SetElement_s * container, - const u1_t * instance, - const Escher_size_t length, - Escher_size_t count ) -{ - Escher_SetElement_s * head = ( count > 0 ) ? container : 0; - while ( count > 0 ) { - count--; - container->object = (void *) instance; /* Link in the object data. */ - instance = instance + length; /* Bump to next object image. */ - /* String together or ground containoids. */ - container->next = ( count > 0 ) ? container + 1 : 0; - container++; - } - return head; -} - -/* - * Remove an instance from an instance collection. - */ -/* Signature: void Escher_SetRemoveInstance( pextent, instance, slot, container, pool ) */ - -/* - * Insert an instance onto an extent. - */ -/* Signature: void Escher_SetInsertInstance( pextent, node ) */ - - -/* - * Remove a data item from the given set. This requires searching - * the set for the item, unlinking the item (if found) and returning - * the pointer to the removed node. SetRemoveNode is used - * when some knowledge of the linking mechanism is required (as - * in extent management). SetRemoveElement is used whenever - * possible. - */ -Escher_SetElement_s * -Escher_SetRemoveNode( - Escher_ObjectSet_s * set, - const void * const d -) -{ - Escher_SetElement_s * t = set->head; /* Start with first node. */ - /* Find node containing data and unlink from list. */ - if ( t->object == d ) { /* Element found at head. */ - set->head = t->next; /* Unlink it from the list. */ - } else { - Escher_SetElement_s * t_old; - do { /* Search for data element. */ - t_old = t; - t = t->next; - if ( t == 0 ) { return 0; } /* absent */ - } while ( t->object != d ); - t_old->next = t->next; /* Unlink element from the list. */ - } - return t; -} - -/* - * This interface is used more often to remove an element. This is - * used when maximum anonymity is required. Escher_SetRemoveNode is - * used when some knowledge of the linking mechanism is required (as - * in extent management). - */ -/* Set remove element code optimized out. */ - -/* - * Return a pointer to the found element when the set contains the - * given data element. - */ -const void * -Escher_SetContains( - const Escher_ObjectSet_s * const set, - const void * const element -) -{ - const Escher_SetElement_s * node = set->head; - while ( node != 0 ) { - if ( node->object == element ) { return node; } /* found */ - node = node->next; - } - return 0; /* absent */ -} - -/* - * Count the elements in the set. Return that count. - * This routine counts nodes. - */ -Escher_size_t -Escher_SetCardinality( const Escher_ObjectSet_s * const set ) -{ - Escher_size_t result = 0; - const Escher_SetElement_s * node = set->head; - while ( node != 0 ) { - result++; - node = node->next; - } - return result; -} - -/* - * Return true when the left and right set are equivalent. - * Note: This currently is not implemented. - */ -bool -Escher_SetEquality( Escher_ObjectSet_s * const left_set, - Escher_ObjectSet_s * const right_set ) -{ - bool rc = false; - if ( (left_set->head == 0) && (right_set->head == 0) ) { - rc = true; - } else if ( ( (left_set->head != 0) && (right_set->head != 0) ) && - (Escher_SetCardinality( left_set ) == Escher_SetCardinality( right_set )) ) { - rc = true; - } else { /* nop */ } - return rc; -} - -/* - * Initialize a set variable. - */ -/* Signature: void Escher_InitSet( Escher_ObjectSet_s * set ) */ - -/* - * Get any element (1st) from a collection. - */ -/* Signature: void * Escher_SetGetAny( Escher_ObjectSet_s * const set ) */ - -/* - * Return true if set is empty. - */ -/* Signature: bool Escher_SetIsEmpty( const Escher_ObjectSet_s * const set ) */ - -/* - * Use this method to reset the cursor. - */ -/* Signature: void Escher_IteratorReset( Escher_Iterator_s * const iterator, - * Escher_ObjectSet_s * const set ) - */ - -/* - * Interate to the next element and return it. - */ -void * -Escher_IteratorNext( Escher_Iterator_s * const iter ) -{ - void * element = 0; - if ( iter->cursor != 0 ) { - element = iter->cursor->object; - iter->cursor = iter->cursor->next; - } - return element; -} - -/* - * Set memory bytes to value at destination. - */ -void -Escher_memset( void * const dst, const u1_t val, Escher_size_t len ) -{ - u1_t * d = (u1_t *) dst; - while ( len > 0 ) { - len--; - *d++ = val; - } -} - -/* - * Move memory bytes from source to destination. - */ -void -Escher_memmove( void * const dst, const void * const src, Escher_size_t len ) -{ - u1_t * s = (u1_t *) src; - u1_t * d = (u1_t *) dst; - while ( len > 0 ) { - len--; - *d++ = *s++; - } -} - -/* - * Copy characters and be paranoid about null delimiter. - */ -c_t * -Escher_strcpy( c_t * dst, const c_t * src ) -{ - c_t * s = dst; - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; - if ( ( 0 != src ) && ( 0 != dst ) ) { - while ( ( i > 0 ) && ( *src != '\0' ) ) { - --i; - *dst++ = *src++; - } - *dst = '\0'; /* Ensure delimiter. */ - } - return s; -} - -/* - * Add two strings. Allocate a temporary memory variable to return the value. - */ -c_t * -Escher_stradd( const c_t * left, const c_t * right ) -{ - s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1; - c_t * s = Escher_strget(); - c_t * dst = s; - if ( 0 == left ) left = ""; - if ( 0 == right ) right = ""; - while ( ( i > 0 ) && ( *left != '\0' ) ) { - --i; - *dst++ = *left++; - } - while ( ( i > 0 ) && ( *right != '\0' ) ) { - --i; - *dst++ = *right++; - } - *dst = '\0'; /* Ensure delimiter. */ - return s; -} - -/* - * Compare two strings. - * Return negative number if s1 < s2. - * Return zero if s1 == s2. - * Return postive number if s1 > s2. - */ -c_t -Escher_strcmp( const c_t *p1, const c_t *p2 ) -{ - const c_t *s1 = p1; - const c_t *s2 = p2; - c_t c1, c2; - i_t i = ESCHER_SYS_MAX_STRING_LEN; - do { - c1 = *s1++; - c2 = *s2++; - if ( c1 == 0 ) { break; } - --i; - } while ( ( c1 == c2 ) && ( i >= 0 ) ); - return ( c1 - c2 ); -} - -/* - * Return a string buffer. Rotate through a pool. - */ -c_t * -Escher_strget( void ) -{ - static u1_t i = 0; - static c_t s[ 16 ][ ESCHER_SYS_MAX_STRING_LEN ]; - i = ( i + 1 ) % 16; - s[ i ][ 0 ] = 0; - return ( &s[ i ][ 0 ] ); -} - - -/* xtUML class info for all of the components (collections, sizes, etc.) */ -Escher_Extent_t * const * const domain_class_info[ SYSTEM_DOMAIN_COUNT ] = { - &stringtest_class_info[0] -}; - -/* - * Create an instance of the class numbered on the input. - * Return the handle of the created instance. - */ -Escher_iHandle_t -Escher_CreateInstance( - const Escher_DomainNumber_t domain_num, - const Escher_ClassNumber_t class_num -) -{ - Escher_SetElement_s * node; - Escher_iHandle_t instance; - Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - Escher_mutex_lock( SEMAPHORE_FLAVOR_INSTANCE ); - node = dci->inactive.head; - - if ( 0 == node ) { - UserObjectPoolEmptyCallout( domain_num, class_num ); - } - - dci->inactive.head = dci->inactive.head->next; - instance = (Escher_iHandle_t) node->object; - if ( 0 != dci->initial_state ) { - instance->current_state = dci->initial_state; - } - Escher_SetInsertInstance( &dci->active, node ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_INSTANCE ); - return instance; -} - -/* - * Delete an instance of the class passed and numbered on the input. - */ -void -Escher_DeleteInstance( - Escher_iHandle_t instance, - const Escher_DomainNumber_t domain_num, - const Escher_ClassNumber_t class_num -) -{ - Escher_SetElement_s * node; - Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - Escher_mutex_lock( SEMAPHORE_FLAVOR_INSTANCE ); - node = Escher_SetRemoveNode( &dci->active, instance ); - node->next = dci->inactive.head; - dci->inactive.head = node; - /* Initialize storage to zero. */ - Escher_memset( instance, 0, dci->size ); - Escher_mutex_unlock( SEMAPHORE_FLAVOR_INSTANCE ); -} - -/* - * Initialize object factory services. - * Initialize class instance storage free pool (inanimate list) - * by linking the empty instances into a collection. - */ -void -Escher_ClassFactoryInit( - const Escher_DomainNumber_t domain_num, - const Escher_ClassNumber_t class_num ) -{ - Escher_Extent_t * dci = *(domain_class_info[ domain_num ] + class_num); - if ( 0 != dci ) { - dci->active.head = 0; - dci->inactive.head = Escher_SetInsertBlock( - dci->container, - (const u1_t *) dci->pool, - dci->size, - dci->population ); - } -} -/* - * Following provides the dispatcher loops for the xtUML event queues. - */ - - -bool Escher_run_flag = true; /* Turn this off to exit dispatch loop(s). */ -/* Map the classes to the tasks/threads for each domain. */ -static const Escher_ClassNumber_t stringtest_task_numbers[ stringtest_STATE_MODELS ] = { - stringtest_TASK_NUMBERS -}; -static const Escher_ClassNumber_t * const class_thread_assignment[ SYSTEM_DOMAIN_COUNT ] = { - &stringtest_task_numbers[0] -}; - -/* Structure: Escher_systemxtUMLevents - * _Super-union_ of all xtUML events in the system. For translation - * patterns which can not accept dynamic memory allocation for - * xtUML events, this union is used to predetermine the maximum - * size of any xtUML event in the system. */ -typedef union { - Escher_xtUMLEvent_t mc_event_base; - stringtest_DomainEvents_u mc_events_in_domain_stringtest; -} Escher_systemxtUMLevents_t; - -/* anchor declaration for front and back of list of events */ -typedef struct { - Escher_xtUMLEvent_t * head, * tail; -} xtUMLEventQueue_t; - -/* Pointer to head of list of available event nodes. */ -static Escher_xtUMLEvent_t * free_event_list = 0; -static xtUMLEventQueue_t non_self_event_queue[ NUM_OF_XTUML_CLASS_THREADS ]; - -/* - * Link the event skeleton nodes together on the free list ready - * for allocation. - */ -void -InitializeOoaEventPool( void ) -{ - /* Pre-allocated memory pool for xtUML events. */ - static Escher_systemxtUMLevents_t Escher_xtUML_event_pool[ ESCHER_SYS_MAX_XTUML_EVENTS ]; - u2_t i; - Escher_run_flag = true; /* Default running enabled. */ - for ( i = 0; i < NUM_OF_XTUML_CLASS_THREADS; i++ ) { - non_self_event_queue[ i ].head = 0; non_self_event_queue[ i ].tail = 0; - } - /* String events together into a singly linked list. */ - free_event_list = (Escher_xtUMLEvent_t *) &Escher_xtUML_event_pool[ 0 ]; - for ( i = 0; i < ESCHER_SYS_MAX_XTUML_EVENTS - 1; i++ ) { - Escher_xtUML_event_pool[ i ].mc_event_base.next = - (Escher_xtUMLEvent_t *) &(Escher_xtUML_event_pool[ i + 1 ]); - } - Escher_xtUML_event_pool[ ESCHER_SYS_MAX_XTUML_EVENTS - 1 ].mc_event_base.next = 0; -} - -/* - * Obtain an empty event from the free list. - */ -Escher_xtUMLEvent_t * Escher_AllocatextUMLEvent( void ) -{ - Escher_xtUMLEvent_t * event = 0; - Escher_mutex_lock( SEMAPHORE_FLAVOR_FREELIST ); - if ( 0 == free_event_list ) { - UserEventFreeListEmptyCallout(); /* Bad news! No more events. */ - } else { - event = free_event_list; /* Grab front of the free list. */ - free_event_list = event->next; /* Unlink from front of free list. */ - } - Escher_mutex_unlock( SEMAPHORE_FLAVOR_FREELIST ); - return event; -} - -/* - * Allocate the event and initialize the base attributes. - */ -Escher_xtUMLEvent_t * -Escher_NewxtUMLEvent( const void * const destination, - const Escher_xtUMLEventConstant_t * const event_info ) -{ - Escher_xtUMLEvent_t * event = Escher_AllocatextUMLEvent(); - SetEventTargetInstance( event, destination ); - SetEventDestDomainNumber( event, event_info->destination_domain_number ); - SetEventDestObjectNumber( event, event_info->destination_object_number ); - SetOoaEventNumber( event, event_info->event_number ); - SetOoaEventFlags( event, event_info->event_flags ); - return event; -} - -/* - * Update the base attributes of an event for polymorphic processing. - */ -Escher_xtUMLEvent_t * -Escher_ModifyxtUMLEvent( Escher_xtUMLEvent_t * event, - const Escher_xtUMLEventConstant_t * const event_info ) -{ - SetEventDestDomainNumber( event, event_info->destination_domain_number ); - SetEventDestObjectNumber( event, event_info->destination_object_number ); - SetOoaEventNumber( event, event_info->event_number ); - SetOoaEventFlags( event, event_info->event_flags ); - return event; -} - -/* - * Delete an event by moving it onto the free list. - */ -void -Escher_DeletextUMLEvent( Escher_xtUMLEvent_t * event ) -{ - Escher_mutex_lock( SEMAPHORE_FLAVOR_FREELIST ); - event->next = free_event_list; - free_event_list = event; - Escher_mutex_unlock( SEMAPHORE_FLAVOR_FREELIST ); -} - -/* - * Send an event to the instance queue. Use priority where applicable. - * - * The following table summarizes the construction of events - * as expected in Escher. For each type of object that - * may be the source or target of an event, the expected - * value of the source and destination handles in the event are - * given. - * - * object type | as event source | as destination - * ------------+---------------------+---------------------- - * instance | handle | handle - * class | manufactured handle | 0 - * creator | manufactured handle | 0 - */ -void -Escher_SendEvent( Escher_xtUMLEvent_t * event ) -{ - u1_t t = *( class_thread_assignment[ GetEventDestDomainNumber( event ) ] - + GetEventDestObjectNumber( event ) ); - xtUMLEventQueue_t * q = &non_self_event_queue[ t ]; - event->next = 0; - /* Append the event to the tail end of the queue. */ - /* No need to maintain prev pointers when not prioritizing. */ - Escher_mutex_lock( SEMAPHORE_FLAVOR_IQUEUE ); - if ( q->tail == 0 ) { - q->head = event; - } else { - q->tail->next = event; - } - q->tail = event; - Escher_mutex_unlock( SEMAPHORE_FLAVOR_IQUEUE ); - Escher_nonbusy_wake( t ); -} - -/* - * Drag an event from the instance directed queue if there is one. This - * routine also serves as the IsQueueEmpty routine. A null return code - * indicates that the queue is empty. Otherwise the handle to the - * event will be returned. - */ -static Escher_xtUMLEvent_t * DequeueOoaNonSelfEvent( const u1_t ); -static Escher_xtUMLEvent_t * DequeueOoaNonSelfEvent( const u1_t t ) -{ - Escher_xtUMLEvent_t * event; - xtUMLEventQueue_t * q = &non_self_event_queue[ t ]; - Escher_mutex_lock( SEMAPHORE_FLAVOR_IQUEUE ); - /* Assign the event from the head of the queue. */ - event = q->head; - /* If the list is not empty, bump the head. */ - if ( event != 0 ) { - q->head = event->next; - /* If empty, nullify tail. Link prev pointers (if needed). */ - if ( q->head == 0 ) { - q->tail = 0; - } - } else { - UserNonSelfEventQueueEmptyCallout(); - } - Escher_mutex_unlock( SEMAPHORE_FLAVOR_IQUEUE ); - return event; -} -/* - * Loop on the event queues dispatching events for this thread. - */ -static void * ooa_loop( void * ); -static void * ooa_loop( void * thread ) -{ - /* class dispatch table - */ - static const EventTaker_t * DomainClassDispatcherTable[ 1 ] = - { - stringtest_EventDispatcher - }; - Escher_xtUMLEvent_t * event; - u1_t t = *( (u1_t *) thread ); - /* Start consuming events and dispatching background processes. */ - while ( true == Escher_run_flag ) { - event = DequeueOoaNonSelfEvent(t); /* Instance next. */ - if ( 0 != event ) { - ( *( DomainClassDispatcherTable[ GetEventDestDomainNumber( event ) ] )[ GetEventDestObjectNumber( event ) ] )( event ); - Escher_DeletextUMLEvent( event ); - } else { - Escher_nonbusy_wait( t ); - } - if ( t == 0 ) { /* Is this the default task/thread? */ - UserBackgroundProcessingCallout(); - } - } - return 0; -} - -/* - * Load up the threads with event dispatchers and/or specific functionality. - */ -void Escher_xtUML_run( void ) -{ - void * vp; - u1_t i; - /* Create threads in reverse order saving thread 0 for default. */ - for ( i = NUM_OF_XTUML_CLASS_THREADS - 1; i > 0; i-- ) { - Escher_thread_create( ooa_loop, i ); - } - i = 0; - vp = ooa_loop( (void *) &i ); -} diff --git a/VandMC_testing/mctest/string_return_test/src3/sys_xtuml.h b/VandMC_testing/mctest/string_return_test/src3/sys_xtuml.h deleted file mode 100644 index efc1d0cc8..000000000 --- a/VandMC_testing/mctest/string_return_test/src3/sys_xtuml.h +++ /dev/null @@ -1,128 +0,0 @@ -/*---------------------------------------------------------------------------- - * File: sys_xtuml.h - * - * Description: - * Here we have the system-level instance create and delete declaration. - * your copyright statement can go here (from te_copyright.body) - *--------------------------------------------------------------------------*/ - -#ifndef SYS_XTUML_H -#define SYS_XTUML_H -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This is the most simple and basic container class and - * represents elements in the set (nodes in the list). - */ -typedef struct Escher_SetElement_s Escher_SetElement_s; -struct Escher_SetElement_s { - Escher_SetElement_s * next; - void * object; -}; - -/* - * This is the set class and may contain attributes that apply - * to the set as a whole. - */ -typedef struct { - Escher_SetElement_s * head; -} Escher_ObjectSet_s; - -/* - * Notice the symmetry between the object containoid, the - * head of set structure and the set node containoid. - */ -typedef struct { - Escher_SetElement_s * next; -} Escher_Object_s; - -/* - * Here is the shape of the general class extent. This array contains list - * heads for both active (animate) and inactive (inanimate) instances. - */ -typedef struct { - Escher_ObjectSet_s active, inactive; - Escher_SetElement_s* container; - Escher_iHandle_t pool; - Escher_ClassSize_t size; - Escher_StateNumber_t initial_state; - Escher_InstanceIndex_t population; -} Escher_Extent_t; - -void Escher_SetFactoryInit( const i_t ); -void Escher_CopySet( Escher_ObjectSet_s *, - Escher_ObjectSet_s * const ); -void Escher_ClearSet( Escher_ObjectSet_s * ); -void Escher_SetInsertElement( Escher_ObjectSet_s *, - void * const ); -Escher_SetElement_s * -Escher_SetInsertBlock( Escher_SetElement_s *, - const u1_t *, - const Escher_size_t, - Escher_size_t ); -#define Escher_SetRemoveInstance( pextent, instance, slot, container, pool ) \ - slot = Escher_SetRemoveNode( pextent, instance ) -#define Escher_SetInsertInstance( pextent, node ) \ - node->next = (pextent)->head; \ - (pextent)->head = node - - -Escher_SetElement_s * -Escher_SetRemoveNode( Escher_ObjectSet_s *, - const void * const ); -void Escher_SetRemoveElement( Escher_ObjectSet_s *, - const void * const ); -const void * Escher_SetContains( const Escher_ObjectSet_s * const, - const void * const ); -Escher_size_t Escher_SetCardinality( const Escher_ObjectSet_s * const ); -bool Escher_SetEquality( Escher_ObjectSet_s * const, - Escher_ObjectSet_s * const ); -#define Escher_InitSet( S ) (S)->head = 0 -#define Escher_SetGetAny( S ) ( ((S)->head != 0) ? (S)->head->object : 0 ) -#define Escher_SetIsEmpty( S ) ( (S)->head == 0 ) - -/* - * Collection Iteration - * The iterator uses a cursor external to the set (or extent). - * This cursor maintains a flavor of current element. - */ -typedef struct Escher_Iterator_s Escher_Iterator_s; -struct Escher_Iterator_s { - Escher_SetElement_s * cursor; -}; -#define Escher_IteratorReset( I, S ) ( ((I)->cursor = (S)->head) ) -void * Escher_IteratorNext( Escher_Iterator_s * const ); - -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied strlen. */ -Escher_size_t Escher_strlen( const c_t * ); - -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied memset. */ -void Escher_memset( void * const, const u1_t, Escher_size_t ); - -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied memmove. */ -void Escher_memmove( void * const, const void * const, Escher_size_t ); -c_t * Escher_strcpy( c_t *, const c_t * ); -c_t * Escher_stradd( const c_t *, const c_t * ); -/* We could easily replace this function declaration with a macro - that invoked the compiler (C library) supplied strcmp. */ -c_t Escher_strcmp( const c_t *, const c_t * ); -c_t * Escher_strget( void ); - -Escher_iHandle_t Escher_CreateInstance( const Escher_DomainNumber_t, const Escher_ClassNumber_t ); -void Escher_DeleteInstance( Escher_iHandle_t, const Escher_DomainNumber_t, const Escher_ClassNumber_t ); -/* - * Initialize object factory services. - * Initialize class instance storage free pool (inanimate list) - * by linking the empty instances into a collection. - */ -void Escher_ClassFactoryInit( const Escher_DomainNumber_t, const Escher_ClassNumber_t ); - -#ifdef __cplusplus -} -#endif -#endif /* SYS_XTUML_H */