diff --git a/macros/import_tf.lym b/macros/import_tf.lym index 8b06d65..d4a8aa0 100644 --- a/macros/import_tf.lym +++ b/macros/import_tf.lym @@ -15,15 +15,10 @@ ruby # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# LICENSE file for details. # # DESCRIPTION: Cadence techfile import for KLayout. # diff --git a/macros/import_tf_standalone.rb b/macros/import_tf_standalone.rb index d4f8f68..fadeee8 100644 --- a/macros/import_tf_standalone.rb +++ b/macros/import_tf_standalone.rb @@ -1,16 +1,11 @@ # $autorun # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# LICENSE file for details. # -# DESCRIPTION: Cadence techfile converter for KLayout. +# DESCRIPTION: Cadence techfile converter for KLayout - batch mode interface # # Run the script with # klayout -z -rd tf_file=[input] -rd lyp_file=[output] -r import_tf_standalone.lym ... diff --git a/ruby/import_tf.rb b/ruby/import_tf.rb index 93fbe43..a14b720 100644 --- a/ruby/import_tf.rb +++ b/ruby/import_tf.rb @@ -1,15 +1,10 @@ # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# LICENSE file for details. # -# DESCRIPTION: Cadence techfile import for KLayout. +# DESCRIPTION: Cadence techfile import for KLayout - core functionality. # module TechfileToKLayout @@ -23,6 +18,7 @@ def initialize(_packet) frame_color = 0x808080 fill_color = 0x808080 width = 1 + xfill = false end attr_reader :packet @@ -31,6 +27,7 @@ def initialize(_packet) attr_accessor :frame_color attr_accessor :fill_color attr_accessor :width + attr_accessor :xfill end @@ -218,7 +215,7 @@ def self.import_techfile(lv, tf_file) if sname == "drDefinePacket" section.each do |defs| if defs.length >= 6 - packets[defs[1]] ||= [ defs[2], defs[3], defs[4], defs[5] ] + packets[defs[1]] ||= [ defs[2], defs[3], defs[4], defs[5], defs[6] ] end end elsif sname == "drDefineLineStyle" @@ -261,9 +258,10 @@ def self.import_techfile(lv, tf_file) packets.each do |k,v| stipple = stipples[v[0]] - line_style = line_styles[v[0]] + line_style = line_styles[v[1]] fill_color = colors[v[2]] frame_color = colors[v[3]] + xfill = v[4].to_s == "X" width = widths[v[1]] width ||= 0 @@ -273,6 +271,7 @@ def self.import_techfile(lv, tf_file) dd.line_style = line_style dd.fill_color = fill_color dd.frame_color = frame_color + dd.xfill = xfill dd.width = width end @@ -380,6 +379,8 @@ def self.import_techfile(lv, tf_file) lprops.frame_color = ldef.display.frame_color lprops.fill_color = ldef.display.fill_color lprops.visible = ldef.visible + lprops.valid = ldef.valid + lprops.xfill = ldef.display.xfill lprops.dither_pattern = ldef.display.stipple || 1 lprops.line_style = ldef.display.line_style || 0 lv.insert_layer(lv.end_layers, lprops) diff --git a/ruby/testdata_1/default.drf b/ruby/testdata_1/default.drf new file mode 100755 index 0000000..fe758e5 --- /dev/null +++ b/ruby/testdata_1/default.drf @@ -0,0 +1,323 @@ +drDefineDisplay( +;( DisplayName ) + ( display ) +) +drDefineColor( +;( DisplayName ColorsName Red Green Blue ) + ( display white 255 255 255 ) + ( display yellow 255 255 0 ) + ( display silver 217 230 255 ) + ( display cream 255 255 204 ) + ( display pink 255 191 242 ) + ( display magenta 255 0 255 ) + ( display lime 0 255 0 ) + ( display tan 255 230 191 ) + ( display cyan 0 255 255 ) + ( display cadetBlue 57 191 255 ) + ( display orange 227 139 0 ) + ( display red 255 0 0 ) + ( display purple 153 0 230 ) + ( display green 0 204 102 ) + ( display brown 191 64 38 ) + ( display blue 0 0 255 ) + ( display slate 140 140 166 ) + ( display gold 217 204 0 ) + ( display maroon 230 31 13 ) + ( display violet 94 0 230 ) + ( display forest 38 140 107 ) + ( display chocolate 128 38 38 ) + ( display navy 51 51 153 ) + ( display black 0 0 0 ) + ( display gray 204 204 217 ) + ( display winColor1 166 166 166 ) + ( display winColor2 115 115 115 ) + ( display winColor3 189 204 204 ) + ( display winColor4 204 204 204 ) + ( display winColor5 199 199 199 ) + ( display blinkRed 255 0 0 t ) + ( display blinkYellow 255 255 0 t ) + ( display blinkWhite 255 255 255 t ) +) +drDefineStipple( +;( DisplayName StippleName Bitmap ) + ( display dots ( ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 1 0 0 0 1 0 0 0 1 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 ) + ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) ) ) + ( display x ( ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) ) ) +) +drDefineLineStyle( +;( DisplayName LineStyle Size Pattern ) + ( display solid 1 (1 1 1 ) ) + ( display dashed 1 (1 1 1 1 0 0 ) ) + ( display dots 1 (1 0 0 ) ) + ( display dashDot 1 (1 1 1 0 0 1 0 0 ) ) + ( display shortDash 1 (1 1 0 0 ) ) + ( display doubleDash 1 (1 1 1 1 0 0 1 1 0 0 ) ) + ( display hidden 1 (1 0 0 0 ) ) + ( display thickLine 3 (1 1 1 ) ) + ( display thickDots 3 (1 0 0 ) ) +) +drDefinePacket( +;( DisplayName PacketName Stipple LineStyle Fill Outline [FillStyle]) + ( display AA dots thickDots winColor4 winColor4 outlineStipple) + ( display C1 blank thickLine purple purple X ) + ( display M1 dots solid forest forest outlineStipple) + ( display NBL x dashed silver silver outlineStipple) + ( display NHV slash dashDots cadetBlue cadetBlue outlineStipple) + ( display NP dots shortDash navy navy outlineStipple) + ( display NW dots doubleDash cadetBlue cadetBlue outlineStipple) + ( display P1 dots1 solid orange orange outlineStipple) + ( display P2 blank solid brown brown solid ) + ( display PA brick solid slate slate outlineStipple) + ( display PBL triangle solid pink pink outlineStipple) + ( display PHV vZigZag solid orange orange outlineStipple) + ( display PP dots solid chocolate chocolate outlineStipple) + ( display PTOP slash solid maroon maroon outlineStipple) + ( display PW slash solid brown brown outlineStipple) + ( display SP backSlash solid brown brown outlineStipple) + ( display VTH hLine solid orange orange outlineStipple) + ( display P1net dots1 hidden orange white outlineStipple) + ( display P2net blank hidden brown white outlineStipple) + ( display C1net blank hidden purple white X ) + ( display M1net dots hidden forest white outlineStipple) +) diff --git a/ruby/testdata_1/techfile.tf b/ruby/testdata_1/techfile.tf new file mode 100755 index 0000000..8bd2188 --- /dev/null +++ b/ruby/testdata_1/techfile.tf @@ -0,0 +1,140 @@ + +;******************************** +; LAYER DEFINITION +;******************************** +layerDefinitions( + + techPurposes( + ;( PurposeName Purpose# Abbreviation ) + ;( ----------- -------- ------------ ) + ( drawing 252 drw ) + ( net 253 net ) + ) ;techPurposes + + techLayers( + ;( LayerName Layer# Abbreviation ) + ;( --------- ------ ------------ ) + ;User-Defined Layers: + ( PW 1 PW ) + ( NBL 2 NBL ) + ( SP 3 SP ) + ( PBL 6 PBL ) + ( C1 9 C1 ) + ( M1 10 M1 ) + ( PA 11 PA ) + ( NW 12 NW ) + ( NHV 23 NHV ) + ( PHV 24 PHV ) + ( PTOP 25 PTOP ) + ( P1 30 P1 ) + ( P2 31 P2 ) + ( AA 54 AA ) + ( VTH 91 VTH ) + ( PP 97 PP ) + ( NP 98 NP ) + ) ;techLayers + + techLayerPurposePriorities( + ;layers are ordered from lowest to highest priority + ;( LayerName Purpose ) + ;( --------- ------- ) + ( NBL drawing ) + ( PBL drawing ) + ( PW drawing ) + ( NW drawing ) + ( PTOP drawing ) + ( AA drawing ) + ( VTH drawing ) + ( P1 drawing ) + ( NHV drawing ) + ( PHV drawing ) + ( SP drawing ) + ( P2 drawing ) + ( NP drawing ) + ( PP drawing ) + ( C1 drawing ) + ( M1 drawing ) + ( PA drawing ) + ( P1 net ) + ( P2 net ) + ( C1 net ) + ( M1 net ) + ) ;techLayerPurposePriorities + + techDisplays( + ;( LayerName Purpose Packet Vis Sel Con2ChgLy DrgEnbl Valid ) + ;( --------- ------- ------ --- --- --------- ------- ----- ) + ( NBL drawing NBL t t t t t ) + ( PBL drawing PBL t t t t t ) + ( PW drawing PW t t t t t ) + ( NW drawing NW t t t t t ) + ( PTOP drawing PTOP t t t t t ) + ( AA drawing AA t t t t t ) + ( VTH drawing VTH t t t t t ) + ( P1 drawing P1 t t t t t ) + ( NHV drawing NHV t t t t t ) + ( PHV drawing PHV t t t t t ) + ( SP drawing SP t t t t t ) + ( P2 drawing P2 t t t t t ) + ( NP drawing NP t t t t t ) + ( PP drawing PP t t t t t ) + ( C1 drawing C1 t t t t t ) + ( M1 drawing M1 t t t t t ) + ( PA drawing PA t t t t t ) + ( P1 net P1net t t t t nil ) + ( P2 net P2net t t t t nil ) + ( C1 net C1net t t t t nil ) + ( M1 net M1net t t t t nil ) + ) ;techDisplays + +techLayerProperties( +;( PropName Layer1 [ Layer2 ] PropValue ) +) + +) ;layerDefinitions + + +;******************************** +; LAYER RULES +;******************************** +layerRules( + + streamLayers( + ;( layer streamNumber dataType translate ) + ;( ----- ------------ -------- --------- ) + ( ("NBL" "drawing") 2 0 t ) + ( ("PBL" "drawing") 6 0 t ) + ( ("PW" "drawing") 1 0 t ) + ( ("NW" "drawing") 12 0 t ) + ( ("PTOP" "drawing") 25 0 t ) + ( ("AA" "drawing") 54 0 t ) + ( ("VTH" "drawing") 91 0 t ) + ( ("P1" "drawing") 30 0 t ) + ( ("NHV" "drawing") 23 0 t ) + ( ("PHV" "drawing") 24 0 t ) + ( ("SP" "drawing") 3 0 t ) + ( ("P2" "drawing") 31 0 t ) + ( ("NP" "drawing") 98 0 t ) + ( ("PP" "drawing") 97 0 t ) + ( ("C1" "drawing") 9 0 t ) + ( ("M1" "drawing") 10 0 t ) + ( ("PA" "drawing") 11 0 t ) + ( ("P2" "net") 101 0 t ) + ( ("P1" "net") 102 0 t ) + ( ("M1" "net") 103 0 t ) + ( ("C1" "net") 104 0 t ) + ) ;streamLayers + +) ;layerRules + + +;******************************** +; PHYSICAL RULES +;******************************** +physicalRules( + + mfgGridResolution( + ( 0.001000 ) + ) ;mfgGridResolution + +) ;physicalRules diff --git a/ruby/testdata_2/default.drf b/ruby/testdata_2/default.drf new file mode 100755 index 0000000..fe758e5 --- /dev/null +++ b/ruby/testdata_2/default.drf @@ -0,0 +1,323 @@ +drDefineDisplay( +;( DisplayName ) + ( display ) +) +drDefineColor( +;( DisplayName ColorsName Red Green Blue ) + ( display white 255 255 255 ) + ( display yellow 255 255 0 ) + ( display silver 217 230 255 ) + ( display cream 255 255 204 ) + ( display pink 255 191 242 ) + ( display magenta 255 0 255 ) + ( display lime 0 255 0 ) + ( display tan 255 230 191 ) + ( display cyan 0 255 255 ) + ( display cadetBlue 57 191 255 ) + ( display orange 227 139 0 ) + ( display red 255 0 0 ) + ( display purple 153 0 230 ) + ( display green 0 204 102 ) + ( display brown 191 64 38 ) + ( display blue 0 0 255 ) + ( display slate 140 140 166 ) + ( display gold 217 204 0 ) + ( display maroon 230 31 13 ) + ( display violet 94 0 230 ) + ( display forest 38 140 107 ) + ( display chocolate 128 38 38 ) + ( display navy 51 51 153 ) + ( display black 0 0 0 ) + ( display gray 204 204 217 ) + ( display winColor1 166 166 166 ) + ( display winColor2 115 115 115 ) + ( display winColor3 189 204 204 ) + ( display winColor4 204 204 204 ) + ( display winColor5 199 199 199 ) + ( display blinkRed 255 0 0 t ) + ( display blinkYellow 255 255 0 t ) + ( display blinkWhite 255 255 255 t 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1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) + ( 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 ) + ( 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ) ) ) +) +drDefineLineStyle( +;( DisplayName LineStyle Size Pattern ) + ( display solid 1 (1 1 1 ) ) + ( display dashed 1 (1 1 1 1 0 0 ) ) + ( display dots 1 (1 0 0 ) ) + ( display dashDot 1 (1 1 1 0 0 1 0 0 ) ) + ( display shortDash 1 (1 1 0 0 ) ) + ( display doubleDash 1 (1 1 1 1 0 0 1 1 0 0 ) ) + ( display hidden 1 (1 0 0 0 ) ) + ( display thickLine 3 (1 1 1 ) ) + ( display thickDots 3 (1 0 0 ) ) +) +drDefinePacket( +;( DisplayName PacketName Stipple LineStyle Fill Outline [FillStyle]) + ( display AA dots thickDots winColor4 winColor4 outlineStipple) + ( display C1 blank thickLine purple purple X ) + ( display M1 dots solid forest forest outlineStipple) + ( display NBL x dashed silver silver outlineStipple) + ( display NHV slash dashDots cadetBlue cadetBlue outlineStipple) + ( display NP dots shortDash navy navy outlineStipple) + ( display NW dots doubleDash cadetBlue cadetBlue outlineStipple) + ( display P1 dots1 solid orange orange outlineStipple) + ( display P2 blank solid brown brown solid ) + ( display PA brick solid slate slate outlineStipple) + ( display PBL triangle solid pink pink outlineStipple) + ( display PHV vZigZag solid orange orange outlineStipple) + ( display PP dots solid chocolate chocolate outlineStipple) + ( display PTOP slash solid maroon maroon outlineStipple) + ( display PW slash solid brown brown outlineStipple) + ( display SP backSlash solid brown brown outlineStipple) + ( display VTH hLine solid orange orange outlineStipple) + ( display P1net dots1 hidden orange white outlineStipple) + ( display P2net blank hidden brown white outlineStipple) + ( display C1net blank hidden purple white X ) + ( display M1net dots hidden forest white outlineStipple) +) diff --git a/ruby/testdata_2/techfile.tf b/ruby/testdata_2/techfile.tf new file mode 100755 index 0000000..8c03161 --- /dev/null +++ b/ruby/testdata_2/techfile.tf @@ -0,0 +1,96 @@ + +;******************************** +; LAYER DEFINITION +;******************************** +layerDefinitions( + + techPurposes( + ;( PurposeName Purpose# Abbreviation ) + ;( ----------- -------- ------------ ) + ( drawing 252 drw ) + ( net 253 net ) + ) ;techPurposes + + techLayers( + ;( LayerName Layer# Abbreviation ) + ;( --------- ------ ------------ ) + ;User-Defined Layers: + ( PW 1 PW ) + ( NBL 2 NBL ) + ( SP 3 SP ) + ( PBL 6 PBL ) + ( C1 9 C1 ) + ( M1 10 M1 ) + ( PA 11 PA ) + ( NW 12 NW ) + ( NHV 23 NHV ) + ( PHV 24 PHV ) + ( PTOP 25 PTOP ) + ( P1 30 P1 ) + ( P2 31 P2 ) + ( AA 54 AA ) + ( VTH 91 VTH ) + ( PP 97 PP ) + ( NP 98 NP ) + ) ;techLayers + + techLayerPurposePriorities( + ;layers are ordered from lowest to highest priority + ;( LayerName Purpose ) + ;( --------- ------- ) + ( NBL drawing ) + ( PBL drawing ) + ( PW drawing ) + ( NW drawing ) + ( PTOP drawing ) + ( AA drawing ) + ( VTH drawing ) + ( P1 drawing ) + ( NHV drawing ) + ( PHV drawing ) + ( SP drawing ) + ( P2 drawing ) + ( NP drawing ) + ( PP drawing ) + ( C1 drawing ) + ( M1 drawing ) + ( PA drawing ) + ( P1 net ) + ( P2 net ) + ( C1 net ) + ( M1 net ) + ) ;techLayerPurposePriorities + + techDisplays( + ;( LayerName Purpose Packet Vis Sel Con2ChgLy DrgEnbl Valid ) + ;( --------- ------- ------ --- --- --------- ------- ----- ) + ( NBL drawing NBL t t t t t ) + ( PBL drawing PBL t t t t t ) + ( PW drawing PW t t t t t ) + ( NW drawing NW t t t t t ) + ( PTOP drawing PTOP t t t t t ) + ( AA drawing AA t t t t t ) + ( VTH drawing VTH t t t t t ) + ( P1 drawing P1 t t t t t ) + ( NHV drawing NHV t t t t t ) + ( PHV drawing PHV t t t t t ) + ( SP drawing SP t t t t t ) + ( P2 drawing P2 t t t t t ) + ( NP drawing NP t t t t t ) + ( PP drawing PP t t t t t ) + ( C1 drawing C1 t t t t t ) + ( M1 drawing M1 t t t t t ) + ( PA drawing PA t t t t t ) + ( P1 net P1net t t t t nil ) + ( P2 net P2net t t t t nil ) + ( C1 net C1net t t t t nil ) + ( M1 net M1net t t t t nil ) + ) ;techDisplays + +techLayerProperties( +;( PropName Layer1 [ Layer2 ] PropValue ) +) + +) ;layerDefinitions + + diff --git a/ruby/testdata_2/test.layermap b/ruby/testdata_2/test.layermap new file mode 100644 index 0000000..d2b36f8 --- /dev/null +++ b/ruby/testdata_2/test.layermap @@ -0,0 +1,28 @@ + +# A comment + +# layer purpose layer datatype +# ------------------------------------ + + NBL drawing 2 0 + PBL drawing 6 0 + PW drawing 1 0 + NW drawing 12 0 + PTOP drawing 25 0 + AA drawing 54 0 + VTH drawing 91 0 + P1 drawing 30 0 + NHV drawing 23 0 + PHV drawing 24 0 + SP drawing 3 0 + P2 drawing 31 0 + NP drawing 98 0 + PP drawing 97 0 + C1 drawing 9 0 + M1 drawing 10 0 + PA drawing 11 1 + P2 net 101 + P1 net 102 + M1 net 113 + C1 net 104 + diff --git a/ruby/tests.rb b/ruby/tests.rb new file mode 100644 index 0000000..c7b5705 --- /dev/null +++ b/ruby/tests.rb @@ -0,0 +1,155 @@ + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# LICENSE file for details. +# +# DESCRIPTION: Cadence tech file importer - tests + +# Force load of import_tf.rb +load File.join(File.dirname(__FILE__), "import_tf.rb") + +require 'test/unit' +require 'test/unit/ui/console/testrunner' + +module TechfileToKLayout + + class TFImport_TestClass < Test::Unit::TestCase + + def test_read1 + + lv = RBA::LayoutView::new + + tf_file = File.join(File.dirname(__FILE__), "testdata_1", "techfile.tf") + TechfileToKLayout.import_techfile(lv, tf_file) + + lp = [] + + li = lv.begin_layers + while !li.at_end? + lp << [ + li.current.fill_color, + li.current.frame_color, + li.current.dither_pattern, + li.current.line_style, + li.current.name, + li.current.source, + li.current.width, + li.current.valid?, + li.current.xfill? + ] + li.next + end + + ref = [ + # fill color frame color dp ls name source w valid xfill + [ 0xffd9e6ff, 0xffd9e6ff, 62, 9, 'NBL.drawing - 2/0', '2/0@1', 1, true, false ], + [ 0xffffbff2, 0xffffbff2, 61, 8, 'PBL.drawing - 6/0', '6/0@1', 1, true, false ], + [ 0xffbf4026, 0xffbf4026, 53, 8, 'PW.drawing - 1/0', '1/0@1', 1, true, false ], + [ 0xff39bfff, 0xff39bfff, 47, 13, 'NW.drawing - 12/0', '12/0@1', 1, true, false ], + [ 0xffe61f0d, 0xffe61f0d, 53, 8, 'PTOP.drawing - 25/0', '25/0@1', 1, true, false ], + [ 0xffcccccc, 0xffcccccc, 47, 16, 'AA.drawing - 54/0', '54/0@1', 3, true, false ], + [ 0xffe38b00, 0xffe38b00, 49, 8, 'VTH.drawing - 91/0', '91/0@1', 1, true, false ], + [ 0xffe38b00, 0xffe38b00, 48, 8, 'P1.drawing - 30/0', '30/0@1', 1, true, false ], + [ 0xff39bfff, 0xff39bfff, 53, 0, 'NHV.drawing - 23/0', '23/0@1', 0, true, false ], + [ 0xffe38b00, 0xffe38b00, 56, 8, 'PHV.drawing - 24/0', '24/0@1', 1, true, false ], + [ 0xffbf4026, 0xffbf4026, 54, 8, 'SP.drawing - 3/0', '3/0@1', 1, true, false ], + [ 0xffbf4026, 0xffbf4026, 1, 8, 'P2.drawing - 31/0', '31/0@1', 1, true, false ], + [ 0xff333399, 0xff333399, 47, 12, 'NP.drawing - 98/0', '98/0@1', 1, true, false ], + [ 0xff802626, 0xff802626, 47, 8, 'PP.drawing - 97/0', '97/0@1', 1, true, false ], + [ 0xff9900e6, 0xff9900e6, 1, 15, 'C1.drawing - 9/0', '9/0@1', 3, true, true ], + [ 0xff268c6b, 0xff268c6b, 47, 8, 'M1.drawing - 10/0', '10/0@1', 1, true, false ], + [ 0xff8c8ca6, 0xff8c8ca6, 59, 8, 'PA.drawing - 11/0', '11/0@1', 1, true, false ], + [ 0xffe38b00, 0xffffffff, 48, 14, 'P1.net - 102/0', '102/0@1', 1, false, false ], + [ 0xffbf4026, 0xffffffff, 1, 14, 'P2.net - 101/0', '101/0@1', 1, false, false ], + [ 0xff9900e6, 0xffffffff, 1, 14, 'C1.net - 104/0', '104/0@1', 1, false, true ], + [ 0xff268c6b, 0xffffffff, 47, 14, 'M1.net - 103/0', '103/0@1', 1, false, false ] + ] + + [ ref.size, lp.size ].max.times do |i| + assert_equal(ref[i].inspect, lp[i].inspect) + end + + end + + def test_read2 + + lv = RBA::LayoutView::new + + tf_file = File.join(File.dirname(__FILE__), "testdata_2", "techfile.tf") + TechfileToKLayout.import_techfile(lv, tf_file) + + lp = [] + + li = lv.begin_layers + while !li.at_end? + lp << [ + li.current.fill_color, + li.current.frame_color, + li.current.dither_pattern, + li.current.line_style, + li.current.name, + li.current.source, + li.current.width, + li.current.valid?, + li.current.xfill? + ] + li.next + end + + ref = [ + # fill color frame color dp ls name source w valid xfill + [ 0xffd9e6ff, 0xffd9e6ff, 62, 9, 'NBL.drawing - 2/0', '2/0@1', 1, true, false ], + [ 0xffffbff2, 0xffffbff2, 61, 8, 'PBL.drawing - 6/0', '6/0@1', 1, true, false ], + [ 0xffbf4026, 0xffbf4026, 53, 8, 'PW.drawing - 1/0', '1/0@1', 1, true, false ], + [ 0xff39bfff, 0xff39bfff, 47, 13, 'NW.drawing - 12/0', '12/0@1', 1, true, false ], + [ 0xffe61f0d, 0xffe61f0d, 53, 8, 'PTOP.drawing - 25/0', '25/0@1', 1, true, false ], + [ 0xffcccccc, 0xffcccccc, 47, 16, 'AA.drawing - 54/0', '54/0@1', 3, true, false ], + [ 0xffe38b00, 0xffe38b00, 49, 8, 'VTH.drawing - 91/0', '91/0@1', 1, true, false ], + [ 0xffe38b00, 0xffe38b00, 48, 8, 'P1.drawing - 30/0', '30/0@1', 1, true, false ], + [ 0xff39bfff, 0xff39bfff, 53, 0, 'NHV.drawing - 23/0', '23/0@1', 0, true, false ], + [ 0xffe38b00, 0xffe38b00, 56, 8, 'PHV.drawing - 24/0', '24/0@1', 1, true, false ], + [ 0xffbf4026, 0xffbf4026, 54, 8, 'SP.drawing - 3/0', '3/0@1', 1, true, false ], + [ 0xffbf4026, 0xffbf4026, 1, 8, 'P2.drawing - 31/0', '31/0@1', 1, true, false ], + [ 0xff333399, 0xff333399, 47, 12, 'NP.drawing - 98/0', '98/0@1', 1, true, false ], + [ 0xff802626, 0xff802626, 47, 8, 'PP.drawing - 97/0', '97/0@1', 1, true, false ], + [ 0xff9900e6, 0xff9900e6, 1, 15, 'C1.drawing - 9/0', '9/0@1', 3, true, true ], + [ 0xff268c6b, 0xff268c6b, 47, 8, 'M1.drawing - 10/0', '10/0@1', 1, true, false ], + [ 0xff8c8ca6, 0xff8c8ca6, 59, 8, 'PA.drawing - 11/1', '11/1@1', 1, true, false ], + [ 0xffe38b00, 0xffffffff, 48, 14, 'P1.net - 102/0', '102/0@1', 1, false, false ], + [ 0xffbf4026, 0xffffffff, 1, 14, 'P2.net - 101/0', '101/0@1', 1, false, false ], + [ 0xff9900e6, 0xffffffff, 1, 14, 'C1.net - 104/0', '104/0@1', 1, false, true ], + [ 0xff268c6b, 0xffffffff, 47, 14, 'M1.net - 113/0', '113/0@1', 1, false, false ] + ] + + [ ref.size, lp.size ].max.times do |i| + assert_equal(ref[i].inspect, lp[i].inspect) + end + + end + + end + + + # Runs the tests + + class TestRunner < Test::Unit::UI::Console::TestRunner + def initialize(suite, *args) + super(suite, *args) + end + def test_started(name) + super + end + end + + err = 0 + self.constants.each do |c| + if c.to_s =~ /_TestClass$/ + r = TestRunner::new(self.const_get(c), :output => $stdout).start + err += r.error_count + r.failure_count + end + end + + err == 0 || $stderr.puts("Test(s) failed. See log for details") + +end \ No newline at end of file