ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/meta.h
Revision: 1.4
Committed: Tue Jul 1 21:21:40 2003 UTC (20 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.3: +2 -2 lines
Log Message:
Compile fixes for gcc 3.3

File Contents

# Content
1 /* RCSid: $Id: meta.h,v 1.3 2003/06/16 14:54:54 greg Exp $ */
2 /*
3 * Standard meta-file definitions and limits
4 */
5 #ifndef _RAD_META_H_
6 #define _RAD_META_H_
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 #include "copyright.h"
12
13 #include <stdio.h>
14 #include <stdlib.h>
15
16 #include <ctype.h>
17
18
19 #define TRUE 1
20 #define FALSE 0
21
22 #define PEOF 'F' /* end of file global */
23 #define PEOP 'E' /* end of page global */
24 #define PPAUS 'P' /* pause global */
25 #define PDRAW 'D' /* draw global */
26 #define POPEN 'O' /* open segment */
27 #define PCLOSE 'C' /* close segment */
28 #define PSET 'S' /* set global */
29 #define PUNSET 'U' /* unset global */
30 #define PRESET 'R' /* reset global to default */
31 #define PINCL 'I' /* include file */
32
33 #define PLSEG 'l' /* line segment command */
34 #define PRFILL 'r' /* rectangle fill command */
35 #define PTFILL 't' /* triangle fill command */
36 #define PMSTR 'm' /* matrix string command */
37 #define PVSTR 'v' /* vector string command */
38 #define PSEG 's' /* print segment command */
39 #define PPFILL 'p' /* polygon fill command */
40
41 #define NCOMMANDS 17 /* number of commands */
42
43 #define COML "lrtmsvpOCESURPDIF" /* command letters */
44
45 #define ADELIM '`' /* additional argument delimiter */
46 #define CDELIM '#' /* comment delimiter */
47
48 #define MAXARGS 512 /* maximum # of arguments for primitive */
49
50 #define SALL 0 /* set all */
51 #define SPAT0 04 /* set pattern 0 */
52 #define SPAT1 05 /* set pattern 1 */
53 #define SPAT2 06 /* set pattern 2 */
54 #define SPAT3 07 /* set pattern 3 */
55
56 #define SYSTEM 0 /* system error, internal, fatal */
57 #define USER 1 /* user error, fatal */
58 #define WARNING 2 /* user error, not fatal */
59
60 #ifdef UNIX
61 #define TDIR "/tmp/" /* directory for temporary files */
62 #ifndef MDIR
63 #define MDIR "/usr/local/lib/meta/" /* directory for metafiles */
64 #endif
65 #define TTY "/dev/tty" /* console name */
66 #endif
67
68 #ifdef MAC
69 #define TDIR "5:tmp/" /* directory for temporary files */
70 #define MDIR "/meta/" /* directory for metafiles */
71 #define TTY ".con" /* console name */
72 #endif
73
74 #ifdef CPM
75 #define TDIR "0/" /* directory for temporary files */
76 #define MDIR "0/" /* directory for metafiles */
77 #define TTY "CON:" /* console name */
78 #endif
79
80 #ifdef _WIN32 /* XXX */
81 #define MDIR "c\\tmp\\" /* XXX we just need something to compile for now */
82 #define TTY "CON:" /* XXX this probably doesn't work */
83 #endif /* XXX */
84
85 #define MAXFNAME 64 /* maximum file name length */
86
87 #define XYSIZE (1<<14) /* metafile coordinate size */
88
89 #ifndef max
90 #define max(x, y) ((x) > (y) ? (x) : (y))
91 #endif
92 #ifndef min
93 #define min(x, y) ((x) < (y) ? (x) : (y))
94 #endif
95
96 #define abs(x) ((x) < 0 ? -(x) : (x))
97
98 #define iscom(c) (comndx(c) != -1)
99 #define isglob(c) isupper(c)
100 #define isprim(c) islower(c)
101
102 #define WIDTH(wspec) ((wspec)==0 ? 0 : 12*(1<<(wspec)))
103 #define CONV(coord, size) ((int)(((long)(coord)*(size))>>14))
104 #define ICONV(dcoord, size) ((int)(((long)(dcoord)<<14)/(size)))
105
106 #define XMN 0 /* index in xy array for xmin */
107 #define YMN 1 /* index in xy array for ymin */
108 #define XMX 2 /* index in xy array for xmax */
109 #define YMX 3 /* index in xy array for ymax */
110
111
112 /*
113 * Structure definitions for primitives
114 */
115
116 struct primitive { /* output primitive */
117 short com, /* command (0 - 127) */
118 arg0; /* first argument (1 byte) */
119 int xy[4]; /* extent=(xmin,ymin,xmax,ymax) */
120 char *args; /* additional arguments */
121 struct primitive *pnext; /* next primitive */
122 };
123
124 typedef struct primitive PRIMITIVE;
125
126 struct plist { /* list of primitives */
127 PRIMITIVE *ptop, *pbot;
128 };
129
130 typedef struct plist PLIST;
131
132
133 /*
134 * External declarations
135 */
136
137 char *savestr();
138
139 PRIMITIVE *pop();
140
141 FILE *efopen(), *mfopen();
142
143 extern char coms[];
144 extern char errmsg[];
145 extern char *progname;
146
147 /* expand.c */
148 extern void expand(FILE *infp, short *exlist);
149 /* palloc.c */
150 extern PRIMITIVE *palloc(void);
151 extern void pfree(register PRIMITIVE *p);
152 extern void plfree(register PLIST *pl);
153 /* sort.c */
154 extern void sort(FILE *infp, int (*pcmp)());
155 extern void pmergesort(FILE *fi[], int nf, PLIST *pl, int (*pcmp)(), FILE *ofp);
156 /* metacalls.c */
157 extern void mdraw(int x, int y);
158 extern void msegment(int xmin, int ymin, int xmax, int ymax, char *sname,
159 int d, int thick, int color);
160 extern void mvstr(int xmin, int ymin, int xmax, int ymax, char *s,
161 int d, int thick, int color);
162 extern void mtext(int x, int y, char *s, int cpi, int color);
163 extern void mpoly(int x, int y, int border, int pat, int color);
164 extern void mtriangle(int xmin, int ymin, int xmax, int ymax,
165 int d, int pat, int color);
166 extern void mrectangle(int xmin, int ymin, int xmax, int ymax,
167 int pat, int color);
168 extern void mline(int x, int y, int type, int thick, int color);
169 extern void mcloseseg(void);
170 extern void mopenseg(char *sname);
171 extern void msetpat(int pn, char *pat);
172 extern void minclude(char *fname);
173 extern void mdone(void);
174 extern void mendpage(void);
175
176
177 #ifdef __cplusplus
178 }
179 #endif
180 #endif /* _RAD_META_H_ */
181