Windows NT 4.0 source code leak
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.

221 lines
8.1 KiB

4 years ago
  1. /*** globals.h - global variables/needed across modules ************************
  2. *
  3. * Copyright (c) 1988-1990, Microsoft Corporation. All rights reserved.
  4. *
  5. * Purpose:
  6. * Globals.c is the routine in which global variables reside. Globals.h mirrors
  7. * the declarations in globals.c as externs and is included in all routines that
  8. * use globals.
  9. *
  10. * Notes:
  11. * This module was created for an interesting reason. NMAKE handles recursive
  12. * calls by saving its global variables somewhere in memory. It handles this by
  13. * allocating all global variables which have value changes in each recursive
  14. * in adjacent memory. The routine called recursively is doMake() and before it
  15. * is called the address of this chunk of memory is stored. When the recursive
  16. * call returns the memory is restored using the stored address. startOfSave and
  17. * endOfSave give the location of this chunk. The reason this method was opted
  18. * for is that spawning of NMAKE would consume a lot of memory under DOS. This
  19. * might not be very efficient under OS/2 because the code gets shared.
  20. *
  21. * Revision History:
  22. * 15-Nov-1993 JdR Major speed improvements
  23. * 04-Apr-1990 SB Add fHeapChk
  24. * 01-Dec-1989 SB Made some variables near and pushed some into saveArea
  25. * 19-Oct-1989 SB variable fOptionK added (ifdef SLASHK)
  26. * 02-Oct-1989 SB add dynamic inline file handling support
  27. * 24-Apr-1989 SB Added ext_size, filename_size, filenameext_size &
  28. * resultbuf_size for OS/2 1.2 support
  29. * 05-Apr-1989 SB made revList, delList, scriptFileList NEAR
  30. * 22-Mar-1989 SB removed tmpFileStack and related variables
  31. * 16-Feb-1989 SB added delList to have scriptfile deletes at end of make
  32. * 21-Dec-1988 SB Added scriptFileList to handle multiple script files
  33. * removed tmpScriptFile and fKeep (not reqd anymore)
  34. * 19-Dec-1988 SB Added fKeep to handle KEEP/NOKEEP
  35. * 14-Dec-1988 SB Added tmpScriptFile for 'z' option
  36. * 30-Nov-1988 SB Added revList to handle 'z' option
  37. * 23-Nov-1988 SB Added CmdLine[] to handle extmake syntax
  38. * made pCmdLineCopy Global in build.c
  39. * 21-Oct-1988 SB Added fInheritUserEnv to inherit macros
  40. * 20-Sep-1988 RB Clean up.
  41. * 17-Aug-1988 RB Declare everything NEAR.
  42. * 06-Jul-1988 rj Ditched shell and argVector globals.
  43. * Put all ECS declarations as macros in here.
  44. *
  45. *******************************************************************************/
  46. #if defined(STATISTICS)
  47. extern unsigned long CntfindMacro;
  48. extern unsigned long CntmacroChains;
  49. extern unsigned long CntinsertMacro;
  50. extern unsigned long CntfindTarget;
  51. extern unsigned long CnttargetChains;
  52. extern unsigned long CntStriCmp;
  53. extern unsigned long CntunQuotes;
  54. extern unsigned long CntFreeStrList;
  55. extern unsigned long CntAllocStrList;
  56. #endif
  57. extern UCHAR NEAR startOfSave; /* dummy variable */
  58. extern BOOL NEAR fOptionK; /* user specified /K ? */
  59. extern BOOL NEAR fDescRebuildOrder; /* user specified /O ? */
  60. extern BOOL NEAR fNoEmsXms; /* user specified /M ? */
  61. extern BOOL NEAR fSlashKStatus;
  62. /* boolean used by action.c & nmake.c
  63. *
  64. * Required for NMAKE enhancement -- to make NMAKE inherit user modified
  65. * changes in the environment. To be set to true before defineMacro() is
  66. * called so that user defined changes in environment variables are
  67. * reflected in the environment. If set to false then these changes are
  68. * made only in NMAKE tables and the environment remains unchanged
  69. *
  70. */
  71. extern BOOL NEAR fInheritUserEnv;
  72. /*
  73. * TRUE if /b specified, Rebuild on tie
  74. */
  75. extern BOOL NEAR fRebuildOnTie;
  76. /*
  77. * TRUE if /v specified, Inherit macros to child
  78. */
  79. #if defined(SELF_RECURSE)
  80. extern BOOL NEAR fInheritMacros;
  81. #endif
  82. /* Used by action.c and nmake.c
  83. *
  84. * delList is the list of delete commands for deleting inline files which are
  85. * to be deleted before NMAKE exits & have a NOKEEP action specified.
  86. */
  87. extern STRINGLIST * NEAR delList;
  88. /* Complete list of generated inline files. Required to avoid duplicate names
  89. */
  90. extern STRINGLIST * NEAR inlineFileList;
  91. #ifndef NO_OPTION_Z
  92. /* Used by print.c and build.c and nmake.c
  93. *
  94. * revList is the list of Commands in reverse order required for
  95. * implementing 'z' option. Used by printReverseFile().
  96. */
  97. extern STRINGLIST * NEAR revList;
  98. #endif
  99. /* from NMAKE.C */
  100. extern BOOL NEAR firstToken; /* to initialize parser */
  101. extern BOOL NEAR bannerDisplayed;
  102. extern UCHAR NEAR flags; /* holds -d -s -n -i */
  103. extern UCHAR NEAR gFlags; /* "global" -- all targets*/
  104. extern char NEAR makeflags[];
  105. extern FILE * NEAR file;
  106. extern STRINGLIST * NEAR makeTargets; /* list of targets to make*/
  107. extern STRINGLIST * NEAR makeFiles; /* user can specify > 1 */
  108. extern BOOL NEAR fDebug;
  109. /* from LEXER.C */
  110. extern unsigned NEAR line;
  111. extern BOOL NEAR colZero; /* global flag set if at column zero
  112. of a makefile/tools.ini */
  113. extern char * NEAR fName;
  114. extern char * NEAR string;
  115. extern INCLUDEINFO NEAR incStack[MAXINCLUDE];
  116. extern int NEAR incTop;
  117. /* Inline file list -- Gets created in lexer.c and is used by action.c to
  118. * produce a delete command when 'NOKEEP' or Z option is set
  119. */
  120. extern SCRIPTLIST * NEAR scriptFileList;
  121. /* from PARSER.C */
  122. #define STACKSIZE 16
  123. extern UCHAR NEAR stack[STACKSIZE];
  124. extern int NEAR top; /* gets pre-incremented before use*/
  125. extern unsigned NEAR currentLine; /* used for all error messages */
  126. extern BOOL NEAR init; /* global boolean value to indicate
  127. if tools.ini is being parsed */
  128. /* from ACTION.C */
  129. extern MACRODEF * NEAR macroTable[MAXMACRO];
  130. extern MAKEOBJECT * NEAR targetTable[MAXTARGET];
  131. extern STRINGLIST * NEAR macros;
  132. extern STRINGLIST * NEAR dotSuffixList;
  133. extern STRINGLIST * NEAR dotPreciousList;
  134. extern RULELIST * NEAR rules;
  135. extern STRINGLIST * NEAR list;
  136. extern char * NEAR name;
  137. extern BUILDBLOCK * NEAR block;
  138. extern UCHAR NEAR currentFlags;
  139. extern UCHAR NEAR actionFlags;
  140. /* from BUILD.C */
  141. extern long NEAR errorLevel;
  142. extern unsigned NEAR numCommands;
  143. extern char * NEAR pCmdLineCopy;
  144. /* Used to store expanded Command Line returned by SPRINTF, the result on
  145. * expanding extmake syntax part in the command line */
  146. extern char CmdLine[MAXCMDLINELENGTH];
  147. /* from IFEXPR.C */
  148. #define IFSTACKSIZE 16
  149. extern UCHAR NEAR ifStack[IFSTACKSIZE];
  150. extern int NEAR ifTop; /* gets pre-incremented before use */
  151. extern char * NEAR lbufPtr; /* pointer to alloc'd buffer */
  152. /* we don't use a static buffer so
  153. that buffer may be realloced */
  154. extern char * NEAR prevDirPtr; /* ptr to directive to be processed */
  155. extern unsigned NEAR lbufSize; /* initial size of the buffer */
  156. /* from UTIL.C */
  157. extern char * NEAR dollarDollarAt;
  158. extern char * NEAR dollarLessThan;
  159. extern char * NEAR dollarStar;
  160. extern char * NEAR dollarAt;
  161. extern STRINGLIST * NEAR dollarQuestion;
  162. extern STRINGLIST * NEAR dollarStarStar;
  163. extern char NEAR buf[MAXBUF]; /* from parser.c */
  164. extern UCHAR NEAR endOfSave; /* dummy variable */
  165. extern char NEAR suffixes[]; /* from action.c */
  166. extern char NEAR ignore[];
  167. extern char NEAR silent[];
  168. extern char NEAR precious[];
  169. extern unsigned NEAR ext_size; /* default .ext size */
  170. extern unsigned NEAR filename_size; /* filename size */
  171. extern unsigned NEAR filenameext_size; /* filename.ext size */
  172. extern unsigned NEAR resultbuf_size; /* fileFindBuf size */
  173. /* This flag activates special heap functionality.
  174. *
  175. * When TRUE allocate() asks for extra bytes from CRT functions and adds
  176. * signatures before and after the allocation. Any subsequent calls to
  177. * free_memory() and realloc_memory() check for the presence of these
  178. * sentinels and assert when such trashing occurs.
  179. */
  180. #ifdef HEAP
  181. extern BOOL fHeapChk;
  182. #endif