tecscde 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rubocop.yml +125 -0
  4. data/.rubocop_todo.yml +188 -0
  5. data/CHANGELOG.md +3 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE +46 -0
  8. data/LICENSE.ja +32 -0
  9. data/README.ja.md +200 -0
  10. data/README.md +35 -0
  11. data/Rakefile +27 -0
  12. data/bin/tecscde +64 -0
  13. data/glade/tecscde-cell-property.glade +205 -0
  14. data/glade/tecscde-celltype-property.glade +172 -0
  15. data/glade/tecscde-celltype.glade +414 -0
  16. data/glade/tecscde-export.glade +161 -0
  17. data/glade/test-cell-plugin.rb +51 -0
  18. data/glade/test-cell-property.rb +35 -0
  19. data/glade/test-export.rb +35 -0
  20. data/glade/test-palette.rb +26 -0
  21. data/lib/tcflow.rb +148 -0
  22. data/lib/tecscde.rb +65 -0
  23. data/lib/tecscde/NewCell.png +0 -0
  24. data/lib/tecscde/SelectArrow.png +0 -0
  25. data/lib/tecscde/attr_tree_view.rb +253 -0
  26. data/lib/tecscde/cell_plugin_dialog.glade +294 -0
  27. data/lib/tecscde/cell_plugin_dialog.rb +89 -0
  28. data/lib/tecscde/celltype_tree_view.rb +105 -0
  29. data/lib/tecscde/change_set_control.rb +35 -0
  30. data/lib/tecscde/change_set_control/change_set.rb +32 -0
  31. data/lib/tecscde/change_set_control/change_set_manager.rb +62 -0
  32. data/lib/tecscde/command.rb +35 -0
  33. data/lib/tecscde/control.rb +491 -0
  34. data/lib/tecscde/highlighted_objects.rb +180 -0
  35. data/lib/tecscde/logger.rb +74 -0
  36. data/lib/tecscde/main_view_and_model.rb +80 -0
  37. data/lib/tecscde/palette.glade +553 -0
  38. data/lib/tecscde/palette.rb +174 -0
  39. data/lib/tecscde/preferences.glade +117 -0
  40. data/lib/tecscde/preferences.rb +44 -0
  41. data/lib/tecscde/tecs_model.rb +1137 -0
  42. data/lib/tecscde/tecs_model/hbar.rb +68 -0
  43. data/lib/tecscde/tecs_model/tm_c_port.rb +122 -0
  44. data/lib/tecscde/tecs_model/tm_c_port_array.rb +98 -0
  45. data/lib/tecscde/tecs_model/tm_cell.rb +496 -0
  46. data/lib/tecscde/tecs_model/tm_e_port.rb +126 -0
  47. data/lib/tecscde/tecs_model/tm_e_port_array.rb +78 -0
  48. data/lib/tecscde/tecs_model/tm_join.rb +293 -0
  49. data/lib/tecscde/tecs_model/tm_join_bar.rb +146 -0
  50. data/lib/tecscde/tecs_model/tm_port.rb +238 -0
  51. data/lib/tecscde/tecs_model/tm_port_array.rb +246 -0
  52. data/lib/tecscde/tecs_model/tm_region.rb +107 -0
  53. data/lib/tecscde/tecs_model/tm_uneditable.rb +68 -0
  54. data/lib/tecscde/tecs_model/vbar.rb +68 -0
  55. data/lib/tecscde/templates/_cell_info.cde.erb +15 -0
  56. data/lib/tecscde/templates/_join_info.cde.erb +28 -0
  57. data/lib/tecscde/templates/main.cde.erb +49 -0
  58. data/lib/tecscde/tm_object.rb +91 -0
  59. data/lib/tecscde/version.rb +4 -0
  60. data/lib/tecscde/view.rb +58 -0
  61. data/lib/tecscde/view/cairo_matrix.rb +90 -0
  62. data/lib/tecscde/view/canvas.rb +59 -0
  63. data/lib/tecscde/view/constants.rb +114 -0
  64. data/lib/tecscde/view/main_view.rb +1245 -0
  65. data/lib/tecsflow.rb +475 -0
  66. data/lib/tecsflow/C_parser.tab.rb +2471 -0
  67. data/lib/tecsflow/C_parser.y.rb +1087 -0
  68. data/lib/tecsflow/classes.rb +421 -0
  69. data/lib/tecsgen.rb +581 -0
  70. data/lib/tecsgen/core/C_parser.tab.rb +2477 -0
  71. data/lib/tecsgen/core/C_parser.y +1032 -0
  72. data/lib/tecsgen/core/bnf-deb.tab.rb +5193 -0
  73. data/lib/tecsgen/core/bnf.tab.rb +5193 -0
  74. data/lib/tecsgen/core/bnf.y +2211 -0
  75. data/lib/tecsgen/core/componentobj.rb +7901 -0
  76. data/lib/tecsgen/core/ctypes.rb +226 -0
  77. data/lib/tecsgen/core/expression.rb +1031 -0
  78. data/lib/tecsgen/core/gen_xml.rb +374 -0
  79. data/lib/tecsgen/core/generate.rb +5206 -0
  80. data/lib/tecsgen/core/location.rb +116 -0
  81. data/lib/tecsgen/core/messages.rb +101 -0
  82. data/lib/tecsgen/core/optimize.rb +456 -0
  83. data/lib/tecsgen/core/plugin.rb +332 -0
  84. data/lib/tecsgen/core/pluginModule.rb +165 -0
  85. data/lib/tecsgen/core/syntaxobj.rb +1234 -0
  86. data/lib/tecsgen/core/tecs_lang.rb +306 -0
  87. data/lib/tecsgen/core/tecsgen.rb +453 -0
  88. data/lib/tecsgen/core/tecsinfo.rb +860 -0
  89. data/lib/tecsgen/core/tool_info.rb +258 -0
  90. data/lib/tecsgen/core/types.rb +1632 -0
  91. data/lib/tecsgen/core/unjoin_plugin.rb +218 -0
  92. data/lib/tecsgen/core/value.rb +650 -0
  93. data/lib/tecsgen/messages/messages_console_en_US.rb +1171 -0
  94. data/lib/tecsgen/messages/messages_console_ja_JP.rb +1171 -0
  95. data/lib/tecsgen/messages/messages_file_en_US.rb +334 -0
  96. data/lib/tecsgen/messages/messages_file_ja_JP.rb +163 -0
  97. data/lib/tecsgen/plugin/ATK1AlarmPlugin.rb +196 -0
  98. data/lib/tecsgen/plugin/ATK1DelayTaskPlugin.rb +106 -0
  99. data/lib/tecsgen/plugin/ATK1EventPlugin.rb +147 -0
  100. data/lib/tecsgen/plugin/ATK1ISRPlugin.rb +174 -0
  101. data/lib/tecsgen/plugin/ATK1KernelPlugin.rb +287 -0
  102. data/lib/tecsgen/plugin/ATK1ResourcePlugin.rb +124 -0
  103. data/lib/tecsgen/plugin/ATK1TaskPlugin.rb +220 -0
  104. data/lib/tecsgen/plugin/C2TECSBridgePlugin.rb +210 -0
  105. data/lib/tecsgen/plugin/CellPlugin.rb +61 -0
  106. data/lib/tecsgen/plugin/CelltypePlugin.rb +72 -0
  107. data/lib/tecsgen/plugin/CompositePlugin.rb +66 -0
  108. data/lib/tecsgen/plugin/DomainPlugin.rb +89 -0
  109. data/lib/tecsgen/plugin/HRP2AlarmHandlerPlugin.rb +76 -0
  110. data/lib/tecsgen/plugin/HRP2Cache.rb +1 -0
  111. data/lib/tecsgen/plugin/HRP2CyclicHandlerPlugin.rb +75 -0
  112. data/lib/tecsgen/plugin/HRP2DataqueuePlugin.rb +68 -0
  113. data/lib/tecsgen/plugin/HRP2EventflagPlugin.rb +68 -0
  114. data/lib/tecsgen/plugin/HRP2FixedSizeMemoryPoolPlugin.rb +68 -0
  115. data/lib/tecsgen/plugin/HRP2HandlerPlugin.rb +117 -0
  116. data/lib/tecsgen/plugin/HRP2KernelObjectPlugin.rb +372 -0
  117. data/lib/tecsgen/plugin/HRP2ObjectPlugin.rb +94 -0
  118. data/lib/tecsgen/plugin/HRP2Plugin.rb +140 -0
  119. data/lib/tecsgen/plugin/HRP2PostHook.rb +111 -0
  120. data/lib/tecsgen/plugin/HRP2PriorityDataqueuePlugin.rb +66 -0
  121. data/lib/tecsgen/plugin/HRP2RPCPlugin.rb +319 -0
  122. data/lib/tecsgen/plugin/HRP2SVCPlugin.rb +473 -0
  123. data/lib/tecsgen/plugin/HRP2SemaphorePlugin.rb +67 -0
  124. data/lib/tecsgen/plugin/HRP2TaskPlugin.rb +200 -0
  125. data/lib/tecsgen/plugin/HRPHandlerPlugin.rb +125 -0
  126. data/lib/tecsgen/plugin/HRPKernelObjectManager.rb +72 -0
  127. data/lib/tecsgen/plugin/HRPKernelObjectPlugin.rb +333 -0
  128. data/lib/tecsgen/plugin/HRPObjectPlugin.rb +93 -0
  129. data/lib/tecsgen/plugin/HRPPlugin.rb +356 -0
  130. data/lib/tecsgen/plugin/HRPRPCPlugin.rb +407 -0
  131. data/lib/tecsgen/plugin/HRPSVCPlugin.rb +859 -0
  132. data/lib/tecsgen/plugin/HRPTaskPlugin.rb +107 -0
  133. data/lib/tecsgen/plugin/Mruby2CBridgePlugin.rb +86 -0
  134. data/lib/tecsgen/plugin/MrubyBridgeCellPlugin.rb +264 -0
  135. data/lib/tecsgen/plugin/MrubyBridgeCelltypePlugin.rb +293 -0
  136. data/lib/tecsgen/plugin/MrubyBridgeCompositePlugin.rb +49 -0
  137. data/lib/tecsgen/plugin/MrubyBridgePlugin.rb +67 -0
  138. data/lib/tecsgen/plugin/MrubyBridgeSignaturePlugin.rb +1307 -0
  139. data/lib/tecsgen/plugin/MrubyInfoBridgePlugin.rb +14 -0
  140. data/lib/tecsgen/plugin/MrubyInfoBridgeSignaturePlugin.rb +994 -0
  141. data/lib/tecsgen/plugin/MultiPlugin.rb +57 -0
  142. data/lib/tecsgen/plugin/NotifierPlugin.rb +1217 -0
  143. data/lib/tecsgen/plugin/OpaqueMarshalerPlugin.rb +81 -0
  144. data/lib/tecsgen/plugin/OpaqueRPCPlugin.rb +323 -0
  145. data/lib/tecsgen/plugin/RPCPlugin.rb +266 -0
  146. data/lib/tecsgen/plugin/RepeatCellPlugin.rb +166 -0
  147. data/lib/tecsgen/plugin/RepeatJoinPlugin.rb +130 -0
  148. data/lib/tecsgen/plugin/SharedOpaqueRPCPlugin.rb +357 -0
  149. data/lib/tecsgen/plugin/SharedRPCPlugin.rb +329 -0
  150. data/lib/tecsgen/plugin/SignaturePlugin.rb +77 -0
  151. data/lib/tecsgen/plugin/TECS2CBridgePlugin.rb +178 -0
  152. data/lib/tecsgen/plugin/TECSInfoPlugin.rb +280 -0
  153. data/lib/tecsgen/plugin/ThroughPlugin.rb +333 -0
  154. data/lib/tecsgen/plugin/TracePlugin.rb +484 -0
  155. data/lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb +761 -0
  156. data/lib/tecsgen/plugin/lib/GenOpaqueMarshaler.rb +1107 -0
  157. data/lib/tecsgen/plugin/lib/GenParamCopy.rb +365 -0
  158. data/lib/tecsgen/plugin/lib/GenTransparentMarshaler.rb +683 -0
  159. data/lib/tecsgen/plugin/lib/MrubyBridgeCelltypePluginModule.rb +283 -0
  160. data/lib/tecsgen/plugin/lib/MrubyBridgeSignaturePluginModule.rb +277 -0
  161. data/lib/tecsgen/version.rb +6 -0
  162. data/samples/FigureSamples/active/active.cde +104 -0
  163. data/samples/FigureSamples/active/active.cdl +20 -0
  164. data/samples/FigureSamples/active/active.pdf +0 -0
  165. data/samples/FigureSamples/active/active.png +0 -0
  166. data/samples/FigureSamples/active/gen/tmp_C_src.c +36 -0
  167. data/samples/FigureSamples/active/gen/tmp_cygwin_tecs.h +1908 -0
  168. data/samples/FigureSamples/active/gen/tmp_plugin_post_code.cdl +0 -0
  169. data/samples/FigureSamples/allocator/allocator-internal.png +0 -0
  170. data/samples/FigureSamples/allocator/allocator.cde +171 -0
  171. data/samples/FigureSamples/allocator/allocator.cdl +58 -0
  172. data/samples/FigureSamples/allocator/allocator.png +0 -0
  173. data/samples/FigureSamples/basic/Makefile +87 -0
  174. data/samples/FigureSamples/basic/SimpleSample-trace.cdl +50 -0
  175. data/samples/FigureSamples/basic/SimpleSample.cde +91 -0
  176. data/samples/FigureSamples/basic/SimpleSample.cdl +47 -0
  177. data/samples/FigureSamples/basic/basic.cde +93 -0
  178. data/samples/FigureSamples/basic/basic.cdl +46 -0
  179. data/samples/FigureSamples/basic/basic.png +0 -0
  180. data/samples/FigureSamples/callback/callback.cde +130 -0
  181. data/samples/FigureSamples/callback/callback.cdl +29 -0
  182. data/samples/FigureSamples/callback/callback.png +0 -0
  183. data/samples/FigureSamples/carray/carray.cde +144 -0
  184. data/samples/FigureSamples/carray/carray.cdl +38 -0
  185. data/samples/FigureSamples/carray/carray.png +0 -0
  186. data/samples/FigureSamples/cearray/cearray.cde +314 -0
  187. data/samples/FigureSamples/cearray/cearray.cdl +60 -0
  188. data/samples/FigureSamples/cearray/cearray.png +0 -0
  189. data/samples/FigureSamples/composite/composite-internal.png +0 -0
  190. data/samples/FigureSamples/composite/composite.cde +216 -0
  191. data/samples/FigureSamples/composite/composite.cdl +95 -0
  192. data/samples/FigureSamples/composite/composite.png +0 -0
  193. data/samples/FigureSamples/earray/earray.cde +142 -0
  194. data/samples/FigureSamples/earray/earray.cdl +38 -0
  195. data/samples/FigureSamples/earray/earray.png +0 -0
  196. data/samples/FigureSamples/join/Makefile +87 -0
  197. data/samples/FigureSamples/join/join.cde +132 -0
  198. data/samples/FigureSamples/join/join.cdl +40 -0
  199. data/samples/FigureSamples/join/join.png +0 -0
  200. data/samples/FigureSamples/relay/Makefile +99 -0
  201. data/samples/FigureSamples/relay/relay-internal.png +0 -0
  202. data/samples/FigureSamples/relay/relay.cde +284 -0
  203. data/samples/FigureSamples/relay/relay.cdl +52 -0
  204. data/samples/FigureSamples/relay/relay.png +0 -0
  205. data/samples/FigureSamples/rpc/Makefile +123 -0
  206. data/samples/FigureSamples/rpc/rpc-expand.png +0 -0
  207. data/samples/FigureSamples/rpc/rpc.cde +245 -0
  208. data/samples/FigureSamples/rpc/rpc.png +0 -0
  209. data/samples/FigureSamples/rpc/rpc_sample.cdl +53 -0
  210. data/samples/SimpleSample/Makefile +25 -0
  211. data/samples/SimpleSample/SimpleSample/Makefile +86 -0
  212. data/samples/SimpleSample/SimpleSample/Makefile-trace +91 -0
  213. data/samples/SimpleSample/SimpleSample/README.txt +106 -0
  214. data/samples/SimpleSample/SimpleSample/SimpleSample-trace.cdl +50 -0
  215. data/samples/SimpleSample/SimpleSample/SimpleSample.cdl +45 -0
  216. data/samples/SimpleSample/SimpleSample/src/tSample.c +77 -0
  217. data/samples/SimpleSample/SimpleSample/src/tSimple.c +48 -0
  218. data/samples/SimpleSample/SimpleSample/src/tecs-types.h +27 -0
  219. data/samples/SimpleSample/SimpleSampleOpaqueRPC/Makefile +51 -0
  220. data/samples/SimpleSample/SimpleSampleOpaqueRPC/Makefile-trace +91 -0
  221. data/samples/SimpleSample/SimpleSampleOpaqueRPC/README.txt +106 -0
  222. data/samples/SimpleSample/SimpleSampleOpaqueRPC/SimpleSample-trace.cdl +80 -0
  223. data/samples/SimpleSample/SimpleSampleOpaqueRPC/SimpleSample.cdl +77 -0
  224. data/samples/SimpleSample/SimpleSampleOpaqueRPC/rSample/Makefile +112 -0
  225. data/samples/SimpleSample/SimpleSampleOpaqueRPC/rSimple/Makefile +109 -0
  226. data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tSample.c +80 -0
  227. data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tSimple.c +47 -0
  228. data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tTaskMain.c +66 -0
  229. data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tecs-types.h +27 -0
  230. data/samples/SimpleSample/SimpleSampleTransparentRPC/Makefile +125 -0
  231. data/samples/SimpleSample/SimpleSampleTransparentRPC/Makefile-trace +130 -0
  232. data/samples/SimpleSample/SimpleSampleTransparentRPC/SimpleSample-trace.cdl +54 -0
  233. data/samples/SimpleSample/SimpleSampleTransparentRPC/SimpleSample.cdl +53 -0
  234. data/samples/SimpleSample/SimpleSampleTransparentRPC/src/tSample.c +80 -0
  235. data/samples/SimpleSample/SimpleSampleTransparentRPC/src/tSimple.c +54 -0
  236. data/tecscde.gemspec +41 -0
  237. metadata +353 -0
