File: read.at

package info (click to toggle)
fig2dev 1:3.2.7a-5+deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,556 kB
  • sloc: ansic: 35,809; sh: 5,401; makefile: 177; perl: 13; csh: 12
file content (241 lines) | stat: -rw-r--r-- 6,872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
dnl Fig2dev: Translate Fig code to various Devices
dnl Copyright (c) 1991 by Micah Beck
dnl Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
dnl Parts Copyright (c) 1989-2015 by Brian V. Smith
dnl Parts Copyright (c) 2015-2018 by Thomas Loimer
dnl 
dnl Any party obtaining a copy of these files is granted, free of charge, a
dnl full and unrestricted irrevocable, world-wide, paid up, royalty-free,
dnl nonexclusive right and license to deal in this software and documentation
dnl files (the "Software"), including without limitation the rights to use,
dnl copy, modify, merge, publish, distribute, sublicense and/or sell copies
dnl of the Software, and to permit persons who receive copies from any such
dnl party to do so, with the only requirement being that the above copyright
dnl and this permission notice remain intact.

dnl read.at
dnl Author: Thomas Loimer, 2017, 2018


AT_BANNER([Sanitize input files in read.c.])

AT_SETUP([co-incident points])
AT_KEYWORDS(read.c coincident)

AT_CHECK([fig2dev -L pict2e <<EOF | grep 'polygon\(([[0-9]]*,[[0-9]]*)\)\{4\}'
FIG_FILE_TOP
2 2 0 1 -1 -1 50 -1 -1 0.000 0 0 -1 0 0 8
	0 10200 1200 10200 1200 10200 1200 9225
	1200 9225 0 9225 0 10200 0 10200
EOF
],0,ignore)

AT_CLEANUP

AT_SETUP([open rectangle])
AT_KEYWORDS(read.c open)
AT_CHECK([fig2dev -L pict2e <<EOF | grep 'polygon\(([[0-9]]*,[[0-9]]*)\)\{4\}'
FIG_FILE_TOP
2 2 0 1 -1 -1 50 -1 -1 0.000 0 0 -1 0 0 4
	 0 10200 1200 10200 1200 9225 0 9225
EOF
],0,ignore,[An open rectangle at line 11 - close it.
])
AT_CLEANUP

AT_SETUP([open arc box])
AT_KEYWORDS(read.c open)
AT_CHECK([fig2dev -L pict2e <<EOF
FIG_FILE_TOP
2 4 0 1 -1 -1 50 -1 -1 0.000 0 0 15 0 0 4
	 0 10200 1200 10200 1200 9225 0 9225
EOF
],0,ignore,[An open rectangle with rounded corners at line 11 - close it.
])
AT_CLEANUP

AT_SETUP([open polygon])
AT_KEYWORDS(read.c open)
AT_CHECK([fig2dev -L pict2e <<EOF | grep 'polygon\(([[0-9]]*,[[0-9]]*)\)\{4\}'
FIG_FILE_TOP
2 3 0 1 -1 -1 50 -1 -1 0.000 0 0 15 0 0 5
	 0 10200 600 9825 1200 10200 1200 9225 0 9225
EOF
],0,ignore,[An open polygon at line 11 - close it.
])
AT_CLEANUP

AT_SETUP([convert box to polygon])
AT_KEYWORDS(read.c polygon)
AT_CHECK([fig2dev -L pict2e <<EOF | grep 'polygon\(([[0-9]]*,[[0-9]]*)\)\{3\}'
FIG_FILE_TOP
2 2 0 1 -1 -1 50 -1 -1 0.000 0 0 -1 0 0 4
	 0 10200 1200 9225 0 9225 0 10200
EOF
],0,ignore,[A rectangle with 3 corners at line 11 - convert to a polygon.
])
AT_CLEANUP

AT_SETUP([convert malformed, open box to a polygon])
AT_KEYWORDS(read.c open polygon)
AT_CHECK([fig2dev -L pict2e <<EOF
FIG_FILE_TOP
2 2 0 1 -1 -1 50 -1 -1 0.000 0 0 -1 0 0 3
	 0 10200 1200 9225 0 9225
EOF
],0,ignore,[An open rectangle at line 11 - close it.
A rectangle with 3 corners at line 11 - convert to a polygon.
])
AT_CLEANUP

