home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / Native / JView / jviewprf.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-04  |  4.7 KB  |  144 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::JVIEWInitialize
  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.     // Called when the profiling module is loaded.
  86.     // If fails, JVIEW terminates with an error code.
  87.     STDMETHOD(JVIEWInitialize) (THIS_ IJVIEWProfilerUtils *putils) PURE;
  88.  
  89.     // Called to parse parameters after the "-prof" option.  If no parameters
  90.     // are specified, this proc will not be called.
  91.     // If fails, JVIEW terminates with an error code.
  92.     STDMETHOD(ParseParameters) (THIS_ PCSTR pcszParams) PURE;
  93.  
  94.     // Called before JVIEW terminates.  If the process is terminated abnormally
  95.     // (ex. via ExitProcess or java/lang/System.exit), this function will not
  96.     // be called.
  97.     STDMETHOD_(VOID, Shutdown) (THIS) PURE;
  98. };
  99.  
  100.  
  101. #endif // !DEFINES_ONLY
  102.  
  103.  
  104. //------------------------------------------------------------------------
  105. // Profiler module search order:
  106.  
  107. // 1. CLSID specified in environment
  108. #define JVIEWPRF_ENV_VAR_CLSID_STR          TEXT("JVIEW_PROFILER_CLSID")
  109.  
  110. // 2. file specified in environment
  111. #define JVIEWPRF_ENV_VAR_LIB_STR            TEXT("JVIEW_PROFILER")
  112.  
  113. // 3. on path
  114. #define JVIEWPRF_DEFAULT_LIB_FILENAME_STR   TEXT("JVIEWPRF.DLL")
  115.  
  116. // 4. default CLSID {03D9F3F2-B0E3-11d2-B081-006008039BF0}
  117. #ifndef DEFINES_ONLY
  118. DEFINE_GUID(CLSID_DefaultJVIEWProfiler, 0x3d9f3f2, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
  119. #endif
  120.  
  121.  
  122. //------------------------------------------------------------------------
  123. // Profiler creation
  124. //
  125. // If JVIEW loads the module directly (via LoadLibrary - not
  126. // CoCreateInstance), it will first try to use this export to create the
  127. // profiler.
  128. //
  129. // If this export does not exist, DllGetClassObject will be called directly
  130. // for CLSID_DefaultJVIEWProfiler.
  131. //
  132. // Either way, JVIEW will register the returned object as a profiler.  (Use of
  133. // this export eliminates the need for any COM registration stuff.)
  134.  
  135. #define JVIEWPRF_CreateProfilerProcName     JVIEWPRF_CreateProfiler
  136. #define JVIEWPRF_CreateProfilerProcNameStr "JVIEWPRF_CreateProfiler"
  137. #ifndef DEFINES_ONLY
  138. typedef IJVIEWProfiler * __stdcall JVIEWPRF_CreateProfilerProc ();
  139. #endif
  140.  
  141.  
  142. #endif /* __JVIEWPRF_H__ */
  143.  
  144.