home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 186_01 / make.h < prev    next >
Text File  |  1985-08-21  |  5KB  |  139 lines

  1. /* MAKE.H -- Header file for MAKE utility.
  2.  * 
  3.  * Based on code by Allen Holub (DDJ, #106).  Revised and
  4.  * adapted for BDS C and CP/M-80 by James Pritchett.
  5.  *
  6.  * Version 1.0 -- 10/28/85
  7.  * Version 1.1 -- 12/06/85
  8.  *
  9.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  10.  */
  11.  
  12.             /* * * * * * * * * * *
  13.              * COMPILER SWITCHES *
  14.              * * * * * * * * * * */
  15.  
  16. /* If the following symbol is defined, then debugging code is
  17.  * activated.  Debug routines are given in the file MDEBUG.C.
  18.  */
  19.  
  20. /*
  21. #define DEBUG   1
  22. */
  23.  
  24. /* If using the Plu*Perfect public files system, the following
  25.  * symbol should be defined in order to cause compilation of
  26.  * code necessary to handle public files correctly.
  27.  */
  28.  
  29. #define PUBLIC 1
  30.  
  31. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  32.  
  33.                 /* * * * * * * * * * * *
  34.                  * STRUCT DEFINITIONS  *
  35.                  * * * * * * * * * * * */
  36.  
  37. /* Definition of tree node structure for objects: */
  38.  
  39. struct _tn {
  40.     struct _tn  *lnode;         /* Left branch */
  41.     struct _tn  *rnode;         /* Right branch */
  42.     char        *being_made;    /* Name of object */
  43.     char        **depends_on;   /* Pointers to dependancies */
  44.     char        **do_this;      /* Pointers to actions */
  45.     int         changed;        /* Action flag: 
  46.                                  * = -1 if UNKNOWN
  47.                                  * =  0 if unchanged/made
  48.                                  * =  1 if changed/unmade
  49.                                  */
  50. } ;
  51. #define TNODE       struct _tn  /* Pseudo-typedef */
  52. #define NODESIZE    12          /* Size of a _tn struct */
  53.  
  54.  
  55. /* Definition of stack element structure for command stack: */
  56.  
  57. struct _stack {
  58.     char            *comline;   /* Pointer to command line */
  59.     struct _stack   *next;      /* Next struct in stack */
  60. } ;
  61. #define STACK       struct _stack
  62. #define STACKSIZE   4
  63.  
  64. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  65.  
  66.             /* * * * * * * * * * * * * * * * *
  67.              *    USER-DEFINABLE SYMBOLS     *
  68.              * * * * * * * * * * * * * * * * */
  69.  
  70. /* The following four symbols define the various limits imposed
  71.  * on a makefile.  These may be freely changed to suit your needs.
  72.  */
  73.  
  74. #define MAXLINE     300     /* Maximum line length */
  75. #define MAXBLOCK    10      /* Maximum actions per object */
  76. #define MAXDEP      20      /* Maximum dependancies per object */
  77. #define MAXUSER     15      /* Maximum user area on system */
  78.  
  79. /* MATTRIB defines the file attribute bit that is used by MAKE to
  80.  * determine a file's status (changed/unchanged).  Any unused
  81.  * attribute may be used (i.e., attributes 1-8 or 11).
  82.  */
  83.  
  84. #define MATTRIB     11
  85.  
  86. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  87.  
  88.                 /* * * * * * * * * *
  89.                  * OTHER CONSTANTS *
  90.                  * * * * * * * * * */
  91.  
  92. #define COMMENT     '#'     /* Comment line character */
  93. #define UNKNOWN     -1      /* Unknown status value for objects */
  94.  
  95. #define DMA         0x080   /* For the file searching routine */
  96. #define SEARCH_F    17      /* BDOS calls */
  97. #define SET_DMA     26
  98. #define SET_ATT     30
  99. #define GS_USER     32
  100.  
  101. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  102.  
  103.                     /* * * * * *
  104.                      * MACROS  *
  105.                      * * * * * */
  106.  
  107. /* Macros for line parsing */
  108.  
  109. #define iswhite(c)  ((c) == ' ' || (c) == '\t')
  110. #define skipwhite(s)    while( iswhite(*s) ) ++s
  111. #define skipnonwhite(s) while( *s && !iswhite(*s) ) ++s
  112.  
  113. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  114.  
  115.                 /* * * * * * * * * * *
  116.                  * GLOBAL VARIABLES  *
  117.                  * * * * * * * * * * */
  118.  
  119.  
  120. TNODE   *root;              /* Root of the object tree */
  121. char     iobuff[BUFSIZ];    /* File buffer */
  122. char    *filename;          /* Makefile filename */
  123. int      inputline;         /* Makefile line number for error messages */
  124. char    *first;             /* Target name */
  125. char     defdsk;            /* Default disk for searches */
  126. int      defuser;           /* Default user area for searches */
  127. char     linbuf[MAXLINE];   /* For reading raw input lines */
  128. STACK   *stackp;            /* Stack pointer */
  129. int      aopt,nopt,qopt,ropt,topt;  /* options flags */
  130.  
  131. /* end */
  132.  
  133. *
  134.                      * * * * * */
  135.  
  136. /* Macros for line parsing */
  137.  
  138. #define iswhite(c)  ((c) == ' ' || (c) == '\t')
  139. #d