• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

Revisiond9b4832da639a1d0560cec33fdf6a8476440d9da (tree)
Time2023-11-21 05:28:20
AuthorAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

Is it a hack? Should it be in RenderNS (ToDo), or ... -- Found a solution to render Slowstart_1 correctly

Change Summary

Incremental Difference

diff -r c6035731b985 -r d9b4832da639 DocParts/Design/01.Architecture/AIGR_Transformers.puml
--- a/DocParts/Design/01.Architecture/AIGR_Transformers.puml Fri Nov 17 15:03:42 2023 +0100
+++ b/DocParts/Design/01.Architecture/AIGR_Transformers.puml Mon Nov 20 21:28:20 2023 +0100
@@ -6,8 +6,8 @@
66
77 ''NOTE: Old RTD/plantuml.1.2020.2.jar syntax!
88
9-'!procedure $comp($name)
10-!function $comp($name)
9+!procedure $comp($name)
10+''!function $comp($name)
1111 !$in = $name + "in"
1212 !$out = $name + "out"
1313
@@ -17,8 +17,8 @@
1717
1818 $in )-- $name
1919 $name --( $out
20-'!endprocedure
21-!endfunction
20+!endprocedure
21+''!endfunction
2222
2323
2424 frame "CCastle Compiler" as CCC #c0c0c0 {
diff -r c6035731b985 -r d9b4832da639 DocParts/Design/50.notes/231117_namespace.rst
--- a/DocParts/Design/50.notes/231117_namespace.rst Fri Nov 17 15:03:42 2023 +0100
+++ b/DocParts/Design/50.notes/231117_namespace.rst Mon Nov 20 21:28:20 2023 +0100
@@ -1,32 +1,30 @@
11 AIGR/SIEVE Namespace analyse
22 ============================
33
4-.. UML::
4+.. uml::
55
66 @startuml
77 skin rose
8- skinparam style strictuml
9-
8+ 'skinparam style strictuml
109 skinparam sequenceMessageAlign left
1110
12-
1311 actor Dev
14-
12+ entity T_Protocol
13+ boundary "CastleMacros.jinja2" as m
1514
1615 !procedure $register($ns, $n, $details=0)
1716 Dev -> $ns : register($n)
18- $ns o--\o $n : ""$ns._dict[$n]=$n""
17+ $ns o--\o $n : ""$ns._dict[$n] := $n""
1918 activate $ns
2019
2120 !if $details
2221 group details
2322 $ns -> $ns : _register_2ways()
2423 $ns-> $n : register_in_NS()
25- $n o--\o $ns :""$n._ns=$ns""
2624 end
25+ $n o--\o $ns :""$n._ns := $ns""
2726 !else
28- $ns-> $n : register_in_NS()
29- $n o--\o $ns :""$n._ns=$ns""
27+ $n o--\o $ns :""$n._ns := $ns""
3028 !endif
3129 deactivate $ns
3230 !endprocedure
@@ -34,13 +32,73 @@
3432
3533 participant "simple_sieve :NS" as simple_sieve #LightSkyBlue
3634 participant "slow_start :NS" as slow_start #LightSkyBlue
35+ participant "SimpleSieve:P" as SimpleSieve
3736 participant "SlowStart_1:P" as SlowStart_1
38- participant "SimpleSieve:P" as SimpleSieve
3937 participant "SlowStart:P" as SlowStart
4038
39+ == TestDoubles/AIGR/sieve/namespaces.py ==
40+
41+ $register(simple_sieve, slow_start,1)
42+ alt "old AIGR"
43+ $register(simple_sieve, SlowStart_1)
44+ else "deleted 'simple_sieve.register(protocols.SlowStart_1)'"
45+ note over simple_sieve, SlowStart1 #aqua: Is it a hack? Should it be in RenderNS (ToDo), or ...
46+ end
47+ $register(simple_sieve, SimpleSieve)
48+ $register(slow_start, SlowStart)
49+
50+ == pytst/writers/RPy/test_3_SieveProtocols.py==
51+
4152
53+ [-> T_Protocol: render((sieve.SlowStart_1, sieve.SimpleSieve))
54+ note left: ""inherit_from={{proto.based_on.ns.name}}.{{m.ProtocolName(proto.based_on)}}""
4255
43- $register(simple_sieve, slow_start,1)
44- $register(simple_sieve, SlowStart_1)
45- $register(simple_sieve, SimpleSieve)
56+ ... sieve.SlowStart_1 ...
57+ T_Protocol -> SlowStart_1: based_on()
58+ SlowStart_1 o/--x SlowStart: "".based_on""
59+ T_Protocol <-- SlowStart_1: SlowStart
60+
61+ T_Protocol -> SlowStart: ns()
62+ T_Protocol <-- SlowStart: slow_start
63+
64+ opt "obj 2 str"
65+ T_Protocol -> slow_start :name
66+ T_Protocol <-- slow_start : "slow_start"
67+ end
68+
69+ T_Protocol -> m: ProtocolName(SlowStart)
70+ T_Protocol <--m: ""cc_P_Slowstart""
71+ note right: cc_P_{{Proto.name}}
72+ note left of T_Protocol: inherit_from=slow_start.cc_P_SlowStart
73+
74+ ... sieve.SimpleSieve ...
75+ T_Protocol -> SimpleSieve: based_on()
76+ SimpleSieve o/--x SlowStart_1: "".based_on""
77+ T_Protocol <-- SimpleSieve: SlowStart_1
78+
79+ T_Protocol -> SlowStart_1: ns()
80+ alt "old AIGR"
81+ T_Protocol <-- SlowStart_1: simple_sieve
82+ note left: Note: ‘simple_sieve’ is (also) is the current namespace\n\tSo, it should be named
83+
84+ opt "obj 2 str"
85+ T_Protocol -> simple_sieve : name
86+ T_Protocol <-- simple_sieve : "<color:red>simple_sieve</color>"
87+ end
88+
89+ T_Protocol -> m: ProtocolName(SimpleSieve)
90+ T_Protocol <--m: ""cc_P_SimpleSieve""
91+ note right: cc_P_{{Proto.name}}
92+
93+ note left of T_Protocol #orangered: <color:yellow>inherit_from=<color:white>simple_sieve.<color:yellow>cc_P_SimpleSieve
94+ else "deteled 'simple_sieve.register(protocols.SlowStart_1)'"
95+ T_Protocol <-- SlowStart_1: <NIL>
96+
97+ T_Protocol -> m: ProtocolName(SimpleSieve)
98+ T_Protocol <--m: ""cc_P_SimpleSieve""
99+
100+ note left of T_Protocol #lime: <color:white>inherit_from=cc_P_SimpleSieve</color>
101+ end
102+
46103 @enduml
104+
diff -r c6035731b985 -r d9b4832da639 TestDoubles/AIGR/sieve/namespaces.py
--- a/TestDoubles/AIGR/sieve/namespaces.py Fri Nov 17 15:03:42 2023 +0100
+++ b/TestDoubles/AIGR/sieve/namespaces.py Mon Nov 20 21:28:20 2023 +0100
@@ -14,7 +14,7 @@
1414 start_sieve.register(protocols.StartSieve)
1515 slow_start.register(protocols.SlowStart)
1616 simple_sieve.register(slow_start) # Import/use, to be able to refer slow_start.SlowStart
17-simple_sieve.register(protocols.SlowStart_1)
17+#simple_sieve.register(protocols.SlowStart_1)
1818 simple_sieve.register(protocols.SimpleSieve)
1919
2020
diff -r c6035731b985 -r d9b4832da639 TestDoubles/reference/protocols/simple_sieve.rpy
--- a/TestDoubles/reference/protocols/simple_sieve.rpy Fri Nov 17 15:03:42 2023 +0100
+++ b/TestDoubles/reference/protocols/simple_sieve.rpy Mon Nov 20 21:28:20 2023 +0100
@@ -8,8 +8,6 @@
88 #Put the Castle/generated imports here
99 from CC import base
1010 from CC import slow_start
11-from CC import base #XXX# twice is not needed, but allowed
12-from CC import slow_start #XXX# twice is not needed, but allowed
1311
1412
1513
diff -r c6035731b985 -r d9b4832da639 castle/writers/RPy/templates/macros/CastleMacros.jinja2
--- a/castle/writers/RPy/templates/macros/CastleMacros.jinja2 Fri Nov 17 15:03:42 2023 +0100
+++ b/castle/writers/RPy/templates/macros/CastleMacros.jinja2 Mon Nov 20 21:28:20 2023 +0100
@@ -3,7 +3,7 @@
33 {# See:: http://docideas.mietus.nl/en/default/CCastle/3.Design/B.Workshop/rPY/8.RPY_Jinja.html #}
44
55
6-{%macro ProtocolName(Proto) -%} cc_P_{{Proto.name}} {%- endmacro %}
6+{%macro ProtocolName(Proto) -%} cc_P_{{Proto.name}} {%- endmacro %}
77 {%macro EventIndexName(Proto, Event) -%} CC_P_{{Proto.name}}_{{Event.name}} {%- endmacro %}
88 {%macro comp_interface_Name(Comp) -%} cc_CI_{{Comp.name}} {%- endmacro %}
99 {%macro comp_component_Name(Comp) -%} CC_{{Comp.name}} {%- endmacro %}
diff -r c6035731b985 -r d9b4832da639 castle/writers/RPy/templates/parts/protocol_DataStructures.jinja2
--- a/castle/writers/RPy/templates/parts/protocol_DataStructures.jinja2 Fri Nov 17 15:03:42 2023 +0100
+++ b/castle/writers/RPy/templates/parts/protocol_DataStructures.jinja2 Mon Nov 20 21:28:20 2023 +0100
@@ -13,6 +13,17 @@
1313 {%- endif -%}
1414 {%- endmacro -%}
1515
16+
17+{%- macro DotOrNot(opt_namespace, id) -%}
18+ {%- if opt_namespace|length -%}
19+ {{ opt_namespace }}.{{ id }}
20+ {%- else -%}
21+ {{ id }}
22+ {%- endif -%}
23+{%- endmacro -%}
24+
25+
26+
1627 {%- for proto in protocols %}
1728 ##
1829 ## The protocol Data Definitions for {{proto.name}} -- with {{proto.events|length}} events
@@ -28,7 +39,8 @@
2839
2940 {% endif %}
3041 kind=buildin.{{proto.kind}},
31- inherit_from={{proto.based_on.ns.name}}.{{m.ProtocolName(proto.based_on)}}, #XXX# NSa & NSb
42+ inherit_from=
43+ {{- DotOrNot( proto.based_on.ns.name , m.ProtocolName(proto.based_on) ) -}}, #XXX# NSa & NSb
3244 {#
3345 * NSa: Need cleanup
3446 * NSb: (Prio) Inserts "own" NS, which is wrong
diff -r c6035731b985 -r d9b4832da639 pytst/TD_AIGR/test_2_sieve_NS.py
--- a/pytst/TD_AIGR/test_2_sieve_NS.py Fri Nov 17 15:03:42 2023 +0100
+++ b/pytst/TD_AIGR/test_2_sieve_NS.py Mon Nov 20 21:28:20 2023 +0100
@@ -4,6 +4,7 @@
44 See file:///Users/albert/work/DocIdeas,hg/__result/html/CCastle/HACK/DocParts/Design/231016_NS.html
55 (not published yet -- see .../DocParts/Design/231016_NS.rst for source)"""
66
7+import logging; logger = logging.getLogger(__name__)
78 import pytest
89
910 import castle.aigr as aigr
@@ -32,7 +33,8 @@
3233
3334 def test_simple_sieve_has_SimpleSieve_and_SpecialiseGeneric():
3435 ns = namespaces.simple_sieve
35- verify_NS(ns, "simple_sieve", ["SlowStart_1", "SimpleSieve"])
36+ #verify_NS(ns, "simple_sieve", ["SlowStart_1", "SimpleSieve"])
37+ verify_NS(ns, "simple_sieve", ["SimpleSieve"])
3638
3739
3840 def test_top():
diff -r c6035731b985 -r d9b4832da639 pytst/writers/RPy/test_3_SieveProtocols.py
--- a/pytst/writers/RPy/test_3_SieveProtocols.py Fri Nov 17 15:03:42 2023 +0100
+++ b/pytst/writers/RPy/test_3_SieveProtocols.py Mon Nov 20 21:28:20 2023 +0100
@@ -9,8 +9,8 @@
99 """
1010
1111 import logging; logger = logging.getLogger(__name__)
12+import pytest
1213
13-import pytest
1414 from TestDoubles.AIGR import sieve
1515 from . import TstDoubles, generatedProtocol_verifier
1616 ##Note: T_* are used in **_verifier; but need to be in this scope (or pytest can't find it)
@@ -24,7 +24,6 @@
2424 def test_02_SlowStart(generatedProtocol_verifier):
2525 generatedProtocol_verifier(aigr_mocks=sieve.SlowStart, td=TstDoubles('protocols/slow_start'), strip_remarker=True)
2626
27-@pytest.mark.xfail(reason="ToDo BUSY")
2827 def test_03_SimpleSieve_withGeneric(generatedProtocol_verifier):
2928 """``SimpleSieve`` depend on the instantiated generic ``SlowStart_1``.
3029 They are in the same namespace and (so) need to be rendered in the same file.