Root/components/gencon.pl

Source at commit c3ebae8a401760e605111cff4a3f1447e76b4d6c created 4 years 8 days ago.
By Werner Almesberger, components/gencon.pl: put spaces around operators
1#!/usr/bin/perl
2#
3# gencon.pl - Generate generic connectors
4#
5# Copyright 2012 by Werner Almesberger
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12
13print "EESchema-LIBRARY Version 2.3 Date: `date`\n";
14print "#encoding utf-8\n";
15for ($x = 1; $x <= 40; $x++) {
16    for ($y = 1; $y <= 2; $y++) {
17        $name = "CONN_$x";
18        $name .= "X$y" if $y > 1;
19        print "#\n# $name\n#\n";
20        print "DEF $name CON 0 40 Y N 1 F N\n";
21        $h = $x / 2 * 100;
22        print "F0 \"CON\" 0 " . ($h + 50) . " 60 H V C CNN\n";
23        print "F1 \"$name\" 0 " . (-$h - 50) . " 60 H V C CNN\n";
24        print "DRAW\n";
25        print "S -100 -$h 100 $h 0 1 0 N\n";
26        $n = 1;
27        for ($px = 1; $px <= $x; $px++) {
28            for ($py = 1; $py <= $y; $py++) {
29                print "X $n $n " . (400 * ($py - 1.5) * 2) .
30                    " " . ($h - $px * 100 + 50) . " 300 " .
31                    ("?", "R", "L")[$py] . " 50 50 1 1 P\n";
32                $n++;
33            }
34        }
35        print "ENDDRAW\n";
36        print "ENDDEF\n";
37    }
38}
39print "#\n#End Library\n";
40

Archive Download this file

Branches:
master



interactive