AT_SETUP([fail on a malformed arc-box])
AT_KEYWORDS(read.c malformed arc-box)
AT_CHECK([fig2dev -L pict2e <<EOF
FIG_FILE_TOP
2 4 0 1 -1 -1 50 -1 -1 0.000 0 0 60 0 0 4
	 0 10200 1200 9225 0 9225 0 10200
EOF
],1,[],[A malformed rectangle with rounded corners at line 11 - it has 3 corners.
])
AT_CLEANUP

AT_SETUP([fail on a distorted arc-box])
AT_KEYWORDS(read.c distorted arc-box)
AT_CHECK([fig2dev -L pict2e <<EOF
FIG_FILE_TOP
2 4 0 1 -1 -1 50 -1 -1 0.000 0 0 60 0 0 5
	 0 10200 1210 10200 1200 9225 0 9225 0 10200
EOF
],1,[],[A distorted or inclined rectangle with rounded corners at line 11.
])
AT_CLEANUP

AT_SETUP([fail on a distorted arc-box])
AT_KEYWORDS(read.c distorted arc-box)
AT_CHECK([fig2dev -L pict2e <<EOF
FIG_FILE_TOP
2 4 0 1 -1 -1 50 -1 -1 0.000 0 0 60 0 0 5
	 0 10200 1200 10210 1200 9225 0 9225 0 10200
EOF
],1,[],[A distorted or inclined rectangle with rounded corners at line 11.
])
AT_CLEANUP

AT_SETUP([remove arrows tips from single point])
AT_KEYWORDS(read.c polyline)
AT_CHECK([fig2dev -L pict2e <<EOF
FIG_FILE_TOP
2 1 0 1 -1 -1 50 -1 -1 0. 0 0 0 1 1 1
	0 0 2. 120. 240.
	0 0 2. 120. 240.
	0 0
EOF
],0,ignore,[A single point with a forward arrow - remove the arrow.
A single point with a backward arrow - remove the arrow.
])
AT_CLEANUP

AT_SETUP([reject negative font type])
AT_KEYWORDS(read.c font)
AT_CHECK([fig2dev -L box <<EOF
FIG_FILE_TOP
4 0 0 1 0 -99999 12 0 4 135 360 0 0 A\001
EOF
],1,ignore,[Invalid text object at line 10.
])
AT_CLEANUP

AT_SETUP([survive debian bugs #881143, #881144])
AT_KEYWORDS([font pic tikz])
AT_CHECK([fig2dev -L pic <<EOF

22-222

4
0+4 71111111iNf7-3  3 3 0ítyn
EOF
],1,ignore,[Invalid text object.
])
AT_CHECK([fig2dev -L tikz <<EOF

 1  1

1

11 4-51

11 0 5
1
91
1 
c!!!!
EOF
],1,ignore,[Invalid text object.
])
AT_CLEANUP

AT_SETUP([reject out-of-range pattern, debian bug #881396])
AT_KEYWORDS([read.c])
AT_CHECK([fig2dev -L box <<EOF
FIG_FILE_TOP
3 0 0 0 0 0 0 0 123456789 0 0-0-0 00
EOF
],1,ignore,[Invalid spline object at line 10.
])
AT_CLEANUP

AT_SETUP([survive debian bug #890016])
AT_KEYWORDS([read1_3.c])
AT_CHECK([fig2dev -L box <<EOF
711111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111


0
1
16 3

16 6

0

16 6

0
1
1 6
1=6
EOF
],1,ignore,ignore)
AT_CLEANUP

AT_SETUP([process circle arrow at mag > 42, ticket #52])
AT_KEYWORDS([bound.c])
# With the -fsanitize=address option, a magnification >= 42 triggers an error.
# Without the -fsanitize=address option, a segfault only results
# if the array is accessed far enough from its valid range;
# Use a magnification of 420.
AT_CHECK([fig2dev -L box <<EOF
#FIG 3.2
Landscape
Center
Inches
Letter
42000.0
Single
-2
1200 2
2 1 0 1 0 7 50 -1 -1 0.0 0 0 -1 1 0 2
	5 0 1.0 60.0 120.0
	 0 0 600 0
EOF
], 0, ignore)
AT_CLEANUP

AT_BANNER([Dynamically allocate picture file name.])

AT_SETUP([prepend fig file path to picture file name])
AT_KEYWORDS(read.c picfilename)
AT_CHECK([fig2dev -L eps $srcdir/data/boxwimg.fig | \
	$FGREP "% Begin Imported EPS File: $srcdir/data/line.eps"
],0,ignore)
AT_CLEANUP