1: /*
   2:  * Copyright (c) 1989, 1993
   3:  *	The Regents of the University of California.  All rights reserved.
   4:  *
   5:  * This code is derived from software contributed to Berkeley by
   6:  * Ozan Yigit at York University.
   7:  *
   8:  * Redistribution and use in source and binary forms, with or without
   9:  * modification, are permitted provided that the following conditions
  10:  * are met:
  11:  * 1. Redistributions of source code must retain the above copyright
  12:  *    notice, this list of conditions and the following disclaimer.
  13:  * 2. Redistributions in binary form must reproduce the above copyright
  14:  *    notice, this list of conditions and the following disclaimer in the
  15:  *    documentation and/or other materials provided with the distribution.
  16:  * 3. All advertising materials mentioning features or use of this software
  17:  *    must display the following acknowledgement:
  18:  *	This product includes software developed by the University of
  19:  *	California, Berkeley and its contributors.
  20:  * 4. Neither the name of the University nor the names of its contributors
  21:  *    may be used to endorse or promote products derived from this software
  22:  *    without specific prior written permission.
  23:  *
  24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34:  * SUCH DAMAGE.
  35:  *
  36:  *	@(#)mdef.h	8.1 (Berkeley) 6/6/93
  37:  */
  38: 
  39: #define MACRTYPE        1
  40: #define DEFITYPE        2
  41: #define EXPRTYPE        3
  42: #define SUBSTYPE        4
  43: #define IFELTYPE        5
  44: #define LENGTYPE        6
  45: #define CHNQTYPE        7
  46: #define SYSCTYPE        8
  47: #define UNDFTYPE        9
  48: #define INCLTYPE        10
  49: #define SINCTYPE        11
  50: #define PASTTYPE        12
  51: #define SPASTYPE        13
  52: #define INCRTYPE        14
  53: #define IFDFTYPE        15
  54: #define PUSDTYPE        16
  55: #define POPDTYPE        17
  56: #define SHIFTYPE        18
  57: #define DECRTYPE        19
  58: #define DIVRTYPE        20
  59: #define UNDVTYPE        21
  60: #define DIVNTYPE        22
  61: #define MKTMTYPE        23
  62: #define ERRPTYPE        24
  63: #define M4WRTYPE        25
  64: #define TRNLTYPE        26
  65: #define DNLNTYPE        27
  66: #define DUMPTYPE        28
  67: #define CHNCTYPE        29
  68: #define INDXTYPE        30
  69: #define SYSVTYPE        31
  70: #define EXITTYPE        32
  71: #define DEFNTYPE        33
  72: 
  73: #define STATIC          128
  74: 
  75: /*
  76:  * m4 special characters
  77:  */
  78: 
  79: #define ARGFLAG         '$'
  80: #define LPAREN          '('
  81: #define RPAREN          ')'
  82: #define LQUOTE          '`'
  83: #define RQUOTE          '\''
  84: #define COMMA           ','
  85: #define SCOMMT          '#'
  86: #define ECOMMT          '\n'
  87: 
  88: #ifdef msdos
  89: #define system(str) (-1)
  90: #endif
  91: 
  92: /*
  93:  * other important constants
  94:  */
  95: 
  96: #define EOS             (char) 0
  97: #define MAXINP          10              /* maximum include files   */
  98: #define MAXOUT          10              /* maximum # of diversions */
  99: #define MAXSTR          512             /* maximum size of string  */
 100: #define BUFSIZE         4096            /* size of pushback buffer */
 101: #define STACKMAX        1024            /* size of call stack      */
 102: #define STRSPMAX        4096            /* size of string space    */
 103: #define MAXTOK          MAXSTR          /* maximum chars in a tokn */
 104: #define HASHSIZE        199             /* maximum size of hashtab */
 105: 
 106: #define ALL             1
 107: #define TOP             0
 108: 
 109: #define TRUE            1
 110: #define FALSE           0
 111: #define cycle           for(;;)
 112: 
 113: /*
 114:  * m4 data structures
 115:  */
 116: 
 117: typedef struct ndblock *ndptr;
 118: 
 119: struct ndblock {                /* hastable structure         */
 120:         char    *name;          /* entry name..               */
 121:         char    *defn;          /* definition..               */
 122:         int     type;           /* type of the entry..        */
 123:         ndptr   nxtptr;         /* link to next entry..       */
 124: };
 125: 
 126: #define nil     ((ndptr) 0)
 127: 
 128: struct keyblk {
 129:         char    *knam;          /* keyword name */
 130:         int     ktyp;           /* keyword type */
 131: };
 132: 
 133: typedef union {         /* stack structure */
 134:     int sfra;       /* frame entry  */
 135:     char    *sstr;      /* string entry */
 136: } stae;
 137: 
 138: /*
 139:  * macros for readibility and/or speed
 140:  *
 141:  *      gpbc()  - get a possibly pushed-back character
 142:  *      pushf() - push a call frame entry onto stack
 143:  *      pushs() - push a string pointer onto stack
 144:  */
 145: #define gpbc()   (bp > bufbase) ? *--bp : getc(infile[ilevel])
 146: #define pushf(x) if (sp < STACKMAX) mstack[++sp].sfra = (x)
 147: #define pushs(x) if (sp < STACKMAX) mstack[++sp].sstr = (x)
 148: 
 149: /*
 150:  *	    .				   .
 151:  *	|   .	|  <-- sp		|  .  |
 152:  *	+-------+			+-----+
 153:  *	| arg 3 ----------------------->| str |
 154:  *	+-------+			|  .  |
 155:  *	| arg 2 ---PREVEP-----+ 	   .
 156:  *	+-------+	      |
 157:  *	    .		      |		|     |
 158:  *	+-------+	      | 	+-----+
 159:  *	| plev	|  PARLEV     +-------->| str |
 160:  *	+-------+			|  .  |
 161:  *	| type	|  CALTYP		   .
 162:  *	+-------+
 163:  *	| prcf	---PREVFP--+
 164:  *	+-------+  	   |
 165:  *	|   .	|  PREVSP  |
 166:  *	    .	   	   |
 167:  *	+-------+	   |
 168:  *	|	<----------+
 169:  *	+-------+
 170:  *
 171:  */
 172: #define PARLEV  (mstack[fp].sfra)
 173: #define CALTYP  (mstack[fp-1].sfra)
 174: #define PREVEP  (mstack[fp+3].sstr)
 175: #define PREVSP  (fp-3)
 176: #define PREVFP  (mstack[fp-2].sfra)

