aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/plot/libplot/subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/plot/libplot/subr.c')
-rw-r--r--src/cmd/plot/libplot/subr.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/cmd/plot/libplot/subr.c b/src/cmd/plot/libplot/subr.c
new file mode 100644
index 00000000..cf4cf89e
--- /dev/null
+++ b/src/cmd/plot/libplot/subr.c
@@ -0,0 +1,79 @@
+#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;
+bcolor(char *s){
+ int c;
+ while (*s != NULL) {
+ 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 != NULL)
+ 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);}