1: # include "e.h" 2: 3: paren(leftc, p1, rightc) int p1, leftc, rightc; { 4: int n, m, h1, j, b1, v; 5: h1 = eht[p1]; b1 = ebase[p1]; 6: yyval = p1; 7: lfont[yyval] = rfont[yyval] = 0; 8: n = (h1+(6*EFFPS(ps)-1))/(6*EFFPS(ps)); 9: if( n<2 ) n = 1; 10: m = n-2; 11: if (leftc=='{' || rightc == '}') { 12: n = n%2 ? n : ++n; 13: if( n<3 ) n=3; 14: m = n-3; 15: } 16: eht[yyval] = VERT(6 * ps * n); 17: ebase[yyval] = b1 + (eht[yyval]-h1)/2; 18: v = b1 - h1/2 + VERT( (ps*6*4)/10 ); 19: printf(".ds %d \\|\\v'%du'", yyval, v); 20: switch( leftc ) { 21: case 'n': /* nothing */ 22: case '\0': 23: break; 24: case 'f': /* floor */ 25: if (n <= 1) 26: printf("\\(lf"); 27: else 28: brack(m, "\\(bv", "\\(bv", "\\(lf"); 29: break; 30: case 'c': /* ceiling */ 31: if (n <= 1) 32: printf("\\(lc"); 33: else 34: brack(m, "\\(lc", "\\(bv", "\\(bv"); 35: break; 36: case '{': 37: printf("\\b'\\(lt"); 38: for(j = 0; j < m; j += 2) printf("\\(bv"); 39: printf("\\(lk"); 40: for(j = 0; j < m; j += 2) printf("\\(bv"); 41: printf("\\(lb'"); 42: break; 43: case '(': 44: brack(m, "\\(lt", "\\(bv", "\\(lb"); 45: break; 46: case '[': 47: brack(m, "\\(lc", "\\(bv", "\\(lf"); 48: break; 49: case '|': 50: brack(m, "|", "|", "|"); 51: break; 52: default: 53: brack(m, (char *) &leftc, (char *) &leftc, (char *) &leftc); 54: break; 55: } 56: printf("\\v'%du'\\*(%d", -v, p1); 57: if( rightc ) { 58: printf("\\|\\v'%du'", v); 59: switch( rightc ) { 60: case 'f': /* floor */ 61: if (n <= 1) 62: printf("\\(rf"); 63: else 64: brack(m, "\\(bv", "\\(bv", "\\(rf"); 65: break; 66: case 'c': /* ceiling */ 67: if (n <= 1) 68: printf("\\(rc"); 69: else 70: brack(m, "\\(rc", "\\(bv", "\\(bv"); 71: break; 72: case '}': 73: printf("\\b'\\(rt"); 74: for(j = 0; j< m; j += 2)printf("\\(bv"); 75: printf("\\(rk"); 76: for(j = 0; j< m; j += 2) printf("\\(bv"); 77: printf("\\(rb'"); 78: break; 79: case ']': 80: brack(m, "\\(rc", "\\(bv", "\\(rf"); 81: break; 82: case ')': 83: brack(m, "\\(rt", "\\(bv", "\\(rb"); 84: break; 85: case '|': 86: brack(m, "|", "|", "|"); 87: break; 88: default: 89: brack(m, (char *) &rightc, (char *) &rightc, (char *) &rightc); 90: break; 91: } 92: printf("\\v'%du'", -v); 93: } 94: printf("\n"); 95: if(dbg)printf(".\tcurly: h=%d b=%d n=%d v=%d l=%c, r=%c\n", 96: eht[yyval], ebase[yyval], n, v, leftc, rightc); 97: } 98: 99: brack(m, t, c, b) int m; char *t, *c, *b; { 100: int j; 101: printf("\\b'%s", t); 102: for( j=0; j<m; j++) 103: printf("%s", c); 104: printf("%s'", b); 105: }