summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/dvi-draw.h
blob: c8e74e1f2a4b827980291885092550134bae890e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
 * Copyright (c) 1990-2013  Paul Vojta and the xdvik development team
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#ifndef DVI_DRAW_H_
#define DVI_DRAW_H_

#include "xdvi.h"


extern void prescan(FILE *fp);


/* forward declarations */
struct font;
struct tn;

/* this information is saved when using virtual fonts */
struct drawinf {
    struct framedata data;
    struct font	*fontp;
    set_char_proc set_char_p;
    unsigned long tn_table_len;
    struct font	**tn_table;
    struct tn *tn_head;
    ubyte *pos, *end; /* pointers to a scan buffer defined in dvi-draw.c */
    struct font	*virtual;
#ifdef TEXXET
    int	dir;
#endif
};

struct src_parsed_special {
    int line;
    int col;
    char *filename;
    size_t filename_len;
};
extern void src_parse(const char *str, int str_len, struct src_parsed_special *parsed);

/*
 * pixel_conv is currently used only for converting absolute positions
 * to pixel values; although normally it should be
 *
 *	((int) ((x) / currwin.shrinkfactor + (1 << 15) >> 16)),
 *
 * the rounding is achieved instead by moving the constant 1 << 15 to
 * PAGE_OFFSET in dvi-draw.c.
 */

#define	pixel_conv(x)	    ((int) ((x) / currwin.shrinkfactor >> 16))
#define	pixel_round(x)	    ((int) ROUNDUP(x, currwin.shrinkfactor << 16))

/* entries below with the characters 'dvi' in them are actually stored in
   scaled pixel units */

#define DVI_H   currinf.data.dvi_h
#define PXL_H   pixel_conv(currinf.data.dvi_h)
#define DVI_V   currinf.data.dvi_v
#define PXL_V   currinf.data.pxl_v
#define WW      currinf.data.w
#define XX      currinf.data.x
#define YY      currinf.data.y
#define ZZ      currinf.data.z

extern void draw_page(void);
extern void source_reverse_search(int, int, wide_bool);
extern void source_special_show(wide_bool);
extern void source_forward_search(const char *);

extern void anchor_search(const char *str);


/*
  this is needed by any program that wants to use spcl_scan,
  since the buffer is supposed to be of that length.
*/
#ifndef	DVI_BUFFER_LEN
#define	DVI_BUFFER_LEN 2048
#endif

extern void open_font_file(struct font *fontp);
extern long text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch);
extern Boolean spcl_scan(Boolean(*spcl_proc) (char *str, int str_len, void *data), void *data, Boolean return_if_found, FILE *fp);

extern void geom_scan_part(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte),
			   FILE *fp, struct scan_info *info, struct frame *min_frame, double current_dimconv);

extern void geom_scan(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte),
		      FILE *fp, struct scan_info *info, int pageno);

extern off_t save_file_status(FILE *fp, struct drawinf *currinf_save, ubyte *maxchar_save);
extern void reinit_text_scan(void);
extern void restore_file_status(FILE *fp, struct drawinf currinf_save, ubyte maxchar_save, off_t pos_save);

void htex_do_special(const char *str, size_t len);

extern setcharRetvalT set_char(
#ifdef TEXXET
			       wide_ubyte cmd,
#endif
			       wide_ubyte ch);
extern setcharRetvalT load_n_set_char(
#ifdef TEXXET
				      wide_ubyte cmd,
#endif
				      wide_ubyte ch);
extern setcharRetvalT set_vf_char(
#ifdef TEXXET
				  wide_ubyte cmd,
#endif
				  wide_ubyte ch);

extern setcharRetvalT set_ft_char(
#if TEXXET
				  wide_ubyte cmd,
#endif
				  wide_ubyte ch);

#ifdef GREY
void init_plane_masks(void);
#endif

#if COLOR
struct rgb; /* forward declaration */

Pixel alloc_color(const struct rgb *, Pixel);
void do_color_change(void);
#elif GREY
void init_pix(void);
#endif

void dvi_fmt_error(const char *message, ...);

#endif /* DVI_DRAW_H_ */