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

Defined functions

brack defined in line 115; used 12 times
paren defined in line 7; used 1 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1983-08-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 888
Valid CSS Valid XHTML 1.0 Strict