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.

148 lines
3.3 KiB

  1. //
  2. //
  3. // DCODESBR.C - dumps a human readable version of the current .sbr file
  4. // record from the r_... variables
  5. //
  6. //
  7. #include "sbrfdef.h"
  8. #include "mbrmake.h"
  9. char * near prectab[] = {
  10. "HEADER", // SBR_REC_HEADER
  11. "MODULE", // SBR_REC_MODULE
  12. "LINDEF", // SBR_REC_LINDEF
  13. "SYMDEF", // SBR_REC_SYMDEF
  14. "SYMREFUSE", // SBR_REC_SYMREFUSE
  15. "SYMREFSET", // SBR_REC_SYMREFSET
  16. "MACROBEG", // SBR_REC_MACROBEG
  17. "MACROEND", // SBR_REC_MACROEND
  18. "BLKBEG", // SBR_REC_BLKBEG
  19. "BLKEND", // SBR_REC_BLDEND
  20. "MODEND", // SBR_REC_MODEND
  21. "OWNER" // SBR_REC_OWNER
  22. };
  23. char * near plangtab[] = {
  24. "UNDEF", // SBR_L_UNDEF
  25. "BASIC", // SBR_L_BASIC
  26. "C", // SBR_L_C
  27. "FORTRAN", // SBR_L_FORTRAN
  28. "MASM", // SBR_L_MASM
  29. "PASCAL", // SBR_L_PASCAL
  30. "COBOL" // SBR_L_COBOL
  31. };
  32. char * near ptyptab[] = {
  33. "UNDEF", // SBR_TYP_UNKNOWN
  34. "FUNCTION", // SBR_TYP_FUNCTION
  35. "LABEL", // SBR_TYP_LABEL
  36. "PARAMETER", // SBR_TYP_PARAMETER
  37. "VARIABLE", // SBR_TYP_VARIABLE
  38. "CONSTANT", // SBR_TYP_CONSTANT
  39. "MACRO", // SBR_TYP_MACRO
  40. "TYPEDEF", // SBR_TYP_TYPEDEF
  41. "STRUCNAM", // SBR_TYP_STRUCNAM
  42. "ENUMNAM", // SBR_TYP_ENUMNAM
  43. "ENUMMEM", // SBR_TYP_ENUMMEM
  44. "UNIONNAM", // SBR_TYP_UNIONNAM
  45. "SEGMENT", // SBR_TYP_SEGMENT
  46. "GROUP", // SBR_TYP_GROUP
  47. "PROGRAM" // SBR_TYP_PROGRAM
  48. };
  49. char * near patrtab[] = {
  50. "LOCAL", // SBR_ATR_LOCAL
  51. "STATIC", // SBR_ATR_STATIC
  52. "SHARED", // SBR_ATR_SHARED
  53. "NEAR", // SBR_ATR_NEAR
  54. "COMMON", // SBR_ATR_COMMON
  55. "DECL_ONLY", // SBR_ATR_DECL_ONLY
  56. "PUBLIC", // SBR_ATR_PUBLIC
  57. "NAMED", // SBR_ATR_NAMED
  58. "MODULE", // SBR_ATR_MODULE
  59. "?", "?" // reserved for expansion
  60. };
  61. VOID
  62. DecodeSBR ()
  63. {
  64. int i;
  65. static indent;
  66. switch(r_rectyp) {
  67. case SBR_REC_MACROEND:
  68. case SBR_REC_BLKEND:
  69. case SBR_REC_MODEND:
  70. indent--;
  71. break;
  72. case SBR_REC_HEADER:
  73. case SBR_REC_MODULE:
  74. case SBR_REC_LINDEF:
  75. case SBR_REC_SYMDEF:
  76. case SBR_REC_SYMREFUSE:
  77. case SBR_REC_SYMREFSET:
  78. case SBR_REC_MACROBEG:
  79. case SBR_REC_BLKBEG:
  80. case SBR_REC_OWNER:
  81. break;
  82. default:
  83. fprintf(streamOut, "invalid record type %0xh", r_rectyp);
  84. SBRCorrupt("");
  85. return;
  86. }
  87. for (i = indent; i; i--)
  88. fprintf (streamOut, " ");
  89. fprintf (streamOut, "%s: (", prectab[r_rectyp]);
  90. switch(r_rectyp) {
  91. case SBR_REC_HEADER:
  92. fprintf (streamOut, "%1d:%1d (%s) %1d)",
  93. r_majv, r_minv, plangtab[r_lang], r_fcol);
  94. fprintf (streamOut, " in %s", r_cwd);
  95. break;
  96. case SBR_REC_MODULE:
  97. fprintf (streamOut, "%s", r_bname);
  98. indent++;
  99. break;
  100. case SBR_REC_LINDEF:
  101. fprintf (streamOut, "%d", r_lineno);
  102. break;
  103. case SBR_REC_SYMDEF:
  104. {
  105. WORD attr, type;
  106. type = (r_attrib & SBR_TYPMASK) >> SBR_TYPSHIFT;
  107. attr = (r_attrib & SBR_ATRMASK) >> SBR_ATRSHIFT;
  108. fprintf (streamOut, "%s", ptyptab[type]);
  109. for (i = 0 ; i < SBR_ATRBITS; i++)
  110. if (attr & (1 << i))
  111. fprintf (streamOut, "|%s", patrtab[i]);
  112. fprintf (streamOut, " o:%d %s", r_ordinal, r_bname);
  113. }
  114. break;
  115. case SBR_REC_SYMREFUSE:
  116. case SBR_REC_SYMREFSET:
  117. case SBR_REC_OWNER:
  118. fprintf (streamOut, "o:%d", r_ordinal);
  119. break;
  120. case SBR_REC_MACROBEG:
  121. case SBR_REC_BLKBEG:
  122. indent++;
  123. break;
  124. }
  125. fprintf (streamOut, ")\n");
  126. }