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.

183 lines
4.8 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File: make.h
  4. //
  5. // History: 28-Feb-01 markder Created.
  6. //
  7. // Desc: This file contains definitions of the SdbMakefile object.
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef __MAKE_H__
  11. #define __MAKE_H__
  12. #include "obj.h"
  13. class SdbInOutFile : public SdbArrayElement
  14. {
  15. public:
  16. CMapStringToString m_mapParameters;
  17. CString GetParameter(CString csName) {
  18. CString csReturn;
  19. if (m_mapParameters.Lookup(csName, csReturn)) {
  20. return csReturn;
  21. }
  22. return CString();
  23. }
  24. CString GetDirectory()
  25. {
  26. CString csFullPath(MakeFullPath(m_csName));
  27. for (long i = csFullPath.GetLength() - 1; i >= 0; i--) {
  28. if (csFullPath.GetAt(i)== _T('\\')) {
  29. return csFullPath.Left(i+1);
  30. }
  31. }
  32. return CString();
  33. }
  34. CString GetFullPath()
  35. {
  36. return MakeFullPath(m_csName);
  37. }
  38. CString GetFullPathWithoutExtension()
  39. {
  40. CString csFullPath(MakeFullPath(m_csName));
  41. for (long i = csFullPath.GetLength() - 1; i >= 0; i--) {
  42. if (csFullPath.GetAt(i) == _T('.')) {
  43. return csFullPath.Left(i);
  44. }
  45. if (csFullPath.GetAt(i) == _T('\\')) {
  46. return csFullPath;
  47. }
  48. }
  49. return csFullPath;
  50. }
  51. CString GetNameWithoutExtension()
  52. {
  53. long nDot = -1;
  54. CString csName(m_csName);
  55. for (long i = csName.GetLength() - 1; i >= 0; i--) {
  56. if (csName.GetAt(i) == _T('.')) {
  57. if (nDot == -1) {
  58. nDot = i;
  59. }
  60. }
  61. if (csName.GetAt(i) == _T('\\')) {
  62. return csName.Mid(i + 1, nDot - i - 1);
  63. }
  64. }
  65. if (nDot == -1) {
  66. return csName;
  67. }
  68. return csName.Left(nDot);
  69. }
  70. };
  71. class SdbInputFile : public SdbInOutFile
  72. {
  73. public:
  74. SdbInputFile() :
  75. m_bSourceUpdated(FALSE) {}
  76. BOOL m_bSourceUpdated;
  77. BOOL ReadFromXML(IXMLDOMNode* pNode, SdbDatabase* pDB);
  78. };
  79. class SdbOutputFile : public SdbInOutFile
  80. {
  81. public:
  82. DATE m_dtRevisionCutoff;
  83. SdbOutputType m_OutputType;
  84. SdbOutputFile() :
  85. m_OutputType(SDB_OUTPUT_TYPE_SDB),
  86. m_dtRevisionCutoff(0)
  87. {
  88. m_dwFilter = SDB_FILTER_INCLUDE_ALL;
  89. }
  90. CString GetFriendlyNameForType() {
  91. switch (m_OutputType) {
  92. case SDB_OUTPUT_TYPE_SDB:
  93. return CString(_T("Writing SDB file"));
  94. case SDB_OUTPUT_TYPE_HTMLHELP:
  95. return CString(_T("Writing HTMLHelp files"));
  96. case SDB_OUTPUT_TYPE_MIGDB_INX:
  97. return CString(_T("Writing MigDB INX file"));
  98. case SDB_OUTPUT_TYPE_MIGDB_TXT:
  99. return CString(_T("Writing MigDB TXT file"));
  100. case SDB_OUTPUT_TYPE_WIN2K_REGISTRY:
  101. return CString(_T("Writing Win2k reg files"));
  102. case SDB_OUTPUT_TYPE_REDIR_MAP:
  103. return CString(_T("Writing redir map file"));
  104. case SDB_OUTPUT_TYPE_NTCOMPAT_INF:
  105. return CString(_T("Writing NTCOMPAT add file"));
  106. case SDB_OUTPUT_TYPE_NTCOMPAT_MESSAGE_INF:
  107. return CString(_T("Writing NTCOMPAT msg file"));
  108. case SDB_OUTPUT_TYPE_APPHELP_REPORT:
  109. return CString(_T("Writing AppHelp report file"));
  110. }
  111. return CString();
  112. }
  113. BOOL ReadFromXML(IXMLDOMNode* pNode, SdbDatabase* pDB);
  114. };
  115. class SdbLangMap : public SdbArrayElement
  116. {
  117. public:
  118. UINT m_dwCodePage;
  119. LCID m_lcid;
  120. CString m_csHtmlCharset;
  121. BOOL ReadFromXML(IXMLDOMNode* pNode, SdbDatabase* pDB);
  122. };
  123. class SdbMakefile
  124. {
  125. public:
  126. SdbMakefile() :
  127. m_bAddExeStubs(FALSE),
  128. m_flOSVersion(0.0),
  129. m_dwOSPlatform(OS_PLATFORM_I386),
  130. m_csLangID(_T("---")) { }
  131. SdbArray<SdbInputFile> m_rgInputFiles;
  132. SdbArray<SdbOutputFile> m_rgOutputFiles;
  133. SdbArray<SdbLangMap> m_rgLangMaps;
  134. DOUBLE m_flOSVersion;
  135. DWORD m_dwOSPlatform;
  136. BOOL m_bAddExeStubs;
  137. CString m_csHTMLHelpFilesOutputDir;
  138. CString m_csRegistryFilesOutputDir;
  139. CString m_csMigDBFilesOutputDir;
  140. CString m_csLangID;
  141. CStringArray m_rgHistoryKeywords;
  142. void AddHistoryKeywords(LPCTSTR szStart);
  143. SdbLangMap* GetLangMap(CString& csLangID);
  144. BOOL ReadMakefile(CString csMakefile);
  145. BOOL ReadFromXML(IXMLDOMNode* pNode, SdbDatabase* pDB);
  146. };
  147. BOOL WriteRedirMapFile(CString csFile, CString csTemplateFile, SdbDatabase* pDB);
  148. BOOL WriteAppHelpReport(SdbOutputFile* pOutputFile, SdbDatabase* pDB);
  149. #endif // __MAKE_H__