Back to index

tetex-bin  3.0
dvi-draw.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1990-2004  Paul Vojta and the xdvik development team
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00017  * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
00018  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  * OTHER DEALINGS IN THE SOFTWARE.
00021  *
00022  */
00023 
00024 #ifndef DVI_DRAW_H_
00025 #define DVI_DRAW_H_
00026 
00027 #include "xdvi-config.h"
00028 #include "xdvi.h"
00029 
00030 
00031 extern void prescan(FILE *fp);
00032 
00033 
00034 /* forward declarations */
00035 struct font;
00036 struct tn;
00037 
00038 /* this information is saved when using virtual fonts */
00039 struct drawinf {
00040     struct framedata data;
00041     struct font      *fontp;
00042     set_char_proc set_char_p;
00043     unsigned long tn_table_len;
00044     struct font      **tn_table;
00045     struct tn *tn_head;
00046     ubyte *pos, *end; /* pointers to a scan buffer defined in dvi-draw.c */
00047     struct font      *virtual;
00048 #ifdef TEXXET
00049     int       dir;
00050 #endif
00051 };
00052 
00053 struct src_parsed_special {
00054     int line;
00055     int col;
00056     char *filename;
00057     size_t filename_len;
00058 };
00059 extern void src_parse(const char *str, int str_len, struct src_parsed_special *parsed);
00060 
00061 /*
00062  * pixel_conv is currently used only for converting absolute positions
00063  * to pixel values; although normally it should be
00064  *
00065  *     ((int) ((x) / currwin.shrinkfactor + (1 << 15) >> 16)),
00066  *
00067  * the rounding is achieved instead by moving the constant 1 << 15 to
00068  * PAGE_OFFSET in dvi-draw.c.
00069  */
00070 
00071 #define       pixel_conv(x)     ((int) ((x) / currwin.shrinkfactor >> 16))
00072 #define       pixel_round(x)           ((int) ROUNDUP(x, currwin.shrinkfactor << 16))
00073 
00074 /* entries below with the characters 'dvi' in them are actually stored in
00075    scaled pixel units */
00076 
00077 #define DVI_H   currinf.data.dvi_h
00078 #define PXL_H   pixel_conv(currinf.data.dvi_h)
00079 #define DVI_V   currinf.data.dvi_v
00080 #define PXL_V   currinf.data.pxl_v
00081 #define WW      currinf.data.w
00082 #define XX      currinf.data.x
00083 #define YY      currinf.data.y
00084 #define ZZ      currinf.data.z
00085 
00086 extern void draw_page(void);
00087 extern void source_reverse_search(int, int, wide_bool);
00088 extern void source_special_show(wide_bool);
00089 extern void source_forward_search(const char *);
00090 
00091 extern void anchor_search(const char *str);
00092 
00093 #ifdef T1LIB
00094 extern void init_t1(void);
00095 extern void add_T1_mapentry(int lineno, const char *mapfile, const char *name, const char *file, const char *vec, char *psec);
00096 extern void read_T1_char(struct font *, wide_ubyte);
00097 extern int find_T1_font(const char *);
00098 extern setcharRetvalT set_t1_char(
00099 #ifdef TEXXET
00100                               wide_ubyte cmd,
00101 #endif
00102                               wide_ubyte ch);
00103 #endif /* T1LIB */
00104 
00105 
00106 /*
00107   this is needed by any program that wants to use spcl_scan,
00108   since the buffer is supposed to be of that length.
00109 */
00110 #ifndef       DVI_BUFFER_LEN
00111 #define       DVI_BUFFER_LEN 2048
00112 #endif
00113 
00114 extern long text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch);
00115 extern Boolean spcl_scan(Boolean(*spcl_proc) (char *str, int str_len, void *data), void *data, Boolean return_if_found, FILE *fp);
00116 
00117 extern void geom_scan_part(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte),
00118                         FILE *fp, struct scan_info *info, struct frame *min_frame, double current_dimconv);
00119 
00120 extern void geom_scan(long(*char_proc)(FILE *, struct scan_info *, wide_ubyte),
00121                     FILE *fp, struct scan_info *info, int pageno);
00122 
00123 extern off_t save_file_status(FILE *fp, struct drawinf *currinf_save, ubyte *maxchar_save);
00124 extern void reinit_text_scan(void);
00125 extern void restore_file_status(FILE *fp, struct drawinf currinf_save, ubyte maxchar_save, off_t pos_save);
00126 
00127 void htex_do_special(const char *str, size_t len);
00128 
00129 extern setcharRetvalT set_char(
00130 #ifdef TEXXET
00131                             wide_ubyte cmd,
00132 #endif
00133                             wide_ubyte ch);
00134 extern setcharRetvalT load_n_set_char(
00135 #ifdef TEXXET
00136                                   wide_ubyte cmd,
00137 #endif
00138                                   wide_ubyte ch);
00139 extern setcharRetvalT set_vf_char(
00140 #ifdef TEXXET
00141                               wide_ubyte cmd,
00142 #endif
00143                               wide_ubyte ch);
00144 
00145 #ifdef GREY
00146 void init_plane_masks(void);
00147 #endif
00148 
00149 #if COLOR
00150 struct rgb; /* forward declaration */
00151 
00152 Pixel alloc_color(const struct rgb *, Pixel);
00153 void do_color_change(void);
00154 #elif GREY
00155 void init_pix(void);
00156 #endif
00157 
00158 void dvi_fmt_error(const char *message, ...);
00159 
00160 #endif /* DVI_DRAW_H_ */