1: /* tv.c: draw vertical lines */ 2: # include "t..c" 3: drawvert(start,end, c, lwid) 4: { 5: char *exb=0, *ext=0; 6: int tp=0, sl, ln, pos, epb, ept, vm; 7: end++; 8: vm='v'; 9: /* note: nr 35 has value of 1m outside of linesize */ 10: while (instead[end]) end++; 11: for(ln=0; ln<lwid; ln++) 12: { 13: epb=ept=0; 14: pos = 2*ln-lwid+1; 15: if (pos!=tp) fprintf(tabout, "\\h'%dp'", pos-tp); 16: tp = pos; 17: if (end<nlin) 18: { 19: if (fullbot[end]|| (!instead[end] && allh(end))) 20: epb=2; 21: else 22: switch (midbar(end,c)) 23: { 24: case '-': 25: exb = "1v-.5m"; break; 26: case '=': 27: exb = "1v-.5m"; 28: epb = 1; break; 29: } 30: } 31: if (lwid>1) 32: switch(interh(end, c)) 33: { 34: case THRU: epb -= 1; break; 35: case RIGHT: epb += (ln==0 ? 1 : -1); break; 36: case LEFT: epb += (ln==1 ? 1 : -1); break; 37: } 38: if (lwid==1) 39: switch(interh(end,c)) 40: { 41: case THRU: epb -= 1; break; 42: case RIGHT: case LEFT: epb += 1; break; 43: } 44: if (start>0) 45: { 46: sl = start-1; 47: while (sl>=0 && instead[sl]) sl--; 48: if (sl>=0 && (fullbot[sl] || allh(sl))) 49: ept=0; 50: else 51: if (sl>=0) 52: switch(midbar(sl,c)) 53: { 54: case '-': 55: ext = ".5m"; break; 56: case '=': 57: ext= ".5m"; ept = -1; break; 58: default: 59: vm = 'm'; break; 60: } 61: else 62: ept = -4; 63: } 64: else if (start==0 && allh(0)) 65: { 66: ept=0; 67: vm = 'm'; 68: } 69: if (lwid>1) 70: switch(interh(start,c)) 71: { 72: case THRU: ept += 1; break; 73: case LEFT: ept += (ln==0 ? 1 : -1); break; 74: case RIGHT: ept += (ln==1 ? 1 : -1); break; 75: } 76: else if (lwid==1) 77: switch(interh(start,c)) 78: { 79: case THRU: ept += 1; break; 80: case LEFT: case RIGHT: ept -= 1; break; 81: } 82: if (exb) 83: fprintf(tabout, "\\v'%s'", exb); 84: if (epb) 85: fprintf(tabout, "\\v'%dp'", epb); 86: fprintf(tabout, "\\s\\n(%d",LSIZE); 87: if (linsize) 88: fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE); 89: fprintf(tabout, "\\h'-\\n(#~u'"); /* adjustment for T450 nroff boxes */ 90: fprintf(tabout, "\\L'|\\n(#%cu-%s", linestop[start]+'a'-1, vm=='v'? "1v" : "\\n(35u"); 91: if (ext) 92: fprintf(tabout, "-(%s)",ext); 93: if (exb) 94: fprintf(tabout, "-(%s)", exb); 95: pos = ept-epb; 96: if (pos) 97: fprintf(tabout, "%s%dp", pos>=0? "+" : "", pos); 98: /* the string #d is either "nl" or ".d" depending 99: on diversions; on GCOS not the same */ 100: fprintf(tabout, "'\\s0\\v'\\n(\\*(#du-\\n(#%cu+%s", linestop[start]+'a'-1,vm=='v' ? "1v" : "\\n(35u"); 101: if (ext) 102: fprintf(tabout, "+%s",ext); 103: if (ept) 104: fprintf(tabout, "%s%dp", (-ept)>0 ? "+" : "", (-ept)); 105: fprintf(tabout, "'"); 106: if (linsize) 107: fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE); 108: } 109: } 110: 111: 112: midbar(i,c) 113: { 114: int k; 115: k = midbcol(i,c); 116: if (k==0 && c>0) 117: k = midbcol(i, c-1); 118: return(k); 119: } 120: midbcol(i,c) 121: { 122: int ct; 123: while ( (ct=ctype(i,c)) == 's') 124: c--; 125: if (ct=='-' || ct == '=') 126: return(ct); 127: if (ct=barent(table[i][c].col)) 128: return(ct); 129: return(0); 130: } 131: 132: barent(s) 133: char *s; 134: { 135: if (s==0) return (1); 136: if (s[0]== '\\') s++; 137: if (s[1]!= 0) 138: return(0); 139: switch(s[0]) 140: { 141: case '_': 142: return('-'); 143: case '=': 144: return('='); 145: } 146: return(0); 147: }