1 # Copyright (C) 2013-2020 Roland Lutz
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 OUTPUT_FILE
= 'gaf/xmlwrite.out'
27 '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f' \
28 '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' \
29 ' !"#$%&\'()*+,-./0123456789:;<=>?' \
30 '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_' \
31 '`abcdefghijklmnopqrstuvwxyz{|}~\x7f' \
32 '\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f' \
33 '\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f' \
34 '\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf' \
35 '\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf' \
36 '\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf' \
37 '\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf' \
38 '\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef' \
39 '\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
41 rev
= xorn
.storage
.Revision()
42 sym_rev0
= xorn
.storage
.Revision()
43 sym_rev0
.add_object(xorn
.storage
.Net(color
= 17, is_pin
= True))
44 sym_rev1
= xorn
.storage
.Revision()
45 sym_rev1
.add_object(xorn
.storage
.Net(color
= 18, is_pin
= True))
46 sym_rev2
= xorn
.storage
.Revision()
47 sym_rev2
.add_object(xorn
.storage
.Net(color
= 19, is_pin
= True))
48 sym_rev3
= xorn
.storage
.Revision()
49 sym_rev3
.add_object(xorn
.storage
.Net(color
= 20, is_pin
= True))
51 symbol0
= gaf
.ref
.Symbol('a.sym', sym_rev0
, False)
52 symbol1
= gaf
.ref
.Symbol('b.sym', sym_rev1
, False)
53 symbol2
= gaf
.ref
.Symbol('c.sym', sym_rev2
, True)
54 symbol3
= gaf
.ref
.Symbol('d.sym', sym_rev3
, True)
55 symbol4
= gaf
.ref
.Symbol('a.sym', sym_rev3
, False)
56 pixmap0
= gaf
.ref
.Pixmap('pixmap0.png', PIXMAP_DATA
, False)
57 pixmap1
= gaf
.ref
.Pixmap('pixmap1.png', PIXMAP_DATA
, False)
58 pixmap2
= gaf
.ref
.Pixmap('pixmap2.png', PIXMAP_DATA
, True)
59 pixmap3
= gaf
.ref
.Pixmap('pixmap3.png', PIXMAP_DATA
, True)
61 line
= xorn
.storage
.LineAttr(width
= 1, cap_style
= 1, dash_style
= 2,
62 dash_length
= 3141, dash_space
= 5926)
63 fill
= xorn
.storage
.FillAttr(type = 2, width
= 1, angle0
= 53, pitch0
= 58,
64 angle1
= 97, pitch1
= 93)
67 xorn
.storage
.Arc(x
= 3141, y
= 5926, radius
= 5358,
68 startangle
= 97, sweepangle
= 93, color
= 3),
69 xorn
.storage
.Arc(color
= 17, line
= line
),
71 xorn
.storage
.Box(x
= 3141, y
= 5926,
72 width
= 5358, height
= 9793, color
= 3),
73 xorn
.storage
.Box(color
= 17, line
= line
, fill
= fill
),
75 xorn
.storage
.Circle(x
= 3141, y
= 5926, radius
= 5358, color
= 3),
76 xorn
.storage
.Circle(color
= 17, line
= line
, fill
= fill
),
78 xorn
.storage
.Component(x
= 3141, y
= 5926, selectable
= True,
80 xorn
.storage
.Component(selectable
= False, angle
= 270, mirror
= True,
82 xorn
.storage
.Component(selectable
= True, symbol
= symbol1
),
83 xorn
.storage
.Component(selectable
= True, symbol
= symbol2
),
84 xorn
.storage
.Component(selectable
= True, symbol
= symbol2
),
85 xorn
.storage
.Component(selectable
= True, symbol
= symbol3
),
87 xorn
.storage
.Line(x
= 3141, y
= 5926, width
= 5358, height
= 9793,
89 xorn
.storage
.Line(color
= 17, line
= line
),
91 xorn
.storage
.Net(x
= 3141, y
= 5926, width
= 5358, height
= 9793,
93 xorn
.storage
.Net(color
= 17),
94 xorn
.storage
.Net(color
= 10, is_bus
= True),
95 xorn
.storage
.Net(color
= 17, is_bus
= True),
96 xorn
.storage
.Net(color
= 1, is_pin
= True),
97 xorn
.storage
.Net(color
= 17, is_pin
= True),
98 xorn
.storage
.Net(color
= 1, is_pin
= True, is_inverted
= True),
99 xorn
.storage
.Net(color
= 1, is_pin
= True, is_bus
= True),
100 xorn
.storage
.Net(color
= 17, is_pin
= True, is_bus
= True),
102 xorn
.storage
.Path(pathdata
= 'M 0,0\nL 100,100\nz', color
= 3),
103 xorn
.storage
.Path(pathdata
= '', color
= 17, line
= line
, fill
= fill
),
105 xorn
.storage
.Picture(x
= 3141, y
= 5926, width
= 5358, height
= 9793,
107 xorn
.storage
.Picture(angle
= 270, mirror
= True, pixmap
= pixmap0
),
108 xorn
.storage
.Picture(pixmap
= pixmap1
),
109 xorn
.storage
.Picture(pixmap
= pixmap2
),
110 xorn
.storage
.Picture(pixmap
= pixmap2
),
111 xorn
.storage
.Picture(pixmap
= pixmap3
),
113 xorn
.storage
.Text(x
= 3141, y
= 5926, color
= 9, text_size
= 10,
114 visibility
= True, show_name_value
= 1,
115 angle
= 0, alignment
= 0, text
= 'foo'),
116 xorn
.storage
.Text(x
= 3141, y
= 5926, color
= 9, text_size
= 10,
117 visibility
= True, show_name_value
= 2,
118 angle
= 270, alignment
= 8, text
= 'foo'),
119 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
121 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
123 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
124 text
= 'foo\nbar=baz'),
125 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
127 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
128 text
= 'foo\\\\bar'),
129 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
131 xorn
.storage
.Text(color
= 9, text_size
= 10, visibility
= True,
132 text
= 'foo\\_bar\\_baz'),
133 xorn
.storage
.Text(color
= 5, text_size
= 10, visibility
= True,
135 xorn
.storage
.Text(color
= 5, text_size
= 10, visibility
= True,
136 text
= 'foo=bar\nbaz'),
137 xorn
.storage
.Text(color
= 5, text_size
= 10, visibility
= True,
138 text
= 'foo=bar\\baz'),
139 xorn
.storage
.Text(color
= 5, text_size
= 10, visibility
= True,
140 text
= 'foo=bar\\\\baz'),
141 xorn
.storage
.Text(color
= 5, text_size
= 10, visibility
= True,
142 text
= 'foo=bar\\_baz'),
143 xorn
.storage
.Text(color
= 5, text_size
= 10, visibility
= True,
144 text
= 'foo\\_bar=baz')]:
147 ob
= rev
.add_object(xorn
.storage
.Net(color
= 4))
148 attrib0
= rev
.add_object(xorn
.storage
.Text(
149 color
= 17, text_size
= 10, visibility
= True, text
= 'foo'))
150 attrib1
= rev
.add_object(xorn
.storage
.Text(
151 color
= 17, text_size
= 10, visibility
= True, text
= 'foo=bar'))
152 rev
.relocate_object(attrib0
, ob
, None)
153 rev
.relocate_object(attrib1
, ob
, None)
155 ob
= rev
.add_object(xorn
.storage
.Component(
156 selectable
= True, symbol
= symbol4
))
157 attrib0
= rev
.add_object(xorn
.storage
.Text(
158 color
= 17, text_size
= 10, visibility
= True, text
= 'foo'))
159 attrib1
= rev
.add_object(xorn
.storage
.Text(
160 color
= 17, text_size
= 10, visibility
= True, text
= 'foo=bar'))
161 rev
.relocate_object(attrib0
, ob
, None)
162 rev
.relocate_object(attrib1
, ob
, None)
164 gaf
.write
.write(xorn
.proxy
.RevisionProxy(rev
), OUTPUT_FILE
,
165 gaf
.fileformat
.FORMAT_SCH_XML
,
166 write_kwds
= { 'backup': False, 'fsync': False })
168 os
.execvp('diff', ['diff', '-u', sys
.argv
[0][:-3] + '.sch.xml', OUTPUT_FILE
])