devutf: add unicode aliases for accented characters
[troff.git] / pic / pic.h
bloba4f7a6a49284a148f10355e7462832855bdb414c
1 #ifndef PI
2 #define PI 3.1415926535897932384626433832795028841971693993751
3 #endif
5 #define MAXWID 8.5 /* default limits max picture to 8.5 x 11; */
6 #define MAXHT 11 /* change to taste without peril */
8 #define dprintf if(dbg)printf
10 extern void yyerror(char *);
12 extern char errbuf[200];
13 #define ERROR sprintf(errbuf,
14 #define FATAL ), yyerror(errbuf), exit(1)
15 #define WARNING ), yyerror(errbuf)
17 #define DEFAULT 0
19 #define HEAD1 1
20 #define HEAD2 2
21 #define HEAD12 (HEAD1+HEAD2)
22 #define INVIS 4
23 #define CW_ARC 8 /* clockwise arc */
24 #define DOTBIT 16 /* line styles */
25 #define DASHBIT 32
26 #define FILLBIT 64 /* gray-fill on boxes, etc. */
27 #define NOEDGEBIT 128 /* no edge on filled object */
29 #define CENTER 01 /* text attributes */
30 #define LJUST 02
31 #define RJUST 04
32 #define ABOVE 010
33 #define BELOW 020
34 #define SPREAD 040
36 #define SCALE 1.0 /* default scale: units/inch */
37 #define WID 0.75 /* default width for boxes and ellipses */
38 #define WID2 0.375
39 #define HT 0.5 /* default height and line length */
40 #define HT2 (HT/2)
41 #define HT5 (HT/5)
42 #define HT10 (HT/10)
44 /* these have to be like so, so that we can write */
45 /* things like R & V, etc. */
46 #define H 0
47 #define V 1
48 #define R_DIR 0
49 #define U_DIR 1
50 #define L_DIR 2
51 #define D_DIR 3
52 #define ishor(n) (((n) & V) == 0)
53 #define isvert(n) (((n) & V) != 0)
54 #define isright(n) ((n) == R_DIR)
55 #define isleft(n) ((n) == L_DIR)
56 #define isdown(n) ((n) == D_DIR)
57 #define isup(n) ((n) == U_DIR)
59 typedef float ofloat; /* for o_val[] in obj; could be double */
61 typedef struct obj { /* stores various things in variable length */
62 int o_type;
63 int o_count; /* number of things */
64 int o_nobj; /* index in objlist */
65 int o_mode; /* hor or vert */
66 float o_x; /* coord of "center" */
67 float o_y;
68 int o_nt1; /* 1st index in text[] for this object */
69 int o_nt2; /* 2nd; difference is #text strings */
70 int o_attr; /* HEAD, CW, INVIS, etc., go here */
71 int o_size; /* linesize */
72 int o_nhead; /* arrowhead style */
73 struct symtab *o_symtab; /* symtab for [...] */
74 float o_ddval; /* value of dot/dash expression */
75 float o_fillval; /* gray scale value */
76 ofloat o_val[1]; /* actually this will be > 1 in general */
77 /* type is not always FLOAT!!!! */
78 } obj;
80 typedef union { /* the yacc stack type */
81 int i;
82 char *p;
83 obj *o;
84 double f;
85 struct symtab *st;
86 } YYSTYPE;
88 extern YYSTYPE yylval, yyval;
90 struct symtab {
91 char *s_name;
92 int s_type;
93 YYSTYPE s_val;
94 struct symtab *s_next;
97 typedef struct { /* attribute of an object */
98 int a_type;
99 int a_sub;
100 YYSTYPE a_val;
101 } Attr;
103 typedef struct {
104 int t_type; /* CENTER, LJUST, etc. */
105 char t_op; /* optional sign for size changes */
106 char t_size; /* size, abs or rel */
107 char *t_val;
108 } Text;
110 #define String 01
111 #define Macro 02
112 #define File 04
113 #define Char 010
114 #define Thru 020
115 #define Free 040
117 typedef struct { /* input source */
118 int type; /* Macro, String, File */
119 char *sp; /* if String or Macro */
120 } Src;
122 extern Src src[], *srcp; /* input source stack */
124 typedef struct {
125 FILE *fin;
126 char *fname;
127 int lineno;
128 } Infile;
130 extern Infile infile[], *curfile;
132 #define MAXARGS 20
133 typedef struct { /* argument stack */
134 char *argstk[MAXARGS]; /* pointers to args */
135 char *argval; /* points to space containing args */
136 } Arg;
138 extern int dbg;
139 extern obj **objlist;
140 extern int nobj, nobjlist;
141 extern Attr *attr;
142 extern int nattr, nattrlist;
143 extern Text *text;
144 extern int ntextlist;
145 extern int ntext;
146 extern int ntext1;
147 extern double curx, cury;
148 extern int hvmode;
149 extern int codegen;
150 extern char *PEstring;
152 char *tostring(char *);
153 char *grow(char *, char *, int, int);
154 double getfval(char *), getcomp(obj *, int), getblkvar(obj *, char *);
155 YYSTYPE getvar(char *);
156 struct symtab *lookup(char *), *makevar(char *, int, YYSTYPE);
157 char *ifstat(double, char *, char *), *delimstr(char *), *sprintgen(char *);
158 void forloop(char *var, double from, double to, int op, double by, char *_str);
159 int setdir(int), curdir(void);
160 void resetvar(void);
161 void checkscale(char *);
162 void pushsrc(int, char *);
163 void copy(void);
164 void copyuntil(char *);
165 void copyfile(char *);
166 void copydef(struct symtab *);
167 void definition(char *);
168 struct symtab *copythru(char *);
169 int input(void);
170 int unput(int);
171 void extreme(double, double);
173 extern double deltx, delty;
174 extern int lineno;
175 extern int synerr;
177 extern double xmin, ymin, xmax, ymax;
179 obj *leftthing(int), *boxgen(void), *circgen(int), *arcgen(int);
180 obj *linegen(int), *splinegen(void), *movegen(void);
181 obj *textgen(void), *plotgen(void);
182 obj *troffgen(char *), *rightthing(obj *, int), *blockgen(obj *, obj *);
183 obj *makenode(int, int), *makepos(double, double);
184 obj *fixpos(obj *, double, double);
185 obj *addpos(obj *, obj *), *subpos(obj *, obj *);
186 obj *makebetween(double, obj *, obj *);
187 obj *getpos(obj *, int), *gethere(void), *getfirst(int, int);
188 obj *getlast(int, int), *getblock(obj *, char *);
189 void savetext(int, char *);
190 void makeiattr(int, int);
191 void makevattr(char *);
192 void makefattr(int type, int sub, double f);
193 void maketattr(int, char *);
194 void makeoattr(int, obj *);
195 void makeattr(int type, int sub, YYSTYPE val);
196 void printexpr(double);
197 void printpos(obj *);
198 void exprsave(double);
199 void addtattr(int);
200 void printlf(int, char *);
202 struct pushstack {
203 double p_x;
204 double p_y;
205 int p_hvmode;
206 double p_xmin;
207 double p_ymin;
208 double p_xmax;
209 double p_ymax;
210 struct symtab *p_symtab;
212 extern struct pushstack stack[];
213 extern int nstack;
214 extern int cw;
216 extern double errcheck(double, char *);
217 #define Log10(x) errcheck(log10(x), "log")
218 #define Exp(x) errcheck(exp(x), "exp")
219 #define Sqrt(x) errcheck(sqrt(x), "sqrt")