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.

160 lines
3.9 KiB

  1. class OutputFile
  2. {
  3. public:
  4. OutputFile(FILE* out)
  5. {
  6. outfile = out;
  7. tabs = 0;
  8. tabStr[0] = '\0';
  9. }
  10. ~OutputFile()
  11. {
  12. if (outfile)
  13. {
  14. fflush(outfile);
  15. fclose(outfile);
  16. }
  17. }
  18. static OutputFile* CreateOutputFile(LPTSTR filename);
  19. virtual VOID GraphicsProcedure() = 0;
  20. virtual VOID GraphicsDeclaration() = 0;
  21. virtual VOID PointDeclaration(LPCTSTR pointName, Point* pts, INT count = -1) = 0;
  22. virtual VOID ColorDeclaration(LPCTSTR colorName, ARGB* argb, INT count = -1) = 0;
  23. virtual VOID RectangleDeclaration(LPCTSTR rectName, ERectangle& rect) = 0;
  24. virtual VOID Declaration(LPCTSTR type,
  25. LPCTSTR object,
  26. LPCTSTR argList,
  27. ...) = 0;
  28. // set matrix, do nothing if identity matrix
  29. virtual VOID SetPointDeclaration(LPCTSTR object,
  30. LPCTSTR command,
  31. LPCTSTR varName,
  32. Point* pts,
  33. INT count = -1,
  34. BOOL ref = FALSE) = 0;
  35. virtual VOID SetColorDeclaration(LPCTSTR object,
  36. LPCTSTR command,
  37. LPCTSTR varName,
  38. ARGB* colors,
  39. INT count = -1,
  40. BOOL ref = FALSE) = 0;
  41. virtual VOID SetMatrixDeclaration(LPCTSTR object,
  42. LPCTSTR command,
  43. LPCTSTR varName,
  44. Matrix* matrix) = 0;
  45. virtual VOID SetBlendDeclaration(LPCTSTR object,
  46. LPCTSTR command,
  47. LPCTSTR varName,
  48. REAL* blend,
  49. INT count) = 0;
  50. virtual VOID GraphicsCommand(LPCTSTR command,
  51. LPCTSTR argList,
  52. ...) = 0;
  53. virtual VOID ObjectCommand(LPCTSTR object,
  54. LPCTSTR command,
  55. LPCTSTR argList,
  56. ...) = 0;
  57. virtual VOID BeginIndent() = 0;
  58. virtual VOID EndIndent() = 0;
  59. virtual VOID BlankLine() = 0;
  60. virtual LPTSTR Ref(LPCTSTR) = 0;
  61. virtual LPTSTR RefArray(LPCTSTR refStr) = 0;
  62. virtual LPTSTR WStr(LPCTSTR) = 0;
  63. protected:
  64. FILE* outfile;
  65. INT tabs;
  66. TCHAR tabStr[MAX_PATH];
  67. };
  68. class CPPOutputFile : public OutputFile
  69. {
  70. public:
  71. CPPOutputFile(FILE* out) : OutputFile(out) {}
  72. virtual VOID GraphicsProcedure();
  73. virtual VOID GraphicsDeclaration();
  74. virtual VOID PointDeclaration(LPCTSTR pointName, Point* pts, INT count = -1);
  75. virtual VOID ColorDeclaration(LPCTSTR colorName, ARGB* argb, INT count = -1);
  76. virtual VOID RectangleDeclaration(LPCTSTR rectName, ERectangle& rect);
  77. virtual VOID Declaration(LPCTSTR type,
  78. LPCTSTR object,
  79. LPCTSTR argList,
  80. ...);
  81. // set matrix, do nothing if identity matrix
  82. virtual VOID SetPointDeclaration(LPCTSTR object,
  83. LPCTSTR command,
  84. LPCTSTR varName,
  85. Point* pts,
  86. INT count = -1,
  87. BOOL ref = FALSE);
  88. virtual VOID SetColorDeclaration(LPCTSTR object,
  89. LPCTSTR command,
  90. LPCTSTR varName,
  91. ARGB* colors,
  92. INT count = -1,
  93. BOOL ref = FALSE);
  94. virtual VOID SetMatrixDeclaration(LPCTSTR object,
  95. LPCTSTR command,
  96. LPCTSTR varName,
  97. Matrix* matrix);
  98. virtual VOID SetBlendDeclaration(LPCTSTR object,
  99. LPCTSTR command,
  100. LPCTSTR varName,
  101. REAL* blend,
  102. INT count);
  103. virtual VOID GraphicsCommand(LPCTSTR command,
  104. LPCTSTR argList,
  105. ...);
  106. virtual VOID ObjectCommand(LPCTSTR object,
  107. LPCTSTR command,
  108. LPCTSTR argList,
  109. ...);
  110. virtual VOID BeginIndent();
  111. virtual VOID EndIndent();
  112. virtual VOID BlankLine();
  113. // add '&' to constant
  114. virtual LPTSTR Ref(LPCTSTR refStr);
  115. // add '&' name '[x]'
  116. virtual LPTSTR RefArray(LPCTSTR refStr);
  117. // Add 'L' to constant
  118. virtual LPTSTR WStr(LPCTSTR refStr);
  119. };
  120. class JavaOutputFile : public CPPOutputFile
  121. {
  122. public:
  123. JavaOutputFile(FILE* out) : CPPOutputFile(out) {};
  124. };
  125. class VMLOutputFile : public CPPOutputFile
  126. {
  127. public:
  128. VMLOutputFile(FILE* out) : CPPOutputFile(out) {};
  129. };