1 |
– |
/* Copyright (c) 1987 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* ximage.c - driver for X-windows |
6 |
|
* |
18 |
|
|
19 |
|
#include <ctype.h> |
20 |
|
|
21 |
+ |
#include <time.h> |
22 |
+ |
|
23 |
|
#include "color.h" |
24 |
|
|
25 |
+ |
#include "resolu.h" |
26 |
+ |
|
27 |
|
#include "xraster.h" |
28 |
|
|
29 |
|
#include "view.h" |
36 |
|
|
37 |
|
#define FONTNAME "9x15" /* text font we'll use */ |
38 |
|
|
39 |
< |
#define CTRL(c) ('c'-'@') |
39 |
> |
#define CTRL(c) ((c)-'@') |
40 |
|
|
41 |
|
#define BORWIDTH 5 /* border width */ |
42 |
|
#define BARHEIGHT 25 /* menu bar size */ |
85 |
|
|
86 |
|
char errmsg[128]; |
87 |
|
|
87 |
– |
extern long ftell(); |
88 |
|
|
89 |
– |
extern char *malloc(), *calloc(); |
90 |
– |
|
91 |
– |
extern double atof(), pow(), log(); |
92 |
– |
|
93 |
– |
|
89 |
|
main(argc, argv) |
90 |
|
int argc; |
91 |
|
char *argv[]; |
92 |
|
{ |
93 |
+ |
extern char *getenv(); |
94 |
+ |
char *gv; |
95 |
|
int headline(); |
96 |
|
int i; |
97 |
|
|
98 |
|
progname = argv[0]; |
99 |
+ |
if ((gv = getenv("DISPLAY_GAMMA")) != NULL) |
100 |
+ |
gamcor = atof(gv); |
101 |
|
|
102 |
|
for (i = 1; i < argc; i++) |
103 |
|
if (argv[i][0] == '-') |
164 |
|
} |
165 |
|
|
166 |
|
|
167 |
+ |
int |
168 |
|
headline(s) /* get relevant info from header */ |
169 |
|
char *s; |
170 |
|
{ |
171 |
– |
static char *altname[] = {"rview","rpict",VIEWSTR,NULL}; |
172 |
– |
register char **an; |
171 |
|
char fmt[32]; |
172 |
|
|
173 |
|
if (isexpos(s)) |
175 |
|
else if (isformat(s)) { |
176 |
|
formatval(fmt, s); |
177 |
|
wrongformat = strcmp(fmt, COLRFMT); |
178 |
< |
} else |
179 |
< |
for (an = altname; *an != NULL; an++) |
180 |
< |
if (!strncmp(*an, s, strlen(*an))) { |
183 |
< |
if (sscanview(&ourview, s+strlen(*an)) > 0) |
184 |
< |
gotview++; |
185 |
< |
return; |
186 |
< |
} |
178 |
> |
} else if (isview(s) && sscanview(&ourview, s) > 0) |
179 |
> |
gotview++; |
180 |
> |
return(0); |
181 |
|
} |
182 |
|
|
183 |
|
|
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
+ |
void |
250 |
|
eputs(s) |
251 |
|
char *s; |
252 |
|
{ |
254 |
|
} |
255 |
|
|
256 |
|
|
257 |
+ |
void |
258 |
|
quit(code) |
259 |
|
int code; |
260 |
|
{ |
361 |
|
return(0); |
362 |
|
switch (*cp) { /* interpret command */ |
363 |
|
case 'q': |
364 |
< |
case CTRL(D): /* quit */ |
364 |
> |
case CTRL('D'): /* quit */ |
365 |
|
quit(0); |
366 |
|
case '\n': |
367 |
|
case '\r': |
431 |
|
free_raster(ourras); |
432 |
|
getras(); |
433 |
|
/* fall through */ |
434 |
< |
case CTRL(R): /* redraw */ |
435 |
< |
case CTRL(L): |
434 |
> |
case CTRL('R'): /* redraw */ |
435 |
> |
case CTRL('L'): |
436 |
|
unmap_rcolors(ourras); |
437 |
|
XClear(wind); |
438 |
|
return(redraw(0, 0, width, height)); |
568 |
|
cerr[x] = err + errp; |
569 |
|
} |
570 |
|
} |
571 |
< |
free((char *)inl); |
572 |
< |
free((char *)cerr); |
571 |
> |
free((void *)inl); |
572 |
> |
free((void *)cerr); |
573 |
|
} |
574 |
|
|
575 |
|
|
641 |
|
if (fseek(fin, scanpos[y], 0) == -1) |
642 |
|
quiterr("fseek error"); |
643 |
|
cury = y; |
644 |
< |
} else if (scanpos != NULL) |
644 |
> |
} else if (scanpos != NULL && scanpos[y] == -1) |
645 |
|
scanpos[y] = ftell(fin); |
646 |
|
|
647 |
|
if (freadcolrs(scanline, xmax, fin) < 0) |