showIncludes.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef _CRT_SECURE_NO_WARNINGS
  2. # define _CRT_SECURE_NO_WARNINGS
  3. #endif
  4. #if defined(_MSC_VER) && _MSC_VER >= 1928
  5. # pragma warning(disable : 5105) /* macro expansion warning in windows.h */
  6. #endif
  7. #include <windows.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. int main()
  11. {
  12. /* 'cl /showIncludes' encodes output in the console output code page. */
  13. unsigned int cp = GetConsoleOutputCP();
  14. /* 'cl /showIncludes' prints output in the VS language. */
  15. const char* vslang = getenv("VSLANG");
  16. if (!vslang) {
  17. fprintf(stderr, "VSLANG is not set.\n");
  18. return 1;
  19. }
  20. printf("Console output code page: %u\n", cp);
  21. printf("Console input code page: %u\n", GetConsoleCP());
  22. printf("ANSI code page: %u\n", GetACP());
  23. printf("OEM code page: %u\n", GetOEMCP());
  24. printf("VSLANG: %s\n", vslang);
  25. if (strcmp(vslang, "1031") == 0) {
  26. if (cp == 437 || cp == 65001) {
  27. printf("Hinweis: Einlesen der Datei: C:\\foo.h\n");
  28. return 0;
  29. }
  30. }
  31. if (strcmp(vslang, "1033") == 0) {
  32. if (cp == 437 || cp == 65001) {
  33. printf("Note: including file: C:\\foo.h\n");
  34. return 0;
  35. }
  36. }
  37. if (strcmp(vslang, "1036") == 0) {
  38. if (cp == 437 || cp == 863) {
  39. printf("Remarque\xff: inclusion du fichier\xff: C:\\foo.h\n");
  40. return 0;
  41. }
  42. if (cp == 65001) {
  43. printf("Remarque\xc2\xa0: inclusion du fichier\xc2\xa0: C:\\foo.h\n");
  44. return 0;
  45. }
  46. }
  47. if (strcmp(vslang, "1041") == 0) {
  48. if (cp == 932) {
  49. printf("\x83\x81\x83\x82: "
  50. "\x83\x43\x83\x93\x83\x4e\x83\x8b\x81\x5b\x83\x68 "
  51. "\x83\x74\x83\x40\x83\x43\x83\x8b: C:\\foo.h\n");
  52. return 0;
  53. }
  54. if (cp == 65001) {
  55. printf("\xe3\x83\xa1\xe3\x83\xa2: \xe3\x82\xa4\xe3\x83\xb3"
  56. "\xe3\x82\xaf\xe3\x83\xab\xe3\x83\xbc\xe3\x83\x89 "
  57. "\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab: C:\\foo.h\n");
  58. return 0;
  59. }
  60. }
  61. if (strcmp(vslang, "2052") == 0) {
  62. if (cp == 54936 || cp == 936) {
  63. printf("\xd7\xa2\xd2\xe2: "
  64. "\xb0\xfc\xba\xac\xce\xc4\xbc\xfe: C:\\foo.h\n");
  65. return 0;
  66. }
  67. if (cp == 65001) {
  68. printf("\xe6\xb3\xa8\xe6\x84\x8f: "
  69. "\xe5\x8c\x85\xe5\x90\xab\xe6\x96\x87\xe4\xbb\xb6: C:\\foo.h\n");
  70. return 0;
  71. }
  72. }
  73. fprintf(stderr, "No example showIncludes for this code page and VSLANG.\n");
  74. return 1;
  75. }