1: # include "ne.h"
   2: 
   3: char *res[] {
   4:     ">=", "<=", "!=",
   5:     "+-", "==", "cdot", "CDOT",
   6:     "times", "TIMES",
   7:     "SIGMA", "pi", "PI",
   8:     "alpha", "beta", "gamma", "GAMMA", "delta", "epsilon", "omega",
   9:     "DELTA", "LAMBDA", "PHI", "OMEGA",
  10:     "lambda", "mu", "nu", "theta", "rho", "sigma", "tau", "phi",
  11:     "INF", "INFINITY",
  12:     "inf", "infinity",
  13:     "partial", "PARTIAL",
  14:     "zeta", "eta", "iota", "kappa", "xi", "omicron", "upsilon",
  15:     "chi", "psi", "THETA", "XI", "UPSILON", "PSI",
  16:     "del", "DEL",
  17:     "nothing", "NOTHING",
  18:     "approx", "APPROX",
  19:     0};
  20: char *restran[] {
  21:     ">\b_", "<\b_", "/\b=",
  22:     "+\b_", "=\b_", "8.9", "8.9",
  23:     "x", "x",
  24:     "R", "J", "P",
  25:     "A", "B", "\\e", "G", "D", "S", "C",
  26:     "W", "E", "F", "Z",
  27:     "L", "M", "@", "T", "K", "Y", "I", "U",
  28:     "o", "o", "o", "o",
  29:     "]", "]",
  30:     "Q", "N", "i", "k", "X", "o", "u",
  31:     "X", "V", "O", "X", "U", "H",
  32:     "[", "[",
  33:     "", "",
  34:     "~\b=", "~\b=",
  35:     0};
  36: 
  37: int csp;
  38: int psp;
  39: #define CSSIZE  400
  40: char    cs[420];
  41: 
  42: text(t,p1) int t; char *p1; {
  43:     int i,j,c;
  44:     int w;
  45:     yyval = oalloc();
  46:     ebase[yyval] = 0;
  47:     eht[yyval] = 2; /* ht in 1/2 spaces */
  48:     if( t=='q' )
  49:         j = p1;
  50:     else if ( t == '~' )
  51:         j = &"~";
  52:     else if ( t == '^' )
  53:         j = &"";
  54:     else if ( t == '\t' )
  55:         j = &"\\t";
  56:     else if( (i=lookup(p1,res))>=0 )
  57:         j = restran[i];
  58:     else {
  59:         for( csp=psp=0; (c=p1[psp++])!='\0'; ){
  60:             trans(c,p1);
  61:             if( csp>CSSIZE )
  62:                 error(FATAL,"converted token %.20s... too long",p1);
  63:         }
  64:         cs[csp] = '\0';
  65:         j = cs;
  66:     }
  67:     ewid[yyval] = width(j);
  68:     if(dbg)printf(".\t%ctext: S%d <- %s; b=%d,h=%d,w=%d\n",
  69:         t, yyval, j, ebase[yyval], eht[yyval], ewid[yyval]);
  70:     printf(".ds %d \"%s\n",yyval,j);
  71: }
  72: 
  73: width(s) char *s; {
  74:     int c,w;
  75:     w = 0;
  76:     while( (c = *s++) != '\0' ){
  77:         if( c == '\b' || c == 033 )
  78:             w--;
  79:         else if ( c == '\\' && *s == '\\' );
  80:         else if ( c == '\\' && *s == 'e' );
  81:         else if ( c >= 040 )
  82:             w++;
  83:     }
  84:     return(w);
  85: }
  86: 
  87: trans(c,p1) int c; char *p1; {
  88:     switch( c){
  89:     case '>': case '<': case '=':
  90:         if( p1[psp]=='=' ){ /* look ahead for == <= >= */
  91:             cs[csp++] = c; cs[csp++] = '\b'; cs[csp++] = '_';
  92:             psp++;
  93:         } else
  94:             cs[csp++] = c;
  95:         break;
  96:     case '\\':  /* troff - pass 2 or 3 more chars */
  97:         cs[csp++] = c; cs[csp++] = c = p1[psp++]; cs[csp++] = p1[psp++];
  98:         if( c=='(' ) cs[csp++] = p1[psp++];
  99:         break;
 100:     default:
 101:         cs[csp++] = c; break;
 102:     }
 103: }

Defined functions

text defined in line 42; used 10 times
trans defined in line 87; used 1 times
  • in line 60
width defined in line 73; used 1 times
  • in line 67

Defined variables

cs defined in line 40; used 11 times
csp defined in line 37; used 12 times
psp defined in line 38; used 7 times
res defined in line 3; used 1 times
  • in line 56
restran defined in line 20; used 1 times
  • in line 57

Defined macros

CSSIZE defined in line 39; used 1 times
  • in line 61
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 596
Valid CSS Valid XHTML 1.0 Strict