annotate gcc/testsuite/gcc.c-torture/compile/920428-2.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
1 /* { dg-require-effective-target indirect_calls } */
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
2
111
kono
parents:
diff changeset
3 double sin(double x);
kono
parents:
diff changeset
4 double cos(double x);
kono
parents:
diff changeset
5 double tan(double x);
kono
parents:
diff changeset
6 double asin(double x);
kono
parents:
diff changeset
7 double acos(double x);
kono
parents:
diff changeset
8 double atan(double x);
kono
parents:
diff changeset
9 double atan2(double y, double x);
kono
parents:
diff changeset
10 double sinh(double x);
kono
parents:
diff changeset
11 double cosh(double x);
kono
parents:
diff changeset
12 double tanh(double x);
kono
parents:
diff changeset
13 double exp(double x);
kono
parents:
diff changeset
14 double expm1(double x);
kono
parents:
diff changeset
15 double log(double x);
kono
parents:
diff changeset
16 double log10(double x);
kono
parents:
diff changeset
17 double log1p(double x);
kono
parents:
diff changeset
18 double pow(double x, double y);
kono
parents:
diff changeset
19 double sqrt(double x);
kono
parents:
diff changeset
20 double cbrt(double x);
kono
parents:
diff changeset
21 double ceil(double x);
kono
parents:
diff changeset
22 double floor(double x);
kono
parents:
diff changeset
23 double fabs(double x);
kono
parents:
diff changeset
24 double frexp(double value, int *eptr);
kono
parents:
diff changeset
25 double ldexp(double value, int exp);
kono
parents:
diff changeset
26 double modf(double value, double *iptr);
kono
parents:
diff changeset
27 double erf(double x);
kono
parents:
diff changeset
28 double erfc(double x);
kono
parents:
diff changeset
29 double atof(const char *nptr);
kono
parents:
diff changeset
30 double hypot(double x, double y);
kono
parents:
diff changeset
31 double lgamma(double x);
kono
parents:
diff changeset
32 double j0(double x);
kono
parents:
diff changeset
33 double j1(double x);
kono
parents:
diff changeset
34 double jn(int n, double x);
kono
parents:
diff changeset
35 double y0(double x);
kono
parents:
diff changeset
36 double y1(double x);
kono
parents:
diff changeset
37 double yn(int n, double x);
kono
parents:
diff changeset
38 extern struct _iobuf {
kono
parents:
diff changeset
39 int _cnt;
kono
parents:
diff changeset
40 char *_ptr;
kono
parents:
diff changeset
41 char *_base;
kono
parents:
diff changeset
42 int _bufsiz;
kono
parents:
diff changeset
43 short _flag;
kono
parents:
diff changeset
44 char _file;
kono
parents:
diff changeset
45 } _iob[];
kono
parents:
diff changeset
46 typedef __SIZE_TYPE__ size_t;
kono
parents:
diff changeset
47 typedef char *va_list;
kono
parents:
diff changeset
48 struct _iobuf *fopen(const char *filename, const char *type);
kono
parents:
diff changeset
49 struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream);
kono
parents:
diff changeset
50 struct _iobuf *fdopen(int fildes, const char *type);
kono
parents:
diff changeset
51 struct _iobuf *popen(const char *command, const char *type);
kono
parents:
diff changeset
52 int pclose(struct _iobuf *stream);
kono
parents:
diff changeset
53 int fflush(struct _iobuf *stream);
kono
parents:
diff changeset
54 int fclose(struct _iobuf *stream);
kono
parents:
diff changeset
55 int remove(const char *path);
kono
parents:
diff changeset
56 int rename(const char *from, const char *to);
kono
parents:
diff changeset
57 struct _iobuf *tmpfile(void);
kono
parents:
diff changeset
58 char *tmpnam(char *s);
kono
parents:
diff changeset
59 int setvbuf(struct _iobuf *iop, char *buf, int type, size_t size);
kono
parents:
diff changeset
60 int setbuf(struct _iobuf *stream, char *buf);
kono
parents:
diff changeset
61 int setbuffer(struct _iobuf *stream, char *buf, size_t size);
kono
parents:
diff changeset
62 int setlinebuf(struct _iobuf *stream);
kono
parents:
diff changeset
63 int fprintf(struct _iobuf *stream, const char *format, ...);
kono
parents:
diff changeset
64 int printf(const char *format, ...);
kono
parents:
diff changeset
65 char *sprintf(char *s, const char *format, ...);
kono
parents:
diff changeset
66 int vfprintf(struct _iobuf *stream, const char *format, va_list arg);
kono
parents:
diff changeset
67 int vprintf(const char *format, va_list arg);
kono
parents:
diff changeset
68 int vsprintf(char *s, const char *format, va_list arg);
kono
parents:
diff changeset
69 int fscanf(struct _iobuf *stream, const char *format, ...);
kono
parents:
diff changeset
70 int scanf(const char *format, ...);
kono
parents:
diff changeset
71 int sscanf(char *s, const char *format, ...);
kono
parents:
diff changeset
72 int fgetc(struct _iobuf *stream);
kono
parents:
diff changeset
73 int getw(struct _iobuf *stream);
kono
parents:
diff changeset
74 char *fgets(char *s, int n, struct _iobuf *stream);
kono
parents:
diff changeset
75 char *gets(char *s);
kono
parents:
diff changeset
76 int fputc(int c, struct _iobuf *stream);
kono
parents:
diff changeset
77 int putw(int w, struct _iobuf *stream);
kono
parents:
diff changeset
78 int fputs(const char *s, struct _iobuf *stream);
kono
parents:
diff changeset
79 int puts(const char *s);
kono
parents:
diff changeset
80 int ungetc(int c, struct _iobuf *stream);
kono
parents:
diff changeset
81 int fread(void *ptr, size_t size, size_t count, struct _iobuf *iop);
kono
parents:
diff changeset
82 int fwrite(const void *ptr, size_t size, size_t count, struct _iobuf *iop);
kono
parents:
diff changeset
83 int fseek(struct _iobuf *stream, long offset, int ptrname);
kono
parents:
diff changeset
84 long ftell(struct _iobuf *stream);
kono
parents:
diff changeset
85 void rewind(struct _iobuf *stream);
kono
parents:
diff changeset
86 int fgetpos(struct _iobuf *stream, long *pos);
kono
parents:
diff changeset
87 int fsetpos(struct _iobuf *stream, const long *pos);
kono
parents:
diff changeset
88 void perror(const char *s);
kono
parents:
diff changeset
89 typedef unsigned char byte;
kono
parents:
diff changeset
90 typedef unsigned char uchar;
kono
parents:
diff changeset
91 typedef unsigned short ushort;
kono
parents:
diff changeset
92 typedef unsigned int uint;
kono
parents:
diff changeset
93 typedef unsigned long ulong;
kono
parents:
diff changeset
94 typedef unsigned char u_char;
kono
parents:
diff changeset
95 typedef unsigned short u_short;
kono
parents:
diff changeset
96 typedef unsigned int u_int;
kono
parents:
diff changeset
97 typedef unsigned long u_long;
kono
parents:
diff changeset
98 typedef unsigned short ushort_;
kono
parents:
diff changeset
99 typedef struct _physadr { int r[1]; } *physadr;
kono
parents:
diff changeset
100 typedef struct label_t {
kono
parents:
diff changeset
101 int val[11];
kono
parents:
diff changeset
102 } label_t;
kono
parents:
diff changeset
103 typedef struct _quad { long val[2]; } quad;
kono
parents:
diff changeset
104 typedef long daddr_t;
kono
parents:
diff changeset
105 typedef char * caddr_t;
kono
parents:
diff changeset
106 typedef u_long ino_t;
kono
parents:
diff changeset
107 typedef long swblk_t;
kono
parents:
diff changeset
108 typedef long time_t;
kono
parents:
diff changeset
109 typedef short dev_t;
kono
parents:
diff changeset
110 typedef long off_t;
kono
parents:
diff changeset
111 typedef u_short uid_t;
kono
parents:
diff changeset
112 typedef u_short gid_t;
kono
parents:
diff changeset
113 typedef signed char prio_t;
kono
parents:
diff changeset
114 typedef long fd_mask;
kono
parents:
diff changeset
115 typedef struct fd_set {
kono
parents:
diff changeset
116 fd_mask fds_bits[(((256 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ];
kono
parents:
diff changeset
117 } fd_set;
kono
parents:
diff changeset
118 typedef struct qhdr {
kono
parents:
diff changeset
119 struct qhdr *link, *rlink;
kono
parents:
diff changeset
120 } *queue_t;
kono
parents:
diff changeset
121 typedef char *ptr_ord_t;
kono
parents:
diff changeset
122 typedef double floatp;
kono
parents:
diff changeset
123 typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name );
kono
parents:
diff changeset
124 typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name );
kono
parents:
diff changeset
125 extern struct _iobuf *gs_out;
kono
parents:
diff changeset
126 typedef struct gs_point_s {
kono
parents:
diff changeset
127 double x, y;
kono
parents:
diff changeset
128 } gs_point;
kono
parents:
diff changeset
129 typedef struct gs_int_point_s {
kono
parents:
diff changeset
130 int x, y;
kono
parents:
diff changeset
131 } gs_int_point;
kono
parents:
diff changeset
132 typedef struct gs_rect_s {
kono
parents:
diff changeset
133 gs_point p, q;
kono
parents:
diff changeset
134 } gs_rect;
kono
parents:
diff changeset
135 typedef struct gs_int_rect_s {
kono
parents:
diff changeset
136 gs_int_point p, q;
kono
parents:
diff changeset
137 } gs_int_rect;
kono
parents:
diff changeset
138 typedef struct gs_state_s gs_state;
kono
parents:
diff changeset
139 typedef struct {
kono
parents:
diff changeset
140 proc_alloc_t alloc;
kono
parents:
diff changeset
141 proc_free_t free;
kono
parents:
diff changeset
142 } gs_memory_procs;
kono
parents:
diff changeset
143 char *gs_malloc(uint, uint, const char * );
kono
parents:
diff changeset
144 void gs_free(char *, uint, uint, const char * );
kono
parents:
diff changeset
145 extern char gs_debug[128];
kono
parents:
diff changeset
146 extern int gs_log_error(int, const char *, int );
kono
parents:
diff changeset
147 typedef long fixed;
kono
parents:
diff changeset
148 typedef struct gs_fixed_point_s {
kono
parents:
diff changeset
149 fixed x, y;
kono
parents:
diff changeset
150 } gs_fixed_point;
kono
parents:
diff changeset
151 typedef struct gs_fixed_rect_s {
kono
parents:
diff changeset
152 gs_fixed_point p, q;
kono
parents:
diff changeset
153 } gs_fixed_rect;
kono
parents:
diff changeset
154 typedef struct gs_matrix_s {
kono
parents:
diff changeset
155 long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty;
kono
parents:
diff changeset
156 } gs_matrix;
kono
parents:
diff changeset
157 void gs_make_identity(gs_matrix * );
kono
parents:
diff changeset
158 int gs_make_translation(floatp, floatp, gs_matrix * ),
kono
parents:
diff changeset
159 gs_make_scaling(floatp, floatp, gs_matrix * ),
kono
parents:
diff changeset
160 gs_make_rotation(floatp, gs_matrix * );
kono
parents:
diff changeset
161 int gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ),
kono
parents:
diff changeset
162 gs_matrix_invert(const gs_matrix *, gs_matrix * ),
kono
parents:
diff changeset
163 gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * );
kono
parents:
diff changeset
164 int gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ),
kono
parents:
diff changeset
165 gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ),
kono
parents:
diff changeset
166 gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ),
kono
parents:
diff changeset
167 gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ),
kono
parents:
diff changeset
168 gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * );
kono
parents:
diff changeset
169 typedef struct gs_matrix_fixed_s {
kono
parents:
diff changeset
170 long _xx; float xx; long _xy; float xy; long _yx; float yx; long _yy; float yy; long _tx; float tx; long _ty; float ty;
kono
parents:
diff changeset
171 fixed tx_fixed, ty_fixed;
kono
parents:
diff changeset
172 } gs_matrix_fixed;
kono
parents:
diff changeset
173 extern void gs_update_matrix_fixed(gs_matrix_fixed * );
kono
parents:
diff changeset
174 int gs_point_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * ),
kono
parents:
diff changeset
175 gs_distance_transform2fixed(gs_matrix_fixed *, floatp, floatp, gs_fixed_point * );
kono
parents:
diff changeset
176 typedef struct {
kono
parents:
diff changeset
177 long xx, xy, yx, yy;
kono
parents:
diff changeset
178 int skewed;
kono
parents:
diff changeset
179 int shift;
kono
parents:
diff changeset
180 int max_bits;
kono
parents:
diff changeset
181 fixed round;
kono
parents:
diff changeset
182 } fixed_coeff;
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 typedef enum {
kono
parents:
diff changeset
185 gs_cap_butt = 0,
kono
parents:
diff changeset
186 gs_cap_round = 1,
kono
parents:
diff changeset
187 gs_cap_square = 2
kono
parents:
diff changeset
188 } gs_line_cap;
kono
parents:
diff changeset
189 typedef enum {
kono
parents:
diff changeset
190 gs_join_miter = 0,
kono
parents:
diff changeset
191 gs_join_round = 1,
kono
parents:
diff changeset
192 gs_join_bevel = 2
kono
parents:
diff changeset
193 } gs_line_join;
kono
parents:
diff changeset
194 gs_state *gs_state_alloc(proc_alloc_t, proc_free_t );
kono
parents:
diff changeset
195 int gs_state_free(gs_state * );
kono
parents:
diff changeset
196 int gs_gsave(gs_state * ),
kono
parents:
diff changeset
197 gs_grestore(gs_state * ),
kono
parents:
diff changeset
198 gs_grestoreall(gs_state * );
kono
parents:
diff changeset
199 gs_state *gs_gstate(gs_state * );
kono
parents:
diff changeset
200 int gs_currentgstate(gs_state * , const gs_state * ),
kono
parents:
diff changeset
201 gs_setgstate(gs_state * , const gs_state * );
kono
parents:
diff changeset
202 gs_state *gs_state_swap_saved(gs_state *, gs_state * );
kono
parents:
diff changeset
203 void gs_state_swap(gs_state *, gs_state * );
kono
parents:
diff changeset
204 int gs_initgraphics(gs_state * );
kono
parents:
diff changeset
205 typedef struct gx_device_s gx_device;
kono
parents:
diff changeset
206 int gs_flushpage(gs_state * );
kono
parents:
diff changeset
207 int gs_copypage(gs_state * );
kono
parents:
diff changeset
208 int gs_output_page(gs_state *, int, int );
kono
parents:
diff changeset
209 int gs_copyscanlines(gx_device *, int, byte *, uint, int *, uint * );
kono
parents:
diff changeset
210 gx_device * gs_getdevice(int );
kono
parents:
diff changeset
211 int gs_copydevice(gx_device **, gx_device *, proc_alloc_t );
kono
parents:
diff changeset
212 int gs_makeimagedevice(gx_device **, gs_matrix *, uint, uint, byte *, int, proc_alloc_t );
kono
parents:
diff changeset
213 void gs_nulldevice(gs_state * );
kono
parents:
diff changeset
214 int gs_setdevice(gs_state *, gx_device * );
kono
parents:
diff changeset
215 gx_device * gs_currentdevice(gs_state * );
kono
parents:
diff changeset
216 const char * gs_devicename(gx_device * );
kono
parents:
diff changeset
217 void gs_deviceinitialmatrix(gx_device *, gs_matrix * );
kono
parents:
diff changeset
218 int gs_closedevice(gx_device * );
kono
parents:
diff changeset
219 int gs_setlinewidth(gs_state *, floatp );
kono
parents:
diff changeset
220 float gs_currentlinewidth(const gs_state * );
kono
parents:
diff changeset
221 int gs_setlinecap(gs_state *, gs_line_cap );
kono
parents:
diff changeset
222 gs_line_cap gs_currentlinecap(const gs_state * );
kono
parents:
diff changeset
223 int gs_setlinejoin(gs_state *, gs_line_join );
kono
parents:
diff changeset
224 gs_line_join gs_currentlinejoin(const gs_state * );
kono
parents:
diff changeset
225 int gs_setmiterlimit(gs_state *, floatp );
kono
parents:
diff changeset
226 float gs_currentmiterlimit(const gs_state * );
kono
parents:
diff changeset
227 int gs_setdash(gs_state *, const float *, uint, floatp );
kono
parents:
diff changeset
228 uint gs_currentdash_length(const gs_state * );
kono
parents:
diff changeset
229 int gs_currentdash_pattern(const gs_state *, float * );
kono
parents:
diff changeset
230 float gs_currentdash_offset(const gs_state * );
kono
parents:
diff changeset
231 int gs_setflat(gs_state *, floatp );
kono
parents:
diff changeset
232 float gs_currentflat(const gs_state * );
kono
parents:
diff changeset
233 int gs_setstrokeadjust(gs_state *, int );
kono
parents:
diff changeset
234 int gs_currentstrokeadjust(const gs_state * );
kono
parents:
diff changeset
235 typedef enum {
kono
parents:
diff changeset
236 gs_color_space_DeviceGray = 0,
kono
parents:
diff changeset
237 gs_color_space_DeviceRGB,
kono
parents:
diff changeset
238 gs_color_space_DeviceCMYK
kono
parents:
diff changeset
239 } gs_color_space;
kono
parents:
diff changeset
240 typedef struct gs_color_s gs_color;
kono
parents:
diff changeset
241 extern const uint gs_color_sizeof;
kono
parents:
diff changeset
242 int gs_setgray(gs_state *, floatp );
kono
parents:
diff changeset
243 float gs_currentgray(gs_state * );
kono
parents:
diff changeset
244 int gs_sethsbcolor(gs_state *, floatp, floatp, floatp ),
kono
parents:
diff changeset
245 gs_currenthsbcolor(gs_state *, float [3] ),
kono
parents:
diff changeset
246 gs_setrgbcolor(gs_state *, floatp, floatp, floatp ),
kono
parents:
diff changeset
247 gs_currentrgbcolor(gs_state *, float [3] );
kono
parents:
diff changeset
248 int gs_currentcolorspace(gs_state *, gs_color_space * );
kono
parents:
diff changeset
249 typedef float (*gs_transfer_proc)(gs_state *, floatp );
kono
parents:
diff changeset
250 int gs_settransfer(gs_state *, gs_transfer_proc ),
kono
parents:
diff changeset
251 gs_settransfer_remap(gs_state *, gs_transfer_proc, int );
kono
parents:
diff changeset
252 gs_transfer_proc gs_currenttransfer(gs_state * );
kono
parents:
diff changeset
253 int gs_setcolortransfer(gs_state *, gs_transfer_proc ,
kono
parents:
diff changeset
254 gs_transfer_proc , gs_transfer_proc ,
kono
parents:
diff changeset
255 gs_transfer_proc ),
kono
parents:
diff changeset
256 gs_setcolortransfer_remap(gs_state *, gs_transfer_proc ,
kono
parents:
diff changeset
257 gs_transfer_proc , gs_transfer_proc ,
kono
parents:
diff changeset
258 gs_transfer_proc , int );
kono
parents:
diff changeset
259 void gs_currentcolortransfer(gs_state *, gs_transfer_proc [4] );
kono
parents:
diff changeset
260 int gs_setscreen(gs_state *, floatp, floatp, float (*)(floatp, floatp ) );
kono
parents:
diff changeset
261 int gs_currentscreen(gs_state *, float *, float *, float (**)(floatp, floatp ) );
kono
parents:
diff changeset
262 int gs_sethalftonephase(gs_state *, int, int );
kono
parents:
diff changeset
263 int gs_currenthalftonephase(gs_state *, gs_int_point * );
kono
parents:
diff changeset
264 typedef struct gs_screen_enum_s gs_screen_enum;
kono
parents:
diff changeset
265 extern const uint gs_screen_enum_sizeof;
kono
parents:
diff changeset
266 int gs_screen_init(gs_screen_enum *, gs_state *, floatp, floatp );
kono
parents:
diff changeset
267 int gs_screen_currentpoint(gs_screen_enum *, gs_point * );
kono
parents:
diff changeset
268 int gs_screen_next(gs_screen_enum *, floatp );
kono
parents:
diff changeset
269 struct gs_state_s {
kono
parents:
diff changeset
270 gs_state *saved;
kono
parents:
diff changeset
271 gs_memory_procs memory_procs;
kono
parents:
diff changeset
272 gs_matrix_fixed ctm;
kono
parents:
diff changeset
273 gs_matrix ctm_inverse;
kono
parents:
diff changeset
274 int inverse_valid;
kono
parents:
diff changeset
275 struct gx_path_s *path;
kono
parents:
diff changeset
276 struct gx_clip_path_s *clip_path;
kono
parents:
diff changeset
277 int clip_rule;
kono
parents:
diff changeset
278 struct line_params_s *line_params;
kono
parents:
diff changeset
279 struct halftone_params_s *halftone;
kono
parents:
diff changeset
280 float (*ht_proc)(floatp, floatp );
kono
parents:
diff changeset
281 gs_int_point ht_phase;
kono
parents:
diff changeset
282 gs_int_point phase_mod;
kono
parents:
diff changeset
283 struct gs_color_s *color;
kono
parents:
diff changeset
284 struct gx_device_color_s *dev_color;
kono
parents:
diff changeset
285 struct gx_transfer_s *transfer;
kono
parents:
diff changeset
286 struct gs_font_s *font;
kono
parents:
diff changeset
287 gs_matrix char_tm;
kono
parents:
diff changeset
288 int char_tm_valid;
kono
parents:
diff changeset
289 byte in_cachedevice;
kono
parents:
diff changeset
290 byte in_charpath;
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294
kono
parents:
diff changeset
295 int level;
kono
parents:
diff changeset
296 float flatness;
kono
parents:
diff changeset
297 int stroke_adjust;
kono
parents:
diff changeset
298 struct device_s *device;
kono
parents:
diff changeset
299 int device_is_shared;
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 };
kono
parents:
diff changeset
302 typedef unsigned long gx_bitmap_id;
kono
parents:
diff changeset
303 typedef struct gx_bitmap_s {
kono
parents:
diff changeset
304 byte *data;
kono
parents:
diff changeset
305 int raster;
kono
parents:
diff changeset
306 gs_int_point size;
kono
parents:
diff changeset
307 gx_bitmap_id id;
kono
parents:
diff changeset
308 ushort rep_width, rep_height;
kono
parents:
diff changeset
309 } gx_bitmap;
kono
parents:
diff changeset
310 typedef unsigned long gx_color_index;
kono
parents:
diff changeset
311 typedef unsigned short gx_color_value;
kono
parents:
diff changeset
312 typedef struct gx_device_color_info_s {
kono
parents:
diff changeset
313 int num_components;
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 int depth;
kono
parents:
diff changeset
316 gx_color_value max_gray;
kono
parents:
diff changeset
317 gx_color_value max_rgb;
kono
parents:
diff changeset
318
kono
parents:
diff changeset
319 gx_color_value dither_gray;
kono
parents:
diff changeset
320 gx_color_value dither_rgb;
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 } gx_device_color_info;
kono
parents:
diff changeset
323 typedef struct gx_device_procs_s gx_device_procs;
kono
parents:
diff changeset
324 struct gx_device_s {
kono
parents:
diff changeset
325 int params_size; gx_device_procs *procs; const char *dname; int width; int height; float x_pixels_per_inch; float y_pixels_per_inch; float l_margin, b_margin, r_margin, t_margin; gx_device_color_info color_info; int is_open;
kono
parents:
diff changeset
326 };
kono
parents:
diff changeset
327 typedef struct gs_prop_item_s gs_prop_item;
kono
parents:
diff changeset
328 struct gx_device_procs_s {
kono
parents:
diff changeset
329 int (*open_device)(gx_device *dev );
kono
parents:
diff changeset
330 void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat );
kono
parents:
diff changeset
331 int (*sync_output)(gx_device *dev );
kono
parents:
diff changeset
332 int (*output_page)(gx_device *dev, int num_copies, int flush );
kono
parents:
diff changeset
333 int (*close_device)(gx_device *dev );
kono
parents:
diff changeset
334 gx_color_index (*map_rgb_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue );
kono
parents:
diff changeset
335 int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3] );
kono
parents:
diff changeset
336 int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color );
kono
parents:
diff changeset
337 int (*tile_rectangle)(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y );
kono
parents:
diff changeset
338 int (*copy_mono)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1 );
kono
parents:
diff changeset
339 int (*copy_color)(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height );
kono
parents:
diff changeset
340 int (*draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color );
kono
parents:
diff changeset
341 int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word );
kono
parents:
diff changeset
342 int (*get_props)(gx_device *dev, gs_prop_item *plist );
kono
parents:
diff changeset
343
kono
parents:
diff changeset
344 int (*put_props)(gx_device *dev, gs_prop_item *plist, int count );
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 };
kono
parents:
diff changeset
347 extern unsigned int gx_device_bytes_per_scan_line(gx_device *dev, int pad_to_word );
kono
parents:
diff changeset
348 int gx_default_open_device(gx_device *dev );
kono
parents:
diff changeset
349 void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat );
kono
parents:
diff changeset
350 int gx_default_sync_output(gx_device *dev );
kono
parents:
diff changeset
351 int gx_default_output_page(gx_device *dev, int num_copies, int flush );
kono
parents:
diff changeset
352 int gx_default_close_device(gx_device *dev );
kono
parents:
diff changeset
353 gx_color_index gx_default_map_rgb_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue );
kono
parents:
diff changeset
354 int gx_default_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3] );
kono
parents:
diff changeset
355 int gx_default_tile_rectangle(gx_device *dev, gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y );
kono
parents:
diff changeset
356 int gx_default_copy_color(gx_device *dev, unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height );
kono
parents:
diff changeset
357 int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color );
kono
parents:
diff changeset
358 int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word );
kono
parents:
diff changeset
359 int gx_default_get_props(gx_device *dev, gs_prop_item *plist );
kono
parents:
diff changeset
360 int gx_default_put_props(gx_device *dev, gs_prop_item *plist, int count );
kono
parents:
diff changeset
361 typedef struct device_s {
kono
parents:
diff changeset
362 gx_device *info;
kono
parents:
diff changeset
363 int is_band_device;
kono
parents:
diff changeset
364 gx_color_index white, black;
kono
parents:
diff changeset
365 } device;
kono
parents:
diff changeset
366 int gs_initmatrix(gs_state * ),
kono
parents:
diff changeset
367 gs_defaultmatrix(const gs_state *, gs_matrix * ),
kono
parents:
diff changeset
368 gs_currentmatrix(const gs_state *, gs_matrix * ),
kono
parents:
diff changeset
369 gs_setmatrix(gs_state *, const gs_matrix * ),
kono
parents:
diff changeset
370 gs_translate(gs_state *, floatp, floatp ),
kono
parents:
diff changeset
371 gs_scale(gs_state *, floatp, floatp ),
kono
parents:
diff changeset
372 gs_rotate(gs_state *, floatp ),
kono
parents:
diff changeset
373 gs_concat(gs_state *, const gs_matrix * );
kono
parents:
diff changeset
374 int gs_transform(gs_state *, floatp, floatp, gs_point * ),
kono
parents:
diff changeset
375 gs_dtransform(gs_state *, floatp, floatp, gs_point * ),
kono
parents:
diff changeset
376 gs_itransform(gs_state *, floatp, floatp, gs_point * ),
kono
parents:
diff changeset
377 gs_idtransform(gs_state *, floatp, floatp, gs_point * );
kono
parents:
diff changeset
378 static int
kono
parents:
diff changeset
379 ctm_set_inverse(gs_state *pgs)
kono
parents:
diff changeset
380 { int code = gs_matrix_invert(&*(gs_matrix *)&(pgs)->ctm , &pgs->ctm_inverse);
kono
parents:
diff changeset
381 0;
kono
parents:
diff changeset
382 if ( code < 0 ) return code;
kono
parents:
diff changeset
383 pgs->inverse_valid = 1;
kono
parents:
diff changeset
384 return 0;
kono
parents:
diff changeset
385 }
kono
parents:
diff changeset
386 void
kono
parents:
diff changeset
387 gs_update_matrix_fixed(gs_matrix_fixed *pmat)
kono
parents:
diff changeset
388 { (*pmat). tx = ((float)(((*pmat). tx_fixed = ((fixed)(((*pmat). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (*pmat). ty = ((float)(((*pmat). ty_fixed = ((fixed)(((*pmat). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) )));
kono
parents:
diff changeset
389 }
kono
parents:
diff changeset
390 int
kono
parents:
diff changeset
391 gs_initmatrix(gs_state *pgs)
kono
parents:
diff changeset
392 { gx_device *dev = pgs->device->info;
kono
parents:
diff changeset
393 (*dev->procs->get_initial_matrix)(dev, &*(gs_matrix *)&(pgs)->ctm );
kono
parents:
diff changeset
394 (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0;
kono
parents:
diff changeset
395 return 0;
kono
parents:
diff changeset
396 }
kono
parents:
diff changeset
397 int
kono
parents:
diff changeset
398 gs_defaultmatrix(const gs_state *pgs, gs_matrix *pmat)
kono
parents:
diff changeset
399 { gx_device *dev = pgs->device->info;
kono
parents:
diff changeset
400 (*dev->procs->get_initial_matrix)(dev, pmat);
kono
parents:
diff changeset
401 return 0;
kono
parents:
diff changeset
402 }
kono
parents:
diff changeset
403 int
kono
parents:
diff changeset
404 gs_currentmatrix(const gs_state *pgs, gs_matrix *pmat)
kono
parents:
diff changeset
405 { *pmat = *(gs_matrix *)&(pgs)->ctm;
kono
parents:
diff changeset
406 return 0;
kono
parents:
diff changeset
407 }
kono
parents:
diff changeset
408 int
kono
parents:
diff changeset
409 gs_setmatrix(gs_state *pgs, const gs_matrix *pmat)
kono
parents:
diff changeset
410 { *(gs_matrix *)&(pgs)->ctm = *pmat;
kono
parents:
diff changeset
411 (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0;
kono
parents:
diff changeset
412 return 0;
kono
parents:
diff changeset
413 }
kono
parents:
diff changeset
414 int
kono
parents:
diff changeset
415 gs_translate(gs_state *pgs, floatp dx, floatp dy)
kono
parents:
diff changeset
416 { gs_point pt;
kono
parents:
diff changeset
417 int code;
kono
parents:
diff changeset
418 if ( (code = gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , &pt)) < 0 )
kono
parents:
diff changeset
419 return code;
kono
parents:
diff changeset
420 pgs->ctm.tx += pt.x;
kono
parents:
diff changeset
421 pgs->ctm.ty += pt.y;
kono
parents:
diff changeset
422 (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0;
kono
parents:
diff changeset
423 return 0;
kono
parents:
diff changeset
424 }
kono
parents:
diff changeset
425 int
kono
parents:
diff changeset
426 gs_scale(gs_state *pgs, floatp sx, floatp sy)
kono
parents:
diff changeset
427 { pgs->ctm.xx *= sx;
kono
parents:
diff changeset
428 pgs->ctm.xy *= sx;
kono
parents:
diff changeset
429 pgs->ctm.yx *= sy;
kono
parents:
diff changeset
430 pgs->ctm.yy *= sy;
kono
parents:
diff changeset
431 pgs->inverse_valid = 0, pgs->char_tm_valid = 0;
kono
parents:
diff changeset
432 return 0;
kono
parents:
diff changeset
433 }
kono
parents:
diff changeset
434 int
kono
parents:
diff changeset
435 gs_rotate(gs_state *pgs, floatp ang)
kono
parents:
diff changeset
436 { int code = gs_matrix_rotate(&*(gs_matrix *)&(pgs)->ctm , ang, &*(gs_matrix *)&(pgs)->ctm );
kono
parents:
diff changeset
437 pgs->inverse_valid = 0, pgs->char_tm_valid = 0;
kono
parents:
diff changeset
438 return code;
kono
parents:
diff changeset
439 }
kono
parents:
diff changeset
440 int
kono
parents:
diff changeset
441 gs_concat(gs_state *pgs, const gs_matrix *pmat)
kono
parents:
diff changeset
442 { int code = gs_matrix_multiply(pmat, &*(gs_matrix *)&(pgs)->ctm , &*(gs_matrix *)&(pgs)->ctm );
kono
parents:
diff changeset
443 (pgs->ctm). tx = ((float)(((pgs->ctm). tx_fixed = ((fixed)(((pgs->ctm). tx)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , (pgs->ctm). ty = ((float)(((pgs->ctm). ty_fixed = ((fixed)(((pgs->ctm). ty)*(float)(1<<12 ) )) )*(1.0/(1<<12 ) ))) , pgs->inverse_valid = 0, pgs->char_tm_valid = 0;
kono
parents:
diff changeset
444 return code;
kono
parents:
diff changeset
445 }
kono
parents:
diff changeset
446 int
kono
parents:
diff changeset
447 gs_transform(gs_state *pgs, floatp x, floatp y, gs_point *pt)
kono
parents:
diff changeset
448 { return gs_point_transform(x, y, &*(gs_matrix *)&(pgs)->ctm , pt);
kono
parents:
diff changeset
449 }
kono
parents:
diff changeset
450 int
kono
parents:
diff changeset
451 gs_dtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt)
kono
parents:
diff changeset
452 { return gs_distance_transform(dx, dy, &*(gs_matrix *)&(pgs)->ctm , pt);
kono
parents:
diff changeset
453 }
kono
parents:
diff changeset
454 int
kono
parents:
diff changeset
455 gs_itransform(gs_state *pgs, floatp x, floatp y, gs_point *pt)
kono
parents:
diff changeset
456 {
kono
parents:
diff changeset
457
kono
parents:
diff changeset
458 if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) )
kono
parents:
diff changeset
459 { return gs_point_transform_inverse(x, y, &*(gs_matrix *)&(pgs)->ctm , pt);
kono
parents:
diff changeset
460 }
kono
parents:
diff changeset
461 else
kono
parents:
diff changeset
462 { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; };
kono
parents:
diff changeset
463 return gs_point_transform(x, y, &pgs->ctm_inverse, pt);
kono
parents:
diff changeset
464 }
kono
parents:
diff changeset
465 }
kono
parents:
diff changeset
466 int
kono
parents:
diff changeset
467 gs_idtransform(gs_state *pgs, floatp dx, floatp dy, gs_point *pt)
kono
parents:
diff changeset
468 {
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 if ( !!(((*(long *)(&((&pgs->ctm)->xy)) | *(long *)(&( (&pgs->ctm)->yx)) ) << 1) == 0) )
kono
parents:
diff changeset
471 { return gs_distance_transform_inverse(dx, dy,
kono
parents:
diff changeset
472 &*(gs_matrix *)&(pgs)->ctm , pt);
kono
parents:
diff changeset
473 }
kono
parents:
diff changeset
474 else
kono
parents:
diff changeset
475 { if ( !pgs->inverse_valid ) { int code = ctm_set_inverse(pgs); if ( code < 0 ) return code; };
kono
parents:
diff changeset
476 return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt);
kono
parents:
diff changeset
477 }
kono
parents:
diff changeset
478 }
kono
parents:
diff changeset
479 int
kono
parents:
diff changeset
480 gs_translate_to_fixed(register gs_state *pgs, fixed px, fixed py)
kono
parents:
diff changeset
481 { pgs->ctm.tx = ((float)((pgs->ctm.tx_fixed = px)*(1.0/(1<<12 ) )));
kono
parents:
diff changeset
482 pgs->ctm.ty = ((float)((pgs->ctm.ty_fixed = py)*(1.0/(1<<12 ) )));
kono
parents:
diff changeset
483 pgs->inverse_valid = 0;
kono
parents:
diff changeset
484 pgs->char_tm_valid = 1;
kono
parents:
diff changeset
485 return 0;
kono
parents:
diff changeset
486 }
kono
parents:
diff changeset
487 int
kono
parents:
diff changeset
488 gx_matrix_to_fixed_coeff(const gs_matrix *pmat, register fixed_coeff *pfc,
kono
parents:
diff changeset
489 int max_bits)
kono
parents:
diff changeset
490 { gs_matrix ctm;
kono
parents:
diff changeset
491 int scale = -10000;
kono
parents:
diff changeset
492 int expt, shift;
kono
parents:
diff changeset
493 ctm = *pmat;
kono
parents:
diff changeset
494 pfc->skewed = 0;
kono
parents:
diff changeset
495 if ( !((*(long *)(&(ctm.xx)) << 1) == 0) )
kono
parents:
diff changeset
496 { (void)frexp(ctm.xx, &scale);
kono
parents:
diff changeset
497 }
kono
parents:
diff changeset
498 if ( !((*(long *)(&(ctm.xy)) << 1) == 0) )
kono
parents:
diff changeset
499 { (void)frexp(ctm.xy, &expt);
kono
parents:
diff changeset
500 if ( expt > scale ) scale = expt;
kono
parents:
diff changeset
501 pfc->skewed = 1;
kono
parents:
diff changeset
502 }
kono
parents:
diff changeset
503 if ( !((*(long *)(&(ctm.yx)) << 1) == 0) )
kono
parents:
diff changeset
504 { (void)frexp(ctm.yx, &expt);
kono
parents:
diff changeset
505 if ( expt > scale ) scale = expt;
kono
parents:
diff changeset
506 pfc->skewed = 1;
kono
parents:
diff changeset
507 }
kono
parents:
diff changeset
508 if ( !((*(long *)(&(ctm.yy)) << 1) == 0) )
kono
parents:
diff changeset
509 { (void)frexp(ctm.yy, &expt);
kono
parents:
diff changeset
510 if ( expt > scale ) scale = expt;
kono
parents:
diff changeset
511 }
kono
parents:
diff changeset
512 scale = sizeof(long) * 8 - 1 - max_bits - scale;
kono
parents:
diff changeset
513 shift = scale - 12;
kono
parents:
diff changeset
514 if ( shift > 0 )
kono
parents:
diff changeset
515 { pfc->shift = shift;
kono
parents:
diff changeset
516 pfc->round = (fixed)1 << (shift - 1);
kono
parents:
diff changeset
517 }
kono
parents:
diff changeset
518 else
kono
parents:
diff changeset
519 { pfc->shift = 0;
kono
parents:
diff changeset
520 pfc->round = 0;
kono
parents:
diff changeset
521 scale -= shift;
kono
parents:
diff changeset
522 }
kono
parents:
diff changeset
523 pfc->xx = (((*(long *)(&(ctm.xx)) << 1) == 0) ? 0 : (long)ldexp(ctm.xx, scale));
kono
parents:
diff changeset
524 pfc->yy = (((*(long *)(&(ctm.yy)) << 1) == 0) ? 0 : (long)ldexp(ctm.yy, scale));
kono
parents:
diff changeset
525 if ( pfc->skewed )
kono
parents:
diff changeset
526 { pfc->xy = (((*(long *)(&(ctm.xy)) << 1) == 0) ? 0 : (long)ldexp(ctm.xy, scale));
kono
parents:
diff changeset
527 pfc->yx = (((*(long *)(&(ctm.yx)) << 1) == 0) ? 0 : (long)ldexp(ctm.yx, scale));
kono
parents:
diff changeset
528 }
kono
parents:
diff changeset
529 else
kono
parents:
diff changeset
530 pfc->xy = pfc->yx = 0;
kono
parents:
diff changeset
531 pfc->max_bits = max_bits;
kono
parents:
diff changeset
532 return 0;
kono
parents:
diff changeset
533 }