2 /* Copyright (c) 1995, 1996, 1998, 2000, 2001, 2006 by Arkkra Enterprises */
3 /* All rights reserved */
5 /* include file for Mup/Ghostscript display program */
10 #include <sys/types.h>
16 #if !defined(linux) && !defined(__EMX__)
17 /* undef SIGCHLD to avoid conflict with Xos.h */
28 #if defined(__DOS__) || defined (__EMX__)
33 #define unix /* not really unix, but acts like it */
42 /* X window includes */
44 #include <X11/Xutil.h>
46 /* define XK_MISCELLANY so we can use XK_Return, etc */
47 #define XK_MISCELLANY 1
48 #include <X11/keysymdef.h>
51 /* macro for function templates if using ANSI C */
53 #define P(parms) parms
61 /* define screen and page dimensions */
62 /* we only handle the standard sizes that are less than 640 pixels wide.
63 * This includes letter, note, legal, a3, a4, a5, a6, flsa, flse,
65 #define MAX_BYTES_PER_LINE 77 /* 612/8 rounded up */
66 #define MAX_LINES_PER_PAGE 1008 /* to handle legal size */
68 #define BITS_PER_LINE Bits_per_line /* horizontal pixels */
69 #define BYTES_PER_LINE Bytes_per_line /* Bits_per_line / 8 rounded up */
70 #define LINES_PER_PAGE Lines_per_page /* vertical pixels */
71 #define BYTES_PER_PAGE (BYTES_PER_LINE * LINES_PER_PAGE)
74 /* default mode is not full page */
77 typedef void (*FUNC
)();
79 /* list of supported $TERM types and which functions and parameters to use
80 * to implement them. To support a new terminal type, write appropriate
81 * functions, and add to the Config table in init.c.
84 char *termname
; /* $TERM value */
85 FUNC setup
; /* call this to initialize */
86 FUNC cleanup
; /* call this to clean up and exit */
87 FUNC draw
; /* call this to draw a screen of the page */
88 FUNC user_interf
; /* call this to read user input */
89 FUNC error
; /* call this on bad user input */
90 FUNC bitmap
; /* call this to display a bitmap */
91 int vlines
; /* number of lines vertically on screen */
92 float adjust
; /* aspect ratio adjustment */
96 /* information about a particular bitmap-ed page. */
98 int pagenum
; /* actual designated page number. If the mup
99 * -p option is used, this may start somewhere
100 * other than 1, and if -o is used, there
101 * may be gaps in the list */
102 int seqnum
; /* page number from 0 to n-1. Multiplying this
103 * by the number of bytes per page in a bitmap
104 * gives the file offset for the page. */
105 long begin
; /* where page begins in input */
106 long end
; /* where page ends in input */
107 struct Pginfo
*next
; /* linked list link */
112 extern struct CONFIG
*Conf_info_p
;
113 extern struct Pginfo
*Pagehead
; /* all page bitmaps */
114 extern struct Pginfo
*Pagetail
; /* where to add to list */
115 extern struct Pginfo
*Currpage_p
; /* current page */
116 extern int Fullpgmode
; /* full page or partial page */
117 extern long Beginprolog
;/* where in PostScript file the prolog begins */
118 extern long Endprolog
; /* where in PostScript file the prolog ends */
119 extern long Begin_offset
;/* offset in file where current page begins */
120 extern int Pagenum
; /* current page number */
121 extern int Psfile
; /* PostScript temp file, file descriptor */
122 extern FILE *PS_file
; /* PostScript temp file */
123 extern int Fullbitmaps
; /* temp file of full page bitmaps */
124 extern int Partbitmaps
; /* temp file for bitmaps for scrollable pages */
125 extern int Nulldev
; /* /dev/null */
126 extern char Fullfile
[]; /* name of gs output tmp file */
127 extern char Partfile
[]; /* name of gs output tmp file */
128 extern char Mupfile
[]; /* mup output temp file */
129 extern char **Argv
; /* global version of argv */
130 extern int Argc
; /* global version of argc */
131 extern char *Exit_errmsg
;/* error message to print upon exit */
132 extern char *Gs_errfile
;/* Ghostscript error file */
133 extern int Bits_per_line
; /* pixels per line */
134 extern int Bytes_per_line
;/* pixels per line divided by 8 and rounded up */
135 extern int Lines_per_page
;/* vertical pixels */
138 extern int getpginfo
P((int pgnum
));
139 extern void user_interf
P((void));
140 extern int scroll
P((int line
, int distance
));
141 extern void generalcleanup
P((int status
));
142 extern int create_tmpfile
P((char *tmpfname
));
143 extern int gen1file
P((int fullpgmode
));
144 extern void get_paper_size
P((int x
, int y
));
145 extern void run_mup
P((char **argv
));
146 extern void init
P((void));
147 extern void do_cmd
P((int c
));
149 extern char *getenv();