|
|
1.1 root 1: /* Plotting functions for v8 and v9 systems */
2: /* This file is an alternative to plot.h */
3:
4: #define SOLID "solid"
5: #define DOTTED "dotted"
6: #define DASHED "dashed"
7: #define DOTDASH "dotdash"
8:
9: /* open the plotting output */
10: #define openpl() printf("o\n")
11:
12: /* close the plotting output */
13: #define closepl() printf("cl\n")
14:
15: /* make sure the page or screen is clear */
16: #define erase() printf("e\n")
17:
18: /* plot a point at _x,_y, which becomes current */
19: #define point(_x,_y) printf("poi %d %d\n", _x,_y)
20:
21: /* coordinates to be assigned to lower left and upper right
22: corners of (square) plotting area */
23: #define range(_x,_y,_X,_Y) printf("ra %d %d %d %d\n", _x,_y,_X,_Y)
24:
25: /* place text, first letter at current point, which does not change */
26: #define text(_s) {if(*(_s) == ' ')printf("t \"%s\"\n",_s); else printf("t %s\n", _s); }
27:
28: /* draw line from current point to _x,_y, which becomes current */
29: #define vec(_x,_y) printf("v %d %d\n", _x,_y)
30:
31: /* _x,_y becomes current point */
32: #define move(_x, _y) printf("m %d %d\n", _x, _y)
33:
34: /* specify style for drawing lines: "dotted", "solid", "dotdash" */
35: #define pen(_s) printf("pe %s\n", _s)
36:
37: #define BLACK "black"
38: #define RED "red"
39: #define GREEN "green"
40: #define BLUE "blue"
41:
42: static struct {
43: char *name;
44: char *hsbcode;
45: } colors[] = {
46: BLACK, "0 0 0",
47: RED, "0 1 1",
48: GREEN, ".33 1 1",
49: BLUE, ".67 1 1"
50: };
51:
52: static void
53: color(char *s)
54: {
55: char *t;
56: int i;
57: for(i=0; i<sizeof(colors)/sizeof(*colors); i++)
58: if(strcmp(s, colors[i].name) == 0)
59: s = colors[i].hsbcode;
60: while(t = strchr(s, ','))
61: *t = ' ';
62: printf("co \"%s\"\n",s);
63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.