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.

208 lines
6.9 KiB

  1. /*++
  2. UNIMACRO.H
  3. Macros to handle unicode conversions and naming schemes for
  4. unicode independent files.
  5. 4/17/1997 DavidCHR, Created
  6. --*/
  7. #ifdef UNICODE
  8. #define U(functionName) functionName##W
  9. #define NU(functionName) functionName##A
  10. #define NTEXT( text ) text
  11. #define LPNSTR LPSTR
  12. #define UAWA "W"
  13. #define UAWW L"W"
  14. #define STR_FMTA "ws"
  15. #define STR_FMTW L"ws"
  16. #define STRING_FMTA "%ws" // "%" STR_FMTA causes problems
  17. #define STRING_FMTW L"%ws" // L"%" STR_FMTW causes problems
  18. #define WIDE_OR_ASCII( testname ) Wide_##testname
  19. #else /* NOT UNICODE */
  20. #define U(functionName) functionName##A
  21. #define NU(functionName) functionName##W
  22. #define NTEXT( text ) L##text
  23. #define LPNSTR LPWSTR
  24. #define UAWA "A"
  25. #define UAWW L"A"
  26. #define STR_FMTA "hs"
  27. #define STR_FMTW L"hs"
  28. #define STRING_FMTA "%hs" // "%" STR_FMTA causes problems
  29. #define STRING_FMTW L"%hs" // L"%" STR_FMTW causes problems
  30. #define WIDE_OR_ASCII( testname ) Ascii_##testname
  31. #endif /* UNICODE */
  32. /* define these so that you can use TEXT(UAW) and TEXT(STRING_FMT) */
  33. #define LUAW UAWW
  34. #define UAW UAWA
  35. #define LSTRING_FMT STRING_FMTW
  36. #define STRING_FMT STRING_FMTA
  37. /* evidently someone has failed to put these definitions
  38. where I could find them. So I'm putting them all here. */
  39. #define TFGETC U(TFGETC_)
  40. #define TFGETC_W fgetwc
  41. #define TFGETC_A fgetc
  42. #define TFPUTC U(TFPUTC_)
  43. #define TFPUTC_W fputwc
  44. #define TFPUTC__A fputc
  45. #define TGETCHAR U(TGETCHAR_)
  46. #define TGETCHAR_A getchar
  47. #define TGETCHAR_W getwchar
  48. #define TPUTCHAR U(TPUTCHAR_)
  49. #define TPUTCHAR_A putchar
  50. #define TPUTCHAR_W putwchar
  51. #define TFGETS U(TFGETS_)
  52. #define TFGETS_A fgets
  53. #define TFGETS_W fgetws
  54. #define TFPUTS U(TFPUTS_)
  55. #define TFPUTS_A fputs
  56. #define TFPUTS_W fputws
  57. #define TFPRINTF U(TFPRINTF_)
  58. #define TFPRINTF_A fprintf
  59. #define TFPRINTF_W fwprintf
  60. #define TPRINTF U(TPRINTF_)
  61. #define TPRINTF_A printf
  62. #define TPRINTF_W wprintf
  63. #define TSNPRINTF U(TSNPRINTF_)
  64. #define TSNPRINTF_A snprintf
  65. #define TSNPRINTF_W _snwprintf
  66. #define TSPRINTF U(TSPRINTF_)
  67. #define TSPRINTF_A sprintf
  68. #define TSPRINTF_W swprintf
  69. #define TVSNPRINTF U(TVSNPRINTF_)
  70. #define TVSNPRINTF_A _vsnprintf
  71. #define TVSNPRINTF_W _vsnwprintf
  72. #define TVSPRINTF U(TVSPRINTF_)
  73. #define TVSPRINTF_A vsprintf
  74. #define TVSPRINTF_W vswprintf
  75. #define TFSCANF U(TFSCANF_)
  76. #define TFSCANF_A fscanf
  77. #define TFSCANF_W fwscanf
  78. #define TSSCANF U(TSSCANF_)
  79. #define TSSCANF_A sscanf
  80. #define TSSCANF_W swscanf
  81. #define TSCANF U(TSCANF_)
  82. #define TSCANF_A scanf
  83. #define TSCANF_W wscanf
  84. #define TFOPEN U(TFOPEN_)
  85. #define TFOPEN_A fopen
  86. #define TFOPEN_W _wfopen
  87. #define TFREOPEN U(TFREOPEN_)
  88. #define TFREOPEN_A freopen
  89. #define TFREOPEN_W _wfreopen
  90. #define TATOI U(TATOI_)
  91. #define TATOI_A atoi
  92. #define TATOI_W _wtoi
  93. #define TATOL U(TATOL_)
  94. #define TATOL_A atol
  95. #define TATOL_W _wtol
  96. #define TATOLD U(TATOLD_)
  97. #define TATOLD_A atold
  98. #define TATOLD_W _wtold
  99. #define TSTRTOD U(TSTRTOD_)
  100. #define TSTRTOD_A strtod
  101. #define TSTRTOD_W wcstod
  102. #define TSTRTOL U(TSTRTOL_)
  103. #define TSTRTOL_A strtol
  104. #define TSTRTOL_W wcstol
  105. #define TSTRTOUL U(TSTRTOUL_)
  106. #define TSTRTOUL_A strtoul
  107. #define TSTRTOUL_W wcstoul
  108. #define TVFPRINTF U(TVFPRINTF_)
  109. #define TVFPRINTF_A vfprintf
  110. #define TVFPRINTF_W vfwprintf
  111. #define TVPRINTF U(TVPRINTF_)
  112. #define TVPRINTF_A vprintf
  113. #define TVPRINTF_W vwprintf
  114. #define TSTRCAT U(TSTRCAT_)
  115. #define TSTRCAT_A strcat
  116. #define TSTRCAT_W wcscat
  117. #define TSTRCHR U(TSTRCHR_)
  118. #define TSTRCHR_A strchr
  119. #define TSTRCHR_W wcschr
  120. #define TSTRRCHR U(TSTRRCHR_)
  121. #define TSTRRCHR_A strrchr
  122. #define TSTRRCHR_W wcsrchr
  123. #define TSTRCMP U(TSTRCMP_)
  124. #define TSTRCMP_A strcmp
  125. #define TSTRCMP_W wcscmp
  126. #define TSTRCPY U(TSTRCPY_)
  127. #define TSTRCPY_A strcpy
  128. #define TSTRCPY_W wcscpy
  129. #define TSTRLEN U(TSTRLEN_)
  130. #define TSTRLEN_A strlen
  131. #define TSTRLEN_W wcslen
  132. #define TSTRNCMP U(TSTRNCMP_)
  133. #define TSTRNCMP_A strncmp
  134. #define TSTRNCMP_W wcsncmp
  135. #define TSTRCMPI U(TSTRCMPI_)
  136. #define TSTRCMPI_A strcmpi
  137. #define TSTRCMPI_W wcscmpi
  138. #define TSTRSTR U(TSTRSTR_)
  139. #define TSTRSTR_A strstr
  140. #define TSTRSTR_W wcsstr
  141. #define TSTRTOK U(TSTRTOK_)
  142. #define TSTRTOK_A strtok
  143. #define TSTRTOK_W wcstok
  144. #define TSTRDUP U(TSTRDUP_)
  145. #define TSTRDUP_A strdup
  146. #define TSTRDUP_W wcsdup
  147. #define TSTRICMP U(TSTRICMP_)
  148. #define TSTRICMP_A strcmpi
  149. #define TSTRICMP_W wcscmpi
  150. #define TSTRNICMP U(TSTRNICMP_)
  151. #define TSTRNICMP_A strnicmp
  152. #define TSTRNICMP_W wcsnicmp