OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [920428-2.c] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.