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.

122 lines
4.0 KiB

  1. /*
  2. * html.h
  3. *
  4. * Constants and Macros for html file generation and parsing
  5. *
  6. * Revision History:
  7. *
  8. * When Who What
  9. * -------- ------------------ ---------------------------------------
  10. * Sunita Created/defined macros to write and parse html
  11. */
  12. #ifndef _HTML_H
  13. #define _HTML_H
  14. //include for common token defns
  15. #include "nameres.h"
  16. #include <pshpack8.h> /* Assume 8 byte packing throughout */
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //html file manipulation macros
  21. #define HTMLTOKENBEGINCHAR TOKENBEGINCHAR
  22. #define HTMLTOKENENDCHAR TOKENENDCHAR
  23. #define HTMLHEADERSTARTSTR HEADSTARTSTR
  24. #define HTMLHEADERENDSTR HEADENDSTR
  25. #define HTMLSIGNSTARTSTR "HTML"
  26. #define HTMLSIGNENDSTR "/HTML"
  27. #define HTMLBODYSTARTSTR "BODY"
  28. #define HTMLBODYENDSTR "/BODY"
  29. #define HTMLAHREFSTARTSTR "A HREF = "
  30. #define HTMLAHREFENDSTR "/A"
  31. #define HTMLTITLESTARTSTR "TITLE"
  32. #define HTMLTITLEENDSTR "/TITLE"
  33. #define HTMLCONTENTTYPESTR "Content-Type: text/html\r\n\n\n"
  34. //token types in the ipa file format
  35. #define HTMLTOKEN_INVALID 0
  36. #define HTMLTOKEN_UNKNOWN 1
  37. #define HTMLTOKEN_SIGNSTART 2
  38. #define HTMLTOKEN_SIGNEND 3
  39. #define HTMLTOKEN_HEADSTART 4
  40. #define HTMLTOKEN_HEADEND 5
  41. #define HTMLTOKEN_BODYSTART 6
  42. #define HTMLTOKEN_BODYEND 7
  43. #define HTMLTOKEN_AHREFSTART 8
  44. #define HTMLTOKEN_AHREFEND 9
  45. #define HTMLTOKEN_TITLESTART 10
  46. #define HTMLTOKEN_TITLEEND 11
  47. //write macros
  48. //note all macros taken LPSTR - it is the responsibility of the calling
  49. //code to do any appropriate string conversions.
  50. #define WRITEHTMLSIGNATURESTART(lpBuf) \
  51. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  52. (LPSTR)HTMLSIGNSTARTSTR,HTMLTOKENENDCHAR)
  53. #define WRITEHTMLSIGNATUREEND(lpBuf) \
  54. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  55. (LPSTR)HTMLSIGNENDSTR,HTMLTOKENENDCHAR)
  56. #define WRITEHTMLHEADERSTART(lpBuf) \
  57. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  58. (LPSTR)HTMLHEADERSTARTSTR,HTMLTOKENENDCHAR)
  59. #define WRITEHTMLHEADEREND(lpBuf) \
  60. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  61. (LPSTR)HTMLHEADERENDSTR,HTMLTOKENENDCHAR)
  62. #define WRITEHTMLTITLESTART(lpBuf) \
  63. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  64. (LPSTR)HTMLTITLESTARTSTR,HTMLTOKENENDCHAR)
  65. #define WRITEHTMLTITLE(lpBuf,lpszTitle) \
  66. wsprintf((LPSTR)(lpBuf), "%s\r\n", lpszTitle)
  67. #define WRITEHTMLTITLEEND(lpBuf) \
  68. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  69. (LPSTR)HTMLTITLEENDSTR,HTMLTOKENENDCHAR)
  70. #define WRITEHTMLBODYSTART(lpBuf) \
  71. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  72. (LPSTR)HTMLBODYSTARTSTR,HTMLTOKENENDCHAR)
  73. #define WRITEHTMLBODYEND(lpBuf) \
  74. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  75. (LPSTR)HTMLBODYENDSTR,HTMLTOKENENDCHAR)
  76. #define WRITEHTMLSIGNATURE(lpBuf) \
  77. wsprintf((LPSTR)(lpBuf), "%c%s%c\r\n", HTMLTOKENBEGINCHAR, \
  78. (LPSTR)HTMLSIGNATURESTR,HTMLTOKENENDCHAR)
  79. #define WRITEHTMLREF(lpBuf,lpszUrl,lpszDisplayName) \
  80. wsprintf((LPSTR)(lpBuf), "%c%s\"%s\"%c%s%c%s%c\r\n", \
  81. HTMLTOKENBEGINCHAR,(LPSTR)HTMLAHREFSTARTSTR, \
  82. (LPSTR)lpszUrl,HTMLTOKENENDCHAR, \
  83. (LPSTR)lpszDisplayName,HTMLTOKENBEGINCHAR, \
  84. (LPSTR)HTMLAHREFENDSTR,HTMLTOKENENDCHAR)
  85. #define WRITEHTMLREFCRLF(lpBuf,lpszUrl,lpszDisplayName) \
  86. wsprintf((LPSTR)(lpBuf), "%c%s\"%s\"%c%s%c%s%c<BR>\r\n", \
  87. HTMLTOKENBEGINCHAR,(LPSTR)HTMLAHREFSTARTSTR, \
  88. (LPSTR)lpszUrl,HTMLTOKENENDCHAR, \
  89. (LPSTR)lpszDisplayName,HTMLTOKENBEGINCHAR, \
  90. (LPSTR)HTMLAHREFENDSTR,HTMLTOKENENDCHAR)
  91. //token identification macros
  92. #define ISBUFOURHTMLTOKEN(lpBuf,dwBufSize,lpszToken) \
  93. ((strlen((LPSTR)lpszToken) == dwBufSize) ? \
  94. !(memcmp((LPBYTE)lpBuf,(LPBYTE)lpszToken,dwBufSize)) : 0 )
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #include <poppack.h> /* End byte packing */
  99. #endif //#ifndef _HTML_H