home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sherlock.zip / SRCINTER.H < prev    next >
Text File  |  1994-09-03  |  5KB  |  154 lines

  1. /*
  2. **  Sherlock - Copyright 1992, 1993, 1994
  3. **    Harfmann Software
  4. **    Compuserve: 73147,213
  5. **    All rights reserved
  6. */
  7. /*
  8. ** Structures and manifest constants for the expression analyiser.
  9. */
  10.  
  11. /*
  12. ** State return values.
  13. */
  14. #define SUCCESS     0   /* Success in requested function    */
  15. #define INVALID_VALUE    1   /* Invalid value given for state.    */
  16. #define SYNTAX_ERROR    2   /* Syntax error from parser     */
  17. #define INVALID_NAME    3   /* Invalid name given        */
  18. #define NO_MORE_MEMBERS 4   /* No more elements in structure    */
  19. #define OUT_OF_CONTEXT    5   /* Request for information out of
  20.                 ** retrievable context        */
  21. #define INVALID_INDEX    6   /* Index given too large        */
  22. #define INTERNAL_ERROR    7   /* Internal error            */
  23.  
  24. /*
  25. ** State of the interpreter for finding how to get from a name to
  26. ** a variable.
  27. */
  28. typedef struct _StructValue {
  29.     struct _StructValue *next;    /* Pointer to next element  */
  30.     char        *str;    /* Element name         */
  31. } StructValue;
  32.  
  33. typedef struct {
  34.     int     typeValue;        /* Type of data                */
  35.     union {            /* Data for item                */
  36.     ULONG    lVal;
  37.         double  dVal;
  38.         char    cVal;
  39.     char   *sVal;
  40.     StructValue *strVal;
  41.     } val;
  42. } Value;
  43. /*
  44. ** Value of a variable to display.
  45. */
  46. #define UNKNOWN_VAL 0
  47. #define LONG_VAL    1    /* Use lVal */
  48. #define DOUBLE_VAL  2    /* Use dVal */
  49. #define CHAR_VAL    3    /* Use cVal */
  50. #define STR_VAL     4    /* Use sVal */
  51. #define PTR_VAL     5    /* Use sVal */
  52. #define NAME_VAL    6    /* Use sVal - Name of some type. */
  53. #define STRUCT_VAL  7    /* Not expected in support DLL */
  54.  
  55.  
  56. typedef struct {
  57.     struct _DebugModule *module; /* Handle of the debug module of the source.*/
  58.     ULONG   baseEIP;        /* EIP for context of evaluating locals     */
  59.     ULONG   baseEBP;        /* EBP for context of evaluating locals     */
  60.     ULONG   addr;           /* Address of the variable                  */
  61.     ULONG   elementSize;    /* Size of the member specified.        */
  62.     int     isStruct;        /* Is the value a ptr to a structure?    */
  63.     Value   value;        /* Data for item.                */
  64.     int     typeDataSize;   /* Size of the type data information.    */
  65.     void   *typeData;        /* Aux data for use by the source module    */
  66. } State;
  67.  
  68. /*
  69. ** Find the requested source information based on certain information.
  70. */
  71. typedef struct _DebugModule {
  72.     void   *nextModule; /* Pointer to the next debug module.        */
  73.     char   *name;    /* Name as given by DosQueryModuleName        */
  74.     void   *AuxData;    /* Pointer for use by the support DLL        */
  75.     void   *ViewData;    /* Pointer used by the source code control  */
  76.     time_t  fTimestamp; /* Time stamp of the module            */
  77.     ULONG   fileSize;    /* File size of the module            */
  78.     ULONG   MTE;    /* Module handle                */
  79.     ULONG   typeFlags;    /* Flags returned by DosQueryAppType        */
  80.  
  81.     /*
  82.     ** Module cleanup.    Free any support structures.
  83.     */
  84.     void    (* _System FreeModule)(
  85.                struct _DebugModule *module);    /* Module handle */
  86.  
  87.     /*
  88.     ** Source functions.
  89.     */
  90.     int     (* _System FindSource)(        /* 1 found / 0 - not found     */
  91.             struct _DebugModule *module,    /* Module handle */
  92.             ULONG eipOffset,    /* EIP for function to find  */
  93.             char *funcName,     /* Buffer for function name  */
  94.             char *sourceName,   /* Buffer for source code     */
  95.             ULONG *lineNum);    /* Pointer to line number     */
  96.  
  97.     ULONG   (* _System FindSourceLine)(     /* Return offset of file/line*/
  98.             struct _DebugModule *module,    /* Module handle */
  99.             int line,        /* Line to find         */
  100.             char *fileName);    /* File name         */
  101.  
  102.     ULONG   (* _System FindFuncAddr)(        /* Return offset of function */
  103.             struct _DebugModule *module,    /* Module handle */
  104.             char *name);        /* Function name.         */
  105.  
  106.     /*
  107.     ** Variable functions.
  108.     */
  109.     int     (* _System GetName)(    /* State return value from above    */
  110.             struct _DebugModule *module,    /* Module handle */
  111.             State *state,    /* State information to retrieve.
  112.                     ** Contains name of variable.
  113.                     */
  114.             State *state2); /* If !NULL: state2 is element of
  115.                     ** structure given in state.
  116.                     */
  117.  
  118.  
  119.     int     (* _System GetArray)(    /* State return value from above */
  120.             struct _DebugModule *module,    /* Module handle */
  121.             State *state,    /* Name of array        */
  122.             State *state2); /* Index of element to retrieve */
  123.  
  124.     int     (* _System GetNumMembers)(    /* Return # of elements 0 if not
  125.                     ** a structure
  126.                     */
  127.             struct _DebugModule *module,    /* Module handle */
  128.             State *state);    /* Variable to query and program
  129.                     ** state
  130.                     */
  131.  
  132.     /*
  133.     ** Get the name of the index'th structure element
  134.     */
  135.     int     (* _System GetMemberIndex)( /* State return value from above */
  136.             struct _DebugModule *module,    /* Module handle */
  137.             State *state,    /* Program state         */
  138.             int MemberIndex,/* Index of element to retrieve  */
  139.             char *name);    /* Buffer to return name into     */
  140.  
  141.     /*
  142.     ** Get the address of a variable and it's type.
  143.     */
  144. } DebugModule;
  145.  
  146. /*
  147. ** Public access to debugger support specific routines.
  148. */
  149. int _System isKnownModule(DebugModule *module,
  150.                int (* _System DispatchCommand)(int command),
  151.                DebugBuffer *buffer);
  152. int _System DispatchCommand(int command);
  153. int _System linkPriority(void);
  154.