ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/meta.h
Revision: 1.1
Committed: Sat Feb 22 02:07:26 2003 UTC (21 years, 9 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 /* RCSid: $Id$ */
2 /*
3 * Standard meta-file definitions and limits
4 */
5
6
7 #include <stdio.h>
8
9 #include <ctype.h>
10
11
12 #define TRUE 1
13 #define FALSE 0
14
15 #define PEOF 'F' /* end of file global */
16 #define PEOP 'E' /* end of page global */
17 #define PPAUSE 'P' /* pause global */
18 #define PDRAW 'D' /* draw global */
19 #define POPEN 'O' /* open segment */
20 #define PCLOSE 'C' /* close segment */
21 #define PSET 'S' /* set global */
22 #define PUNSET 'U' /* unset global */
23 #define PRESET 'R' /* reset global to default */
24 #define PINCL 'I' /* include file */
25
26 #define PLSEG 'l' /* line segment command */
27 #define PRFILL 'r' /* rectangle fill command */
28 #define PTFILL 't' /* triangle fill command */
29 #define PMSTR 'm' /* matrix string command */
30 #define PVSTR 'v' /* vector string command */
31 #define PSEG 's' /* print segment command */
32 #define PPFILL 'p' /* polygon fill command */
33
34 #define NCOMMANDS 17 /* number of commands */
35
36 #define COML "lrtmsvpOCESURPDIF" /* command letters */
37
38 #define ADELIM '`' /* additional argument delimiter */
39 #define CDELIM '#' /* comment delimiter */
40
41 #define MAXARGS 512 /* maximum # of arguments for primitive */
42
43 #define SALL 0 /* set all */
44 #define SPAT0 04 /* set pattern 0 */
45 #define SPAT1 05 /* set pattern 1 */
46 #define SPAT2 06 /* set pattern 2 */
47 #define SPAT3 07 /* set pattern 3 */
48
49 #define SYSTEM 0 /* system error, internal, fatal */
50 #define USER 1 /* user error, fatal */
51 #define WARNING 2 /* user error, not fatal */
52
53 #ifdef UNIX
54 #define TDIR "/tmp/" /* directory for temporary files */
55 #ifndef MDIR
56 #define MDIR "/usr/local/lib/meta/" /* directory for metafiles */
57 #endif
58 #define TTY "/dev/tty" /* console name */
59 #endif
60
61 #ifdef MAC
62 #define TDIR "5:tmp/" /* directory for temporary files */
63 #define MDIR "/meta/" /* directory for metafiles */
64 #define TTY ".con" /* console name */
65 #endif
66
67 #ifdef CPM
68 #define TDIR "0/" /* directory for temporary files */
69 #define MDIR "0/" /* directory for metafiles */
70 #define TTY "CON:" /* console name */
71 #endif
72
73 #define MAXFNAME 64 /* maximum file name length */
74
75 #define XYSIZE (1<<14) /* metafile coordinate size */
76
77 #define max(x, y) ((x) > (y) ? (x) : (y))
78 #define min(x, y) ((x) < (y) ? (x) : (y))
79
80 #define abs(x) ((x) < 0 ? -(x) : (x))
81
82 #define iscom(c) (comndx(c) != -1)
83 #define isglob(c) isupper(c)
84 #define isprim(c) islower(c)
85
86 #define WIDTH(wspec) ((wspec)==0 ? 0 : 12*(1<<(wspec)))
87 #define CONV(coord, size) ((int)(((long)(coord)*(size))>>14))
88 #define ICONV(dcoord, size) ((int)(((long)(dcoord)<<14)/(size)))
89
90 #define XMN 0 /* index in xy array for xmin */
91 #define YMN 1 /* index in xy array for ymin */
92 #define XMX 2 /* index in xy array for xmax */
93 #define YMX 3 /* index in xy array for ymax */
94
95
96 /*
97 * Structure definitions for primitives
98 */
99
100 struct primitive { /* output primitive */
101 short com, /* command (0 - 127) */
102 arg0; /* first argument (1 byte) */
103 int xy[4]; /* extent=(xmin,ymin,xmax,ymax) */
104 char *args; /* additional arguments */
105 struct primitive *pnext; /* next primitive */
106 };
107
108 typedef struct primitive PRIMITIVE;
109
110 struct plist { /* list of primitives */
111 PRIMITIVE *ptop, *pbot;
112 };
113
114 typedef struct plist PLIST;
115
116
117 /*
118 * External declarations
119 */
120
121 char *malloc(), *savestr();
122
123 PRIMITIVE *palloc(), *pop();
124
125 FILE *efopen(), *mfopen();
126
127 extern char coms[];
128
129 extern char errmsg[];
130
131 extern char *progname;