|
|
1.1 ! root 1: #include "idfilt.h" ! 2: ! 3: #define RESOLUTION 972.0 ! 4: ! 5: float xscale, yscale; ! 6: ! 7: void idjusttext (str) ! 8: char *str; ! 9: { ! 10: if ( ! 11: strncmp (str, ".IE", 3) && ! 12: strncmp (str, "...knot", 7) && ! 13: strncmp (str, "...endspline", 12) && ! 14: strncmp (str, "...left", 7) && ! 15: strncmp (str, "...center", 9) && ! 16: strncmp (str, "...right", 8) ! 17: ) ! 18: fputs (str, stdout); ! 19: } ! 20: ! 21: void idstart () ! 22: { ! 23: } ! 24: ! 25: void idendbound () ! 26: { ! 27: if (boundset) ! 28: return; ! 29: idminx (-6.0); ! 30: idmaxy (6.0); ! 31: idmaxx (6.0); ! 32: idminy (-6.0); ! 33: if (!banzai && maxx - minx < 0.2) { ! 34: maxx += 1; ! 35: minx -= 1; ! 36: } ! 37: if (!banzai && maxy - miny < 0.2) { ! 38: maxy += 1; ! 39: miny -= 1; ! 40: } ! 41: xscale = width*RESOLUTION/(maxx - minx); ! 42: if (!heightset) ! 43: yscale = - xscale; ! 44: else ! 45: yscale = height*RESOLUTION/(miny - maxy); ! 46: minx -= 0.5*(colwid - width)*RESOLUTION/xscale; ! 47: maxx += 0.5*(colwid - width)*RESOLUTION/xscale; ! 48: boundset = TRUE; ! 49: printf (".ne %4.2fi\n", heightset?height:yscale*(miny - maxy)/RESOLUTION); ! 50: } ! 51: ! 52: void idline (x1, y1, x2, y2) ! 53: float x1; ! 54: float y1; ! 55: float x2; ! 56: float y2; ! 57: { ! 58: long int X1, Y1, X2, Y2; ! 59: boolean shortvert, shorthoriz, nonrectilinear; ! 60: X1 = round(xscale*x1); ! 61: Y1 = round(yscale*y1); ! 62: X2 = round(xscale*x2); ! 63: Y2 = round(yscale*y2); ! 64: shortvert = X1 == X2 && abs(Y1-Y2) < RESOLUTION/2; ! 65: shorthoriz = Y1 == Y2 && abs(X1-X2) < RESOLUTION/2; ! 66: nonrectilinear = X1 != X2 && Y1 != Y2; ! 67: if (wantquality || shortvert || shorthoriz || nonrectilinear) ! 68: printf ("\\h'%du'\\v'%du'\\D'l %du %du'\\h'%du'\\v'%du'\n.sp -1\n", ! 69: round(xscale*(x1-minx)), ! 70: round(yscale*(y1-maxy)), ! 71: round(xscale*(x2-x1)), ! 72: round(yscale*(y2-y1)), ! 73: round(-xscale*(x2-minx)), ! 74: round(-yscale*(y2-maxy)) ! 75: ); ! 76: else { ! 77: if (Y1 == Y2) ! 78: printf ("\\h'%du'\\v'%du'\\l'%du'\\h'%du'\\v'%du'\n.sp -1\n", ! 79: round(xscale*(x1-minx)), ! 80: round(yscale*(y1-maxy)), ! 81: round(xscale*(x2-x1)), ! 82: round(-xscale*(x2-minx)), ! 83: round(-yscale*(y2-maxy)) ! 84: ); ! 85: if (X1 == X2) ! 86: printf ("\\h'%du'\\v'%du'\\L'%du'\\h'%du'\\v'%du'\n.sp -1\n", ! 87: round(xscale*(x1-minx)), ! 88: round(yscale*(y1-maxy)), ! 89: round(yscale*(y2-y1)), ! 90: round(-xscale*(x2-minx)), ! 91: round(-yscale*(y2-maxy)) ! 92: ); ! 93: } ! 94: } ! 95: ! 96: void idcircle (x0, y0, r) ! 97: float x0; ! 98: float y0; ! 99: float r; ! 100: { ! 101: printf ("\\h'%du'\\v'%du'\\D'c %du'\\h'%du'\\v'%du'\n.sp -1\n", ! 102: round(xscale*(x0-r-minx)), ! 103: round(yscale*(y0-maxy)), ! 104: round(2*xscale*r), ! 105: round(-xscale*(x0+r-minx)), ! 106: round(-yscale*(y0-maxy)) ! 107: ); ! 108: } ! 109: ! 110: void idarc (x0, y0, x1, y1, x2, y2, t1, t2, r) ! 111: float x0; ! 112: float y0; ! 113: float x1; ! 114: float y1; ! 115: float x2; ! 116: float y2; ! 117: float t1; ! 118: float t2; ! 119: float r; ! 120: { ! 121: if (xscale*r > 30000.0) ! 122: idline (x1, y1, x2, y2); ! 123: else { ! 124: printf ("\\h'%du'\\v'%du'\\D'a %du %du %du %du'\\h'%du'\\v'%du'\n.sp -1\n", ! 125: round(xscale*(x1-minx)), ! 126: round(yscale*(y1-maxy)), ! 127: round(xscale*(x0-x1)), ! 128: round(yscale*(y0-y1)), ! 129: round(xscale*(x2-x0)), ! 130: round(yscale*(y2-y0)), ! 131: round(-xscale*(x2-minx)), ! 132: round(-yscale*(y2-maxy)) ! 133: ); ! 134: } ! 135: } ! 136: ! 137: void idleft (x, y, str) ! 138: float x; ! 139: float y; ! 140: char *str; ! 141: { ! 142: str == ++str; ! 143: printf ("\\h'%du'\\v'%du'%s\\h'-\\w\\(ts%s\\(tsu'\n.sp -1\n", ! 144: round(xscale*(x-minx)), ! 145: round(yscale*(y-maxy)), ! 146: str, ! 147: str ! 148: ); ! 149: } ! 150: ! 151: void idcenter (x, y, str) ! 152: float x; ! 153: float y; ! 154: char *str; ! 155: { ! 156: str = ++str; ! 157: printf ("\\h'%du'\\v'%du'\\h'-\\w\\(ts%s\\(tsu/2u'%s\\h'-\\w\\(ts%s\\(tsu/2u'\n.sp -1\n", ! 158: round(xscale*(x-minx)), ! 159: round(yscale*(y-maxy)), ! 160: str, ! 161: str, ! 162: str ! 163: ); ! 164: } ! 165: ! 166: void idright (x, y, str) ! 167: float x; ! 168: float y; ! 169: char *str; ! 170: { ! 171: str = ++str; ! 172: printf ("\\h'%du'\\v'%du'\\h'-\\w\\(ts%s\\(tsu'%s\\h'-\\w\\(ts%s\\(tsu'\n.sp -1\n", ! 173: round(xscale*(x-minx)), ! 174: round(yscale*(y-maxy)), ! 175: str, ! 176: str, ! 177: str ! 178: ); ! 179: } ! 180: ! 181: void idendE () ! 182: { ! 183: if (boundset) ! 184: printf (".sp %du\n.sp 1\n.sp 1\n", ! 185: round(yscale*(miny-maxy)) ! 186: ); ! 187: printf (".IE\n"); ! 188: } ! 189: ! 190: void idendF () ! 191: { ! 192: } ! 193: ! 194: float osplx, osply; ! 195: ! 196: void idspline (sx, sy) ! 197: float sx, sy; ! 198: { ! 199: osplx = sx; ! 200: osply = sy; ! 201: printf ("\\h'%du'\\v'%du'\\D'~", ! 202: round(xscale*(osplx-minx)), ! 203: round(yscale*(osply-maxy)) ! 204: ); ! 205: } ! 206: ! 207: void idknot (sx, sy) ! 208: float sx, sy; ! 209: { ! 210: printf (" %du %du", ! 211: round(xscale*(sx-osplx)), ! 212: round(yscale*(sy-osply)) ! 213: ); ! 214: osplx = sx; ! 215: osply = sy; ! 216: } ! 217: ! 218: void idendspline () ! 219: { ! 220: printf ("'\\h'%du'\\v'%du'\n.sp -1\n", ! 221: round(xscale*(minx-osplx)), ! 222: round(yscale*(maxy-osply)) ! 223: ); ! 224: } ! 225: ! 226: void idnoerase () ! 227: { ! 228: } ! 229: ! 230: ! 231: void idyeserase () ! 232: { ! 233: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.