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.

231 lines
6.8 KiB

  1. use constant PL_NORMAL => 0x00000000; # no html modifiers
  2. use constant PL_RED => 0x00000001; # print to log in red text
  3. use constant PL_BLUE => 0x00000002; # print to log in blue text
  4. use constant PL_GREEN => 0x00000004; # print to log in green text
  5. use constant PL_ORANGE => 0x00000008; # print to log in orange text
  6. use constant PL_PURPLE => 0x00000010; # print to log in purple text
  7. use constant PL_GRAY => 0x00000020; # print to log in gray text
  8. use constant PL_VERYLARGE => 0x00000040; # print to log in very large font html
  9. use constant PL_LARGE => 0x00000080; # print to log in large font html
  10. use constant PL_BOLD => 0x00000100; # print to log in BOLD html
  11. use constant PL_ITALIC => 0x00000200; # print to log in italic html
  12. use constant PL_MSG => 0x00000400; # print to build message as well
  13. use constant PL_NOSTD => 0x00000800; # don't print to console output
  14. use constant PL_NOLOG => 0x00001000; # don't print to log
  15. use constant PL_BOOKMARK => 0x00002000; # bookmark to build message
  16. use constant PL_NOTAG => 0x00004000; # remove html tags before teeing to console
  17. use constant PL_STDERR => 0x00008000; # print to STDERR instead or STDOUT
  18. use constant PL_FLUSH => 0x00010000; # flush buffers after printing
  19. use constant PL_VERBOSE => 0x00020000; # print only if in verbose mode (in purple)
  20. use constant PL_SETERROR => 0x00040000; # store current string in $ERROR (no pre-formatting)
  21. use constant PL_MSGCONCAT => 0x00080000; # msg concatination (don't automatically prefix w/ <dd>)
  22. use constant PL_ADDREF => 0x00100000; # additional reference; concatenate any href with existing <a ...> ref
  23. use constant PL_HEADER => PL_VERYLARGE | PL_BOLD;
  24. use constant PL_SUBHEADER => PL_LARGE | PL_BOLD;
  25. use constant PL_WARNING => PL_ORANGE | PL_STDERR | PL_SETERROR;
  26. use constant PL_ERROR => PL_RED | PL_STDERR | PL_SETERROR;
  27. use constant PL_BIGWARNING => PL_ORANGE | PL_STDERR | PL_BOLD | PL_MSG | PL_BOOKMARK | PL_NOTAG;
  28. use constant PL_BIGERROR => PL_RED | PL_STDERR | PL_BOLD | PL_MSG | PL_BOOKMARK | PL_NOTAG;
  29. use constant PL_MSGONLY => PL_MSG | PL_NOLOG | PL_NOSTD;
  30. #TODO PL_BIGHEADER
  31. ####################################################################################
  32. # PrintL()
  33. # multi-option print, options listed with constants at top of library
  34. # Input: output string as first var, options as second var
  35. # (if null, PL_NORMAL assumed)
  36. # a-jbilas, 08/08/99 - created
  37. ####################################################################################
  38. sub PrintL($;$)
  39. {
  40. my($sMsg, $sModifiers) = @_;
  41. my($sHead) = "";
  42. my($sFoot) = "";
  43. # skip rest of function if just printing to console and log
  44. if (($sModifiers eq "") || ($sModifiers == PL_NORMAL))
  45. {
  46. print(STDOUT $sMsg);
  47. # $CONSOLE->Write($sMsg);
  48. if ($fhBuildLog)
  49. {
  50. my($tmp) = $sMsg;
  51. $tmp =~ s/\n/<br>\n/g;
  52. $fhBuildLog->print($tmp);
  53. }
  54. return();
  55. }
  56. if ($sModifiers & PL_VERBOSE)
  57. {
  58. if ($bVerbose)
  59. {
  60. $sModifiers = $sModifiers | PL_PURPLE;
  61. }
  62. else
  63. {
  64. return();
  65. }
  66. }
  67. if ($sModifiers & PL_SETERROR)
  68. {
  69. SetError($sMsg, ($sModifiers & PL_MSGCONCAT ? 1 : 0));
  70. }
  71. # color modifiers
  72. if ($sModifiers & PL_RED)
  73. {
  74. $sHead = '<font color="red">'.$sHead;
  75. $sFoot = $sFoot.'</font>';
  76. }
  77. elsif ($sModifiers & PL_BLUE)
  78. {
  79. $sHead = '<font color="blue">'.$sHead;
  80. $sFoot = $sFoot.'</font>';
  81. }
  82. elsif ($sModifiers & PL_GREEN)
  83. {
  84. $sHead = '<font color="green">'.$sHead;
  85. $sFoot = $sFoot.'</font>';
  86. }
  87. elsif ($sModifiers & PL_PURPLE)
  88. {
  89. $sHead = '<font color="purple">'.$sHead;
  90. $sFoot = $sFoot.'</font>';
  91. }
  92. elsif ($sModifiers & PL_ORANGE)
  93. {
  94. $sHead = '<font color="orange">'.$sHead;
  95. $sFoot = $sFoot.'</font>';
  96. }
  97. elsif ($sModifiers & PL_GRAY)
  98. {
  99. $sHead = '<font color="gray">'.$sHead;
  100. $sFoot = $sFoot.'</font>';
  101. }
  102. # font modifiers
  103. if ($sModifiers & PL_LARGE)
  104. {
  105. $sHead = '<font size="4">'.$sHead;
  106. $sFoot = $sFoot.'</font>';
  107. }
  108. elsif ($sModifiers & PL_VERYLARGE)
  109. {
  110. $sHead = '<font size="5" face="arial">'.$sHead;
  111. $sFoot = $sFoot.'</font>';
  112. }
  113. if ($sModifiers & PL_BOLD)
  114. {
  115. $sHead = '<b>'.$sHead;
  116. $sFoot = $sFoot.'</b>';
  117. }
  118. if ($sModifiers & PL_ITALIC)
  119. {
  120. $sHead = '<i>'.$sHead;
  121. $sFoot = $sFoot.'</i>';
  122. }
  123. # print to strBuildMsg
  124. if ($sModifiers & PL_MSG)
  125. {
  126. if (!($sModifiers & PL_MSGCONCAT) && ($sMsg !~ /<dd>/i))
  127. {
  128. $strBuildMsg .= "<dd>";
  129. }
  130. if ($sModifiers & PL_BOOKMARK)
  131. {
  132. $strBuildMsg .= Bookmark($sHead.$sMsg.$sFoot, (PL_ADDREF & $sModifiers));
  133. }
  134. else
  135. {
  136. $strBuildMsg .= $sHead.$sMsg.$sFoot."\n";
  137. }
  138. }
  139. # print to log
  140. if ($fhBuildLog && !($sModifiers & PL_NOLOG))
  141. {
  142. my($tmp) = $sMsg;
  143. $tmp =~ s/\n/<br>\n/g;
  144. $fhBuildLog->print($sHead.$tmp.$sFoot);
  145. }
  146. # print to console
  147. if (!($sModifiers & PL_NOSTD))
  148. {
  149. if ($sModifiers & PL_NOTAG)
  150. {
  151. $sMsg =~ s/<[^>]*>//g;
  152. }
  153. if ($sModifiers & PL_STDERR)
  154. {
  155. # $CONSOLE->Write($sMsg);
  156. print(STDERR $sMsg);
  157. }
  158. else
  159. {
  160. # $CONSOLE->Write($sMsg);
  161. print(STDOUT $sMsg);
  162. }
  163. }
  164. # flush buffers
  165. if ($sModifiers & PL_FLUSH)
  166. {
  167. if ($fhBuildLog && !($sModifiers & PL_NOLOG))
  168. {
  169. $fhBuildLog->flush();
  170. }
  171. if (!($sModifiers & PL_NOSTD))
  172. {
  173. if ($sModifiers & PL_STDERR)
  174. {
  175. # TODO: how to flush STDERR?
  176. }
  177. else
  178. {
  179. # TODO: how to flush STDOUT?
  180. }
  181. }
  182. }
  183. }
  184. sub PrintLTip($$;$)
  185. {
  186. if ($bDHTMLActive)
  187. {
  188. my($tip) = $_[1];
  189. # (, ), ', ", and \ not allowed in tooltips captions
  190. $tip =~ s/\(/\</g;
  191. $tip =~ s/\)/\>/g;
  192. $tip =~ s/\"/\*/g;
  193. $tip =~ s/\'/\*/g;
  194. $tip =~ s/\\/\//g;
  195. # print log and message w/ tooltips
  196. PrintL("<a onMouseover=\"showtip(this,event,'".$tip."')\" onMouseout=\"hidetip()\">".$_[0]."<\/a>", $_[2] | PL_NOSTD | PL_ADDREF | PL_FLUSH);
  197. # print console output wo/ tooltips (and don't re-seterror())
  198. PrintL($_[0], (($_[2] | PL_NOLOG) - ($_[2] & PL_MSG) - ($_[2] & PL_SETERROR)));
  199. }
  200. else
  201. {
  202. PrintL($_[0], $_[2]);
  203. SetError($_[1]);
  204. }
  205. }
  206. $__IITPRINTLPM = 1;
  207. 1;