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

Diff for /src/usr.bin/m4/eval.c between version 1.19 and 1.20

version 1.19, 1999/11/17 14:57:21 version 1.20, 1999/11/17 15:34:13
Line 65 
Line 65 
 #include "extern.h"  #include "extern.h"
 #include "pathnames.h"  #include "pathnames.h"
   
   static void     dodefn __P((const char *));
   static void     dopushdef __P((const char *, const char *));
   static void     dodump __P((const char *[], int));
   static void     doifelse __P((const char *[], int));
   static int      doincl __P((const char *));
   static int      dopaste __P((const char *));
   static void     dochq __P((const char *[], int));
   static void     dochc __P((const char *[], int));
   static void     dodiv __P((int));
   static void     doundiv __P((const char *[], int));
   static void     dosub __P((const char *[], int));
   static void     map __P((char *, const char *, const char *, const char *));
 /*  /*
  * eval - evaluate built-in macros.   * eval - evaluate built-in macros.
  *        argc - number of elements in argv.   *        argc - number of elements in argv.
Line 86 
Line 98 
   
 void  void
 eval(argv, argc, td)  eval(argv, argc, td)
         char *argv[];          const char *argv[];
         int argc;          int argc;
         int td;          int td;
 {  {
Line 299 
Line 311 
          */           */
                 if (argc > 2) {                  if (argc > 2) {
                         int fd;                          int fd;
                           char *temp;
   
                           temp = xstrdup(argv[2]);
   
                         fd = mkstemp(argv[2]);                          fd = mkstemp(temp);
                         if (fd == -1)                          if (fd == -1)
                                 err(1, "couldn't make temp file %s", argv[2]);                                  err(1, "couldn't make temp file %s", argv[2]);
                         close(fd);                          close(fd);
                         pbstr(argv[2]);                          pbstr(temp);
                           free(temp);
                 }                  }
                 break;                  break;
   
Line 391 
Line 407 
  */   */
 void  void
 expand(argv, argc)  expand(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         char *t;          const char *t;
         char *p;          const char *p;
         int n;          int n;
         int argno;          int argno;
   
Line 462 
Line 478 
  */   */
 void  void
 dodefine(name, defn)  dodefine(name, defn)
         char *name;          const char *name;
         char *defn;          const char *defn;
 {  {
         ndptr p;          ndptr p;
   
Line 486 
Line 502 
  * dodefn - push back a quoted definition of   * dodefn - push back a quoted definition of
  *      the given name.   *      the given name.
  */   */
 void  static void
 dodefn(name)  dodefn(name)
         char *name;          const char *name;
 {  {
         ndptr p;          ndptr p;
   
Line 506 
Line 522 
  *      hash bucket, it hides a previous definition from   *      hash bucket, it hides a previous definition from
  *      lookup.   *      lookup.
  */   */
 void  static void
 dopushdef(name, defn)  dopushdef(name, defn)
         char *name;          const char *name;
         char *defn;          const char *defn;
 {  {
         ndptr p;          ndptr p;
   
Line 530 
Line 546 
  *      table to stderr. If nothing is specified, the entire   *      table to stderr. If nothing is specified, the entire
  *      hash table is dumped.   *      hash table is dumped.
  */   */
 void  static void
 dodump(argv, argc)  dodump(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         int n;          int n;
Line 554 
Line 570 
 /*  /*
  * doifelse - select one of two alternatives - loop.   * doifelse - select one of two alternatives - loop.
  */   */
 void  static void
 doifelse(argv, argc)  doifelse(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         cycle {          cycle {
Line 576 
Line 592 
 /*  /*
  * doinclude - include a given file.   * doinclude - include a given file.
  */   */
 int  static int
 doincl(ifile)  doincl(ifile)
         char *ifile;          const char *ifile;
 {  {
         if (ilevel + 1 == MAXINP)          if (ilevel + 1 == MAXINP)
                 errx(1, "too many include files.");                  errx(1, "too many include files.");
Line 595 
Line 611 
  * dopaste - include a given file without any   * dopaste - include a given file without any
  *           macro processing.   *           macro processing.
  */   */
 int  static int
 dopaste(pfile)  dopaste(pfile)
         char *pfile;          const char *pfile;
 {  {
         FILE *pf;          FILE *pf;
         int c;          int c;
Line 615 
Line 631 
 /*  /*
  * dochq - change quote characters   * dochq - change quote characters
  */   */
 void  static void
 dochq(argv, argc)  dochq(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         if (argc > 2) {          if (argc > 2) {
Line 641 
Line 657 
 /*  /*
  * dochc - change comment characters   * dochc - change comment characters
  */   */
 void  static void
 dochc(argv, argc)  dochc(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         if (argc > 2) {          if (argc > 2) {
Line 665 
Line 681 
 /*  /*
  * dodivert - divert the output to a temporary file   * dodivert - divert the output to a temporary file
  */   */
 void  static void
 dodiv(n)  dodiv(n)
         int n;          int n;
 {  {
Line 690 
Line 706 
  * doundivert - undivert a specified output, or all   * doundivert - undivert a specified output, or all
  *              other outputs, in numerical order.   *              other outputs, in numerical order.
  */   */
 void  static void
 doundiv(argv, argc)  doundiv(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         int ind;          int ind;
Line 715 
Line 731 
 /*  /*
  * dosub - select substring   * dosub - select substring
  */   */
 void  static void
 dosub(argv, argc)  dosub(argv, argc)
         char *argv[];          const char *argv[];
         int argc;          int argc;
 {  {
         char *ap, *fc, *k;          const char *ap, *fc, *k;
         int nc;          int nc;
   
         if (argc < 5)          if (argc < 5)
Line 767 
Line 783 
  * about 5 times faster than any algorithm that makes multiple passes over   * about 5 times faster than any algorithm that makes multiple passes over
  * destination string.   * destination string.
  */   */
 void  static void
 map(dest, src, from, to)  map(dest, src, from, to)
         char *dest;          char *dest;
         char *src;          const char *src;
         char *from;          const char *from;
         char *to;          const char *to;
 {  {
         char *tmp;          const char *tmp;
         unsigned char sch, dch;          unsigned char sch, dch;
         static unsigned char mapvec[256] = {          static unsigned char mapvec[256] = {
             0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,              0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20