[BACK]Return to bc.y CVS log [TXT][DIR] Up to [local] / src / usr.bin / bc

Diff for /src/usr.bin/bc/bc.y between version 1.48 and 1.49

version 1.48, 2015/10/10 19:28:54 version 1.49, 2015/11/23 09:58:55
Line 72 
Line 72 
 static ssize_t          cs(const char *);  static ssize_t          cs(const char *);
 static ssize_t          as(const char *);  static ssize_t          as(const char *);
 static ssize_t          node(ssize_t, ...);  static ssize_t          node(ssize_t, ...);
 static void             emit(ssize_t);  static void             emit(ssize_t, int);
 static void             emit_macro(int, ssize_t);  static void             emit_macro(int, ssize_t);
 static void             free_tree(void);  static void             free_tree(void);
 static ssize_t          numnode(int);  static ssize_t          numnode(int);
Line 175 
Line 175 
   
 input_item      : semicolon_list NEWLINE  input_item      : semicolon_list NEWLINE
                         {                          {
                                 emit($1);                                  emit($1, 0);
                                 macro_char = reset_macro_char;                                  macro_char = reset_macro_char;
                                 putchar('\n');                                  putchar('\n');
                                 free_tree();                                  free_tree();
Line 803 
Line 803 
 }  }
   
 static void  static void
 emit(ssize_t i)  emit(ssize_t i, int level)
 {  {
         if (instructions[i].index >= 0)          if (level > 1000)
                 while (instructions[i].index != END_NODE)                  errx(1, "internal error: tree level > 1000");
                         emit(instructions[i++].index);          if (instructions[i].index >= 0) {
         else                  while (instructions[i].index != END_NODE &&
                       instructions[i].index != i)  {
                           emit(instructions[i].index, level + 1);
                           i++;
                   }
           } else if (instructions[i].index != END_NODE)
                 fputs(instructions[i].u.cstr, stdout);                  fputs(instructions[i].u.cstr, stdout);
 }  }
   
Line 816 
Line 821 
 emit_macro(int node, ssize_t code)  emit_macro(int node, ssize_t code)
 {  {
         putchar('[');          putchar('[');
         emit(code);          emit(code, 0);
         printf("]s%s\n", instructions[node].u.cstr);          printf("]s%s\n", instructions[node].u.cstr);
         nesting--;          nesting--;
 }  }
Line 951 
Line 956 
             !isprint((unsigned char)yytext[0]))              !isprint((unsigned char)yytext[0]))
                 n = asprintf(&str,                  n = asprintf(&str,
                     "%s: %s:%d: %s: ascii char 0x%02x unexpected",                      "%s: %s:%d: %s: ascii char 0x%02x unexpected",
                     __progname, filename, lineno, s, yytext[0]);                      __progname, filename, lineno, s, yytext[0] & 0xff);
         else          else
                 n = asprintf(&str, "%s: %s:%d: %s: %s unexpected",                  n = asprintf(&str, "%s: %s:%d: %s: %s unexpected",
                     __progname, filename, lineno, s, yytext);                      __progname, filename, lineno, s, yytext);

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49