File: defs.h

package info (click to toggle)
dvi2ps 3.0a1-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,392 kB
  • ctags: 1,750
  • sloc: ansic: 11,699; sh: 277; makefile: 235
file content (214 lines) | stat: -rw-r--r-- 5,241 bytes parent folder | download | duplicates (2)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/**********************************************************************/
/************************  Global Definitions  ************************/
/**********************************************************************/

#include	<stdio.h>
#include	<ctype.h>
#ifdef SYSVIO
#include	"xxstdio.h"
#endif

/* R_OK, F_OK */
#ifndef POSIX
#ifdef SYSV
#include	<sys/types.h>
#else
#include	<sys/file.h>
#endif
#else
#include	<unistd.h>
#endif

#ifdef linux
#include	<time.h>
#endif

/* string operation */
#ifdef SYSV
#include	<string.h>
#define	index	strchr
#define	rindex	strrchr
#define	bcopy(s, d, n)	memcpy(d, s, n)
#define	bzero(p, n)	memset(p, 0, n)
#else
#include	<strings.h>
#endif

#ifndef POSIX
char *malloc();
char *realloc();
char *calloc();
int free();
#ifdef ANSI
char *sprintf(char *, const char *, ...);
#else
char *sprintf();
#endif
#else
void *malloc();
void *realloc();
void *calloc();
void free();
#ifdef ANSI
int sprintf(char *, const char *, ...);
#else
int sprintf();
#endif
#endif
char *mktemp();
char *getenv();
void exit();

#define DEBUG		/* for massive printing of input */
			/* trace information; select by -d */
#define STATS		/* to enable statistics reporting via -s option */

#define	DEBUGoff	0
#define	DEBUGuser	1
#define	DEBUGsys	2
#define	Debugoff	(debug<=DEBUGoff)
#define	Debuguser	(debug>=DEBUGuser)
#define	Debug		(debug>=DEBUGsys)

#ifdef MSDOS
#define BINARYOPEN(f)	fopen(f,"rb")	/* byte-oriented host version */
#define BINARYWOPEN(f)	fopen(f,"w+b")
/*#define	DIR_SEP		'\\'*/
#define	DIR_SEP		'/'
#define	PATH_SEP	';'
#define	TMP		""
#define	DVITEMPLATE	"D2PXXXXX"
#else
#define BINARYOPEN(f)	fopen(f,"r")	/* byte-oriented host version */
#define BINARYWOPEN(f)	fopen(f,"w+")
#define	DIR_SEP		'/'
#define	PATH_SEP	':'
#define	TMP		"/tmp/"
#define	DVITEMPLATE	"DVI2PS-XXXXXX"
#endif

/* ARITHRSHIFT not used */
#define ARITHRSHIFT			/* define if ">>" operator is a */
					/* sign-propagating arithmetic  */
					/*   right shift */
#define USEGLOBALMAG			/* when defined, the dvi global */
					/*   magnification is applied   */
      
/* We can leave USEGLOBALMAG undefined when we have a limited
   number of font magnifications (at 300dpi) available.  Otherwise, we
   will simply complain about missing PXL files
 */
/* #undef USEGLOBALMAG */

#define	PSIFONT_HDR	"//psifont"
#define	PSCOLOR_HDR	"//color"

#define	INCEXT		".ps"

#define	MAXOPEN		12	/* limit on number of open font files */

#define	DVIFORMAT	2
#define	EXTDVIFORMAT	3

#define	STACKSIZE	100
#define	STRSIZE		257
#define	PATHLEN		1024
#define	NO_FILE		(FILE *)-1

#define	NEW(A,e)	((A *)alloc_check(malloc((unsigned)sizeof(A)), e))
#define	NEWTAB(A,n,e)	((A *)alloc_check(malloc((unsigned)sizeof(A)*n), e))
#define	MAGSIZE(f)	((unsigned int)(1000.0*(f) + 0.5))
#define	ROUND(f)	((int)((f) + 0.5))
#define	STREQ(s,t)	(strcmp(s,t) == 0)

typedef unsigned char byte;

typedef float SCALED;
#define	scale(x,s)	(int)((SCALED)(x)*(SCALED)(s)/(1<<20))
/*
typedef int SCALED;
#define	scale(x,s)	scale_exact(x,s)
*/

typedef int BOOLEAN;
typedef char Boolean;
#define	TRUE		1
#define	FALSE		0


/**********************************************************************/
/***********************  Font Data Structures  ***********************/
/**********************************************************************/

struct font_index {	/* pointer to font entry */
    int k;
    struct font_entry *fent;
    struct font_index *next;
};

typedef int DEV_FONT;
#define	DEV_NULLFONT	(DEV_FONT)(-1)

struct font_entry {	/* font entry */
    int k;			/* unique id	*/
    int c, s, d, a, l;
    char n[STRSIZE];		/* FNT_DEF command parameters		*/
    void (*fnt_readfontinfo)();
    void (*rvf_setchar)();
    void (*rvf_setstring)();
    DEV_FONT (*dev_fontdict)();	/* returns the font in device		*/
    int (*dev_setchar)();	/* device dependent part of setchar	*/
    int (*dev_setstring)();	/* device dependent part of setstring	*/
    void *finfo;	/* font/device dependent information	*/
    struct font_entry *next;
    char name[PATHLEN];		/* full name of font file		*/
    FILE *openfile;		/* file stream (NO_FILE if none)	*/
    struct openfont_list *openlist;
    int ncdl;			/* # of different chars actually downloaded */
#ifdef STATS
    int nbpxl;			/* # of bytes of PXL data downloaded	*/
    int ncts;			/* total # of characters typeset	*/
#endif
};

#define	setcurfont(fe)	curfontent = fe
#define	fnt_markchar	dev_setchar
#define	FNT_markchar	DEV_setchar
#define	DEV_fontdict	(*(curfontent->dev_fontdict))
#define	DEV_setchar	(*(curfontent->dev_setchar))
#define	DEV_setstring	(*(curfontent->dev_setstring))

#define	NDIR	4
#define	HOR	0
#define	VER	1


struct fontop {
    char *fo_type;
    int (*fo_init)();
    int (*fo_access)();
    void (*fo_initfontinfo)();
};

#define	FDQUO	'"'
struct confop {
    char *co_name;
    void (*co_get)();
};

#define	ACC_EXACT	0
#define	ACC_SUBST	1
#define	ACC_MAGSTEP	2
#define	ACC_GEN		4
struct accarg {
    int acc_mode;
    float rawmagfact;
    float actmagfact;
    int submag, reqmag;
    float stepmagfact;
    char *pv_name;	/* font name */
    int pv_mag;		/* magnification */
    char *pv_fam;	/* family */
    int pv_ds;		/* design size */
    char *pv_jsub;	/* jsubfont name */
};