aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/plot/libplot/subr.c
blob: 48078ed6602a7405a29d59cfd49b3eb6034caf13 (plain)
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
#include "mplot.h"
#define pSMALL    0.5
struct penvir  E[9] = {
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite},
{ 0., 1024., 0., 0., 1., -1.,1024., -1024., 0., 0., pSMALL, 1., 1, 0.,1, DBlack, DWhite}
};
struct penvir *e0 = E, *e1 = &E[1], *esave;
int
bcolor(char *s){
	int c;
	while (*s != 0) {
		switch (*s) {
		case '0': case '1': case '2': case '3': case '4':
		case '5': case '6': case '7': case '8': case '9':
			c=0;
			while('0'<=*s && *s<='9')
				c=c*10+*s++-'0';
			if(c < 0)
				return DBlack;
			return cmap2rgba(c);
		case 'k':  case 'z':	/* zero was old name for kblack */
			return(DBlack);
		case 'r':
print("RED");
			return(DRed);
		case 'g': 
			return(DGreen);
		case 'b': 
			return(DBlue);
		case 'm': 
			return(DMagenta);
		case 'y': 
			return(DYellow);
		case 'c': 
			return(DCyan);
		case 'w': 
			return(DWhite);
		case 'R': 
			return(atoi(s + 1));
		case 'G': 
			e1->pgap = atof(s + 1); 
			return(-1);
		case 'A': 
			e1->pslant = (180. - atof(s + 1)) / RADIAN; 
			return(-1);
		}
		while (*++s != 0) 
			if (*s == '/') {
				s++;
				break;
			}
	}
	return DBlack;
}
void sscpy(struct penvir *a, struct penvir *b){ /* copy 'a' onto 'b' */
	b->left = a->left; 
	b->bottom = a->bottom; 
	b->xmin = a->xmin; 
	b->ymin = a->ymin;
	b->scalex = a->scalex; 
	b->scaley = a->scaley;
	b->sidex = a->sidex; 
	b->sidey = a->sidey;
	b->copyx = a->copyx; 
	b->copyy = a->copyy;
	b->quantum = a->quantum;
	b->grade = a->grade;
	b->pmode = a->pmode; 
	b->foregr = a->foregr; 
	b->backgr = a->backgr;
}
void idle(void){}

void ptype(char *s){USED(s);}