7 |
|
* 2/26/88 |
8 |
|
*/ |
9 |
|
|
10 |
+ |
#include "platform.h" |
11 |
|
#include "standard.h" |
12 |
|
|
13 |
|
#include "color.h" |
35 |
|
char *progname; |
36 |
|
|
37 |
|
short ordertab[4][2] = { |
38 |
< |
{0,XDECR}, {XDECR,XDECR|YDECR}, {XDECR|YDECR,YDECR}, {YDECR,0} |
38 |
> |
{0,0}, {XDECR,XDECR|YDECR}, {XDECR|YDECR,YDECR}, {YDECR,XDECR} |
39 |
|
}; |
40 |
|
|
41 |
+ |
|
42 |
|
static int neworder(void); |
43 |
|
static void rotatecw(FILE *fp); |
44 |
|
static void rotateccw(FILE *fp); |
48 |
|
static int |
49 |
|
neworder(void) /* return corrected order */ |
50 |
|
{ |
51 |
+ |
static short ordercw[8]; |
52 |
|
register int i; |
53 |
|
|
54 |
|
if (correctorder) |
55 |
|
return(order); |
56 |
< |
for (i = 4; i--; ) |
57 |
< |
if ((order&~YMAJOR) == ordertab[i][ccw]) |
58 |
< |
return(ordertab[i][1-ccw] | ((order&YMAJOR)^YMAJOR)); |
56 |
> |
if (!ordercw[0]) { |
57 |
> |
ordercw[YMAJOR|YDECR] = 0; |
58 |
> |
ordercw[0] = YMAJOR|XDECR; |
59 |
> |
ordercw[YMAJOR|XDECR] = XDECR|YDECR; |
60 |
> |
ordercw[XDECR|YDECR] = YMAJOR|YDECR; |
61 |
> |
ordercw[YMAJOR|XDECR|YDECR] = XDECR; |
62 |
> |
ordercw[XDECR] = YMAJOR; |
63 |
> |
ordercw[YMAJOR] = YDECR; |
64 |
> |
ordercw[YDECR] = YMAJOR|XDECR|YDECR; |
65 |
> |
} |
66 |
> |
if (!ccw) |
67 |
> |
return(ordercw[order]); |
68 |
> |
for (i = 8; i--; ) |
69 |
> |
if (ordercw[i] == order) |
70 |
> |
return(i); |
71 |
|
fputs("Order botch!\n", stderr); |
72 |
|
exit(2); |
73 |
|
} |
78 |
|
char *argv[] |
79 |
|
) |
80 |
|
{ |
81 |
< |
static char picfmt[LPICFMT+1] = PICFMT; |
81 |
> |
static char picfmt[MAXFMTLEN] = PICFMT; |
82 |
|
int rval; |
83 |
|
FILE *fin; |
84 |
+ |
|
85 |
+ |
SET_DEFAULT_BINARY(); |
86 |
+ |
SET_FILE_BINARY(stdout); |
87 |
|
|
88 |
|
progname = argv[0]; |
89 |
|
|