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.

114 lines
2.4 KiB

  1. //
  2. //
  3. // DumpBSC - Dump Source Data Base.
  4. // Walk the symbol tree dumping stuff.
  5. //
  6. #include <string.h>
  7. #include <stdio.h>
  8. #if defined(OS2)
  9. #define INCL_NOCOMMON
  10. #define INCL_DOSPROCESS
  11. #define INCL_DOSSEMAPHORES
  12. #define INCL_DOSFILEMGR
  13. #define INCL_DOSERRORS
  14. #define INCL_DOSMISC
  15. #include <os2.h>
  16. #else
  17. #include <windows.h>
  18. #endif
  19. #include <dos.h>
  20. #include "hungary.h"
  21. #include "bsc.h"
  22. #include "bscsup.h"
  23. VOID BSC_API
  24. DumpBSC()
  25. // Dump the contents of the .BSC file to the Output Function
  26. //
  27. {
  28. IMOD imod, imodMac;
  29. IMS ims, imsMac;
  30. ISYM isym, isymMac, isymT;
  31. IINST iinst, iinstMac, iinstT;
  32. IDEF idef, idefMac;
  33. IREF iref, irefMac;
  34. IUSE iuse, iuseMac;
  35. IUBY iuby, iubyMac;
  36. WORD wLine, cnt;
  37. LSZ lsz;
  38. imodMac = ImodMac();
  39. BSCPrintf("Modules:\n\n");
  40. for (imod = 0; imod < imodMac; imod++) {
  41. BSCPrintf("%s\n", LszNameFrMod(imod));
  42. MsRangeOfMod(imod, &ims, &imsMac);
  43. for ( ;ims < imsMac; ims++) {
  44. BSCPrintf("\t contains ");
  45. DumpInst(IinstOfIms(ims));
  46. BSCPrintf("\n");
  47. }
  48. }
  49. isymMac = IsymMac();
  50. BSCPrintf("\nSymbols:\n\n");
  51. for (isym = 0; isym < isymMac; isym++) {
  52. InstRangeOfSym(isym, &iinst, &iinstMac);
  53. for ( ;iinst < iinstMac; iinst++) {
  54. TYP typ;
  55. ATR atr;
  56. DumpInst(iinst);
  57. BSCPrintf("\n");
  58. InstInfo(iinst, &isymT, &typ, &atr);
  59. if (isym != isymT)
  60. BSCPrintf("\t ERROR instance points back to wrong symbol!\n");
  61. DefRangeOfInst(iinst, &idef, &idefMac);
  62. for (; idef < idefMac; idef++) {
  63. DefInfo(idef, &lsz, &wLine);
  64. BSCPrintf ("\t def'd %s(%d)\n", lsz, wLine);
  65. }
  66. RefRangeOfInst(iinst, &iref, &irefMac);
  67. for (; iref < irefMac; iref++) {
  68. RefInfo(iref, &lsz, &wLine);
  69. BSCPrintf ("\t ref'd %s(%d)\n", lsz, wLine);
  70. }
  71. UseRangeOfInst(iinst, &iuse, &iuseMac);
  72. for (; iuse < iuseMac; iuse++) {
  73. BSCPrintf ("\t uses ");
  74. UseInfo(iuse, &iinstT, &cnt);
  75. DumpInst(iinstT);
  76. if (cnt > 1) BSCPrintf("[%d]", cnt);
  77. BSCPrintf ("\n");
  78. }
  79. UbyRangeOfInst(iinst, &iuby, &iubyMac);
  80. for (; iuby < iubyMac; iuby++) {
  81. BSCPrintf ("\t used-by ");
  82. UbyInfo(iuby, &iinstT, &cnt);
  83. DumpInst(iinstT);
  84. if (cnt > 1) BSCPrintf("[%d]", cnt);
  85. BSCPrintf ("\n");
  86. }
  87. BSCPrintf("\n");
  88. }
  89. }
  90. }