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.

228 lines
6.6 KiB

  1. // bsc.h
  2. //
  3. #include <stdarg.h>
  4. #define BSC_API far
  5. #if defined (OS2)
  6. typedef int FILEHANDLE;
  7. typedef int FILEMODE;
  8. #else
  9. typedef HANDLE FILEHANDLE;
  10. typedef DWORD FILEMODE;
  11. #endif
  12. //////////////////////////////////////////////////////////////////////
  13. // you must define the following callbacks for the library to use
  14. // to avoid dependancy on the C standard io library. If you don't
  15. // define these then you accept the defaults which call C runtime
  16. //
  17. // malloc and free workalikes
  18. LPV BSC_API LpvAllocCb(WORD cb);
  19. VOID BSC_API FreeLpv(LPV lpv);
  20. // open, read, close, seek workalikes
  21. FILEHANDLE BSC_API BSCOpen(LSZ lszFileName, FILEMODE mode);
  22. int BSC_API BSCRead(FILEHANDLE handle, LPCH lpchBuf, WORD cb);
  23. int BSC_API BSCSeek(FILEHANDLE handle, long lPos, FILEMODE mode);
  24. int BSC_API BSCClose(FILEHANDLE handle);
  25. // ascii text output routine
  26. VOID BSC_API BSCOutput(LSZ lsz);
  27. #ifdef DEBUG
  28. VOID BSC_API BSCDebugOut(LSZ lsz);
  29. VOID BSC_API BSCDebug(LSZ lszFormat, ...);
  30. #endif
  31. // error handling routines
  32. //
  33. VOID BSC_API SeekError(LSZ lszFileName); // (may choose to not return)
  34. VOID BSC_API ReadError(LSZ lszFileName); // (may choose to not return)
  35. VOID BSC_API BadBSCVer(LSZ lszFileName); // (may choose to not return)
  36. // end of callbacks
  37. //
  38. ///////////////////////////////////////////////////////////////////////
  39. // an IDX is guaranteed to be big enough to hold any of the
  40. // database index types, i.e. it is a generic index
  41. typedef DWORD IDX;
  42. #define idxNil 0xffffffffL
  43. #define isymNil 0xffffL
  44. #define imodNil 0xffffL
  45. // definition and prototypes for use with the bsc library
  46. //
  47. typedef WORD IMOD;
  48. typedef WORD IMS;
  49. typedef WORD ISYM;
  50. typedef WORD IINST;
  51. typedef DWORD IREF;
  52. typedef WORD IDEF;
  53. typedef WORD IUSE;
  54. typedef WORD IUBY;
  55. typedef WORD TYP;
  56. typedef WORD ATR;
  57. // Open the specified data base.
  58. // Return TRUE iff successful, FALSE if database can't be read
  59. //
  60. BOOL BSC_API FOpenBSC (LSZ lszName);
  61. // close database and free as much memory as possible
  62. //
  63. VOID BSC_API CloseBSC(VOID);
  64. // return the length of the largest symbol in the database
  65. //
  66. WORD BSC_API BSCMaxSymLen(VOID);
  67. // is this database built with a case sensitive language?
  68. //
  69. BOOL BSC_API FCaseBSC(VOID);
  70. // override the case sensitivity of the database, symbol lookups become
  71. // case (in)sensistive as specified
  72. //
  73. VOID BSC_API SetCaseBSC(BOOL fCaseSensitive);
  74. // do a case insenstive compare qualified by a case sensitive compare
  75. // if fCase is true -- this is the order of symbols in the symbol list
  76. int BSC_API CaseCmp(LSZ lsz1, LSZ lsz2);
  77. // return the name of the given symbol
  78. //
  79. LSZ BSC_API LszNameFrSym (ISYM isym);
  80. // return the name of the given module
  81. //
  82. LSZ BSC_API LszNameFrMod (IMOD imod);
  83. // return the imod with the given name -- imodNil if none
  84. //
  85. IMOD BSC_API ImodFrLsz(LSZ lszModName);
  86. // return the isym with the given name -- isymNil if none
  87. //
  88. ISYM BSC_API IsymFrLsz(LSZ lszSymName);
  89. // return the biggest isym in this database, isyms run from 0 to this value - 1
  90. //
  91. ISYM BSC_API IsymMac(VOID);
  92. // return the biggest imod in this database, imods run from 0 to this value - 1
  93. //
  94. IMOD BSC_API ImodMac(VOID);
  95. // return the biggest iinst in this database, iinsts run from 0 to the value -1
  96. IINST BSC_API IinstMac(VOID);
  97. // fill in the range of MS items valid for this module
  98. //
  99. VOID BSC_API MsRangeOfMod(IMOD imod, IMS far *pimsFirst, IMS far *pimsLast);
  100. // give the instance index of the module symbol (MS)
  101. //
  102. IINST BSC_API IinstOfIms(IMS ims);
  103. // fill in the range of inst values for this symbol
  104. //
  105. VOID BSC_API InstRangeOfSym(ISYM isym, IINST far *piinstFirst, IINST far *piinstLast);
  106. // get the information that qualifies this instance
  107. //
  108. VOID BSC_API InstInfo(IINST iinst, ISYM far *pisymInst, TYP far *typ, ATR far *atr);
  109. // fill in the reference ranges from the inst
  110. //
  111. VOID BSC_API RefRangeOfInst(IINST iinst, IREF far *pirefFirst, IREF far *pirefLast);
  112. // fill in the definition ranges from the inst
  113. //
  114. VOID BSC_API DefRangeOfInst(IINST iinst, IDEF far *pidefFirst, IDEF far *pidefLast);
  115. // fill in the use ranges from the inst
  116. //
  117. VOID BSC_API UseRangeOfInst(IINST iinst, IUSE far *piuseFirst, IUSE far *piuseLast);
  118. // fill in the used by ranges from the inst
  119. //
  120. VOID BSC_API UbyRangeOfInst(IINST iinst, IUBY far *piubyFirst, IUBY far *piubyLast);
  121. // fill in the information about this things which an inst uses
  122. //
  123. VOID BSC_API UseInfo(IUSE iuse, IINST far *piinst, WORD far *pcnt);
  124. // fill in the information about this things which an inst is used by
  125. //
  126. VOID BSC_API UbyInfo(IUBY iuby, IINST far *piinst, WORD far *pcnt);
  127. // fill in the information about this reference
  128. //
  129. VOID BSC_API RefInfo(IREF iref, LSZ far *plszName, WORD far *pline);
  130. // fill in the information about this definition
  131. //
  132. VOID BSC_API DefInfo(IDEF idef, LSZ far *plszName, WORD far *pline);
  133. // these are the bit values for the InstInfo() TYP and ATR types
  134. //
  135. //
  136. // this is the type part of the field, it describes what sort of object
  137. // we are talking about. Note the values are sequential -- the item will
  138. // be exactly one of these things
  139. //
  140. #define INST_TYP_FUNCTION 0x01
  141. #define INST_TYP_LABEL 0x02
  142. #define INST_TYP_PARAMETER 0x03
  143. #define INST_TYP_VARIABLE 0x04
  144. #define INST_TYP_CONSTANT 0x05
  145. #define INST_TYP_MACRO 0x06
  146. #define INST_TYP_TYPEDEF 0x07
  147. #define INST_TYP_STRUCNAM 0x08
  148. #define INST_TYP_ENUMNAM 0x09
  149. #define INST_TYP_ENUMMEM 0x0A
  150. #define INST_TYP_UNIONNAM 0x0B
  151. #define INST_TYP_SEGMENT 0x0C
  152. #define INST_TYP_GROUP 0x0D
  153. // this is the attribute part of the field, it describes the storage
  154. // class and/or scope of the instance. Any combination of the bits
  155. // might be set by some language compiler, but there are some combinations
  156. // that done make sense.
  157. #define INST_ATR_LOCAL 0x001
  158. #define INST_ATR_STATIC 0x002
  159. #define INST_ATR_SHARED 0x004
  160. #define INST_ATR_NEAR 0x008
  161. #define INST_ATR_COMMON 0x010
  162. #define INST_ATR_DECL_ONLY 0x020
  163. #define INST_ATR_PUBLIC 0x040
  164. #define INST_ATR_NAMED 0x080
  165. #define INST_ATR_MODULE 0x100
  166. // simple minded printf replacements, only %d, %s supported -- SMALL
  167. VOID BSC_API BSCFormat(LPCH lpchOut, LSZ lszFormat, va_list va);
  168. VOID BSC_API BSCSprintf(LPCH lpchOut, LSZ lszFormat, ...);
  169. VOID BSC_API BSCPrintf(LSZ lszFormat, ...);
  170. // rjsa 10/22/90
  171. // Some runtime library functions are broken, so intrinsics have
  172. // to be used.
  173. // BUGBUG
  174. //#pragma intrinsic (memset, memcpy, memcmp)
  175. //#pragma intrinsic (strset, strcpy, strcmp, strcat, strlen)