├── LICENSE
├── grain.xml
├── macros
├── import_tf.lym
└── import_tf_standalone.rb
├── readme.md
└── ruby
├── import_tf.rb
├── testdata_1
├── default.drf
└── techfile.tf
├── testdata_2
├── default.drf
├── techfile.tf
└── test.layermap
└── tests.rb
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Matthias Köfferlein
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/grain.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | tf_import
4 |
5 | false
6 | 1.1
7 |
8 | Ruby Macro
9 | Imports a Cadence techfile and creates layer properties from it.
10 | A command line version of the converter is provided by which this conversion can be performed in batch mode.
11 | https://github.com/klayoutmatthias/tf_import
12 |
13 | GPL V3
14 | Matthias Köfferlein
15 | matthias@klayout.de
16 |
17 | iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAF/w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fHz87Pj6O8FTXxyH2ccuFIjDGsLS0ZMiyLEzTdCcnJ595+OGHV/U+UVQ7Q+LYsWN/I0lSwDm/rlV/XTdYuZL8ccoGQYCJiQmyceNG+8KFCyceffTRH64W+Icf37qBdPbs2Yt79+7dI0lS79TUFBzHab8HsGLD9DrSQggEQQBZltu/rSxj2zbm5+cxOTmJ999/H7VaDZlMBkEQzLz99ttP3HHHHZdXizsyAQBACHHSMIyvdnR0lAzD8CuVinT58mU2MzMD27Zbi59am6gQojl0toY2y7IwNzeHiYkJTE5OolarQVEUdHR02KlUatK27cLVq1e90dHRNx955JHvRYE58sPSe/fu/UvDMP64u7t7S3d3t9Ld3W3deuutBdM09dZ7BDLnHOl0GtlsVszNzZFqtRqe/0E6nebJZLJSr9cXFxcXWblc7iyVSvFyuYxyuVzhnI8yxr62b9++8SjwruWLkzHHcb7MGNvT3d19b3d392B3dzfr6uqyBgcHi4lEIlGv1+OSJPF169ZVG41GrVQqGaVSaV25XCblcpmXSqUr1Wr1jBDiF5Ikvfz444+fixrnJ/bu8P33359UVfUrhmF8paur69M9PT0burq6yPbt29FqXadUKl2sVCpv2bZ9wnGc/3rqqaduKLz9v6RP/OXpMA0PD6/3ff+rw8PD8tLS0iv79u1752Zh+Y1O/wuJGgM2xyeWQgAAAABJRU5ErkJggg==
18 |
19 |
20 |
--------------------------------------------------------------------------------
/macros/import_tf.lym:
--------------------------------------------------------------------------------
1 |
2 |
3 | Import Cadence Techfile
4 |
5 |
6 |
7 |
8 |
9 | false
10 | false
11 |
12 | true
13 |
14 | file_menu.load_layer_props+
15 | ruby
16 |
17 | #
18 | # This program is distributed in the hope that it will be useful,
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | # LICENSE file for details.
22 | #
23 | # DESCRIPTION: Cadence techfile import for KLayout.
24 | #
25 | # The script will read a Cadence techfile [input] and convert
26 | # it to layer properties.
27 | # It will require a .drf file which must be located where [input] is found. It will also read
28 | # a .layermap file if there is one beside the [input] file.
29 | # It will prompt for a .drf file if it does not find a unique file.
30 |
31 | require "import_tf"
32 |
33 | module TechfileToKLayout
34 |
35 | app = RBA::Application.instance
36 | mw = app.main_window
37 |
38 | lv = mw.current_view
39 | if lv == nil
40 | raise "No view selected"
41 | end
42 |
43 | # Ask for the file name
44 | sel_tf_file = RBA::FileDialog.get_open_file_name("Select Cadence Techfile", ".", "Cadence techfiles (*.tf);;Text files (*.txt);;All files (*)")
45 | if sel_tf_file.has_value?
46 | begin
47 | lv.transaction("Import Cadence Techfile")
48 | import_techfile(lv, sel_tf_file.value)
49 | ensure
50 | lv.commit
51 | end
52 | end
53 |
54 | end
55 |
56 |
57 |
--------------------------------------------------------------------------------
/macros/import_tf_standalone.rb:
--------------------------------------------------------------------------------
1 | # $autorun
2 | #
3 | # This program is distributed in the hope that it will be useful,
4 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
5 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 | # LICENSE file for details.
7 | #
8 | # DESCRIPTION: Cadence techfile converter for KLayout - batch mode interface
9 | #
10 | # Run the script with
11 | # klayout -z -rd tf_file=[input] -rd lyp_file=[output] -r import_tf_standalone.lym ...
12 | #
13 | # The script will convert the Cadence techfile [input] to the layer properties file [output].
14 | # It will require a .drf file which must be located where [input] is found. It will also read
15 | # a .layermap file if there is one beside the [input] file.
16 | # It will prompt for a .drf file if it does not find a unique file.
17 | #
18 | # CAUTION: the script uses a simple parsing scheme of the techfile by converting it into a
19 | # Ruby expression. Hence, no Skill code inside the techfile is evaluated.
20 | #
21 |
22 | require "import_tf"
23 |
24 | module TechfileToKLayout
25 |
26 | # If tf_file is given, this script is executed
27 | if $tf_file
28 |
29 | $lyp_file || raise(Exception("$lyp_file not given"))
30 |
31 | mw = RBA::Application::instance.main_window
32 | mw.create_view
33 | lv = mw.current_view
34 |
35 | import_techfile(lv, $tf_file)
36 | lv.save_layer_props($lyp_file)
37 |
38 | end
39 |
40 | end
41 |
42 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 |
2 | # Cadence techfile import for KLayout
3 |
4 | This macro adds a new entry to the "File" menu below "Load Layer Properties".
5 | This function will ask for the path to a Cadence techfile. It will read the
6 | techfile and create layer properties from it.
7 |
8 | The script needs a ".drf" (display resources) file too. It will look for
9 | any file with extension "drf" next to the techfile. If there are multiple ones,
10 | a dialog will be shown to select one.
11 |
12 | If no stream layers are specified in the techfile, it will also look for a
13 | layer mapping file (one with extension ".layermap") next to the techfile.
14 |
15 | The script will import the techfile and set the layer properties accordingly.
16 | These properties can then be saved using "Save Layer Properties" from the "File" menu.
17 |
18 | Note: the script is able to parse simple forms of techfiles but will not execute
19 | embedded Skill code correctly. The best way is to dump a Cadence ASCII techfile
20 | and import that file.
21 |
22 | ## Batch mode
23 |
24 | The macro will provide a batch mode which allows converting a techfile into
25 | a ".lyp" file on the command line.
26 |
27 | Once the package is installed, batch mode can be used this way:
28 |
29 | ```
30 | klayout -z -rd tf_file= -rd lyp_file=
31 | ```
32 |
33 | Note for Unix users: this mode requires a DISPLAY. If you need to run it on
34 | a headless server, use "xvfb" to provide a dummy display.
35 |
36 |
--------------------------------------------------------------------------------
/ruby/import_tf.rb:
--------------------------------------------------------------------------------
1 | #
2 | # This program is distributed in the hope that it will be useful,
3 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
4 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 | # LICENSE file for details.
6 | #
7 | # DESCRIPTION: Cadence techfile import for KLayout - core functionality.
8 | #
9 |
10 | require "stringio"
11 |
12 | module TechfileToKLayout
13 |
14 | class TechfileDisplayDefinitions
15 |
16 | def initialize(_packet)
17 | @packet = _packet
18 | stipple = nil
19 | line_style = nil
20 | frame_color = 0x808080
21 | fill_color = 0x808080
22 | width = 1
23 | xfill = false
24 | end
25 |
26 | attr_reader :packet
27 | attr_accessor :stipple
28 | attr_accessor :line_style
29 | attr_accessor :frame_color
30 | attr_accessor :fill_color
31 | attr_accessor :width
32 | attr_accessor :xfill
33 |
34 | end
35 |
36 | class TechFileLayer
37 |
38 | def initialize(_lp)
39 | @lp = _lp
40 | ld = nil
41 | visible = false
42 | valid = false
43 | display = nil
44 | end
45 |
46 | attr_reader :lp
47 | attr_accessor :ld
48 | attr_accessor :visible
49 | attr_accessor :valid
50 | attr_accessor :display
51 |
52 | end
53 |
54 | def self.produce_word(expr, word)
55 | if word == "t"
56 | expr.write("true")
57 | elsif word == "nil"
58 | expr.write("false")
59 | elsif word.length > 0 && word =~ /^-?(\d+(\.\d*)?|\d*\.\d+)([eE][+\-]?\d*)?$/
60 | expr.write(word)
61 | elsif (word =~ /^['"]/)
62 | expr.write(word)
63 | else
64 | expr.write("\"")
65 | expr.write(word.gsub(/\\/, "\\\\").gsub(/"/, "\""))
66 | expr.write("\"")
67 | end
68 | end
69 |
70 | def self.read_skill_file_as_ruby_expr(fn)
71 |
72 | expr = StringIO.new("", "w")
73 | expr.write("[")
74 |
75 | File.open(fn) do |file|
76 |
77 | file.each_line do |line|
78 |
79 | state = :reading
80 | word = ""
81 |
82 | line.split(//).each do |c|
83 |
84 | repeat = true
85 | stop = false
86 | while repeat
87 |
88 | repeat = false
89 |
90 | if state == :reading
91 | if c == ";"
92 | # drop comments
93 | stop = true
94 | elsif c == "\""
95 | expr.write(c);
96 | state = :quoted
97 | elsif c == "\'"
98 | expr.write(c);
99 | state = :singlequoted
100 | elsif c == "("
101 | expr.write("[");
102 | elsif c == ")"
103 | expr.write("], ");
104 | elsif c =~ /\s/
105 | expr.write(c)
106 | else
107 | word = c
108 | state = :read_word
109 | end
110 | elsif state == :read_word
111 | if c == "("
112 | expr.write("[ ")
113 | produce_word(expr, word)
114 | expr.write(", ")
115 | state = :reading
116 | elsif c == ")"
117 | produce_word(expr, word)
118 | repeat = true
119 | state = :reading
120 | elsif c =~ /\s/
121 | produce_word(expr, word)
122 | expr.write(", ")
123 | state = :reading
124 | repeat = true
125 | else
126 | word += c
127 | end
128 | elsif state == :escaped
129 | expr.write(c)
130 | state = :quoted
131 | elsif state == :quoted
132 | expr.write(c)
133 | if c == "\""
134 | state = :reading
135 | expr.write(", ")
136 | elsif c == "\\"
137 | state = :escaped
138 | end
139 | elsif state == :singlequoted
140 | if c =~ /[\s\)]/
141 | state = :reading
142 | repeat = true
143 | expr.write("\', ")
144 | else
145 | expr.write(c)
146 | end
147 | end
148 |
149 | end
150 |
151 | if stop
152 | break
153 | end
154 |
155 | end
156 |
157 | if state == :quoted || state == :singlequoted
158 | expr.write("\"")
159 | elsif state == :read_word
160 | produce_word(expr, word)
161 | end
162 |
163 | end
164 |
165 | end
166 |
167 | expr.write("]")
168 | return expr.string
169 |
170 | end
171 |
172 | # @brief Imports the given techfile into the given view
173 | #
174 | # This method will erase all layer definitions from the
175 | # view given by "lv" and replace them by the definitions
176 | # read from the techfile.
177 |
178 | def self.import_techfile(lv, tf_file)
179 |
180 | dir = File.dirname(tf_file)
181 | drf_files = Dir.glob(File.join(dir, "*.drf"))
182 |
183 | drf_file = nil
184 | if drf_files.length == 1
185 | drf_file = drf_files[0]
186 | else
187 | sel_drf_file = RBA::FileDialog.get_open_file_name("Select Display Resource File", dir, "Display resource files (*.drf);;All files (*)")
188 | if sel_drf_file.has_value?
189 | drf_file = sel_drf_file.value
190 | end
191 | end
192 |
193 | if !drf_file
194 | raise "Unable to locate display resource file"
195 | end
196 |
197 | tf = eval(read_skill_file_as_ruby_expr(tf_file))
198 | drf = eval(read_skill_file_as_ruby_expr(drf_file))
199 |
200 | lv.clear_layers
201 | lv.clear_stipples
202 | lv.clear_line_styles
203 |
204 | display_defs = {}
205 |
206 | begin
207 |
208 | colors = {}
209 | widths = {}
210 | line_styles = {}
211 | stipples = {}
212 | packets = {}
213 |
214 | drf.each do |section|
215 |
216 | sname = section.shift
217 | if sname == "drDefinePacket"
218 | section.each do |defs|
219 | if defs.length >= 6
220 | packets[defs[1]] ||= [ defs[2], defs[3], defs[4], defs[5], defs[6] ]
221 | end
222 | end
223 | elsif sname == "drDefineLineStyle"
224 | section.each do |defs|
225 | if defs.length >= 4
226 | widths[defs[1]] ||= defs[2]
227 | p = defs[3]
228 | word = 0
229 | bits = p.length
230 | p.reverse_each { |b| word = (word << 1) + b }
231 | line_styles[defs[1]] ||= lv.add_line_style(defs[1], word, bits)
232 | end
233 | end
234 | elsif sname == "drDefineStipple"
235 | section.each do |defs|
236 | if defs.length >= 3
237 | pat = []
238 | bits = 1
239 | defs[2].reverse_each do |p|
240 | word = 0
241 | bits = p.length
242 | p.reverse_each { |b| word = (word << 1) + b }
243 | if pat.size < 32
244 | pat.push(word & 0xffffffff)
245 | end
246 | end
247 | stipples[defs[1]] ||= lv.add_stipple(defs[1], pat, bits)
248 | end
249 | end
250 | elsif sname == "drDefineColor"
251 | section.each do |defs|
252 | if defs.length >= 5
253 | colors[defs[1]] ||= ((defs[2] << 16) + (defs[3] << 8) + defs[4])
254 | end
255 | end
256 | end
257 |
258 | end
259 |
260 | packets.each do |k,v|
261 |
262 | stipple = stipples[v[0]]
263 | line_style = line_styles[v[1]]
264 | fill_color = colors[v[2]]
265 | frame_color = colors[v[3]]
266 | xfill = v[4].to_s == "X"
267 | width = widths[v[1]]
268 | width ||= 0
269 |
270 | if (fill_color && frame_color && width)
271 | dd = (display_defs[k] ||= TechfileDisplayDefinitions.new(k))
272 | dd.stipple = stipple
273 | dd.line_style = line_style
274 | dd.fill_color = fill_color
275 | dd.frame_color = frame_color
276 | dd.xfill = xfill
277 | dd.width = width
278 | end
279 |
280 | end
281 |
282 | end
283 |
284 | priorities = []
285 | layers = {}
286 | has_layers = false
287 |
288 | tf.each do |section|
289 |
290 | sname = section.shift
291 | if sname == "layerDefinitions"
292 |
293 | section.each do |defs|
294 |
295 | dname = defs.shift
296 | if dname == "techLayerPurposePriorities"
297 | defs.each { |lp| priorities.push(lp) }
298 | elsif dname == "techDisplays"
299 | defs.each do |td|
300 | if td.length >= 8
301 | dd = display_defs[td[2]]
302 | if dd
303 | lp = [ td[0], td[1] ]
304 | tl = (layers[lp] ||= TechFileLayer.new(lp))
305 | tl.display = dd
306 | tl.visible = td[3]
307 | tl.valid = td[7]
308 | end
309 | end
310 | end
311 | end
312 |
313 | end
314 |
315 | elsif sname == "layerRules"
316 |
317 | section.each do |defs|
318 |
319 | dname = defs.shift
320 | if dname == "streamLayers"
321 | defs.each do |td|
322 | if td.length >= 3
323 | lp = td[0]
324 | tl = (layers[lp] ||= TechFileLayer.new(lp))
325 | tl.ld = [ td[1], td[2] ]
326 | has_layers = true
327 | end
328 | end
329 | end
330 |
331 | end
332 |
333 | end
334 |
335 | end
336 |
337 | if !has_layers
338 |
339 | # no layers in techfile -> try to locate layermap
340 | lmap_files = Dir.glob(File.join(dir, "*.layermap"))
341 | lmap_file = nil
342 | if lmap_files.length == 1
343 | lmap_file = lmap_files[0]
344 | else
345 | sel_lmap_file = RBA::FileDialog.get_open_file_name("Select Layer Map File", dir, "Layer Map files (*.layermap);;All files (*)")
346 | if sel_lmap_file.has_value?
347 | lmap_file = sel_lmap_file.value
348 | end
349 | end
350 |
351 | if !lmap_file
352 | raise "Unable to locate layer map file"
353 | end
354 |
355 | File.open(lmap_file) do |file|
356 | file.each_line do |l|
357 | l = l.sub(/#.*/, "").sub(/^\s*/, "").sub(/\s*$/, "").gsub(/\s+/, " ")
358 | if l != ""
359 | ll = l.split(/\s+/)
360 | if ll.size >= 3
361 | lp = [ ll[0], ll[1] ]
362 | tl = (layers[lp] ||= TechFileLayer.new(lp))
363 | tl.ld = [ ll[2].to_i, (ll[3] || "0").to_i ]
364 | end
365 | end
366 | end
367 | end
368 |
369 | end
370 |
371 | priorities.each do |lp|
372 |
373 | ldef = layers[lp]
374 | if ldef && ldef.ld && ldef.display
375 | lprops = RBA::LayerPropertiesNode.new
376 | lprops.source_layer = ldef.ld[0]
377 | lprops.source_datatype = ldef.ld[1]
378 | lprops.source_cellview = 0
379 | lprops.name = lp[0] + "." + lp[1] + " - " + ldef.ld[0].to_s + "/" + ldef.ld[1].to_s
380 | lprops.width = ldef.display.width
381 | lprops.frame_color = ldef.display.frame_color
382 | lprops.fill_color = ldef.display.fill_color
383 | lprops.visible = ldef.visible
384 | lprops.valid = ldef.valid
385 | lprops.xfill = ldef.display.xfill
386 | lprops.dither_pattern = ldef.display.stipple || 1
387 | lprops.line_style = ldef.display.line_style || 0
388 | lv.insert_layer(lv.end_layers, lprops)
389 | end
390 |
391 | end
392 |
393 | end
394 |
395 | end
396 |
397 |
--------------------------------------------------------------------------------
/ruby/testdata_1/default.drf:
--------------------------------------------------------------------------------
1 | drDefineDisplay(
2 | ;( DisplayName )
3 | ( display )
4 | )
5 | drDefineColor(
6 | ;( DisplayName ColorsName Red Green Blue )
7 | ( display white 255 255 255 )
8 | ( display yellow 255 255 0 )
9 | ( display silver 217 230 255 )
10 | ( display cream 255 255 204 )
11 | ( display pink 255 191 242 )
12 | ( display magenta 255 0 255 )
13 | ( display lime 0 255 0 )
14 | ( display tan 255 230 191 )
15 | ( display cyan 0 255 255 )
16 | ( display cadetBlue 57 191 255 )
17 | ( display orange 227 139 0 )
18 | ( display red 255 0 0 )
19 | ( display purple 153 0 230 )
20 | ( display green 0 204 102 )
21 | ( display brown 191 64 38 )
22 | ( display blue 0 0 255 )
23 | ( display slate 140 140 166 )
24 | ( display gold 217 204 0 )
25 | ( display maroon 230 31 13 )
26 | ( display violet 94 0 230 )
27 | ( display forest 38 140 107 )
28 | ( display chocolate 128 38 38 )
29 | ( display navy 51 51 153 )
30 | ( display black 0 0 0 )
31 | ( display gray 204 204 217 )
32 | ( display winColor1 166 166 166 )
33 | ( display winColor2 115 115 115 )
34 | ( display winColor3 189 204 204 )
35 | ( display winColor4 204 204 204 )
36 | ( display winColor5 199 199 199 )
37 | ( display blinkRed 255 0 0 t )
38 | ( display blinkYellow 255 255 0 t )
39 | ( display blinkWhite 255 255 255 t )
40 | )
41 | drDefineStipple(
42 | ;( DisplayName StippleName Bitmap )
43 | ( display d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0 0 1 0 0 0 1 0 0 0 1 0 0 0 )
272 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
273 | ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 )
274 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
275 | ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 )
276 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
277 | ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 )
278 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
279 | ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 )
280 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
281 | ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 )
282 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
283 | ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 )
284 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 )
285 | ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 )
286 | ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) ) )
287 | )
288 | drDefineLineStyle(
289 | ;( DisplayName LineStyle Size Pattern )
290 | ( display solid 1 (1 1 1 ) )
291 | ( display dashed 1 (1 1 1 1 0 0 ) )
292 | ( display dots 1 (1 0 0 ) )
293 | ( display dashDot 1 (1 1 1 0 0 1 0 0 ) )
294 | ( display shortDash 1 (1 1 0 0 ) )
295 | ( display doubleDash 1 (1 1 1 1 0 0 1 1 0 0 ) )
296 | ( display hidden 1 (1 0 0 0 ) )
297 | ( display thickLine 3 (1 1 1 ) )
298 | ( display thickDots 3 (1 0 0 ) )
299 | )
300 | drDefinePacket(
301 | ;( DisplayName PacketName Stipple LineStyle Fill Outline [FillStyle])
302 | ( display AA dots thickDots winColor4 winColor4 outlineStipple)
303 | ( display C1 blank thickLine purple purple X )
304 | ( display M1 dots solid forest forest outlineStipple)
305 | ( display NBL x dashed silver silver outlineStipple)
306 | ( display NHV slash dashDots cadetBlue cadetBlue outlineStipple)
307 | ( display NP dots shortDash navy navy outlineStipple)
308 | ( display NW dots doubleDash cadetBlue cadetBlue outlineStipple)
309 | ( display P1 dots1 solid orange orange outlineStipple)
310 | ( display P2 blank solid brown brown solid )
311 | ( display PA brick solid slate slate outlineStipple)
312 | ( display PBL triangle solid pink pink outlineStipple)
313 | ( display PHV vZigZag solid orange orange outlineStipple)
314 | ( display PP dots solid chocolate chocolate outlineStipple)
315 | ( display PTOP slash solid maroon maroon outlineStipple)
316 | ( display PW slash solid brown brown outlineStipple)
317 | ( display SP backSlash solid brown brown outlineStipple)
318 | ( display VTH hLine solid orange orange outlineStipple)
319 | ( display P1net dots1 hidden orange white outlineStipple)
320 | ( display P2net blank hidden brown white outlineStipple)
321 | ( display C1net blank hidden purple white X )
322 | ( display M1net dots hidden forest white outlineStipple)
323 | )
324 |
--------------------------------------------------------------------------------
/ruby/testdata_1/techfile.tf:
--------------------------------------------------------------------------------
1 |
2 | ;********************************
3 | ; LAYER DEFINITION
4 | ;********************************
5 | layerDefinitions(
6 |
7 | techPurposes(
8 | ;( PurposeName Purpose# Abbreviation )
9 | ;( ----------- -------- ------------ )
10 | ( drawing 252 drw )
11 | ( net 253 net )
12 | ) ;techPurposes
13 |
14 | techLayers(
15 | ;( LayerName Layer# Abbreviation )
16 | ;( --------- ------ ------------ )
17 | ;User-Defined Layers:
18 | ( PW 1 PW )
19 | ( NBL 2 NBL )
20 | ( SP 3 SP )
21 | ( PBL 6 PBL )
22 | ( C1 9 C1 )
23 | ( M1 10 M1 )
24 | ( PA 11 PA )
25 | ( NW 12 NW )
26 | ( NHV 23 NHV )
27 | ( PHV 24 PHV )
28 | ( PTOP 25 PTOP )
29 | ( P1 30 P1 )
30 | ( P2 31 P2 )
31 | ( AA 54 AA )
32 | ( VTH 91 VTH )
33 | ( PP 97 PP )
34 | ( NP 98 NP )
35 | ) ;techLayers
36 |
37 | techLayerPurposePriorities(
38 | ;layers are ordered from lowest to highest priority
39 | ;( LayerName Purpose )
40 | ;( --------- ------- )
41 | ( NBL drawing )
42 | ( PBL drawing )
43 | ( PW drawing )
44 | ( NW drawing )
45 | ( PTOP drawing )
46 | ( AA drawing )
47 | ( VTH drawing )
48 | ( P1 drawing )
49 | ( NHV drawing )
50 | ( PHV drawing )
51 | ( SP drawing )
52 | ( P2 drawing )
53 | ( NP drawing )
54 | ( PP drawing )
55 | ( C1 drawing )
56 | ( M1 drawing )
57 | ( PA drawing )
58 | ( P1 net )
59 | ( P2 net )
60 | ( C1 net )
61 | ( M1 net )
62 | ) ;techLayerPurposePriorities
63 |
64 | techDisplays(
65 | ;( LayerName Purpose Packet Vis Sel Con2ChgLy DrgEnbl Valid )
66 | ;( --------- ------- ------ --- --- --------- ------- ----- )
67 | ( NBL drawing NBL t t t t t )
68 | ( PBL drawing PBL t t t t t )
69 | ( PW drawing PW t t t t t )
70 | ( NW drawing NW t t t t t )
71 | ( PTOP drawing PTOP t t t t t )
72 | ( AA drawing AA t t t t t )
73 | ( VTH drawing VTH t t t t t )
74 | ( P1 drawing P1 t t t t t )
75 | ( NHV drawing NHV t t t t t )
76 | ( PHV drawing PHV t t t t t )
77 | ( SP drawing SP t t t t t )
78 | ( P2 drawing P2 t t t t t )
79 | ( NP drawing NP t t t t t )
80 | ( PP drawing PP t t t t t )
81 | ( C1 drawing C1 t t t t t )
82 | ( M1 drawing M1 t t t t t )
83 | ( PA drawing PA t t t t t )
84 | ( P1 net P1net t t t t nil )
85 | ( P2 net P2net t t t t nil )
86 | ( C1 net C1net t t t t nil )
87 | ( M1 net M1net t t t t nil )
88 | ) ;techDisplays
89 |
90 | techLayerProperties(
91 | ;( PropName Layer1 [ Layer2 ] PropValue )
92 | )
93 |
94 | ) ;layerDefinitions
95 |
96 |
97 | ;********************************
98 | ; LAYER RULES
99 | ;********************************
100 | layerRules(
101 |
102 | streamLayers(
103 | ;( layer streamNumber dataType translate )
104 | ;( ----- ------------ -------- --------- )
105 | ( ("NBL" "drawing") 2 0 t )
106 | ( ("PBL" "drawing") 6 0 t )
107 | ( ("PW" "drawing") 1 0 t )
108 | ( ("NW" "drawing") 12 0 t )
109 | ( ("PTOP" "drawing") 25 0 t )
110 | ( ("AA" "drawing") 54 0 t )
111 | ( ("VTH" "drawing") 91 0 t )
112 | ( ("P1" "drawing") 30 0 t )
113 | ( ("NHV" "drawing") 23 0 t )
114 | ( ("PHV" "drawing") 24 0 t )
115 | ( ("SP" "drawing") 3 0 t )
116 | ( ("P2" "drawing") 31 0 t )
117 | ( ("NP" "drawing") 98 0 t )
118 | ( ("PP" "drawing") 97 0 t )
119 | ( ("C1" "drawing") 9 0 t )
120 | ( ("M1" "drawing") 10 0 t )
121 | ( ("PA" "drawing") 11 0 t )
122 | ( ("P2" "net") 101 0 t )
123 | ( ("P1" "net") 102 0 t )
124 | ( ("M1" "net") 103 0 t )
125 | ( ("C1" "net") 104 0 t )
126 | ) ;streamLayers
127 |
128 | ) ;layerRules
129 |
130 |
131 | ;********************************
132 | ; PHYSICAL RULES
133 | ;********************************
134 | physicalRules(
135 |
136 | mfgGridResolution(
137 | ( 0.001000 )
138 | ) ;mfgGridResolution
139 |
140 | ) ;physicalRules
141 |
--------------------------------------------------------------------------------
/ruby/testdata_2/default.drf:
--------------------------------------------------------------------------------
1 | drDefineDisplay(
2 | ;( DisplayName )
3 | ( display )
4 | )
5 | drDefineColor(
6 | ;( DisplayName ColorsName Red Green Blue )
7 | ( display white 255 255 255 )
8 | ( display yellow 255 255 0 )
9 | ( display silver 217 230 255 )
10 | ( display cream 255 255 204 )
11 | ( display pink 255 191 242 )
12 | ( display magenta 255 0 255 )
13 | ( display lime 0 255 0 )
14 | ( display tan 255 230 191 )
15 | ( display cyan 0 255 255 )
16 | ( display cadetBlue 57 191 255 )
17 | ( display orange 227 139 0 )
18 | ( display red 255 0 0 )
19 | ( display purple 153 0 230 )
20 | ( display green 0 204 102 )
21 | ( display brown 191 64 38 )
22 | ( display blue 0 0 255 )
23 | ( display slate 140 140 166 )
24 | ( display gold 217 204 0 )
25 | ( display maroon 230 31 13 )
26 | ( display violet 94 0 230 )
27 | ( display forest 38 140 107 )
28 | ( display chocolate 128 38 38 )
29 | ( display navy 51 51 153 )
30 | ( display black 0 0 0 )
31 | ( display gray 204 204 217 )
32 | ( display winColor1 166 166 166 )
33 | ( display winColor2 115 115 115 )
34 | ( display winColor3 189 204 204 )
35 | ( display winColor4 204 204 204 )
36 | ( display winColor5 199 199 199 )
37 | ( display blinkRed 255 0 0 t )
38 | ( display blinkYellow 255 255 0 t )
39 | ( display blinkWhite 255 255 255 t )
40 | )
41 | drDefineStipple(
42 | ;( DisplayName StippleName Bitmap )
43 | ( display dots ( ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 )
44 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
45 | ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 )
46 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
47 | ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 )
48 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
49 | ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 )
50 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
51 | ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 )
52 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
53 | ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 )
54 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
55 | ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 )
56 | ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
57 | ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 )
58 | ( 0 0 0 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0 1 0 1 0 1 0 1 ) ) )
287 | )
288 | drDefineLineStyle(
289 | ;( DisplayName LineStyle Size Pattern )
290 | ( display solid 1 (1 1 1 ) )
291 | ( display dashed 1 (1 1 1 1 0 0 ) )
292 | ( display dots 1 (1 0 0 ) )
293 | ( display dashDot 1 (1 1 1 0 0 1 0 0 ) )
294 | ( display shortDash 1 (1 1 0 0 ) )
295 | ( display doubleDash 1 (1 1 1 1 0 0 1 1 0 0 ) )
296 | ( display hidden 1 (1 0 0 0 ) )
297 | ( display thickLine 3 (1 1 1 ) )
298 | ( display thickDots 3 (1 0 0 ) )
299 | )
300 | drDefinePacket(
301 | ;( DisplayName PacketName Stipple LineStyle Fill Outline [FillStyle])
302 | ( display AA dots thickDots winColor4 winColor4 outlineStipple)
303 | ( display C1 blank thickLine purple purple X )
304 | ( display M1 dots solid forest forest outlineStipple)
305 | ( display NBL x dashed silver silver outlineStipple)
306 | ( display NHV slash dashDots cadetBlue cadetBlue outlineStipple)
307 | ( display NP dots shortDash navy navy outlineStipple)
308 | ( display NW dots doubleDash cadetBlue cadetBlue outlineStipple)
309 | ( display P1 dots1 solid orange orange outlineStipple)
310 | ( display P2 blank solid brown brown solid )
311 | ( display PA brick solid slate slate outlineStipple)
312 | ( display PBL triangle solid pink pink outlineStipple)
313 | ( display PHV vZigZag solid orange orange outlineStipple)
314 | ( display PP dots solid chocolate chocolate outlineStipple)
315 | ( display PTOP slash solid maroon maroon outlineStipple)
316 | ( display PW slash solid brown brown outlineStipple)
317 | ( display SP backSlash solid brown brown outlineStipple)
318 | ( display VTH hLine solid orange orange outlineStipple)
319 | ( display P1net dots1 hidden orange white outlineStipple)
320 | ( display P2net blank hidden brown white outlineStipple)
321 | ( display C1net blank hidden purple white X )
322 | ( display M1net dots hidden forest white outlineStipple)
323 | )
324 |
--------------------------------------------------------------------------------
/ruby/testdata_2/techfile.tf:
--------------------------------------------------------------------------------
1 |
2 | ;********************************
3 | ; LAYER DEFINITION
4 | ;********************************
5 | layerDefinitions(
6 |
7 | techPurposes(
8 | ;( PurposeName Purpose# Abbreviation )
9 | ;( ----------- -------- ------------ )
10 | ( drawing 252 drw )
11 | ( net 253 net )
12 | ) ;techPurposes
13 |
14 | techLayers(
15 | ;( LayerName Layer# Abbreviation )
16 | ;( --------- ------ ------------ )
17 | ;User-Defined Layers:
18 | ( PW 1 PW )
19 | ( NBL 2 NBL )
20 | ( SP 3 SP )
21 | ( PBL 6 PBL )
22 | ( C1 9 C1 )
23 | ( M1 10 M1 )
24 | ( PA 11 PA )
25 | ( NW 12 NW )
26 | ( NHV 23 NHV )
27 | ( PHV 24 PHV )
28 | ( PTOP 25 PTOP )
29 | ( P1 30 P1 )
30 | ( P2 31 P2 )
31 | ( AA 54 AA )
32 | ( VTH 91 VTH )
33 | ( PP 97 PP )
34 | ( NP 98 NP )
35 | ) ;techLayers
36 |
37 | techLayerPurposePriorities(
38 | ;layers are ordered from lowest to highest priority
39 | ;( LayerName Purpose )
40 | ;( --------- ------- )
41 | ( NBL drawing )
42 | ( PBL drawing )
43 | ( PW drawing )
44 | ( NW drawing )
45 | ( PTOP drawing )
46 | ( AA drawing )
47 | ( VTH drawing )
48 | ( P1 drawing )
49 | ( NHV drawing )
50 | ( PHV drawing )
51 | ( SP drawing )
52 | ( P2 drawing )
53 | ( NP drawing )
54 | ( PP drawing )
55 | ( C1 drawing )
56 | ( M1 drawing )
57 | ( PA drawing )
58 | ( P1 net )
59 | ( P2 net )
60 | ( C1 net )
61 | ( M1 net )
62 | ) ;techLayerPurposePriorities
63 |
64 | techDisplays(
65 | ;( LayerName Purpose Packet Vis Sel Con2ChgLy DrgEnbl Valid )
66 | ;( --------- ------- ------ --- --- --------- ------- ----- )
67 | ( NBL drawing NBL t t t t t )
68 | ( PBL drawing PBL t t t t t )
69 | ( PW drawing PW t t t t t )
70 | ( NW drawing NW t t t t t )
71 | ( PTOP drawing PTOP t t t t t )
72 | ( AA drawing AA t t t t t )
73 | ( VTH drawing VTH t t t t t )
74 | ( P1 drawing P1 t t t t t )
75 | ( NHV drawing NHV t t t t t )
76 | ( PHV drawing PHV t t t t t )
77 | ( SP drawing SP t t t t t )
78 | ( P2 drawing P2 t t t t t )
79 | ( NP drawing NP t t t t t )
80 | ( PP drawing PP t t t t t )
81 | ( C1 drawing C1 t t t t t )
82 | ( M1 drawing M1 t t t t t )
83 | ( PA drawing PA t t t t t )
84 | ( P1 net P1net t t t t nil )
85 | ( P2 net P2net t t t t nil )
86 | ( C1 net C1net t t t t nil )
87 | ( M1 net M1net t t t t nil )
88 | ) ;techDisplays
89 |
90 | techLayerProperties(
91 | ;( PropName Layer1 [ Layer2 ] PropValue )
92 | )
93 |
94 | ) ;layerDefinitions
95 |
96 |
97 |
--------------------------------------------------------------------------------
/ruby/testdata_2/test.layermap:
--------------------------------------------------------------------------------
1 |
2 | # A comment
3 |
4 | # layer purpose layer datatype
5 | # ------------------------------------
6 |
7 | NBL drawing 2 0
8 | PBL drawing 6 0
9 | PW drawing 1 0
10 | NW drawing 12 0
11 | PTOP drawing 25 0
12 | AA drawing 54 0
13 | VTH drawing 91 0
14 | P1 drawing 30 0
15 | NHV drawing 23 0
16 | PHV drawing 24 0
17 | SP drawing 3 0
18 | P2 drawing 31 0
19 | NP drawing 98 0
20 | PP drawing 97 0
21 | C1 drawing 9 0
22 | M1 drawing 10 0
23 | PA drawing 11 1
24 | P2 net 101
25 | P1 net 102
26 | M1 net 113
27 | C1 net 104
28 |
29 |
--------------------------------------------------------------------------------
/ruby/tests.rb:
--------------------------------------------------------------------------------
1 |
2 | # This program is distributed in the hope that it will be useful,
3 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
4 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 | # LICENSE file for details.
6 | #
7 | # DESCRIPTION: Cadence tech file importer - tests
8 |
9 | # Force load of import_tf.rb
10 | load File.join(File.dirname(__FILE__), "import_tf.rb")
11 |
12 | require 'test/unit'
13 | require 'test/unit/ui/console/testrunner'
14 |
15 | module TechfileToKLayout
16 |
17 | class TFImport_TestClass < Test::Unit::TestCase
18 |
19 | def test_read1
20 |
21 | begin
22 |
23 | lv = RBA::LayoutView::new
24 |
25 | tf_file = File.join(File.dirname(__FILE__), "testdata_1", "techfile.tf")
26 | TechfileToKLayout.import_techfile(lv, tf_file)
27 |
28 | lp = []
29 |
30 | li = lv.begin_layers
31 | while !li.at_end?
32 | lp << [
33 | li.current.fill_color,
34 | li.current.frame_color,
35 | li.current.dither_pattern,
36 | li.current.line_style,
37 | li.current.name,
38 | li.current.source,
39 | li.current.width,
40 | li.current.valid?,
41 | li.current.xfill?
42 | ]
43 | li.next
44 | end
45 |
46 | ensure
47 | lv._destroy
48 | end
49 |
50 | ref = [
51 | # fill color frame color dp ls name source w valid xfill
52 | [ 0xffd9e6ff, 0xffd9e6ff, 62, 9, 'NBL.drawing - 2/0', '2/0@1', 1, true, false ],
53 | [ 0xffffbff2, 0xffffbff2, 61, 8, 'PBL.drawing - 6/0', '6/0@1', 1, true, false ],
54 | [ 0xffbf4026, 0xffbf4026, 53, 8, 'PW.drawing - 1/0', '1/0@1', 1, true, false ],
55 | [ 0xff39bfff, 0xff39bfff, 47, 13, 'NW.drawing - 12/0', '12/0@1', 1, true, false ],
56 | [ 0xffe61f0d, 0xffe61f0d, 53, 8, 'PTOP.drawing - 25/0', '25/0@1', 1, true, false ],
57 | [ 0xffcccccc, 0xffcccccc, 47, 16, 'AA.drawing - 54/0', '54/0@1', 3, true, false ],
58 | [ 0xffe38b00, 0xffe38b00, 49, 8, 'VTH.drawing - 91/0', '91/0@1', 1, true, false ],
59 | [ 0xffe38b00, 0xffe38b00, 48, 8, 'P1.drawing - 30/0', '30/0@1', 1, true, false ],
60 | [ 0xff39bfff, 0xff39bfff, 53, 0, 'NHV.drawing - 23/0', '23/0@1', 0, true, false ],
61 | [ 0xffe38b00, 0xffe38b00, 56, 8, 'PHV.drawing - 24/0', '24/0@1', 1, true, false ],
62 | [ 0xffbf4026, 0xffbf4026, 54, 8, 'SP.drawing - 3/0', '3/0@1', 1, true, false ],
63 | [ 0xffbf4026, 0xffbf4026, 1, 8, 'P2.drawing - 31/0', '31/0@1', 1, true, false ],
64 | [ 0xff333399, 0xff333399, 47, 12, 'NP.drawing - 98/0', '98/0@1', 1, true, false ],
65 | [ 0xff802626, 0xff802626, 47, 8, 'PP.drawing - 97/0', '97/0@1', 1, true, false ],
66 | [ 0xff9900e6, 0xff9900e6, 1, 15, 'C1.drawing - 9/0', '9/0@1', 3, true, true ],
67 | [ 0xff268c6b, 0xff268c6b, 47, 8, 'M1.drawing - 10/0', '10/0@1', 1, true, false ],
68 | [ 0xff8c8ca6, 0xff8c8ca6, 59, 8, 'PA.drawing - 11/0', '11/0@1', 1, true, false ],
69 | [ 0xffe38b00, 0xffffffff, 48, 14, 'P1.net - 102/0', '102/0@1', 1, false, false ],
70 | [ 0xffbf4026, 0xffffffff, 1, 14, 'P2.net - 101/0', '101/0@1', 1, false, false ],
71 | [ 0xff9900e6, 0xffffffff, 1, 14, 'C1.net - 104/0', '104/0@1', 1, false, true ],
72 | [ 0xff268c6b, 0xffffffff, 47, 14, 'M1.net - 103/0', '103/0@1', 1, false, false ]
73 | ]
74 |
75 | [ ref.size, lp.size ].max.times do |i|
76 | assert_equal(ref[i].inspect, lp[i].inspect)
77 | end
78 |
79 | end
80 |
81 | def test_read2
82 |
83 | begin
84 |
85 | lv = RBA::LayoutView::new
86 |
87 | tf_file = File.join(File.dirname(__FILE__), "testdata_2", "techfile.tf")
88 | TechfileToKLayout.import_techfile(lv, tf_file)
89 |
90 | lp = []
91 |
92 | li = lv.begin_layers
93 | while !li.at_end?
94 | lp << [
95 | li.current.fill_color,
96 | li.current.frame_color,
97 | li.current.dither_pattern,
98 | li.current.line_style,
99 | li.current.name,
100 | li.current.source,
101 | li.current.width,
102 | li.current.valid?,
103 | li.current.xfill?
104 | ]
105 | li.next
106 | end
107 |
108 | ensure
109 | lv._destroy
110 | end
111 |
112 | ref = [
113 | # fill color frame color dp ls name source w valid xfill
114 | [ 0xffd9e6ff, 0xffd9e6ff, 62, 9, 'NBL.drawing - 2/0', '2/0@1', 1, true, false ],
115 | [ 0xffffbff2, 0xffffbff2, 61, 8, 'PBL.drawing - 6/0', '6/0@1', 1, true, false ],
116 | [ 0xffbf4026, 0xffbf4026, 53, 8, 'PW.drawing - 1/0', '1/0@1', 1, true, false ],
117 | [ 0xff39bfff, 0xff39bfff, 47, 13, 'NW.drawing - 12/0', '12/0@1', 1, true, false ],
118 | [ 0xffe61f0d, 0xffe61f0d, 53, 8, 'PTOP.drawing - 25/0', '25/0@1', 1, true, false ],
119 | [ 0xffcccccc, 0xffcccccc, 47, 16, 'AA.drawing - 54/0', '54/0@1', 3, true, false ],
120 | [ 0xffe38b00, 0xffe38b00, 49, 8, 'VTH.drawing - 91/0', '91/0@1', 1, true, false ],
121 | [ 0xffe38b00, 0xffe38b00, 48, 8, 'P1.drawing - 30/0', '30/0@1', 1, true, false ],
122 | [ 0xff39bfff, 0xff39bfff, 53, 0, 'NHV.drawing - 23/0', '23/0@1', 0, true, false ],
123 | [ 0xffe38b00, 0xffe38b00, 56, 8, 'PHV.drawing - 24/0', '24/0@1', 1, true, false ],
124 | [ 0xffbf4026, 0xffbf4026, 54, 8, 'SP.drawing - 3/0', '3/0@1', 1, true, false ],
125 | [ 0xffbf4026, 0xffbf4026, 1, 8, 'P2.drawing - 31/0', '31/0@1', 1, true, false ],
126 | [ 0xff333399, 0xff333399, 47, 12, 'NP.drawing - 98/0', '98/0@1', 1, true, false ],
127 | [ 0xff802626, 0xff802626, 47, 8, 'PP.drawing - 97/0', '97/0@1', 1, true, false ],
128 | [ 0xff9900e6, 0xff9900e6, 1, 15, 'C1.drawing - 9/0', '9/0@1', 3, true, true ],
129 | [ 0xff268c6b, 0xff268c6b, 47, 8, 'M1.drawing - 10/0', '10/0@1', 1, true, false ],
130 | [ 0xff8c8ca6, 0xff8c8ca6, 59, 8, 'PA.drawing - 11/1', '11/1@1', 1, true, false ],
131 | [ 0xffe38b00, 0xffffffff, 48, 14, 'P1.net - 102/0', '102/0@1', 1, false, false ],
132 | [ 0xffbf4026, 0xffffffff, 1, 14, 'P2.net - 101/0', '101/0@1', 1, false, false ],
133 | [ 0xff9900e6, 0xffffffff, 1, 14, 'C1.net - 104/0', '104/0@1', 1, false, true ],
134 | [ 0xff268c6b, 0xffffffff, 47, 14, 'M1.net - 113/0', '113/0@1', 1, false, false ]
135 | ]
136 |
137 | [ ref.size, lp.size ].max.times do |i|
138 | assert_equal(ref[i].inspect, lp[i].inspect)
139 | end
140 |
141 | end
142 |
143 | end
144 |
145 |
146 | # Runs the tests
147 |
148 | class TestRunner < Test::Unit::UI::Console::TestRunner
149 | def initialize(suite, *args)
150 | super(suite, *args)
151 | end
152 | def test_started(name)
153 | super
154 | end
155 | end
156 |
157 | err = 0
158 | self.constants.each do |c|
159 | if c.to_s =~ /_TestClass$/
160 | r = TestRunner::new(self.const_get(c), :output => $stdout).start
161 | err += r.error_count + r.failure_count
162 | end
163 | end
164 |
165 | err == 0 || $stderr.puts("Test(s) failed. See log for details")
166 |
167 | end
168 |
--------------------------------------------------------------------------------