home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / BSC32.ZIP / BSCSUP.H < prev    next >
C/C++ Source or Header  |  1993-06-22  |  7KB  |  202 lines

  1.  
  2. // bscsup.h
  3. //
  4. // BSC high level support functions
  5. //
  6.  
  7. VOID BSC_API StatsBSC(VOID);    // ascii dump of bsc statistics
  8. VOID BSC_API DumpBSC(VOID);        // ascii dump of the .bsc file
  9. VOID BSC_API DumpInst(IINST iinst);    // ascii dump of single inst (name + flags)
  10. LSZ  BSC_API LszTypInst(IINST iinst); // ascii version of iinst type
  11.  
  12. VOID BSC_API CallTreeInst (IINST iinst);    // forward call tree from instance
  13. BOOL BSC_API FCallTreeLsz(LSZ lszName);    // forward call tree from name
  14.  
  15. VOID BSC_API RevTreeInst (IINST iinst);    // reverse call tree from instance
  16. BOOL BSC_API FRevTreeLsz(LSZ lszName);    // reverse call tree form name
  17.  
  18. VOID BSC_API ClassTreeInst (IINST iinst);    // forward class tree from instance
  19. BOOL BSC_API FClassTreeLsz(LSZ lszName);    // forward class tree from name
  20.  
  21. VOID BSC_API RevClassTreeInst (IINST iinst);// reverse class tree from inst
  22. BOOL BSC_API FRevClassTreeLsz (LSZ lszName);// reverse class tree from name
  23.  
  24. // return the undecorated name for the function name in lszname
  25. LSZ BSC_API FormatDname (LSZ lszname);
  26.  
  27. // return the base name of a decorated name.  That is, the full name if
  28. // it isn't decorated, the member name if it is a member variable or member
  29. // function, the function/variable name if it is just a decorated function or
  30. // data item (global), or the class name if it is a constructor or destructor.
  31. //
  32. // all other inputs return NULL
  33. //
  34.  
  35. LSZ BSC_API LszBaseOfDname (LSZ lszname);
  36.  
  37. // return the class name from a decorated name or NULL if there is no
  38. // class name there.  If the name is either not a decorated name or if
  39. // the class name part of the decorated name is empty (as in a global operator)
  40. // then the pointer return is NULL.  Otherwise the class name is returned
  41.  
  42. LSZ BSC_API LszClassOfDname (LSZ lszname);
  43.  
  44. // Browse OBject
  45.  
  46. typedef DWORD BOB;
  47.  
  48. #define bobNil 0L
  49.  
  50. typedef WORD CLS;
  51.  
  52. #define clsMod  1
  53. #define clsInst 2
  54. #define clsRef  3
  55. #define clsDef  4
  56. #define clsUse  5
  57. #define clsUby  6 
  58. #define clsSym    7
  59. #define clsBase 8
  60. #define clsDerv 9
  61. #define clsFrin 10
  62. #define clsFrout 11
  63.  
  64. #define BobFrClsIdx(cls, idx)  ((((long)(cls)) << 24) | (idx))
  65. #define ClsOfBob(bob)   (CLS)((bob) >> 24)
  66.  
  67. #define ImodFrBob(bob)     ((IMOD)(bob))
  68. #define IinstFrBob(bob)     ((IINST)(bob))
  69. #define IrefFrBob(bob)     ((IREF)((bob) & 0xffffffL))
  70. #define IdefFrBob(bob)     ((IDEF)(bob))
  71. #define IuseFrBob(bob)     ((IUSE)((bob) & 0xffffffL))
  72. #define IubyFrBob(bob)     ((IUBY)((bob) & 0xffffffL))
  73. #define IsymFrBob(bob)     ((ISYM)(bob))
  74. #define IbaseFrBob(bob)  ((IBASE)(bob))
  75. #define IdervFrBob(bob)  ((IDERV)(bob))
  76. #define IfrinFrBob(bob)  ((IFRIN)(bob))
  77. #define IfroutFrBob(bob) ((IFROUT)(bob))
  78.  
  79. #define BobFrMod(x)  (BobFrClsIdx(clsMod,  (x)))
  80. #define BobFrSym(x)  (BobFrClsIdx(clsSym,  (x)))
  81. #define BobFrInst(x) (BobFrClsIdx(clsInst, (x)))
  82. #define BobFrRef(x)  (BobFrClsIdx(clsRef,  (x)))
  83. #define BobFrDef(x)  (BobFrClsIdx(clsDef,  (x)))
  84. #define BobFrUse(x)  (BobFrClsIdx(clsUse,  (x)))
  85. #define BobFrUby(x)  (BobFrClsIdx(clsUby,  (x)))
  86. #define BobFrBase(x) (BobFrClsIdx(clsBase, (x)))
  87. #define BobFrDerv(x) (BobFrClsIdx(clsDerv, (x)))
  88. #define BobFrFrin(x) (BobFrClsIdx(clsFrin, (x)))
  89. #define BobFrFrout(x) (BobFrClsIdx(clsFrout, (x)))
  90.  
  91. // these are the query types
  92. //
  93. typedef enum _qy_ {
  94.     qyFiles, qySymbols, qyContains, qyDefinedIn,
  95.     qyCalls, qyCalledBy, qyUses, qyUsedBy,
  96.     qyUsedIn, qyBaseOf, qyDervOf, qyMembers,
  97.     qyMemberOf, qyImpMembers, qyFriendIn, qyFriendOut,
  98.     qyBaseSorted, qyBaseIncSorted, qyDervSorted, qyDervIncSorted,
  99.     qyDefs, qyRefs,
  100. } QY;
  101.  
  102. // these are visible so that you can see how the query is progressing
  103. // you may not write on these -- these values may or may not have anything
  104. // to do with any database indices
  105. //
  106.  
  107. extern IDX FAR idxQyStart;
  108. extern IDX FAR idxQyCur;
  109. extern IDX FAR idxQyMac;
  110.  
  111. BOOL BSC_API InitBSCQuery (QY qy, BOB bob);
  112. BOB  BSC_API BobNext(VOID);
  113.  
  114. LSZ  BSC_API LszNameFrBob(BOB bob);
  115. BOB  BSC_API BobFrName(LSZ lsz);
  116.  
  117. // these are the instance types you can filter on
  118. // they are called MBF's for historical reasons which are not clear to me
  119. //
  120.  
  121. typedef WORD MBF;
  122.  
  123. // these may be or'd together
  124.  
  125. #define mbfNil    0
  126. #define mbfVars   1
  127. #define mbfFuncs  2
  128. #define mbfMacros 4
  129. #define mbfTypes  8
  130. #define mbfClass  16
  131. #define mbfAll    31
  132.  
  133. BOOL BSC_API FInstFilter (IINST iinst, MBF mbf);
  134.  
  135. // show outline for the given files (by imod, or by Pattern)
  136. //
  137. VOID BSC_API OutlineMod(IMOD imod, MBF mbfReqd);
  138. BOOL BSC_API FOutlineModuleLsz (LSZ lszPattern, MBF mbfReqd);
  139. LSZ  BSC_API LszBaseName(LSZ lsz);
  140.  
  141. // list references for all symbols meeting the mbf requirement
  142. //
  143. BOOL BSC_API ListRefs (MBF mbfReqd);
  144.  
  145. // DOS style wildcard matching
  146. //
  147. BOOL BSC_API FWildMatch(LSZ lszPat, LSZ lszText);
  148.  
  149. // return, if successful, the range of bob's which are prefixed by the
  150. // zero terminated string in lszprefix, the boolean indicates success
  151. // matching is always case INSENSITIVE
  152. //
  153. BOOL BSC_API FindPrefixRange (LSZ lszprefix, ISYM FAR *pfirstisym, ISYM FAR *plastisym);
  154.  
  155. typedef void (BSC_API *PFN_BOB)(BOB);
  156. typedef BOOL (BSC_API *PFN_BOB_EX)(BOB);
  157.  
  158. // callback the given function returning all the possible bob's that
  159. // could match the given overloaded name
  160. //
  161. // LSZ can be of the form
  162. //
  163. // class::        (generates a list of all members of the class)
  164. // class::foo        (generates a list of all members named foo)
  165. // foo            (generates a list of all members foo in any class
  166. //             or top level items named foo)
  167. //
  168. // for the above forms foo can be a regular member or it can be 'operator+',
  169. // 'operator new' etc.  the class can also be a nested class such as
  170. // class1::class2::foo
  171. //
  172. // GenerateOverloads now also supports these two 'wildcard' forms
  173. //
  174. // foo*            (generates a list of all symbols starting with foo)
  175. // class::foo*        (as above but symbols must be in the given class)
  176. //
  177. // for these two forms foo may not be an operator (it would conflict with
  178. // the likes of operator* and so forth)
  179. //
  180. // GenerateOverloadsEx accepts a PFN_BOB_EX, if the function pointed to
  181. // by the argument ever returns FALSE then generation of overloads will be
  182. // stopped (e.g. this allows you to show the first n overloads in a listbox)
  183. // without having to wait for all the overloads to be computed
  184.  
  185. WORD BSC_API GenerateOverloads (LSZ, MBF, PFN_BOB); // obsolete
  186. WORD BSC_API GenerateOverloadsEx (LSZ, MBF, PFN_BOB_EX);
  187.  
  188.  
  189. // do secondary mappings on iref/idef/iinst
  190.  
  191. // find the iinst which was in context at the location of the given IREF
  192. // e.g. if a you have an IREF for some local variable, the context iinst
  193. // would be the function that it was defined in.
  194.  
  195. IINST IinstContextFrIref (IREF iref);
  196.  
  197. // find the iinst which contains the given IREF
  198. IINST IinstFrIref(IREF);
  199.  
  200. // find the iinst which contains the given IDEF
  201. IINST IinstFrIdef(IDEF);
  202.