[BACK]Return to expr.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / m4

Diff for /src/usr.bin/m4/expr.c between version 1.6 and 1.7

version 1.6, 1999/09/14 08:30:20 version 1.7, 1999/09/14 08:35:16
Line 139 
Line 139 
   
 int  int
 expr(expbuf)  expr(expbuf)
 char *expbuf;          char *expbuf;
 {  {
         register int rval;          int rval;
   
         nxtch = expbuf;          nxtch = expbuf;
         if (setjmp(expjump) != 0)          if (setjmp(expjump) != 0)
Line 161 
Line 161 
 static int  static int
 query()  query()
 {  {
         register int bool, true_val, false_val;          int bool, true_val, false_val;
   
         bool = lor();          bool = lor();
         if (skipws() != '?') {          if (skipws() != '?') {
Line 183 
Line 183 
 static int  static int
 lor()  lor()
 {  {
         register int c, vl, vr;          int c, vl, vr;
   
         vl = land();          vl = land();
         while ((c = skipws()) == '|') {          while ((c = skipws()) == '|') {
Line 203 
Line 203 
 static int  static int
 land()  land()
 {  {
         register int c, vl, vr;          int c, vl, vr;
   
         vl = not();          vl = not();
         while ((c = skipws()) == '&') {          while ((c = skipws()) == '&') {
Line 223 
Line 223 
 static int  static int
 not()  not()
 {  {
         register int val, c;          int val, c;
   
         if ((c = skipws()) == '!' && getch() != '=') {          if ((c = skipws()) == '!' && getch() != '=') {
                 ungetch();                  ungetch();
Line 243 
Line 243 
 static int  static int
 eqrel()  eqrel()
 {  {
         register int vl, vr, eqrel;          int vl, vr, eqrel;
   
         vl = shift();          vl = shift();
         while ((eqrel = geteqrel()) != -1) {          while ((eqrel = geteqrel()) != -1) {
Line 281 
Line 281 
 static int  static int
 shift()  shift()
 {  {
         register int vl, vr, c;          int vl, vr, c;
   
         vl = primary();          vl = primary();
         while (((c = skipws()) == '<' || c == '>') && getch() == c) {          while (((c = skipws()) == '<' || c == '>') && getch() == c) {
Line 305 
Line 305 
 static int  static int
 primary()  primary()
 {  {
         register int c, vl, vr;          int c, vl, vr;
   
         vl = term();          vl = term();
         while ((c = skipws()) == '+' || c == '-') {          while ((c = skipws()) == '+' || c == '-') {
Line 327 
Line 327 
 static int  static int
 term()  term()
 {  {
         register int c, vl, vr;          int c, vl, vr;
   
         vl = exp();          vl = exp();
         while ((c = skipws()) == '*' || c == '/' || c == '%') {          while ((c = skipws()) == '*' || c == '/' || c == '%') {
Line 355 
Line 355 
 static int  static int
 exp()  exp()
 {  {
         register int c, vl, vr, n;          int c, vl, vr, n;
   
         vl = unary();          vl = unary();
         switch (c = skipws()) {          switch (c = skipws()) {
Line 384 
Line 384 
 static int  static int
 unary()  unary()
 {  {
         register int val, c;          int val, c;
   
         if ((c = skipws()) == '+' || c == '-' || c == '~') {          if ((c = skipws()) == '+' || c == '-' || c == '~') {
                 val = unary();                  val = unary();
Line 409 
Line 409 
 static int  static int
 factor()  factor()
 {  {
         register int val;          int val;
   
         if (skipws() == '(') {          if (skipws() == '(') {
                 val = query();                  val = query();
Line 429 
Line 429 
 static int  static int
 constant()  constant()
 {  {
         register int i;          int i;
         register int value;          int value;
         register int c;          int c;
         int v[sizeof(int)];          int v[sizeof(int)];
   
         if (skipws() != '\'') {          if (skipws() != '\'') {
Line 490 
Line 490 
 static int  static int
 num()  num()
 {  {
         register int rval, c, base;          int rval, c, base;
         int ndig;          int ndig;
   
         rval = 0;          rval = 0;
Line 540 
Line 540 
                 experr("bad constant");                  experr("bad constant");
   
         return rval;          return rval;
   
 }  }
   
 /*  /*
Line 549 
Line 548 
 static int  static int
 geteqrel()  geteqrel()
 {  {
         register int c1, c2;          int c1, c2;
   
         c1 = skipws();          c1 = skipws();
         c2 = getch();          c2 = getch();
Line 593 
Line 592 
 static int  static int
 skipws()  skipws()
 {  {
         register int c;          int c;
   
         while ((c = getch()) <= ' ' && c > EOS)          while ((c = getch()) <= ' ' && c > EOS)
                 ;                  ;
Line 606 
Line 605 
  */   */
 static void  static void
 experr(msg)  experr(msg)
 char *msg;          char *msg;
 {  {
         printf("m4: %s in expr.\n", msg);          printf("m4: %s in expr.\n", msg);
         longjmp(expjump, -1);          longjmp(expjump, -1);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7