Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2
Revisión | 655b2a8b6a00156540ebd742df1efeedb463dd95 (tree) |
---|---|
Tiempo | 2023-10-03 03:48:31 |
Autor | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
ASIS/BUSY: Protocol-with-parms: SlowStart & StartSieve reference(s) added (TDD:Oke)
@@ -29,7 +29,7 @@ | ||
29 | 29 | include Mk/testing.mk |
30 | 30 | include Mk/helpful.mk |
31 | 31 | |
32 | -diff_TestDoubles: | |
32 | +diff_TestDoubles: | |
33 | 33 | diff -w -rs TestDoubles/reference/ TestDoubles/_generated/ |
34 | 34 | |
35 | 35 | missing: missing_visitor missing_serialization |
@@ -15,7 +15,6 @@ | ||
15 | 15 | typedParameters=(TypedParameter(name='queue_max', type=int),), |
16 | 16 | events=[ |
17 | 17 | Event(name='setMax', return_type=None, typedParameters=(TypedParameter(name='queue_max', type=int),))], |
18 | - #parameters | |
19 | 18 | ) |
20 | 19 | |
21 | 20 |
@@ -3,7 +3,6 @@ | ||
3 | 3 | # (C) Albert Mietus, 2023. Part of Castle/CCastle project |
4 | 4 | |
5 | 5 | #### |
6 | - | |
7 | 6 | from CC import buildin |
8 | 7 | from CC import base |
9 | 8 |
@@ -18,14 +17,15 @@ | ||
18 | 17 | CC_P_SlowStart_setMax = 0 |
19 | 18 | |
20 | 19 | |
21 | - | |
20 | +cc_P_SlowStart = buildin.CC_B_Protocol(name="SlowStart", | |
21 | + parameters=( | |
22 | + ('queue_max', int), | |
23 | + ), | |
24 | + kind=buildin.ProtocolKind.Event, | |
25 | + inherit_from=cc_P_Protocol, | |
26 | + events=[]) | |
22 | 27 | |
23 | -cc_P_SlowStart = buildin.CC_B_Protocol(name = "SlowStart", | |
24 | - parameters = [('queue_max', int)], | |
25 | - kind = buildin.ProtocolKind.Event, | |
26 | - inherit_from=cc_P_Protocol | |
27 | - events = []) | |
28 | -cc_P_SlowStart.events.append( buildin.CC_B_P_EventID(name="setMax", | |
29 | - seqNo=CC_P_SlowStart_setMax | |
30 | - parameters = [('queue_max', int)], | |
31 | - part_of=cc_P_SlowStart)) | |
28 | +cc_P_SlowStart.events.append(buildin.CC_B_P_EventID(name="setMax", | |
29 | + seqNo=CC_P_SlowStart_setMax, | |
30 | + part_of=cc_P_SlowStart)) | |
31 | + |
@@ -19,15 +19,14 @@ | ||
19 | 19 | |
20 | 20 | |
21 | 21 | cc_P_StartSieve = buildin.CC_B_Protocol(name="StartSieve", |
22 | - kind=buildin.ProtocolKind.Event, | |
23 | - inherit_from=cc_P_Protocol | |
24 | - events = []) | |
22 | + kind=buildin.ProtocolKind.Event, | |
23 | + inherit_from=cc_P_Protocol, | |
24 | + events=[]) | |
25 | + | |
25 | 26 | cc_P_StartSieve.events.append(buildin.CC_B_P_EventID(name="runTo", |
26 | - seqNo=CC_P_StartSieve_runTo, | |
27 | - part_of=cc_P_StartSieve )) | |
27 | + seqNo=CC_P_StartSieve_runTo, | |
28 | + part_of=cc_P_StartSieve)) | |
28 | 29 | cc_P_StartSieve.events.append(buildin.CC_B_P_EventID(name="newMax", |
29 | - seqNo=CC_P_StartSieve_newMax, | |
30 | - part_of=cc_P_StartSieve )) | |
30 | + seqNo=CC_P_StartSieve_newMax, | |
31 | + part_of=cc_P_StartSieve)) | |
31 | 32 | |
32 | - | |
33 | - |
@@ -18,21 +18,19 @@ | ||
18 | 18 | {% if proto.typedParameters %} |
19 | 19 | parameters=( |
20 | 20 | {% for parm in proto.typedParameters %} |
21 | - ('{{ parm.name}}' , {{ Str_or_Type(parm.type) }}), | |
21 | + ('{{ parm.name}}', {{ Str_or_Type(parm.type) }}), | |
22 | 22 | {% endfor %} |
23 | - ), ### XXX ToDo: parms: tuple, namedType, strings, ... (see event -- use macro?) | |
23 | + ), {#- XXX ToDo: parms: tuple, namedType, strings, ... (see event -- use macro?) #} | |
24 | + | |
24 | 25 | {% endif %} |
25 | - kind=buildin.{{proto.kind}}, | |
26 | - inherit_from={{m.ProtocolName(proto.based_on.name)}} | |
27 | - events = []) {#- filled in below -- see design notes // limitation #} | |
26 | + kind=buildin.{{proto.kind}}, | |
27 | + inherit_from={{m.ProtocolName(proto.based_on.name)}}, | |
28 | + events=[]) | |
28 | 29 | |
29 | 30 | {% for e in proto.events %} |
30 | 31 | {{- m.ProtocolName(proto.name) }}.events.append(buildin.CC_B_P_EventID(name="{{- e.name -}}", |
31 | - seqNo={{- m.EventIndexName(proto.name, e.name) }}, | |
32 | - part_of={{ m.ProtocolName(proto.name) }} )) | |
32 | + seqNo={{- m.EventIndexName(proto.name, e.name) }}, | |
33 | + part_of={{ m.ProtocolName(proto.name) }})) | |
33 | 34 | {% endfor %} {#- event #} |
34 | 35 | |
35 | -{% endfor %} {# protocols #} | |
36 | - | |
37 | - | |
38 | - | |
36 | +{% endfor %} {#- protocols #} |
@@ -24,7 +24,7 @@ | ||
24 | 24 | assert filecmp.cmp(gen_file, ref_file), f"The generated file ({gen_file}) and the reference ({ref_file}) are not the same" |
25 | 25 | |
26 | 26 | |
27 | -@pytest.mark.skip("Need to test AIGR.protocols:: parameters first (and writer for it to)") | |
27 | +#@pytest.mark.skip("Need to test AIGR.protocols:: parameters first (and writer for it to)") | |
28 | 28 | def test_03_SlowStart(T_Protocol): |
29 | 29 | ref_file = 'TestDoubles/reference/protocols/SlowStart.rpy' |
30 | 30 | gen_file = 'Testdoubles/_generated/protocols/SlowStart.rpy' |