home *** CD-ROM | disk | FTP | other *** search
/ Enter 1999 November / ENTER11_1.bin / WARSZTAT / SDKJava32.exe / data1.cab / fg_Samples / Samples / Native / JView / jviewprf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-03-17  |  5.0 KB  |  150 lines

  1. // jviewprf.h
  2. //
  3. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  4. //
  5.  
  6. #ifndef __JVIEWPRF_H__
  7. #define __JVIEWPRF_H__
  8.  
  9.  
  10. //------------------------------------------------------------------------
  11. //
  12. // Profiler hook interface for JVIEW.  When a JVIEW profiler is present, a
  13. // "-prof" option is available that causes JVIEW to load the profiler and
  14. // register it with the VM.
  15. //
  16. //------------------------------------------------------------------------
  17.  
  18.  
  19. #ifndef DEFINES_ONLY
  20.  
  21.  
  22. //------------------------------------------------------------------------
  23. // Interfaces provided by JVIEW via IJVIEWProfiler::Initialize
  24.  
  25.  
  26. typedef enum
  27. {
  28.     JDC_INFORMATION     = 1,
  29.     JDC_WARNING         = 2,
  30.     JDC_ERROR           = 3,
  31. }
  32. JVIEWDisplayClass;
  33.  
  34.  
  35. // {03D9F3F0-B0E3-11d2-B081-006008039BF0}
  36. DEFINE_GUID(IID_IJVIEWProfilerUtils, 0x3d9f3f0, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
  37.  
  38. #undef INTERFACE
  39. #define INTERFACE IJVIEWProfilerUtils
  40.  
  41. DECLARE_INTERFACE_(IJVIEWProfilerUtils, IUnknown)
  42. {
  43. #ifndef NO_BASEINTERFACE_FUNCS
  44.     /* IUnknown methods */
  45.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
  46.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  47.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  48. #endif
  49.  
  50.     // These methods should be used for printing informational messages for
  51.     // the user.  Under JVIEW, this is written to the console.  Under WJVIEW,
  52.     // this appears in a message box.
  53.     STDMETHOD(DisplayString) (THIS_ JVIEWDisplayClass cls, PCSTR pcsz) PURE;
  54.     STDMETHOD(DisplayResourceString) (THIS_ JVIEWDisplayClass cls, HINSTANCE hinst, UINT id) PURE;
  55.  
  56.     // Locates a suitable resource string, using the same language-finding
  57.     // semantics as JVIEW.
  58.     STDMETHOD_(int, LoadResourceString) (THIS_ HINSTANCE hinst, UINT id, PSTR buf, int bufsize) PURE;
  59.  
  60.     // Bounded versions of sprintf and vsprintf.
  61.     STDMETHOD_(int, snprintf) (char *str, size_t count, const char *fmt, ...) PURE;
  62.     STDMETHOD_(int, vsnprintf) (char *str, size_t count, const char *fmt, va_list args) PURE;
  63. };
  64.  
  65.  
  66. //------------------------------------------------------------------------
  67. // Interfaces exported by the profiling module
  68.  
  69.  
  70. // {03D9F3F1-B0E3-11d2-B081-006008039BF0}
  71. DEFINE_GUID(IID_IJVIEWProfiler, 0x3d9f3f1, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
  72.  
  73. #undef INTERFACE
  74. #define INTERFACE IJVIEWProfiler
  75.  
  76. DECLARE_INTERFACE_(IJVIEWProfiler, IUnknown)
  77. {
  78. #ifndef NO_BASEINTERFACE_FUNCS
  79.     /* IUnknown methods */
  80.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
  81.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  82.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  83. #endif
  84.  
  85. #define JVIEWPRF_INIT_SUPPORTS_PARAMS   0x00000001
  86.  
  87.     // Called when the profiling module is loaded.
  88.     // If fails, JVIEW terminates with an error code.
  89.     STDMETHOD(JVIEWInitialize) (THIS_ IJVIEWProfilerUtils *putils, DWORD *pFlags) PURE;
  90.  
  91.     // Called to parse parameters after the "-prof" option.  If no parameters
  92.     // are specified, this proc will not be called.
  93.     // If fails, JVIEW terminates with an error code.
  94.     STDMETHOD(ParseParameters) (THIS_ PCSTR pcszParams) PURE;
  95.  
  96.     // Returns a string describing the profiler's parameters, allocated with
  97.     // CoTaskMemAlloc.
  98.     STDMETHOD_(PSTR, GetUsageString) (THIS) PURE;
  99.  
  100.     // Called before JVIEW terminates.  If the process is terminated abnormally
  101.     // (ex. via ExitProcess or java/lang/System.exit), this function will not
  102.     // be called.
  103.     STDMETHOD_(VOID, Shutdown) (THIS) PURE;
  104. };
  105.  
  106.  
  107. #endif // !DEFINES_ONLY
  108.  
  109.  
  110. //------------------------------------------------------------------------
  111. // Profiler module search order:
  112.  
  113. // 1. CLSID specified in environment
  114. #define JVIEWPRF_ENV_VAR_CLSID_STR          TEXT("JVIEW_PROFILER_CLSID")
  115.  
  116. // 2. file specified in environment
  117. #define JVIEWPRF_ENV_VAR_LIB_STR            TEXT("JVIEW_PROFILER")
  118.  
  119. // 3. default CLSID {03D9F3F2-B0E3-11d2-B081-006008039BF0}
  120. #ifndef DEFINES_ONLY
  121. DEFINE_GUID(CLSID_DefaultJVIEWProfiler, 0x3d9f3f2, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
  122. #endif
  123.  
  124. // 4. on path
  125. #define JVIEWPRF_DEFAULT_LIB_FILENAME_STR   TEXT("JVIEWPRF.DLL")
  126.  
  127.  
  128. //------------------------------------------------------------------------
  129. // Profiler creation
  130. //
  131. // If JVIEW loads the module directly (via LoadLibrary - not
  132. // CoCreateInstance), it will first try to use this export to create the
  133. // profiler.
  134. //
  135. // If this export does not exist, DllGetClassObject will be called directly
  136. // for CLSID_DefaultJVIEWProfiler.
  137. //
  138. // Either way, JVIEW will register the returned object as a profiler.  (Use of
  139. // this export eliminates the need for any COM registration stuff.)
  140.  
  141. #define JVIEWPRF_CreateProfilerProcName     JVIEWPRF_CreateProfiler
  142. #define JVIEWPRF_CreateProfilerProcNameStr "JVIEWPRF_CreateProfiler"
  143. #ifndef DEFINES_ONLY
  144. typedef IJVIEWProfiler * __stdcall JVIEWPRF_CreateProfilerProc ();
  145. #endif
  146.  
  147.  
  148. #endif /* __JVIEWPRF_H__ */
  149.  
  150.