Defined struct's

keyblk defined in line 128; used 2 times
ndblock defined in line 119; used 5 times

Defined typedef's

ndptr defined in line 117; used 20 times

Defined macros

ALL defined in line 106; used 1 times
ARGFLAG defined in line 79; used 1 times
BUFSIZE defined in line 100; used 2 times
CALTYP defined in line 173; used 2 times
CHNCTYPE defined in line 67; used 1 times
CHNQTYPE defined in line 45; used 1 times
COMMA defined in line 84; never used
DECRTYPE defined in line 57; used 1 times
DEFITYPE defined in line 40; used 1 times
DEFNTYPE defined in line 71; used 1 times
DIVNTYPE defined in line 60; used 1 times
DIVRTYPE defined in line 58; used 1 times
DNLNTYPE defined in line 65; used 1 times
DUMPTYPE defined in line 66; used 1 times
ECOMMT defined in line 86; used 3 times
EOS defined in line 96; used 4 times
ERRPTYPE defined in line 62; used 1 times
EXITTYPE defined in line 70; used 1 times
EXPRTYPE defined in line 41; used 2 times
FALSE defined in line 110; never used
IFDFTYPE defined in line 53; used 1 times
IFELTYPE defined in line 43; used 1 times
INCLTYPE defined in line 48; used 1 times
INCRTYPE defined in line 52; used 1 times
INDXTYPE defined in line 68; used 1 times
LENGTYPE defined in line 44; used 1 times
LPAREN defined in line 80; used 2 times
LQUOTE defined in line 82; used 2 times
M4WRTYPE defined in line 63; used 1 times
MACRTYPE defined in line 39; used 5 times
MAXINP defined in line 97; used 3 times
MAXOUT defined in line 98; used 5 times
MAXSTR defined in line 99; used 1 times
MAXTOK defined in line 103; used 4 times
MKTMTYPE defined in line 61; used 1 times
PARLEV defined in line 172; used 4 times
PASTTYPE defined in line 50; used 1 times
POPDTYPE defined in line 55; used 1 times
PREVEP defined in line 174; used 1 times
PREVFP defined in line 176; used 1 times
PREVSP defined in line 175; used 1 times
PUSDTYPE defined in line 54; used 1 times
RPAREN defined in line 81; used 1 times
RQUOTE defined in line 83; used 2 times
SCOMMT defined in line 85; used 2 times
SHIFTYPE defined in line 56; used 1 times
SINCTYPE defined in line 49; used 1 times
SPASTYPE defined in line 51; used 1 times
STACKMAX defined in line 101; used 4 times
STRSPMAX defined in line 102; used 2 times
SUBSTYPE defined in line 42; used 1 times
SYSCTYPE defined in line 46; used 1 times
SYSVTYPE defined in line 69; used 1 times
TOP defined in line 107; used 2 times
TRNLTYPE defined in line 64; used 1 times
TRUE defined in line 109; never used
UNDFTYPE defined in line 47; used 1 times
UNDVTYPE defined in line 59; used 1 times
cycle defined in line 111; used 2 times
gpbc defined in line 145; used 8 times
nil defined in line 126; used 11 times
pushf defined in line 146; used 3 times
pushs defined in line 147; used 4 times
system defined in line 89; used 1 times

Usage of this include

Last modified: 1993-06-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1618
Valid CSS Valid XHTML 1.0 Strict