w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

dvi.c
Go to the documentation of this file.
1 #include "defs.h"
2 #include "global.h"
3 #include "commands.h"
4 
5 int dvi_h = 0; /* current h on output dvi */
6 int dvi_v = 0; /* current v on output dvi */
7 int *dvi_move;
8 
10 int spmax = 0;
11 
12 long dvipos;
13 long lpagep;
14 
15 static int vert_moveovercom;
16 static int dir_used;
17 
18 extern int command;
19 extern int num, den;
20 extern long postambleptr;
21 extern int dirmode;
22 extern char *dir_spec_vert;
23 extern char *dir_spec_end;
24 extern int dir_spec_vert_len;
25 extern int dir_spec_end_len;
26 
27 /* ARGSUSED */
29 char option;
30 char *c;
31 {
32 }
33 
35 {
36 }
37 
39 {
40  if (dirmode == DIR_KEEP) {
41  dfd_dirkeep();
42  vfd_dirkeep();
44  } else
47  dir_used = FALSE;
48 }
49 
51 {
52  struct font_entry *fe;
53  int k;
54 
55 /*
56  for (fe = hdfontent, k = 0; fe != NULL; fe = fe->next)
57  if (fe->fnt_use == FU_USED) {
58  fe->k = k;
59  fe->fnt_use = FU_NOTUSED;
60  k++;
61  }
62 */
63 
64  /* output preamble */
65  putbyte(outfp, PRE);
66  putnint(outfp, DVIFORMAT, 1);
67  putnint(outfp, num, 4);
68  putnint(outfp, den, 4);
69  putnint(outfp, mag, 4);
70  (void)fseek(dvifp, (long)14, 0);
71  putnint(outfp, k = getuint(dvifp, 1), 1);
73  dvipos = 15+k;
74  lpagep = -1;
75 }
76 
78 {
79  long postpos;
80  int i;
81  struct font_entry *fe;
82 
83  end_string();
84  postpos = dvipos;
85  /* output postamble */
86  putbyte(outfp, POST);
87  putnint(outfp, lpagep, 4);
88  putnint(outfp, num, 4);
89  putnint(outfp, den, 4);
90  putnint(outfp, mag, 4);
91  (void)fseek(dvifp, postambleptr+17, 0);
92  copybytes(dvifp, outfp, 8);
93  putnint(outfp, spmax+1, 2);
94  (void)fseek(dvifp, (long)2, 1);
95  copybytes(dvifp, outfp, 2);
96  dvipos += 29;
97 
98  for (fe = hdfontent; fe != NULL; fe = fe->next)
99  if (fe->fnt_use == FU_USED)
100  putfontdef(fe);
101 
103  putnint(outfp, postpos, 4);
105  dvipos += 6;
106  for (i = 0; i < 7 - (dvipos+3) % 4; i++)
107  putbyte(outfp, 223);
108 }
109 
111 {
112  byte b[sizeof(int)];
113  int n;
114 
115  n = uinttob(b, fe->k);
116  putbyte(outfp, FNT_DEF1+n-1);
117  putbytes(outfp, b, n);
118  putnint(outfp, fe->c, 4);
119  putnint(outfp, fe->s, 4);
120  putnint(outfp, fe->d, 4);
121  putnint(outfp, fe->a, 1);
122  putnint(outfp, fe->l, 1);
123  putbytes(outfp, fe->n, fe->a+fe->l);
124  dvipos += n+15+fe->a+fe->l;
125  return 0;
126 }
127 
128 
129 static int devicefont = 0;
130 
132 {
133  dvi_h = dvi_v = 0;
134  dev_initfont();
135 }
136 
138 int count[];
139 {
140  int i;
141 
142  end_string();
143  putbyte(outfp, BOP);
144  for (i = 0; i < 10; i++)
145  putnint(outfp, count[i], 4);
146  putnint(outfp, lpagep, 4);
147  lpagep = dvipos;
148  dvipos += 45;
149 }
150 
152 {
153  end_string();
154  putbyte(outfp, EOP);
155  dvipos++;
156 }
157 
159 {
160  extern int sp;
161 
162  putbyte(outfp, PUSH);
163  dvipos++;
164  if (sp > spmax)
165  spmax = sp;
166 }
167 
169 {
170  end_string();
171  dvi_push();
172 }
173 
175 {
176  putbyte(outfp, POP);
177  dvipos++;
178 }
179 
181 {
182  end_string();
183  dvi_pop();
184 }
185 
187 {
189  return 0;
190 }
191 
193 DEV_FONT dvif;
194 {
195  byte b[sizeof(int)];
196  int n;
197 
198  if (dvif != dvi_curf) {
199  end_string();
200  if (dvif->fnt_use == FU_NOTUSED) {
201  dvif->k = devicefont++;
202  putfontdef(dvif);
203  dvif->fnt_use = FU_USED;
204  }
205  if (0 <= dvif->k && dvif->k <= 63) {
206  putbyte(outfp, FONT_00+dvif->k);
207  dvipos++;
208  } else {
209  n = uinttob(b, dvif->k);
210  putbyte(outfp, FNT1+n-1);
211  putbytes(outfp, b, n);
212  dvipos += n+1;
213  }
214  dvi_curf = dvif;
215  }
216 }
217 
219 int com;
220 {
221  end_string();
222  putbyte(outfp, com);
223  dvipos++;
224 }
225 
226 dev_move(x, n, com)
227 byte *x;
228 int n, com;
229 {
230  end_string();
231  putbyte(outfp, com+n);
232  putbytes(outfp, x, n);
233  dvipos += n+1;
234 }
235 
236 void dev_makemove(int x, int com)
237 {
238  byte s[sizeof(int)];
239  int n;
240 
241  /* use resolution as drift!! */
242  if (-resolution < x && x < resolution)
243  return;
244  n = inttob(s, x);
245  dev_move(s, n, com);
246 }
247 
249 int x;
250 {
252 }
253 
254 /* ARGSUSED */
256 int x, y;
257 {
258 }
259 
261 int a, b, com;
262 {
263  putbyte(outfp, com);
264  putnint(outfp, a, 4);
265  putnint(outfp, b, 4);
266  dvipos += 9;
267 }
268 
270 int a, b, com;
271 {
272  end_string();
273  dvi_setrule(a, b, com);
274 }
275 
277 int d;
278 {
279  dir_used = TRUE;
280  putbyte(outfp, DIR);
281  putnint(outfp, d, 1);
282  dvipos += 2;
283 }
284 
286 int d;
287 {
288  if (d == HOR)
289  dvi_move = &dvi_h;
290  else if (d == VER)
291  dvi_move = &dvi_v;
292  if (dirmode == DIR_KEEP)
293  dvi_dir(d);
294 }
295 
297 int (*begstr)();
298 int (*endstr)();
300 
302 {
303  if (dirmode != DIR_KEEP && !instring && dir != HOR) {
304  instring = TRUE;
305  begstr();
306  }
307 }
308 
310 {
311  if (dirmode != DIR_KEEP && instring) {
312  instring = FALSE;
313  endstr();
314  }
315  return 0;
316 }
317 
319 {
320  dvi_dir(dir);
321 }
322 
324 {
325  dvi_dir(HOR);
326 }
327 
329 {
331  dvi_push();
334 }
335 
337 {
340  dvi_pop();
342 }
343 
345 {
347 }
348 
350 {
352 }
353 
354 #define MARKWIDTH 50000
355 
357 {
359 }
360 
362 {
365 }
366 
368 {
369 }
370 
372 {
373 }
374 
376 {
377  if (dirmode == DIR_ELIM) {
378  begstr = bs_elim;
379  endstr = es_elim;
380  } else if (dirmode == DIR_SPECIAL) {
381  begstr = bs_spec;
382  endstr = es_spec;
383  } else if (dirmode == DIR_IGNORE) {
384  begstr = bs_ignore;
385  endstr = es_ignore;
386  } else if (dirmode == DIR_MARKLINE) {
387  begstr = bs_mline;
388  endstr = es_mline;
389  } else if (dirmode == DIR_MARKCHAR) {
390  begstr = bs_mchar;
391  endstr = es_mchar;
392  }
393  return 0;
394 }
395 
396 /* ARGSUSED */
397 void
399 byte *str;
400 int n;
401 {
402 }
403 
404 void
406 byte *str;
407 int n;
408 {
409  end_string();
411  putnint(outfp, n, command-XXX1+1);
412  putbytes(outfp, str, n);
413  dvipos += n+1+command-XXX1+1;
414 }
FILE * outfp
Definition: aftopl.c:22
#define count(a)
Definition: aptex-macros.h:781
#define mag
Definition: aptex-macros.h:802
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define POP
Definition: dtl.h:135
#define PUSH
Definition: dtl.h:134
#define EOP
Definition: dtl.h:133
#define RIGHT1
Definition: dtl.h:137
#define BOP
Definition: dtl.h:132
#define DOWN1
Definition: dtl.h:154
#define FU_USED
Definition: defs.h:188
#define DIR_ELIM
Definition: defs.h:267
#define EXTDVIFORMAT
Definition: defs.h:137
#define DEV_NULLFONT
Definition: defs.h:180
#define DIR_MARKLINE
Definition: defs.h:270
#define DIR_KEEP
Definition: defs.h:266
#define HOR
Definition: defs.h:230
#define DIR_IGNORE
Definition: defs.h:269
#define DIR_SPECIAL
Definition: defs.h:268
#define VER
Definition: defs.h:231
#define DIR_MARKCHAR
Definition: defs.h:271
#define DVIFORMAT
Definition: defs.h:136
#define FU_NOTUSED
Definition: defs.h:187
dfd_dirkeep()
Definition: dfdcom.c:41
FILE * dvifp
Definition: dvi2.c:65
struct font_entry * hdfontent
Definition: fontcom.c:6
int getuint()
vfd_dirkeep()
Definition: vfdcom.c:41
#define fseek
Definition: xxstdio.h:30
static void
Definition: fpif.c:118
#define s
Definition: afcover.h:80
#define c(n)
Definition: gpos-common.c:150
#define a(n)
Definition: gpos-common.c:148
#define d(n)
Definition: gpos-common.c:151
#define PRE
Definition: hbf2gf.c:42
#define XXX1
Definition: hbf2gf.c:53
JCOPY_OPTION option
Definition: transupp.h:131
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific i
Definition: afcover.h:80
kerning y
Definition: ttdriver.c:212
#define POST_POST
Definition: commands.h:259
#define FNT_DEF1
Definition: commands.h:253
#define FNT1
Definition: commands.h:245
#define PUT_RULE
Definition: commands.h:147
#define FONT_00
Definition: commands.h:181
dev_move0(int com)
Definition: dvi.c:218
int dir_spec_vert_len
Definition: fontdesc.c:787
void dev_dospecial(byte *str, int n)
Definition: dvi.c:405
static int vert_moveovercom
Definition: dvi.c:15
dvi_push()
Definition: dvi.c:158
dev_init()
Definition: dvi.c:34
init_begend_str(void)
Definition: dvi.c:375
int den
Definition: dvi.c:19
bs_ignore()
Definition: dvi.c:344
dev_move(byte *x, int n, int com)
Definition: dvi.c:226
int dirmode
Definition: fontdesc.c:784
int * dvi_move
Definition: dvi.c:7
begin_string()
Definition: dvi.c:301
es_mchar()
Definition: dvi.c:371
int spmax
Definition: dvi.c:10
long lpagep
Definition: dvi.c:13
int(* begstr)()
Definition: dvi.c:297
static DEV_FONT dvi_curf
Definition: dvi.c:9
int(* endstr)()
Definition: dvi.c:298
dev_bop(count)
Definition: dvi.c:137
void dev_predospecial(byte *str, int n)
Definition: dvi.c:398
es_elim()
Definition: dvi.c:323
int num
Definition: disdvi.c:621
long dvipos
Definition: dvi.c:12
dev_setrule(int a, int b, int com)
Definition: dvi.c:269
bs_mline()
Definition: dvi.c:356
dev_eop()
Definition: dvi.c:151
dev_setup()
Definition: dvi.c:38
int dvi_v
Definition: dvi.c:6
char * dir_spec_end
Definition: fontdesc.c:786
long postambleptr
Definition: dvi2.c:59
dev_setfont(DEV_FONT dvif)
Definition: dvi.c:192
dev_makemoveover(int x)
Definition: dvi.c:248
dev_push()
Definition: dvi.c:168
static int devicefont
Definition: dvi.c:129
int dvi_move_beg
Definition: dvi.c:299
dev_arg(char option, char *c)
Definition: dvi.c:28
dvi_pop()
Definition: dvi.c:174
dev_endsetup()
Definition: dvi.c:50
bs_spec()
Definition: dvi.c:328
es_ignore()
Definition: dvi.c:349
bs_elim()
Definition: dvi.c:318
#define MARKWIDTH
Definition: dvi.c:354
dev_pop()
Definition: dvi.c:180
dvi_dir(int d)
Definition: dvi.c:276
dev_dir(int d)
Definition: dvi.c:285
dvi_setrule(int a, int b, int com)
Definition: dvi.c:260
dev_finish()
Definition: dvi.c:77
end_string(void)
Definition: dvi.c:309
putfontdef(struct font_entry *fe)
Definition: dvi.c:110
void dev_makemove(int x, int com)
Definition: dvi.c:236
int dvi_h
Definition: dvi.c:5
bs_mchar()
Definition: dvi.c:367
int dir_spec_end_len
Definition: fontdesc.c:788
es_spec()
Definition: dvi.c:336
int command
Definition: dviconv.c:23
dev_initfont(void)
Definition: dvi.c:186
char * dir_spec_vert
Definition: fontdesc.c:785
es_mline()
Definition: dvi.c:361
dev_setposn(int x, int y)
Definition: dvi.c:255
dev_initpage()
Definition: dvi.c:131
int instring
Definition: dvi.c:296
static int dir_used
Definition: dvi.c:16
copybytes(FILE *sfp, FILE *dfp, int n)
Definition: io.c:71
putbyte(FILE *fp, byte c)
Definition: io.c:64
putnint(FILE *fp, unsigned int x, int n)
Definition: io.c:87
putbytes(FILE *fp, byte *cp, int n)
Definition: io.c:79
float x
Definition: cordic.py:15
int k
Definition: otp-parser.c:70
integer resolution
Definition: pbmtopk.c:45
#define dir
#define str(s)
Definition: sh6.c:399
Definition: dirent.h:44
Definition: tables.h:434
Definition: defs.h:190
char n[257]
Definition: defs.h:193
int a
Definition: defs.h:192
char fnt_use
Definition: defs.h:195
int d
Definition: defs.h:192
int s
Definition: defs.h:192
struct font_entry * next
Definition: defs.h:206
int l
Definition: defs.h:192
int c
Definition: defs.h:192
int k
Definition: defs.h:191
Definition: getopt.h:95
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
uinttob(byte *b, unsigned int x)
Definition: util.c:53
inttob(byte *b, int x)
Definition: util.c:72
#define sp
Definition: stack.c:11