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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +125 -0
- data/.rubocop_todo.yml +188 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE +46 -0
- data/LICENSE.ja +32 -0
- data/README.ja.md +200 -0
- data/README.md +35 -0
- data/Rakefile +27 -0
- data/bin/tecscde +64 -0
- data/glade/tecscde-cell-property.glade +205 -0
- data/glade/tecscde-celltype-property.glade +172 -0
- data/glade/tecscde-celltype.glade +414 -0
- data/glade/tecscde-export.glade +161 -0
- data/glade/test-cell-plugin.rb +51 -0
- data/glade/test-cell-property.rb +35 -0
- data/glade/test-export.rb +35 -0
- data/glade/test-palette.rb +26 -0
- data/lib/tcflow.rb +148 -0
- data/lib/tecscde.rb +65 -0
- data/lib/tecscde/NewCell.png +0 -0
- data/lib/tecscde/SelectArrow.png +0 -0
- data/lib/tecscde/attr_tree_view.rb +253 -0
- data/lib/tecscde/cell_plugin_dialog.glade +294 -0
- data/lib/tecscde/cell_plugin_dialog.rb +89 -0
- data/lib/tecscde/celltype_tree_view.rb +105 -0
- data/lib/tecscde/change_set_control.rb +35 -0
- data/lib/tecscde/change_set_control/change_set.rb +32 -0
- data/lib/tecscde/change_set_control/change_set_manager.rb +62 -0
- data/lib/tecscde/command.rb +35 -0
- data/lib/tecscde/control.rb +491 -0
- data/lib/tecscde/highlighted_objects.rb +180 -0
- data/lib/tecscde/logger.rb +74 -0
- data/lib/tecscde/main_view_and_model.rb +80 -0
- data/lib/tecscde/palette.glade +553 -0
- data/lib/tecscde/palette.rb +174 -0
- data/lib/tecscde/preferences.glade +117 -0
- data/lib/tecscde/preferences.rb +44 -0
- data/lib/tecscde/tecs_model.rb +1137 -0
- data/lib/tecscde/tecs_model/hbar.rb +68 -0
- data/lib/tecscde/tecs_model/tm_c_port.rb +122 -0
- data/lib/tecscde/tecs_model/tm_c_port_array.rb +98 -0
- data/lib/tecscde/tecs_model/tm_cell.rb +496 -0
- data/lib/tecscde/tecs_model/tm_e_port.rb +126 -0
- data/lib/tecscde/tecs_model/tm_e_port_array.rb +78 -0
- data/lib/tecscde/tecs_model/tm_join.rb +293 -0
- data/lib/tecscde/tecs_model/tm_join_bar.rb +146 -0
- data/lib/tecscde/tecs_model/tm_port.rb +238 -0
- data/lib/tecscde/tecs_model/tm_port_array.rb +246 -0
- data/lib/tecscde/tecs_model/tm_region.rb +107 -0
- data/lib/tecscde/tecs_model/tm_uneditable.rb +68 -0
- data/lib/tecscde/tecs_model/vbar.rb +68 -0
- data/lib/tecscde/templates/_cell_info.cde.erb +15 -0
- data/lib/tecscde/templates/_join_info.cde.erb +28 -0
- data/lib/tecscde/templates/main.cde.erb +49 -0
- data/lib/tecscde/tm_object.rb +91 -0
- data/lib/tecscde/version.rb +4 -0
- data/lib/tecscde/view.rb +58 -0
- data/lib/tecscde/view/cairo_matrix.rb +90 -0
- data/lib/tecscde/view/canvas.rb +59 -0
- data/lib/tecscde/view/constants.rb +114 -0
- data/lib/tecscde/view/main_view.rb +1245 -0
- data/lib/tecsflow.rb +475 -0
- data/lib/tecsflow/C_parser.tab.rb +2471 -0
- data/lib/tecsflow/C_parser.y.rb +1087 -0
- data/lib/tecsflow/classes.rb +421 -0
- data/lib/tecsgen.rb +581 -0
- data/lib/tecsgen/core/C_parser.tab.rb +2477 -0
- data/lib/tecsgen/core/C_parser.y +1032 -0
- data/lib/tecsgen/core/bnf-deb.tab.rb +5193 -0
- data/lib/tecsgen/core/bnf.tab.rb +5193 -0
- data/lib/tecsgen/core/bnf.y +2211 -0
- data/lib/tecsgen/core/componentobj.rb +7901 -0
- data/lib/tecsgen/core/ctypes.rb +226 -0
- data/lib/tecsgen/core/expression.rb +1031 -0
- data/lib/tecsgen/core/gen_xml.rb +374 -0
- data/lib/tecsgen/core/generate.rb +5206 -0
- data/lib/tecsgen/core/location.rb +116 -0
- data/lib/tecsgen/core/messages.rb +101 -0
- data/lib/tecsgen/core/optimize.rb +456 -0
- data/lib/tecsgen/core/plugin.rb +332 -0
- data/lib/tecsgen/core/pluginModule.rb +165 -0
- data/lib/tecsgen/core/syntaxobj.rb +1234 -0
- data/lib/tecsgen/core/tecs_lang.rb +306 -0
- data/lib/tecsgen/core/tecsgen.rb +453 -0
- data/lib/tecsgen/core/tecsinfo.rb +860 -0
- data/lib/tecsgen/core/tool_info.rb +258 -0
- data/lib/tecsgen/core/types.rb +1632 -0
- data/lib/tecsgen/core/unjoin_plugin.rb +218 -0
- data/lib/tecsgen/core/value.rb +650 -0
- data/lib/tecsgen/messages/messages_console_en_US.rb +1171 -0
- data/lib/tecsgen/messages/messages_console_ja_JP.rb +1171 -0
- data/lib/tecsgen/messages/messages_file_en_US.rb +334 -0
- data/lib/tecsgen/messages/messages_file_ja_JP.rb +163 -0
- data/lib/tecsgen/plugin/ATK1AlarmPlugin.rb +196 -0
- data/lib/tecsgen/plugin/ATK1DelayTaskPlugin.rb +106 -0
- data/lib/tecsgen/plugin/ATK1EventPlugin.rb +147 -0
- data/lib/tecsgen/plugin/ATK1ISRPlugin.rb +174 -0
- data/lib/tecsgen/plugin/ATK1KernelPlugin.rb +287 -0
- data/lib/tecsgen/plugin/ATK1ResourcePlugin.rb +124 -0
- data/lib/tecsgen/plugin/ATK1TaskPlugin.rb +220 -0
- data/lib/tecsgen/plugin/C2TECSBridgePlugin.rb +210 -0
- data/lib/tecsgen/plugin/CellPlugin.rb +61 -0
- data/lib/tecsgen/plugin/CelltypePlugin.rb +72 -0
- data/lib/tecsgen/plugin/CompositePlugin.rb +66 -0
- data/lib/tecsgen/plugin/DomainPlugin.rb +89 -0
- data/lib/tecsgen/plugin/HRP2AlarmHandlerPlugin.rb +76 -0
- data/lib/tecsgen/plugin/HRP2Cache.rb +1 -0
- data/lib/tecsgen/plugin/HRP2CyclicHandlerPlugin.rb +75 -0
- data/lib/tecsgen/plugin/HRP2DataqueuePlugin.rb +68 -0
- data/lib/tecsgen/plugin/HRP2EventflagPlugin.rb +68 -0
- data/lib/tecsgen/plugin/HRP2FixedSizeMemoryPoolPlugin.rb +68 -0
- data/lib/tecsgen/plugin/HRP2HandlerPlugin.rb +117 -0
- data/lib/tecsgen/plugin/HRP2KernelObjectPlugin.rb +372 -0
- data/lib/tecsgen/plugin/HRP2ObjectPlugin.rb +94 -0
- data/lib/tecsgen/plugin/HRP2Plugin.rb +140 -0
- data/lib/tecsgen/plugin/HRP2PostHook.rb +111 -0
- data/lib/tecsgen/plugin/HRP2PriorityDataqueuePlugin.rb +66 -0
- data/lib/tecsgen/plugin/HRP2RPCPlugin.rb +319 -0
- data/lib/tecsgen/plugin/HRP2SVCPlugin.rb +473 -0
- data/lib/tecsgen/plugin/HRP2SemaphorePlugin.rb +67 -0
- data/lib/tecsgen/plugin/HRP2TaskPlugin.rb +200 -0
- data/lib/tecsgen/plugin/HRPHandlerPlugin.rb +125 -0
- data/lib/tecsgen/plugin/HRPKernelObjectManager.rb +72 -0
- data/lib/tecsgen/plugin/HRPKernelObjectPlugin.rb +333 -0
- data/lib/tecsgen/plugin/HRPObjectPlugin.rb +93 -0
- data/lib/tecsgen/plugin/HRPPlugin.rb +356 -0
- data/lib/tecsgen/plugin/HRPRPCPlugin.rb +407 -0
- data/lib/tecsgen/plugin/HRPSVCPlugin.rb +859 -0
- data/lib/tecsgen/plugin/HRPTaskPlugin.rb +107 -0
- data/lib/tecsgen/plugin/Mruby2CBridgePlugin.rb +86 -0
- data/lib/tecsgen/plugin/MrubyBridgeCellPlugin.rb +264 -0
- data/lib/tecsgen/plugin/MrubyBridgeCelltypePlugin.rb +293 -0
- data/lib/tecsgen/plugin/MrubyBridgeCompositePlugin.rb +49 -0
- data/lib/tecsgen/plugin/MrubyBridgePlugin.rb +67 -0
- data/lib/tecsgen/plugin/MrubyBridgeSignaturePlugin.rb +1307 -0
- data/lib/tecsgen/plugin/MrubyInfoBridgePlugin.rb +14 -0
- data/lib/tecsgen/plugin/MrubyInfoBridgeSignaturePlugin.rb +994 -0
- data/lib/tecsgen/plugin/MultiPlugin.rb +57 -0
- data/lib/tecsgen/plugin/NotifierPlugin.rb +1217 -0
- data/lib/tecsgen/plugin/OpaqueMarshalerPlugin.rb +81 -0
- data/lib/tecsgen/plugin/OpaqueRPCPlugin.rb +323 -0
- data/lib/tecsgen/plugin/RPCPlugin.rb +266 -0
- data/lib/tecsgen/plugin/RepeatCellPlugin.rb +166 -0
- data/lib/tecsgen/plugin/RepeatJoinPlugin.rb +130 -0
- data/lib/tecsgen/plugin/SharedOpaqueRPCPlugin.rb +357 -0
- data/lib/tecsgen/plugin/SharedRPCPlugin.rb +329 -0
- data/lib/tecsgen/plugin/SignaturePlugin.rb +77 -0
- data/lib/tecsgen/plugin/TECS2CBridgePlugin.rb +178 -0
- data/lib/tecsgen/plugin/TECSInfoPlugin.rb +280 -0
- data/lib/tecsgen/plugin/ThroughPlugin.rb +333 -0
- data/lib/tecsgen/plugin/TracePlugin.rb +484 -0
- data/lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb +761 -0
- data/lib/tecsgen/plugin/lib/GenOpaqueMarshaler.rb +1107 -0
- data/lib/tecsgen/plugin/lib/GenParamCopy.rb +365 -0
- data/lib/tecsgen/plugin/lib/GenTransparentMarshaler.rb +683 -0
- data/lib/tecsgen/plugin/lib/MrubyBridgeCelltypePluginModule.rb +283 -0
- data/lib/tecsgen/plugin/lib/MrubyBridgeSignaturePluginModule.rb +277 -0
- data/lib/tecsgen/version.rb +6 -0
- data/samples/FigureSamples/active/active.cde +104 -0
- data/samples/FigureSamples/active/active.cdl +20 -0
- data/samples/FigureSamples/active/active.pdf +0 -0
- data/samples/FigureSamples/active/active.png +0 -0
- data/samples/FigureSamples/active/gen/tmp_C_src.c +36 -0
- data/samples/FigureSamples/active/gen/tmp_cygwin_tecs.h +1908 -0
- data/samples/FigureSamples/active/gen/tmp_plugin_post_code.cdl +0 -0
- data/samples/FigureSamples/allocator/allocator-internal.png +0 -0
- data/samples/FigureSamples/allocator/allocator.cde +171 -0
- data/samples/FigureSamples/allocator/allocator.cdl +58 -0
- data/samples/FigureSamples/allocator/allocator.png +0 -0
- data/samples/FigureSamples/basic/Makefile +87 -0
- data/samples/FigureSamples/basic/SimpleSample-trace.cdl +50 -0
- data/samples/FigureSamples/basic/SimpleSample.cde +91 -0
- data/samples/FigureSamples/basic/SimpleSample.cdl +47 -0
- data/samples/FigureSamples/basic/basic.cde +93 -0
- data/samples/FigureSamples/basic/basic.cdl +46 -0
- data/samples/FigureSamples/basic/basic.png +0 -0
- data/samples/FigureSamples/callback/callback.cde +130 -0
- data/samples/FigureSamples/callback/callback.cdl +29 -0
- data/samples/FigureSamples/callback/callback.png +0 -0
- data/samples/FigureSamples/carray/carray.cde +144 -0
- data/samples/FigureSamples/carray/carray.cdl +38 -0
- data/samples/FigureSamples/carray/carray.png +0 -0
- data/samples/FigureSamples/cearray/cearray.cde +314 -0
- data/samples/FigureSamples/cearray/cearray.cdl +60 -0
- data/samples/FigureSamples/cearray/cearray.png +0 -0
- data/samples/FigureSamples/composite/composite-internal.png +0 -0
- data/samples/FigureSamples/composite/composite.cde +216 -0
- data/samples/FigureSamples/composite/composite.cdl +95 -0
- data/samples/FigureSamples/composite/composite.png +0 -0
- data/samples/FigureSamples/earray/earray.cde +142 -0
- data/samples/FigureSamples/earray/earray.cdl +38 -0
- data/samples/FigureSamples/earray/earray.png +0 -0
- data/samples/FigureSamples/join/Makefile +87 -0
- data/samples/FigureSamples/join/join.cde +132 -0
- data/samples/FigureSamples/join/join.cdl +40 -0
- data/samples/FigureSamples/join/join.png +0 -0
- data/samples/FigureSamples/relay/Makefile +99 -0
- data/samples/FigureSamples/relay/relay-internal.png +0 -0
- data/samples/FigureSamples/relay/relay.cde +284 -0
- data/samples/FigureSamples/relay/relay.cdl +52 -0
- data/samples/FigureSamples/relay/relay.png +0 -0
- data/samples/FigureSamples/rpc/Makefile +123 -0
- data/samples/FigureSamples/rpc/rpc-expand.png +0 -0
- data/samples/FigureSamples/rpc/rpc.cde +245 -0
- data/samples/FigureSamples/rpc/rpc.png +0 -0
- data/samples/FigureSamples/rpc/rpc_sample.cdl +53 -0
- data/samples/SimpleSample/Makefile +25 -0
- data/samples/SimpleSample/SimpleSample/Makefile +86 -0
- data/samples/SimpleSample/SimpleSample/Makefile-trace +91 -0
- data/samples/SimpleSample/SimpleSample/README.txt +106 -0
- data/samples/SimpleSample/SimpleSample/SimpleSample-trace.cdl +50 -0
- data/samples/SimpleSample/SimpleSample/SimpleSample.cdl +45 -0
- data/samples/SimpleSample/SimpleSample/src/tSample.c +77 -0
- data/samples/SimpleSample/SimpleSample/src/tSimple.c +48 -0
- data/samples/SimpleSample/SimpleSample/src/tecs-types.h +27 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/Makefile +51 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/Makefile-trace +91 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/README.txt +106 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/SimpleSample-trace.cdl +80 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/SimpleSample.cdl +77 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/rSample/Makefile +112 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/rSimple/Makefile +109 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tSample.c +80 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tSimple.c +47 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tTaskMain.c +66 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tecs-types.h +27 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/Makefile +125 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/Makefile-trace +130 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/SimpleSample-trace.cdl +54 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/SimpleSample.cdl +53 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/src/tSample.c +80 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/src/tSimple.c +54 -0
- data/tecscde.gemspec +41 -0
- metadata +353 -0
|
@@ -0,0 +1,126 @@
|
|
|
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 ep array
|
|
55
|
+
class TmEPort < TECSCDE::TECSModel::TmPort
|
|
56
|
+
# @joins::[TmJoin]
|
|
57
|
+
|
|
58
|
+
def initialize(owner, port_def, subscript = nil)
|
|
59
|
+
@owner = owner
|
|
60
|
+
@port_def = port_def
|
|
61
|
+
@subscript = subscript
|
|
62
|
+
|
|
63
|
+
@joins = []
|
|
64
|
+
@edge_side, @offset = get_cell.get_new_eport_position(port_def)
|
|
65
|
+
modified {}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def moved(x_inc, y_inc)
|
|
69
|
+
@joins.each do |join|
|
|
70
|
+
join.moved_eport(x_inc, y_inc)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def add_join(join)
|
|
75
|
+
modified do
|
|
76
|
+
@joins << join
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#=== TmEPort#include?
|
|
81
|
+
# TmEPort can have plural of joins.
|
|
82
|
+
# test if TmEPort has specified join.
|
|
83
|
+
def include?(join)
|
|
84
|
+
@joins.include?(join)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
#=== TmEPort#get_joins
|
|
88
|
+
def get_joins
|
|
89
|
+
@joins
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#=== TmEPort#delete
|
|
93
|
+
# this method is called from TmCell
|
|
94
|
+
def delete
|
|
95
|
+
modified do
|
|
96
|
+
joins = @joins.dup # in join.edelete delete_join is called and change @joins
|
|
97
|
+
joins.each(&:delete)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
#=== TmEPort#delete_join
|
|
102
|
+
# this method is called from TmJoin
|
|
103
|
+
def delete_join(join)
|
|
104
|
+
modified do
|
|
105
|
+
@joins.delete(join)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
#=== TmEPort#complete?
|
|
110
|
+
def complete?
|
|
111
|
+
!@joins.empty?
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
#=== TmEPort#clone_for_undo
|
|
115
|
+
def clone_for_undo
|
|
116
|
+
bu = clone
|
|
117
|
+
bu.copy_from(self)
|
|
118
|
+
bu
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def setup_clone(joins)
|
|
122
|
+
@joins = joins.dup
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
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_e_port"
|
|
51
|
+
|
|
52
|
+
module TECSCDE
|
|
53
|
+
class TECSModel
|
|
54
|
+
class TmEPortArray < TECSCDE::TECSModel::TmPortArray
|
|
55
|
+
def initialize(cell, port_def)
|
|
56
|
+
# p "TmEPortArray port_def:#{port_def}"
|
|
57
|
+
@port_def = port_def
|
|
58
|
+
@owner = cell
|
|
59
|
+
if port_def.get_array_size == "[]"
|
|
60
|
+
@actual_size = 1
|
|
61
|
+
else
|
|
62
|
+
@actual_size = port_def.get_array_size
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
@ports = []
|
|
66
|
+
(0..(@actual_size - 1)).each do |subscript|
|
|
67
|
+
@ports << TECSCDE::TECSModel::TmEPort.new(self, port_def, subscript)
|
|
68
|
+
end
|
|
69
|
+
modified {}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
#=== TmEPortArray#new_port
|
|
73
|
+
def new_port(subscript)
|
|
74
|
+
TECSCDE::TECSModel::TmEPort.new(self, @port_def, subscript)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,293 @@
|
|
|
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/hbar"
|
|
52
|
+
require "tecscde/tecs_model/vbar"
|
|
53
|
+
|
|
54
|
+
module TECSCDE
|
|
55
|
+
class TECSModel
|
|
56
|
+
class TmJoin < TECSCDE::TmObject
|
|
57
|
+
# @cport::TmCPort
|
|
58
|
+
# @eport::TmEPort
|
|
59
|
+
# @bars::[TECSCDE::TECSModel::HBar|TECSCDE::TECSModel::VBar]
|
|
60
|
+
# @owner::TECSModel
|
|
61
|
+
|
|
62
|
+
include TECSCDE::TECSModel::TmUneditable
|
|
63
|
+
|
|
64
|
+
attr_reader :bars, :cport, :eport
|
|
65
|
+
|
|
66
|
+
def initialize(cport, eport, tmodel)
|
|
67
|
+
@cport = cport
|
|
68
|
+
@eport = eport
|
|
69
|
+
@owner = tmodel
|
|
70
|
+
|
|
71
|
+
cport.set_join(self)
|
|
72
|
+
eport.add_join(self)
|
|
73
|
+
|
|
74
|
+
create_bars
|
|
75
|
+
# @bars.each{ |bar| bar.set_join self }
|
|
76
|
+
|
|
77
|
+
@editable = true
|
|
78
|
+
modified {}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
#=== TmJoin#create_bars_to dest_port
|
|
82
|
+
def create_bars
|
|
83
|
+
if TECSCDE::TECSModel.parallel?(@cport.get_edge_side, @eport.get_edge_side)
|
|
84
|
+
if TECSCDE::TECSModel.opposite?(@cport.get_edge_side, @eport.get_edge_side)
|
|
85
|
+
create_bars_a
|
|
86
|
+
else
|
|
87
|
+
create_bars_e
|
|
88
|
+
end
|
|
89
|
+
else
|
|
90
|
+
create_bars_c
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def create_bar(bar, position)
|
|
95
|
+
if bar.horizontal?
|
|
96
|
+
TECSCDE::TECSModel::VBar.new(position, self)
|
|
97
|
+
else
|
|
98
|
+
TECSCDE::TECSModel::HBar.new(position, self)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
#=== TmJoin#create_bars_a
|
|
103
|
+
# (a) parallel opposite side generic
|
|
104
|
+
def create_bars_a
|
|
105
|
+
@bars = []
|
|
106
|
+
|
|
107
|
+
@bars[0] = @cport.get_normal_bar_of_edge(self)
|
|
108
|
+
|
|
109
|
+
posa = @cport.get_position_in_tangential_dir
|
|
110
|
+
e1, e2 = @eport.get_cell.get_right_angle_edges_position(@cport.get_edge_side)
|
|
111
|
+
# p "posa=#{posa} e1=#{e1}, e2=#{e2}"
|
|
112
|
+
pos1 = ((posa - e1).abs > (posa - e2).abs) ? (e2 + GAP) : (e1 - Gap)
|
|
113
|
+
@bars[1] = create_bar(@bars[0], pos1)
|
|
114
|
+
|
|
115
|
+
pos2 = @eport.get_position_in_normal_dir + EPGAP * @eport.get_sign_of_normal
|
|
116
|
+
@bars[2] = create_bar(@bars[1], pos2)
|
|
117
|
+
|
|
118
|
+
pos3 = @eport.get_position_in_tangential_dir
|
|
119
|
+
@bars[3] = create_bar(@bars[2], pos3)
|
|
120
|
+
|
|
121
|
+
pos4 = @eport.get_position_in_normal_dir
|
|
122
|
+
@bars[4] = create_bar(@bars[3], pos4)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
#=== TmJoin#create_bars_c
|
|
126
|
+
# (c) right angle generic
|
|
127
|
+
def create_bars_c
|
|
128
|
+
@bars = []
|
|
129
|
+
|
|
130
|
+
@bars[0] = @cport.get_normal_bar_of_edge(self)
|
|
131
|
+
|
|
132
|
+
pos1 = @eport.get_position_in_normal_dir + EPGAP * @eport.get_sign_of_normal
|
|
133
|
+
@bars[1] = create_bar(@bars[0], pos1)
|
|
134
|
+
|
|
135
|
+
pos2 = @eport.get_position_in_tangential_dir
|
|
136
|
+
@bars[2] = create_bar(@bars[1], pos2)
|
|
137
|
+
|
|
138
|
+
pos3 = @eport.get_position_in_normal_dir
|
|
139
|
+
@bars[3] = create_bar(@bars[2], pos3)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
#=== TmJoin#create_bars_e
|
|
143
|
+
# (e) parallel same side generic
|
|
144
|
+
def create_bars_e
|
|
145
|
+
@bars = []
|
|
146
|
+
|
|
147
|
+
@bars[0] = @cport.get_normal_bar_of_edge(self)
|
|
148
|
+
|
|
149
|
+
posa = @cport.get_position_in_tangential_dir
|
|
150
|
+
e1, e2 = @eport.get_cell.get_right_angle_edges_position(@cport.get_edge_side)
|
|
151
|
+
pos1 = ((posa - e1).abs > (posa - e2).abs) ? (e2 + GAP) : (e1 - Gap)
|
|
152
|
+
@bars[1] = create_bar(@bars[0], pos1)
|
|
153
|
+
|
|
154
|
+
pos2 = @eport.get_position_in_normal_dir + EPGAP * @eport.get_sign_of_normal
|
|
155
|
+
@bars[2] = create_bar(@bars[1], pos2)
|
|
156
|
+
|
|
157
|
+
pos3 = @eport.get_position_in_tangential_dir
|
|
158
|
+
@bars[3] = create_bar(@bars[2], pos3)
|
|
159
|
+
|
|
160
|
+
pos4 = @eport.get_position_in_normal_dir
|
|
161
|
+
@bars[4] = create_bar(@bars[3], pos4)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def moved_cport(x_inc, y_inc)
|
|
165
|
+
if @bars[0].instance_of?(TECSCDE::TECSModel::VBar)
|
|
166
|
+
@bars[0].moved(y_inc)
|
|
167
|
+
else
|
|
168
|
+
@bars[0].moved(x_inc)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def moved_eport(x_inc, y_inc)
|
|
173
|
+
TECSCDE.logger.debug("moved_eport=(#{x_inc} #{y_inc})")
|
|
174
|
+
len = @bars.length
|
|
175
|
+
|
|
176
|
+
if len >= 5
|
|
177
|
+
if @bars[len - 4].instance_of?(TECSCDE::TECSModel::VBar)
|
|
178
|
+
@bars[len - 4].moved(y_inc)
|
|
179
|
+
else
|
|
180
|
+
@bars[len - 4].moved(x_inc)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if len >= 4
|
|
185
|
+
if @bars[len - 3].instance_of?(TECSCDE::TECSModel::VBar)
|
|
186
|
+
@bars[len - 3].moved(y_inc)
|
|
187
|
+
else
|
|
188
|
+
@bars[len - 3].moved(x_inc)
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
if len >= 3
|
|
193
|
+
if @bars[len - 2].instance_of?(TECSCDE::TECSModel::VBar)
|
|
194
|
+
@bars[len - 2].moved(y_inc)
|
|
195
|
+
else
|
|
196
|
+
@bars[len - 2].moved(x_inc)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
if @bars[len - 1].instance_of?(TECSCDE::TECSModel::VBar)
|
|
201
|
+
@bars[len - 1].moved(y_inc)
|
|
202
|
+
else
|
|
203
|
+
@bars[len - 1].moved(x_inc)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
#=== TmJoin#get_near_bar ***
|
|
208
|
+
def get_near_bar(xm, ym)
|
|
209
|
+
xs, ys = @cport.get_position
|
|
210
|
+
xe = xs
|
|
211
|
+
ye = ys
|
|
212
|
+
min_dist = 999999999
|
|
213
|
+
min_bar = nil
|
|
214
|
+
@bars.each do |bar|
|
|
215
|
+
if bar.horizontal?
|
|
216
|
+
xe = bar.get_position
|
|
217
|
+
if between?(xm, xs, xe) && near?(ym, ys)
|
|
218
|
+
dist = (ym - ys).abs
|
|
219
|
+
if dist < min_dist
|
|
220
|
+
min_dist = dist
|
|
221
|
+
min_bar = bar
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
else # VBar
|
|
225
|
+
ye = bar.get_position
|
|
226
|
+
if between?(ym, ys, ye) && near?(xm, xs)
|
|
227
|
+
dist = (xm - xs).abs
|
|
228
|
+
if dist < min_dist
|
|
229
|
+
min_dist = dist
|
|
230
|
+
min_bar = bar
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
xs = xe
|
|
235
|
+
ys = ye
|
|
236
|
+
end
|
|
237
|
+
[min_bar, min_dist]
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
#=== TmJoin#between?
|
|
241
|
+
# RETURN:: true if x is between a & b
|
|
242
|
+
def between?(x, a, b)
|
|
243
|
+
if a >= b
|
|
244
|
+
if b <= x && x <= a
|
|
245
|
+
true
|
|
246
|
+
else
|
|
247
|
+
false
|
|
248
|
+
end
|
|
249
|
+
else
|
|
250
|
+
if a <= x && x <= b
|
|
251
|
+
true
|
|
252
|
+
else
|
|
253
|
+
false
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
#=== TmJoin#near?
|
|
259
|
+
def near?(x, a)
|
|
260
|
+
(x - a).abs < NEAR_DIST
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
#=== TmJoin#change_bars bars
|
|
264
|
+
def change_bars(bars)
|
|
265
|
+
modified do
|
|
266
|
+
@bars = bars
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
#=== TmJoin#get_signature ***
|
|
271
|
+
def get_signature
|
|
272
|
+
@cport.get_signature
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
#=== TmJoin#delete ***
|
|
276
|
+
def delete
|
|
277
|
+
return unless editable?
|
|
278
|
+
modified do
|
|
279
|
+
@cport.delete_join
|
|
280
|
+
@eport.delete_join(self)
|
|
281
|
+
@owner.delete_join(self)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
#=== TmJoin#clone_for_undo
|
|
286
|
+
def clone_for_undo
|
|
287
|
+
bu = clone
|
|
288
|
+
bu.copy_from(self)
|
|
289
|
+
bu
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
end
|