Source code of Windows XP (NT5)
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.

167 lines
5.0 KiB

  1. /*****************************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1987-1999 **/
  4. /*****************************************************************************/
  5. /*****************************************************************************
  6. File : errors.hxx
  7. Title : error include file
  8. Description : This file contains all the definitions for the import
  9. : handler interface
  10. History :
  11. VibhasC 24-Aug-1990 Created
  12. VibhasC 25-Aug-1990 Additions to the file handler
  13. *****************************************************************************/
  14. #ifndef __FILEHNDL_HXX__
  15. #define __FILEHNDL_HXX__
  16. #include "idict.hxx"
  17. /****************************************************************************
  18. *** extern procs
  19. ***************************************************************************/
  20. extern void StripSlashes( char * );
  21. /****************************************************************************
  22. **** class definitions for the import handler
  23. ****************************************************************************/
  24. /***
  25. *** input file search path list
  26. ***/
  27. struct _path_list
  28. {
  29. struct _path_list *pNext; // next member in linked list
  30. char *pPath; // path
  31. };
  32. typedef struct _path_list PATH_LIST;
  33. /***
  34. *** input file information block
  35. ***/
  36. struct _fname_list
  37. {
  38. struct _fname_list *pNext; // next in the list
  39. char *pName; // including path
  40. char *pPath; // path of the file
  41. } ;
  42. typedef struct _fname_list FNAME_LIST;
  43. // buffer size for open files
  44. #define MIDL_RD_BUFSIZE 16384
  45. /***
  46. *** nested file info stack implemented as a doubly linked list
  47. ***/
  48. struct _in_stack_element
  49. {
  50. struct _in_stack_element *pNext; // next stack element
  51. struct _in_stack_element *pPrev; // previous stack element
  52. FILE * hFile; // this files handle (valid if open)
  53. char * pBuffer; // buffer for file I/O
  54. unsigned long ulPos; // current position in the physical
  55. unsigned char fOpen; // file open ?
  56. unsigned char fShadow; // current file being shadowed ?
  57. unsigned char fNewLine;// new line was just seen
  58. unsigned char fRedundantImport;
  59. char * pShadowName;// shadow file name
  60. char * pMIFileName;// _i intermediate file
  61. unsigned short uShadowLine;// shadow line number
  62. char * pIFileName; // intermediate filename
  63. char * pName; // base file name including path
  64. short uLine; // current line in base file
  65. _in_stack_element()
  66. {
  67. pBuffer = new char[MIDL_RD_BUFSIZE];
  68. }
  69. ~_in_stack_element()
  70. {
  71. delete pBuffer;
  72. }
  73. } ;
  74. typedef struct _in_stack_element IN_STACK_ELEMENT;
  75. /***
  76. *** nested file access flags
  77. ***/
  78. struct _nfa_flags
  79. {
  80. unsigned char fFileSet; // file opened after push lex lvl ?
  81. unsigned char fPreProcess; // preprocessing on ?
  82. unsigned char fEOI; // end of file sensed ?
  83. unsigned char fRedundantImport; // redundant import simulation
  84. unsigned char fBaseFileName;
  85. unsigned char fInInclude;
  86. } ;
  87. typedef struct _nfa_flags NFA_FLAGS;
  88. /***
  89. *** nested file access data structure (used for import/acf)
  90. ***/
  91. class _nfa_info
  92. {
  93. private:
  94. FNAME_LIST * pFileList; // input file information
  95. PATH_LIST * pPathList; // path list
  96. IN_STACK_ELEMENT * pStack; // pointer to nfa stack element
  97. IN_STACK_ELEMENT * pStackFirst; // first in the stack list
  98. short iCurLexLevel; // current lexical level
  99. NFA_FLAGS Flags; // flags for nfa access
  100. char * pBaseName;
  101. STATUS_T AddFileToFileList( char *,char *);
  102. IDICTKEY iText; // macro class dict index
  103. ISTACK * pTextDict; // macro (text expansion dict)
  104. public:
  105. _nfa_info( void );
  106. ~_nfa_info();
  107. void Init();
  108. short GetLexLevel( void );
  109. short PushLexLevel( void );
  110. STATUS_T PopLexLevel( void );
  111. STATUS_T SetNewInputFile( char *);
  112. void SetLineFilename( char *);
  113. STATUS_T SetPath( char *);
  114. STATUS_T SetPreProcessingOn( void );
  115. STATUS_T PreProcess(char*, char*, char*, char*, char*&);
  116. short GetChar( void );
  117. short UnGetChar( short );
  118. STATUS_T GetInputDetails( char**, short *);
  119. STATUS_T GetInputDetails( char **);
  120. STATUS_T GetCurrentInputDetails( char**, short *, short *);
  121. short GetCurrentLineNo()
  122. {
  123. return short( (pStack) ? pStack->uLine : 0 );
  124. }
  125. char * SearchForFile( char *);
  126. void SetEOIFlag();
  127. void ResetEOIFlag()
  128. {
  129. Flags.fEOI = 0;
  130. }
  131. short GetEOIFlag();
  132. STATUS_T EndOperations();
  133. STATUS_T EndOneOperation( IN_STACK_ELEMENT *);
  134. BOOL IsDuplicateInput( char * );
  135. BOOL IsInInclude();
  136. void RegisterTextSubsObject( class TEXT_BUFFER * pT );
  137. /*************************************************************
  138. **** temp functions for current debugging purposes only
  139. ****/
  140. void Dump();
  141. /*************************************************************/
  142. void SetSearchPathsInOrder( char * p1, char *p2, char *p3 );
  143. void RegisterIt( char * );
  144. } ;
  145. typedef class _nfa_info NFA_INFO;
  146. #endif // __FILEHNDL_HXX__