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