@@ -0,0 +1,68 @@
1
+ #
2
+ # TECSCDE - TECS Component Diagram Editor
3
+ #
4
+ # Copyright (C) 2014-2019 by TOPPERS Project
5
+ #
6
+ # The above copyright holders grant permission gratis to use,
7
+ # duplicate, modify, or redistribute (hereafter called use) this
8
+ # software (including the one made by modifying this software),
9
+ # provided that the following four conditions (1) through (4) are
10
+ # satisfied.
11
+ #
12
+ # (1) When this software is used in the form of source code, the above
13
+ # copyright notice, this use conditions, and the disclaimer shown
14
+ # below must be retained in the source code without modification.
15
+ #
16
+ # (2) When this software is redistributed in the forms usable for the
17
+ # development of other software, such as in library form, the above
18
+ # copyright notice, this use conditions, and the disclaimer shown
19
+ # below must be shown without modification in the document provided
20
+ # with the redistributed software, such as the user manual.
21
+ #
22
+ # (3) When this software is redistributed in the forms unusable for the
23
+ # development of other software, such as the case when the software
24
+ # is embedded in a piece of equipment, either of the following two
25
+ # conditions must be satisfied:
26
+ #
27
+ # (a) The above copyright notice, this use conditions, and the
28
+ # disclaimer shown below must be shown without modification in
29
+ # the document provided with the redistributed software, such as
30
+ # the user manual.
31
+ #
32
+ # (b) How the software is to be redistributed must be reported to the
33
+ # TOPPERS Project according to the procedure described
34
+ # separately.
35
+ #
36
+ # (4) The above copyright holders and the TOPPERS Project are exempt
37
+ # from responsibility for any type of damage directly or indirectly
38
+ # caused from the use of this software and are indemnified by any
39
+ # users or end users of this software from any and all causes of
40
+ # action whatsoever.
41
+ #
42
+ # THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
43
+ # THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
44
+ # INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
45
+ # PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
46
+ # TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
47
+ # INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
48
+ #
49
+
50
+ require "tecscde/tecs_model/tm_join_bar"
51
+
52
+ module TECSCDE
53
+ class TECSModel
54
+ class HBar < TECSCDE::TECSModel::TmJoinBar
55
+ def horizontal?
56
+ true
57
+ end
58
+
59
+ def vertical?
60
+ false
61
+ end
62
+
63
+ def type
64
+ "HBar"
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,122 @@
1
+ #
2
+ # TECSCDE - TECS Component Diagram Editor
3
+ #
4
+ # Copyright (C) 2014-2019 by TOPPERS Project
5
+ #
6
+ # The above copyright holders grant permission gratis to use,
7
+ # duplicate, modify, or redistribute (hereafter called use) this
8
+ # software (including the one made by modifying this software),
9
+ # provided that the following four conditions (1) through (4) are
10
+ # satisfied.
11
+ #
12
+ # (1) When this software is used in the form of source code, the above
13
+ # copyright notice, this use conditions, and the disclaimer shown
14
+ # below must be retained in the source code without modification.
15
+ #
16
+ # (2) When this software is redistributed in the forms usable for the
17
+ # development of other software, such as in library form, the above
18
+ # copyright notice, this use conditions, and the disclaimer shown
19
+ # below must be shown without modification in the document provided
20
+ # with the redistributed software, such as the user manual.
21
+ #
22
+ # (3) When this software is redistributed in the forms unusable for the
23
+ # development of other software, such as the case when the software
24
+ # is embedded in a piece of equipment, either of the following two
25
+ # conditions must be satisfied:
26
+ #
27
+ # (a) The above copyright notice, this use conditions, and the
28
+ # disclaimer shown below must be shown without modification in
29
+ # the document provided with the redistributed software, such as
30
+ # the user manual.
31
+ #
32
+ # (b) How the software is to be redistributed must be reported to the
33
+ # TOPPERS Project according to the procedure described
34
+ # separately.
35
+ #
36
+ # (4) The above copyright holders and the TOPPERS Project are exempt
37
+ # from responsibility for any type of damage directly or indirectly
38
+ # caused from the use of this software and are indemnified by any
39
+ # users or end users of this software from any and all causes of
40
+ # action whatsoever.
41
+ #
42
+ # THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
43
+ # THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
44
+ # INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
45
+ # PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
46
+ # TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
47
+ # INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
48
+ #
49
+
50
+ require "tecscde/tecs_model/tm_port"
51
+
52
+ module TECSCDE
53
+ class TECSModel
54
+ # mikan cp array
55
+ class TmCPort < TECSCDE::TECSModel::TmPort
56
+ # @join::TmJoin
57
+
58
+ def initialize(owner, port_def, subscript = nil)
59
+ # p "port_def::#{port_def.get_name} #{port_def.class}"
60
+ @port_def = port_def
61
+ @owner = owner
62
+ @join = nil
63
+ @subscript = subscript
64
+ # p "subscript=#{subscript}"
65
+
66
+ @name = "cCport" # temporal
67
+ @edge_side, @offset = get_cell.get_new_cport_position(port_def)
68
+ modified {}
69
+ end
70
+
71
+ def set_join(join)
72
+ modified do
73
+ @join = join
74
+ end
75
+ end
76
+
77
+ def moved(x_inc, y_inc)
78
+ return unless @join
79
+ @join.moved_cport(x_inc, y_inc)
80
+ end
81
+
82
+ def get_join(subscript = nil)
83
+ @join
84
+ end
85
+
86
+ #=== TmCPort#delete
87
+ # this method is called from TmCell
88
+ def delete
89
+ return unless @join
90
+ modified do
91
+ @join.delete
92
+ @join = nil
93
+ end
94
+ end
95
+
96
+ #=== TmCPort#delete_join
97
+ # this method is called from TmJoin
98
+ def delete_join
99
+ modified do
100
+ @join = nil
101
+ end
102
+ end
103
+
104
+ #=== TmCPort#complete?
105
+ def complete?
106
+ @join ? true : false
107
+ end
108
+
109
+ #=== TmCPort#optional?
110
+ def optional?
111
+ @port_def.is_optional?
112
+ end
113
+
114
+ #=== TmCPort#clone_for_undo
115
+ def clone_for_undo
116
+ bu = clone
117
+ bu.copy_from(self)
118
+ bu
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,98 @@
1
+ #
2
+ # TECSCDE - TECS Component Diagram Editor
3
+ #
4
+ # Copyright (C) 2014-2019 by TOPPERS Project
5
+ #
6
+ # The above copyright holders grant permission gratis to use,
7
+ # duplicate, modify, or redistribute (hereafter called use) this
8
+ # software (including the one made by modifying this software),
9
+ # provided that the following four conditions (1) through (4) are
10
+ # satisfied.
11
+ #
12
+ # (1) When this software is used in the form of source code, the above
13
+ # copyright notice, this use conditions, and the disclaimer shown
14
+ # below must be retained in the source code without modification.
15
+ #
16
+ # (2) When this software is redistributed in the forms usable for the
17
+ # development of other software, such as in library form, the above
18
+ # copyright notice, this use conditions, and the disclaimer shown
19
+ # below must be shown without modification in the document provided
20
+ # with the redistributed software, such as the user manual.
21
+ #
22
+ # (3) When this software is redistributed in the forms unusable for the
23
+ # development of other software, such as the case when the software
24
+ # is embedded in a piece of equipment, either of the following two
25
+ # conditions must be satisfied:
26
+ #
27
+ # (a) The above copyright notice, this use conditions, and the
28
+ # disclaimer shown below must be shown without modification in
29
+ # the document provided with the redistributed software, such as
30
+ # the user manual.
31
+ #
32
+ # (b) How the software is to be redistributed must be reported to the
33
+ # TOPPERS Project according to the procedure described
34
+ # separately.
35
+ #
36
+ # (4) The above copyright holders and the TOPPERS Project are exempt
37
+ # from responsibility for any type of damage directly or indirectly
38
+ # caused from the use of this software and are indemnified by any
39
+ # users or end users of this software from any and all causes of
40
+ # action whatsoever.
41
+ #
42
+ # THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
43
+ # THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
44
+ # INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
45
+ # PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
46
+ # TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
47
+ # INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
48
+ #
49
+
50
+ require "tecscde/tecs_model/tm_c_port"
51
+ require "tecscde/tecs_model/tm_port_array"
52
+
53
+ module TECSCDE
54
+ class TECSModel
55
+ class TmCPortArray < TECSCDE::TECSModel::TmPortArray
56
+ def initialize(cell, port_def)
57
+ # p "TmCPortArray port_def:#{port_def}"
58
+ @port_def = port_def
59
+ @owner = cell
60
+ if port_def.get_array_size == "[]"
61
+ @actual_size = 1
62
+ else
63
+ @actual_size = port_def.get_array_size
64
+ end
65
+
66
+ @ports = []
67
+ (0..(@actual_size - 1)).each do |subscript|
68
+ # p "TmCPortArray: length=#{@ports.length} subscript=#{subscript}"
69
+ @ports << TmCPort.new(self, port_def, subscript)
70
+ end
71
+ modified {}
72
+ end
73
+
74
+ def get_join(subscript)
75
+ return nil if subscript.nil?
76
+ if 0 <= subscript && subscript < @actual_size
77
+ @ports[subscript]
78
+ end
79
+ nil
80
+ end
81
+
82
+ #=== TmCPortArray#complete?
83
+ def complete?
84
+ @ports.all?(&:complete?)
85
+ end
86
+
87
+ #=== TmCPortArray#optional?
88
+ def optional?
89
+ @port_def.is_optional?
90
+ end
91
+
92
+ #=== TmCPortArray#new_port
93
+ def new_port(subscript)
94
+ TECSCDE::TECSModel::TmCPort.new(self, @port_def, subscript)
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,496 @@
1
+ #
2
+ # TECSCDE - TECS Component Diagram Editor
3
+ #
4
+ # Copyright (C) 2014-2019 by TOPPERS Project
5
+ #
6
+ # The above copyright holders grant permission gratis to use,
7
+ # duplicate, modify, or redistribute (hereafter called use) this
8
+ # software (including the one made by modifying this software),
9
+ # provided that the following four conditions (1) through (4) are
10
+ # satisfied.
11
+ #
12
+ # (1) When this software is used in the form of source code, the above
13
+ # copyright notice, this use conditions, and the disclaimer shown
14
+ # below must be retained in the source code without modification.
15
+ #
16
+ # (2) When this software is redistributed in the forms usable for the
17
+ # development of other software, such as in library form, the above
18
+ # copyright notice, this use conditions, and the disclaimer shown
19
+ # below must be shown without modification in the document provided
20
+ # with the redistributed software, such as the user manual.
21
+ #
22
+ # (3) When this software is redistributed in the forms unusable for the
23
+ # development of other software, such as the case when the software
24
+ # is embedded in a piece of equipment, either of the following two
25
+ # conditions must be satisfied:
26
+ #
27
+ # (a) The above copyright notice, this use conditions, and the
28
+ # disclaimer shown below must be shown without modification in
29
+ # the document provided with the redistributed software, such as
30
+ # the user manual.
31
+ #
32
+ # (b) How the software is to be redistributed must be reported to the
33
+ # TOPPERS Project according to the procedure described
34
+ # separately.
35
+ #
36
+ # (4) The above copyright holders and the TOPPERS Project are exempt
37
+ # from responsibility for any type of damage directly or indirectly
38
+ # caused from the use of this software and are indemnified by any
39
+ # users or end users of this software from any and all causes of
40
+ # action whatsoever.
41
+ #
42
+ # THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
43
+ # THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
44
+ # INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
45
+ # PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
46
+ # TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
47
+ # INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
48
+ #
49
+
50
+ require "tecscde/tm_object"
51
+ require "tecscde/tecs_model/tm_uneditable"
52
+
53
+ module TECSCDE
54
+ class TECSModel
55
+ class TmCell < ::TECSCDE::TmObject
56
+ # @x::Integer
57
+ # @y::Integer
58
+ # @width::Integer
59
+ # @height::Integer
60
+ # @name::Symbol
61
+ # @cports::{ Symbol => CPORT }
62
+ # @eports::{ Symbol => EPORT }
63
+ # @n_cport::Integer
64
+ # @n_eport::Integer
65
+ # @celltype:: ::Celltype
66
+ # @owner::TmRegion
67
+ # @tecsgen_cell::Cell : not nil if Cell from .cde/.cdl file
68
+ # @attr_list::{Symbol(name)=>Expression}
69
+
70
+ include TECSCDE::TECSModel::TmUneditable
71
+
72
+ attr_reader :cports, :eports
73
+
74
+ def initialize(name, celltype, x, y, region, tecsgen_cell = nil)
75
+ TECSCDE.logger.debug("TmCell.new")
76
+ @name = name
77
+ @celltype = celltype
78
+ @owner = region
79
+ @attr_list = {}
80
+
81
+ @x = x
82
+ @y = y
83
+ @width = 25
84
+ @height = 15
85
+
86
+ @cports = {}
87
+ @eports = {}
88
+ @n_cport = 0
89
+ @n_eport = 0
90
+
91
+ @celltype.get_port_list.each do |port_def|
92
+ # p "celltype:#{@celltype.get_name} port:#{port_def.get_name}"
93
+ if port_def.get_port_type == :ENTRY
94
+ # if ! port_def.is_reverse_required? then
95
+ if port_def.get_array_size.nil?
96
+ @eports[port_def.get_name] = TECSCDE::TECSModel::TmEPort.new(self, port_def)
97
+ else
98
+ @eports[port_def.get_name] = TECSCDE::TECSModel::TmEPortArray.new(self, port_def)
99
+ end
100
+ # end
101
+ else
102
+ unless port_def.is_require?
103
+ if port_def.get_array_size.nil?
104
+ @cports[port_def.get_name] = TECSCDE::TECSModel::TmCPort.new(self, port_def)
105
+ else
106
+ @cports[port_def.get_name] = TECSCDE::TECSModel::TmCPortArray.new(self, port_def)
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+ @tecsgen_cell = tecsgen_cell
113
+ @editable = true
114
+ modified {}
115
+ end
116
+
117
+ #=== TmCell#set_geometry
118
+ def set_geometry(x, y, w, h)
119
+ x_inc = x - @x
120
+ y_inc = y - @y
121
+ x_inc_r = x + w - (@x + @width)
122
+ y_inc_b = y + h - (@y + @height)
123
+
124
+ @cports.each do |_name, cport|
125
+ cport.moved_edge(x_inc, x_inc_r, y_inc, y_inc_b)
126
+ end
127
+ @eports.each do |_name, eport|
128
+ eport.moved_edge(x_inc, x_inc_r, y_inc, y_inc_b)
129
+ end
130
+
131
+ w_min, h_min = get_min_wh
132
+ w = w_min if w < w_min
133
+ h = h_min if h < h_min
134
+
135
+ @x = TECSCDE::TECSModel.round_length_val(x)
136
+ @y = TECSCDE::TECSModel.round_length_val(y)
137
+ @width = TECSCDE::TECSModel.round_length_val(w)
138
+ @height = TECSCDE::TECSModel.round_length_val(h)
139
+ end
140
+
141
+ #=== TmCell#delete ***
142
+ def delete
143
+ return unless editable?
144
+ modified do
145
+ @cports.each do |_name, cport|
146
+ cport.delete
147
+ end
148
+ @eports.each do |_name, eport|
149
+ eport.delete
150
+ end
151
+ @owner.delete_cell(self)
152
+ end
153
+ end
154
+
155
+ #=== TmCell#get_geometry ***
156
+ def get_geometry
157
+ [@x, @y, @width, @height]
158
+ end
159
+
160
+ #=== TmCell#get_name ***
161
+ def get_name
162
+ @name
163
+ end
164
+
165
+ #=== TmCell#change_name ***
166
+ # name::Symbol : new name
167
+ # return::Bool: true if succeed
168
+ # if cell of new_name already exists, results false
169
+ def change_name(name)
170
+ if @owner.rename_cell(self, name)
171
+ modified do
172
+ @name = name
173
+ return true
174
+ end
175
+ else
176
+ false
177
+ end
178
+ end
179
+
180
+ #=== TmCell#get_celltype ***
181
+ def get_celltype
182
+ @celltype
183
+ end
184
+
185
+ #=== TmCell#get_region
186
+ # return::TmRegion
187
+ def get_region
188
+ @owner
189
+ end
190
+
191
+ #=== TmCell#move ***
192
+ def move(x_inc, y_inc)
193
+ modified do
194
+ TECSCDE.logger.debug("cell move #{@name}")
195
+ x0 = @x
196
+ y0 = @y
197
+ @x = model.clip_x(TECSCDE::TECSModel.round_length_val(@x + x_inc))
198
+ @y = model.clip_y(TECSCDE::TECSModel.round_length_val(@y + y_inc))
199
+ x_inc2 = @x - x0
200
+ y_inc2 = @y - y0
201
+
202
+ @cports.each do |_name, cport|
203
+ cport.moved(x_inc2, y_inc2)
204
+ end
205
+ @eports.each do |_name, eport|
206
+ eport.moved(x_inc2, y_inc2)
207
+ end
208
+ end
209
+ end
210
+
211
+ #=== TmCell::near?( x, y ) ***
212
+ def near?(x, y)
213
+ # p "near? @x=#{@x} @width=#{@width} @y=#{@y} @height=#{@height} x=#{x} y=#{y}"
214
+ @x < x && x < @x + @width && @y < y && y < @y + @height
215
+ end
216
+
217
+ #=== TmCell::get_near_port ***
218
+ def get_near_port(x, y)
219
+ @cports.merge(@eports).each do |_name, port|
220
+ if port.is_a?(TECSCDE::TECSModel::TmPort)
221
+ xp, yp = port.get_position
222
+ else
223
+ pt = port.get_near_port(x, y)
224
+ if pt
225
+ return pt
226
+ end
227
+ next
228
+ end
229
+ # p "get_near_port x=#{x} y=#{y} xp=#{xp} yp=#{yp}"
230
+ if ((xp - x).abs < NEAR_DIST) && ((yp - y).abs < NEAR_DIST)
231
+ # p "near port: found"
232
+ return port
233
+ end
234
+ end
235
+ nil
236
+ end
237
+
238
+ #=== TmCell#get_edge_position_in_normal_dir
239
+ def get_edge_position_in_normal_dir(edge_side)
240
+ case edge_side
241
+ when EDGE_TOP
242
+ @y
243
+ when EDGE_BOTTOM
244
+ @y + @height
245
+ when EDGE_LEFT
246
+ @x
247
+ when EDGE_RIGHT
248
+ @x + @width
249
+ end
250
+ end
251
+
252
+ #=== TmCell#get_right_angle_edges_position
253
+ def get_right_angle_edges_position(edge_side)
254
+ if TECSCDE::TECSModel.vertical?(edge_side)
255
+ [@y, @y + @height]
256
+ else
257
+ [@x, @x + @width]
258
+ end
259
+ end
260
+
261
+ #=== TmCell#inc_n_cport
262
+ # total call port count
263
+ def inc_n_cport
264
+ n = @n_cport
265
+ @n_cport += 1
266
+ n
267
+ end
268
+
269
+ #=== TmCell#inc_n_eport
270
+ # total entry port count
271
+ def inc_n_eport
272
+ n = @n_eport
273
+ @n_eport += 1
274
+ n
275
+ end
276
+
277
+ def get_new_cport_position(port_def)
278
+ if $b_tate
279
+ [EDGE_BOTTOM, DIST_PORT * (inc_n_cport + 1)]
280
+ else
281
+ [EDGE_RIGHT, DIST_PORT * (inc_n_cport + 1)]
282
+ end
283
+ end
284
+
285
+ def get_new_eport_position(port_def)
286
+ if $b_tate
287
+ [EDGE_TOP, DIST_PORT * (inc_n_eport + 1)]
288
+ else
289
+ [EDGE_LEFT, DIST_PORT * (inc_n_eport + 1)]
290
+ end
291
+ end
292
+
293
+ # TmCell#adjust_port_position_to_insert
294
+ # port::TmPort : insert after the port
295
+ def adjust_port_position_to_insert(port)
296
+ # p "adjust_port_position_to_insert"
297
+ nearest_port = find_nearest_next_port(port)
298
+ if nearest_port
299
+ dist = (nearest_port.offset - port.offset)
300
+ if dist < (DIST_PORT * 2)
301
+ offs = (DIST_PORT * 2) - dist
302
+ adjust_port_position_after_port(port, offs)
303
+ end
304
+ end
305
+ end
306
+
307
+ # TmCell#find_nearest_next_port
308
+ # this method is part of adjust_port_position_to_insert
309
+ def find_nearest_next_port(port)
310
+ # p "find_nearest_next_port #{port.get_name} #{port.get_subscript}"
311
+ edge_side = port.get_edge_side
312
+ offs = port.offset
313
+ nearest_port = nil
314
+ (@eports.values + @cports.values).each do |_port|
315
+ if _port.is_a?(TECSCDE::TECSModel::TmPortArray)
316
+ _port.ports.each do |pt|
317
+ nearest_port = judge_near(pt, offs, edge_side, nearest_port)
318
+ # p "nearest=#{nearest_port}"
319
+ end
320
+ else
321
+ nearest_port = judge_near(_port, offs, edge_side, nearest_port)
322
+ # p "nearest=#{nearest_port}"
323
+ end
324
+ end
325
+ # p "find_nearest=#{nearest_port}"
326
+ nearest_port
327
+ end
328
+
329
+ #=== TmCell#adjust_port_position_after_port port, offs
330
+ # this method is part of adjust_port_position_to_insert
331
+ def adjust_port_position_after_port(port, move_offs)
332
+ # p "adjust_port_position_after_port"
333
+ edge_side = port.get_edge_side
334
+ offs = port.offset
335
+ proc_adjust = proc do |port, offs, edge_side, move_offs|
336
+ if port.get_edge_side == edge_side
337
+ dist = port.offset - offs
338
+ if dist > 0
339
+ port.move(move_offs, move_offs) # move same value for x, y (only x or y applied in the method)
340
+ end
341
+ end
342
+ end
343
+ (@eports.values + @cports.values).each do |port|
344
+ if port.is_a?(TECSCDE::TECSModel::TmPortArray)
345
+ port.ports.each do |pt|
346
+ proc_adjust.call(pt, offs, edge_side, move_offs)
347
+ end
348
+ else
349
+ proc_adjust.call(port, offs, edge_side, move_offs)
350
+ end
351
+ end
352
+ end
353
+
354
+ #=== TmCell#get_cport_for_new_join
355
+ def get_cport_for_new_join(cport_name, cport_subscript)
356
+ cp = @cports[cport_name]
357
+ if cp.nil?
358
+ TECSCDE.logger.error("TM9999 cell #{@name} not have call port #{cport_name}")
359
+ end
360
+
361
+ if cport_subscript.nil?
362
+ if !cp.array?
363
+ return cp
364
+ else
365
+ TECSCDE.logger.error("TM9999 cell #{@name}.#{cport_name} is call port array")
366
+ return nil
367
+ end
368
+ else
369
+ if cp.array?
370
+ return cp.get_port_for_new_join(cport_subscript)
371
+ else
372
+ TECSCDE.logger.error("TM9999 cell #{@name}.#{cport_name} is not call port array")
373
+ return nil
374
+ end
375
+ end
376
+ end
377
+
378
+ #=== TmCell#get_eport_for_new_join
379
+ def get_eport_for_new_join(eport_name, eport_subscript)
380
+ ep = @eports[eport_name]
381
+ if ep.nil?
382
+ TECSCDE.logger.error("TM9999 cell #{@name} not have entry port #{eport_name}")
383
+ end
384
+
385
+ if eport_subscript.nil?
386
+ if !ep.array?
387
+ return ep
388
+ else
389
+ TECSCDE.logger.error("TM9999 cell #{@name}.#{eport_name} is entry port array")
390
+ return nil
391
+ end
392
+ else
393
+ if ep.array?
394
+ return ep.get_port_for_new_join(eport_subscript)
395
+ else
396
+ TECSCDE.logger.error("TM9999 cell #{@name}.#{eport_name} is not entry port array")
397
+ return nil
398
+ end
399
+ end
400
+ end
401
+
402
+ #=== TmCell#set_attr
403
+ # name::Symbol
404
+ # init::String|Nil (from Expression)
405
+ def set_attr(name, init)
406
+ modified do
407
+ if init.nil?
408
+ @attr_list.delete(name)
409
+ else
410
+ @attr_list[name] = init
411
+ end
412
+ end
413
+ end
414
+
415
+ def get_attr_list
416
+ @attr_list
417
+ end
418
+
419
+ #=== TmCell#complete?
420
+ def complete?
421
+ @celltype.get_attribute_list.each do |attr|
422
+ if attr.get_initializer.nil? && @attr_list[attr.get_name].nil?
423
+ return false
424
+ end
425
+ end
426
+ @cports.each do |_name, cport|
427
+ if !cport.complete? && !cport.optional?
428
+ return false
429
+ end
430
+ end
431
+ true
432
+ end
433
+
434
+ #=== TmCell#get_min_wh
435
+ # minimum width & height of the cell.
436
+ # these values are calculated from ports' offset.
437
+ # name length is not considered.
438
+ def get_min_wh
439
+ h_min = 0
440
+ w_min = 0
441
+ (@cports.values + @eports.values).each do |port|
442
+ if port.is_a?(TECSCDE::TECSModel::TmPortArray)
443
+ port.ports.each do |pt|
444
+ offs = pt.offset
445
+ case pt.get_edge_side
446
+ when EDGE_TOP, EDGE_BOTTOM
447
+ w_min = offs if offs > w_min
448
+ else
449
+ h_min = offs if offs > h_min
450
+ end
451
+ end
452
+ else
453
+ offs = port.offset
454
+ case port.get_edge_side
455
+ when EDGE_TOP, EDGE_BOTTOM
456
+ w_min = offs if offs > w_min
457
+ else
458
+ h_min = offs if offs > h_min
459
+ end
460
+ end
461
+ end
462
+ [w_min + DIST_PORT, h_min + DIST_PORT]
463
+ end
464
+
465
+ #=== TmCell#get_tecsgen_cell
466
+ def get_tecsgen_cell
467
+ @tecsgen_cell
468
+ end
469
+
470
+ #=== TmCell#clone_for_undo
471
+ def clone_for_undo
472
+ bu = clone
473
+ bu.copy_from(self)
474
+ bu
475
+ end
476
+
477
+ private
478
+
479
+ def judge_near(port, offs, edge_side, nearest_port)
480
+ # p "find_nearest_next_port: comp: #{port.get_name} #{port.get_subscript} at #{port.offset}@#{port.get_edge_side} #{offs}@#{edge_side}"
481
+ return nearest_port unless port.get_edge_side == edge_side
482
+ dist = port.offset - offs
483
+ # p "dist=#{dist}"
484
+ return nearest_port if dist <= 0
485
+ if nearest_port
486
+ if (nearest_port.offset - offs) > dist
487
+ nearest_port = port
488
+ end
489
+ else
490
+ nearest_port = port
491
+ end
492
+ nearest_port
493
+ end
494
+ end
495
+ end
496
+ end