Rev 231 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 231 | Rev 239 | ||
|---|---|---|---|
| Line 17... | Line 17... | ||
| 17 | my $blockname; |
17 | my $blockname; |
| 18 | 18 | ||
| 19 | # vars used later too
|
19 | # vars used later too
|
| 20 | #my (%x, %y);
|
20 | #my (%x, %y);
|
| 21 | 21 | ||
| - | 22 | my %pindata; |
|
| - | 23 | ||
| 22 | # vars used during parsing
|
24 | # vars used during parsing
|
| 23 | my ($side, $busmode, $errors) = ('',0, 0); |
25 | my ($side, $busmode, $errors) = ('',0, 0); |
| 24 | # main loop which parses file
|
26 | # main loop which parses file
|
| 25 | while (<>) { |
27 | while (<>) { |
| 26 | # skip empty lines
|
28 | # skip empty lines
|
| Line 122... | Line 124... | ||
| 122 | $bubble{$pin} = 1 if $flags =~ /!/; |
124 | $bubble{$pin} = 1 if $flags =~ /!/; |
| 123 | $edge{$pin} = 1 if $flags =~ />/; |
125 | $edge{$pin} = 1 if $flags =~ />/; |
| 124 | } else { |
126 | } else { |
| 125 | $pinlabel{$pin} = $rest; |
127 | $pinlabel{$pin} = $rest; |
| 126 | }
|
128 | }
|
| - | 129 | ||
| - | 130 | # if pin has known suffix so it has pintype, maybe we have to rework current format too
|
|
| - | 131 | if ($pinlabel{$pin} =~ /type:([a-zA-Z]+)/) { |
|
| - | 132 | my $type = $1; |
|
| - | 133 | printf STDERR "Found pintype %s\n", $type; |
|
| - | 134 | $pinlabel{$pin} =~ s/type:$type//; |
|
| - | 135 | $pindata{$pin}{type} = $type; |
|
| - | 136 | }
|
|
| - | 137 | $pinlabel{$pin} =~ s/^ +//; |
|
| - | 138 | $pinlabel{$pin} =~ s/ +$//; |
|
| 127 | 139 | ||
| 128 | $rlen{$pin} = &textlen($pinlabel{$pin}); |
140 | $rlen{$pin} = &textlen($pinlabel{$pin}); |
| 129 | 141 | ||
| 130 | if ($pinnumwidth < &textlen($pin)) { |
142 | if ($pinnumwidth < &textlen($pin)) { |
| 131 | $pinnumwidth = &textlen($pin); |
143 | $pinnumwidth = &textlen($pin); |
| Line 357... | Line 369... | ||
| 357 | }
|
369 | }
|
| 358 | printf("P %d %d %d %d 1 0 0\n", |
370 | printf("P %d %d %d %d 1 0 0\n", |
| 359 | $pinx{$pin} - $pinnumwidth, $piny{$pin}, $x, $piny{$pin}); |
371 | $pinx{$pin} - $pinnumwidth, $piny{$pin}, $x, $piny{$pin}); |
| 360 | print "{\n"; |
372 | print "{\n"; |
| 361 | &pltext($pinx{$pin} + $px, $piny{$pin}, 1, $pinlabel{$pin}); |
373 | &pltext($pinx{$pin} + $px, $piny{$pin}, 1, $pinlabel{$pin}); |
| - | 374 | ||
| - | 375 | # pintype
|
|
| - | 376 | if (defined $pindata{$pin} && defined $pindata{$pin}{type}) { |
|
| - | 377 | printf("T %d %d 5 8 1 1 0 8 1\n%s\n", $pinx{$pin} - 50, |
|
| - | 378 | $piny{$pin} - 25, $pindata{$pin}{type}); |
|
| - | 379 | }
|
|
| 362 | &ntext($pinx{$pin} -100, $piny{$pin} + 50, 6, $pin); |
380 | &ntext($pinx{$pin} -100, $piny{$pin} + 50, 6, $pin); |
| 363 | print "}\n"; |
381 | print "}\n"; |
| 364 | }
|
382 | }
|
| 365 | 383 | ||
| 366 | sub drawpin_right { |
384 | sub drawpin_right { |
| Line 383... | Line 401... | ||
| 383 | }
|
401 | }
|
| 384 | printf("P %d %d %d %d 1 0 0\n", |
402 | printf("P %d %d %d %d 1 0 0\n", |
| 385 | $pinx{$pin} + $pinnumwidth, $piny{$pin}, $x, $piny{$pin}); |
403 | $pinx{$pin} + $pinnumwidth, $piny{$pin}, $x, $piny{$pin}); |
| 386 | print "{\n"; |
404 | print "{\n"; |
| 387 | &pltext($pinx{$pin} - $px, $piny{$pin}, 7, $pinlabel{$pin}); |
405 | &pltext($pinx{$pin} - $px, $piny{$pin}, 7, $pinlabel{$pin}); |
| - | 406 | ||
| - | 407 | # pintype
|
|
| - | 408 | if (defined $pindata{$pin} && defined $pindata{$pin}{type}) { |
|
| - | 409 | printf("T %d %d 5 8 1 1 0 2 1\n%s\n", $pinx{$pin} + 50, |
|
| - | 410 | $piny{$pin} - 25, $pindata{$pin}{type}); |
|
| - | 411 | }
|
|
| - | 412 | ||
| 388 | &ntext($pinx{$pin} +100, $piny{$pin} + 50, 0, $pin); |
413 | &ntext($pinx{$pin} +100, $piny{$pin} + 50, 0, $pin); |
| 389 | print "}\n"; |
414 | print "}\n"; |
| 390 | }
|
415 | }
|
| 391 | 416 | ||
| 392 | sub ntext { |
417 | sub ntext { |