Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

331 lines
7.6 KiB

  1. /*
  2. * DTXTRN.H -- Original extern file for UNIX YACC.
  3. *
  4. * Modified to call in "decus" or "vax11c" .H files to set up
  5. * parameters as appropriate.
  6. *
  7. * Copyright (c) 1993-1999 Microsoft Corporation
  8. */
  9. #ifndef __DTXTRN_H__
  10. #define __DTXTRN_H__
  11. #include <stdio.h>
  12. #include "system.h"
  13. #include "fprot.h"
  14. /* MANIFEST CONSTANT DEFINITIONS */
  15. /* base of nonterminal internal numbers */
  16. #define NTBASE 010000
  17. /* internal codes for error and accept actions */
  18. #define ERRCODE 8190
  19. #define ACCEPTCODE 8191
  20. /* sizes and limits */
  21. #ifdef HUGETAB /* defined for a 32 bit machine */
  22. #pragma message ("using HUGETAB")
  23. #define ACTSIZE 12000
  24. #define MEMSIZE 12000
  25. #define NSTATES 1000 /* original value 750 */
  26. #define NTERMS 512 /* original value 127 */
  27. #define NPROD 600
  28. #define NNONTERM 300
  29. #define TEMPSIZE 1200
  30. #define CNAMSZ 10000 /* original value 6000 then 8000*/
  31. #define LSETSIZE 600
  32. #define WSETSIZE 350
  33. #endif
  34. #ifdef MEDTAB /* defined for a 16 bit machine */
  35. #pragma message ("using MEDTAB")
  36. #if 0
  37. #define ACTSIZE 4000
  38. #define MEMSIZE 5200
  39. #define NSTATES 600
  40. #define NTERMS 127
  41. #define NPROD 400
  42. #define NNONTERM 200
  43. #define TEMPSIZE 800
  44. #define CNAMSZ 4000
  45. #define LSETSIZE 450
  46. #define WSETSIZE 250
  47. #else // 0
  48. #define ACTSIZE 12000
  49. #define MEMSIZE 12000
  50. #define NSTATES 750
  51. #define NTERMS 512
  52. #define NPROD 600
  53. #define NNONTERM 300
  54. #define TEMPSIZE 1200
  55. #define CNAMSZ 5000
  56. #define LSETSIZE 600
  57. #define WSETSIZE 350
  58. #endif // 0
  59. #endif
  60. #ifdef SMALLTAB
  61. #pragma message ("using SMALLTAB")
  62. #define ACTSIZE 1000
  63. #define MEMSIZE 1500
  64. #define NSTATES 450
  65. #define NTERMS 127
  66. #define NPROD 200
  67. #define NNONTERM 100
  68. #define TEMPSIZE 600
  69. #define CNAMSZ 1000
  70. #define LSETSIZE 200
  71. #define WSETSIZE 125
  72. #endif
  73. #define NAMESIZE 50
  74. #define NTYPES 63
  75. #ifdef WORD32
  76. #define TBITSET ((32+NTERMS)/32)
  77. /* bit packing macros (may be machine dependent) */
  78. #define BIT(a,i) ((a)[(i)>>5] & (1<<((i)&037)))
  79. #define SETBIT(a,i) ((a)[(i)>>5] |= (1<<((i)&037)))
  80. /* number of words needed to hold n+1 bits */
  81. #define NWORDS(n) (((n)+32)/32)
  82. #else
  83. #define TBITSET ((16+NTERMS)/16)
  84. /* bit packing macros (may be machine dependent) */
  85. #define BIT(a,i) ((a)[(i)>>4] & (1<<((i)&017)))
  86. #define SETBIT(a,i) ((a)[(i)>>4] |= (1<<((i)&017)))
  87. /* number of words needed to hold n+1 bits */
  88. #define NWORDS(n) (((n)+16)/16)
  89. #endif
  90. /* relationships which must hold:
  91. TBITSET ints must hold NTERMS+1 bits...
  92. WSETSIZE >= NNONTERM
  93. LSETSIZE >= NNONTERM
  94. TEMPSIZE >= NTERMS + NNONTERMs + 1
  95. TEMPSIZE >= NSTATES
  96. */
  97. /* associativities */
  98. #define NOASC 0 /* no assoc. */
  99. #define LASC 1 /* left assoc. */
  100. #define RASC 2 /* right assoc. */
  101. #define BASC 3 /* binary assoc. */
  102. /* flags for state generation */
  103. #define DONE 0
  104. #define MUSTDO 1
  105. #define MUSTLOOKAHEAD 2
  106. /* flags for a rule having an action, and being reduced */
  107. #define ACTFLAG 04
  108. #define REDFLAG 010
  109. /* output parser flags */
  110. #define YYFLAG1 (-1000)
  111. /* macros for getting associativity and precedence levels */
  112. #define ASSOC(i) ((i)&03)
  113. #define PLEVEL(i) (((i)>>4)&077)
  114. #define TYPE(i) ((i>>10)&077)
  115. /* macros for setting associativity and precedence levels */
  116. #define SETASC(i,j) i|=j
  117. #define SETPLEV(i,j) i |= (j<<4)
  118. #define SETTYPE(i,j) i |= (j<<10)
  119. /* looping macros */
  120. #define TLOOP(i) for(i=1;i<=ntokens;++i)
  121. #define NTLOOP(i) for(i=0;i<=nnonter;++i)
  122. #define PLOOP(s,i) for(i=s;i<nprod;++i)
  123. #define SLOOP(i) for(i=0;i<nstate;++i)
  124. #define WSBUMP(x) ++x
  125. #define WSLOOP(s,j) for(j=s;j<cwp;++j)
  126. #define ITMLOOP(i,p,q) q=pstate[i+1];for(p=pstate[i];p<q;++p)
  127. #define SETLOOP(i) for(i=0;i<tbitset;++i)
  128. /* I/O descriptors */
  129. #ifndef y2imp
  130. extern FILE * finput; /* input file */
  131. extern FILE * faction; /* file for saving actions */
  132. extern FILE *fdefine; /* file for #defines */
  133. extern FILE * ftable; /* y.tab.c file */
  134. extern FILE * ftemp; /* tempfile to pass 2 */
  135. extern FILE * foutput; /* y.output file */
  136. #endif
  137. /* structure declarations */
  138. struct looksets
  139. {
  140. SSIZE_T lset[TBITSET];
  141. };
  142. struct item
  143. {
  144. SSIZE_T *pitem;
  145. struct looksets *look;
  146. };
  147. struct toksymb
  148. {
  149. char *name;
  150. SSIZE_T value;
  151. };
  152. struct ntsymb
  153. {
  154. char *name;
  155. SSIZE_T tvalue;
  156. };
  157. struct wset
  158. {
  159. SSIZE_T *pitem;
  160. int flag;
  161. struct looksets ws;
  162. };
  163. #ifndef y2imp
  164. /* token information */extern int ntokens ; /* number of tokens */
  165. extern struct toksymb tokset[];
  166. extern int toklev[]; /* vector with the precedence of the terminals */
  167. #endif
  168. /* nonterminal information */
  169. #ifndef y2imp
  170. extern int nnonter ; /* the number of nonterminals */
  171. extern struct ntsymb nontrst[];
  172. #endif
  173. /* grammar rule information */
  174. #ifndef y2imp
  175. extern int nprod ; /* number of productions */
  176. extern SSIZE_T *prdptr[]; /* pointers to descriptions of productions */
  177. extern SSIZE_T levprd[] ; /* contains production levels to break conflicts */
  178. #endif
  179. /* state information */
  180. #ifndef y1imp
  181. extern int nstate ; /* number of states */
  182. extern struct item *pstate[]; /* pointers to the descriptions of the states */
  183. extern SSIZE_T tystate[]; /* contains type information about the states */
  184. #ifndef y3imp
  185. extern SSIZE_T defact[]; /* the default action of the state */
  186. #endif
  187. extern int tstates[]; /* the states deriving each token */
  188. extern int ntstates[]; /* the states deriving each nonterminal */
  189. extern int mstates[]; /* the continuation of the chains begun in tstates and ntstates */
  190. #endif
  191. /* lookahead set information */
  192. #ifndef y1imp
  193. extern struct looksets lkst[];
  194. extern int nolook; /* flag to turn off lookahead computations */
  195. #endif
  196. /* working set information */
  197. #ifndef y1imp
  198. extern struct wset wsets[];
  199. extern struct wset *cwp;
  200. #endif
  201. /* storage for productions */
  202. #ifndef y2imp
  203. extern SSIZE_T mem0[];
  204. extern SSIZE_T *mem;
  205. #endif
  206. /* storage for action table */
  207. #ifndef y1imp
  208. extern SSIZE_T amem[]; /* action table storage */
  209. extern SSIZE_T *memp ; /* next free action table position */
  210. extern SSIZE_T indgo[]; /* index to the stored goto table */
  211. /* temporary vector, indexable by states, terms, or ntokens */
  212. extern SSIZE_T temp1[];
  213. extern int lineno; /* current line number */
  214. /* statistics collection variables */
  215. extern int zzgoent ;
  216. extern int zzgobest ;
  217. extern int zzacent ;
  218. extern int zzexcp ;
  219. extern int zzclose ;
  220. extern int zzrrconf ;
  221. extern int zzsrconf ;
  222. extern char *pszPrefix;
  223. #endif
  224. /* define functions with strange types... */extern char *cstash();
  225. extern struct looksets *flset();
  226. extern char *symnam();
  227. extern char *writem();
  228. /* default settings for a number of macros */
  229. #define ISIZE 400 /* Specific for static in cpres() */
  230. /* name of yacc tempfiles */
  231. #ifndef TEMPNAME
  232. #define TEMPNAME "yacc.tmp"
  233. #endif
  234. #ifndef ACTNAME
  235. #define ACTNAME "yacc.act"
  236. #endif
  237. /* output file name */
  238. #ifndef OFILE
  239. #define OFILE "ytab.c"
  240. #endif
  241. /* user output file name */
  242. #ifndef FILEU
  243. #define FILEU "y.out"
  244. #endif
  245. /* output file for #defines */
  246. #ifndef FILED
  247. #define FILED "ytab.h"
  248. #endif
  249. /* Size of complete filespec */
  250. #ifndef FNAMESIZE
  251. #define FNAMESIZE 32
  252. #endif
  253. /* command to clobber tempfiles after use */
  254. #ifndef ZAPFILE
  255. #define ZAPFILE(x) MIDL_UNLINK(x)
  256. #endif
  257. #endif /* __DTXTRN_H__ */