File: vfdcom.c

package info (click to toggle)
dvi2ps 3.2j-9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,344 kB
  • ctags: 1,896
  • sloc: ansic: 12,767; sh: 938; makefile: 269
file content (135 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download | duplicates (11)
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
/*
 * funtions for analyzing dvi in vf-file (vfd stands for vf-file dvi)
 */

#include	"defs.h"
#include	"commands.h"
#include	"dconv.h"
#include	"global.h"

int vfd_getcommand();
void vfd_backupone();
void vfd_getbytes();
void vfd_skipbytes();
int vfd_getuint();
int vfd_getint();
void vfd_movedown();
void vfd_movedown_v();
void vfd_moveover();
void vfd_moveover_v();
void vfd_setrule();
void vfd_setrule_v();
struct dconv vfd_dconv_templ = {
    vfd_getcommand,
    vfd_backupone,
    vfd_getbytes,
    vfd_skipbytes,
    vfd_getuint,
    vfd_getint,
    NULL,
    NULL,
    NULL,
    vfd_movedown,
    vfd_movedown_v,
    vfd_moveover,
    vfd_moveover_v,
    vfd_setrule,
    vfd_setrule_v,
    0
};

int
vfd_getcommand()
{
    dc_bufbeg++;
    return (dc_bufbeg > dc_bufend ? POST : *(dc_bufbeg-1));
}

void
vfd_backupone()
{
    --dc_bufbeg;
}

void
vfd_getbytes(cp, n)
char *cp;
int n;
{
    (void)strncpy(cp, (char *)dc_bufbeg, n);
    dc_bufbeg += n;
}

void
vfd_skipbytes(n)
int n;
{
    dc_bufbeg += n;
}

int
vfd_getuint(n)
int n;
{
    int x;

    x = makeuint(dc_bufbeg, n);
    dc_bufbeg += n;
    return x;
}

int
vfd_getint(n)
int n;
{
    int x;

    x = makeint(dc_bufbeg, n);
    dc_bufbeg += n;
    return x;
}


void
vfd_movedown(a)
int a;
{
    v += scale(a, dc_scale);
}

void
vfd_movedown_v(a)
int a;
{
    h -= scale(a, dc_scale);
}

void
vfd_moveover(b)
int b;
{
    h += scale(b, dc_scale);
}

void
vfd_moveover_v(b)
int b;
{
    v += scale(b, dc_scale);
}

void
vfd_setrule(a, b, Set)	/* this routine will draw a rule */
int a, b;
BOOLEAN Set;
{
    dfd_setrule(scale(a, dc_scale), scale(b, dc_scale));
}

void
vfd_setrule_v(a, b, Set)	/* this routine will draw a rule */
int a, b;
BOOLEAN Set;
{
    dfd_setrule_v(scale(a, dc_scale), scale(b, dc_scale));
}