File: set.c

package info (click to toggle)
dvi2dvi 2.0alpha-9.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 412 kB
  • ctags: 1,163
  • sloc: ansic: 6,401; makefile: 127; sh: 8
file content (106 lines) | stat: -rw-r--r-- 2,181 bytes parent folder | download | duplicates (9)
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
#include	"defs.h"
#include	"commands.h"
#include	"dconv.h"
#include	"global.h"
#include	"set.h"

extern int dirmode;

struct font_entry *
getcurrentfontent()
{
    static struct font_entry *new_vfe = NULL;

    if (dir == VER) {
	if (curfontent->vert_use == VU_UNDEF) {
	    if (new_vfe == NULL)
		new_vfe = NEW(struct font_entry, "font_entry");
	    *new_vfe = *curfontent;
	    new_vfe->openfile = NO_FILE;
	    if (init_vfontinfo(new_vfe)) {
		curfontent->vert_use = VU_USED;
		curfontent->vert_fe = new_vfe;
		curfontent->vert_fe->base_fe = curfontent;
		curfontent->vert_fe->vert_use = VU_VERT;
		new_vfe = NULL;
	    } else
		curfontent->vert_use = VU_NOTUSED;
	    if (dir_with_width) {
		if (curfontent->vert_use == VU_NOTUSED) {
		    if (curfontent->fnt_type == FT_UNDEF)
			init_fontinfo(curfontent);
		    if (curfontent->fnt_type == FT_DVI)
			Fatal("font info necessary for vertical use of %s\n",
			      curfontent->n);
		}
		if (curfontent->vert_use == VU_NOTUSED) {
		    curfontent->vert_use = VU_USED;
		    curfontent->vert_fe = NEW(struct font_entry, "font_entry");
		    *(curfontent->vert_fe) = *curfontent;
		    curfontent->vert_fe->base_fe = curfontent;
		    curfontent->vert_fe->openfile = NO_FILE;
		}
		curfontent->vert_fe->vert_use = VU_VERT;
	    }
	}
	if (curfontent->vert_use == VU_USED)
	    return curfontent->vert_fe;
    }
    return curfontent;
}

struct font_entry *
currentfontent()
{
    if (dir == VER) {
	if (curfontent->vert_use == VU_USED)
	    return curfontent->vert_fe;
    }
    return curfontent;
}

void
MarkChar(c)
int c;
{
    struct font_entry *fe;

    fe = getcurrentfontent();
    fe->fnt_markchar(fe, c);
}

void
MarkString(firstch)
int firstch;
{
    int c;
    struct font_entry *fe;

    fe = getcurrentfontent();
    for (c = firstch; c >= SETC_000 && c <= SETC_127; ) {
	fe->fnt_markchar(fe, c);
	c = DC_getcommand();
    }
    DC_backupone();
}

void
SetChar(c, Move)
int c;
BOOLEAN Move;
{
    struct font_entry *fe;

    fe = currentfontent();
    fe->rvf_setchar(fe, c, Move);
}

void
SetString(firstch)
int firstch;
{
    struct font_entry *fe;

    fe = currentfontent();
    fe->rvf_setstring(fe, firstch);
}