home *** CD-ROM | disk | FTP | other *** search
- // jviewprf.h
- //
- // (C) Copyright 1995 - 1999 Microsoft Corporation. All rights reserved.
- //
-
- #ifndef __JVIEWPRF_H__
- #define __JVIEWPRF_H__
-
-
- //------------------------------------------------------------------------
- //
- // Profiler hook interface for JVIEW. When a JVIEW profiler is present, a
- // "-prof" option is available that causes JVIEW to load the profiler and
- // register it with the VM.
- //
- //------------------------------------------------------------------------
-
-
- #ifndef DEFINES_ONLY
-
-
- //------------------------------------------------------------------------
- // Interfaces provided by JVIEW via IJVIEWProfiler::JVIEWInitialize
-
-
- typedef enum
- {
- JDC_INFORMATION = 1,
- JDC_WARNING = 2,
- JDC_ERROR = 3,
- }
- JVIEWDisplayClass;
-
-
- // {03D9F3F0-B0E3-11d2-B081-006008039BF0}
- DEFINE_GUID(IID_IJVIEWProfilerUtils, 0x3d9f3f0, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
-
- #undef INTERFACE
- #define INTERFACE IJVIEWProfilerUtils
-
- DECLARE_INTERFACE_(IJVIEWProfilerUtils, IUnknown)
- {
- #ifndef NO_BASEINTERFACE_FUNCS
- /* IUnknown methods */
- STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
- #endif
-
- // These methods should be used for printing informational messages for
- // the user. Under JVIEW, this is written to the console. Under WJVIEW,
- // this appears in a message box.
- STDMETHOD(DisplayString) (THIS_ JVIEWDisplayClass cls, PCSTR pcsz) PURE;
- STDMETHOD(DisplayResourceString) (THIS_ JVIEWDisplayClass cls, HINSTANCE hinst, UINT id) PURE;
-
- // Locates a suitable resource string, using the same language-finding
- // semantics as JVIEW.
- STDMETHOD_(int, LoadResourceString) (THIS_ HINSTANCE hinst, UINT id, PSTR buf, int bufsize) PURE;
-
- // Bounded versions of sprintf and vsprintf.
- STDMETHOD_(int, snprintf) (char *str, size_t count, const char *fmt, ...) PURE;
- STDMETHOD_(int, vsnprintf) (char *str, size_t count, const char *fmt, va_list args) PURE;
- };
-
-
- //------------------------------------------------------------------------
- // Interfaces exported by the profiling module
-
-
- // {03D9F3F1-B0E3-11d2-B081-006008039BF0}
- DEFINE_GUID(IID_IJVIEWProfiler, 0x3d9f3f1, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
-
- #undef INTERFACE
- #define INTERFACE IJVIEWProfiler
-
- DECLARE_INTERFACE_(IJVIEWProfiler, IUnknown)
- {
- #ifndef NO_BASEINTERFACE_FUNCS
- /* IUnknown methods */
- STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
- #endif
-
- // Called when the profiling module is loaded.
- // If fails, JVIEW terminates with an error code.
- STDMETHOD(JVIEWInitialize) (THIS_ IJVIEWProfilerUtils *putils) PURE;
-
- // Called to parse parameters after the "-prof" option. If no parameters
- // are specified, this proc will not be called.
- // If fails, JVIEW terminates with an error code.
- STDMETHOD(ParseParameters) (THIS_ PCSTR pcszParams) PURE;
-
- // Called before JVIEW terminates. If the process is terminated abnormally
- // (ex. via ExitProcess or java/lang/System.exit), this function will not
- // be called.
- STDMETHOD_(VOID, Shutdown) (THIS) PURE;
- };
-
-
- #endif // !DEFINES_ONLY
-
-
- //------------------------------------------------------------------------
- // Profiler module search order:
-
- // 1. CLSID specified in environment
- #define JVIEWPRF_ENV_VAR_CLSID_STR TEXT("JVIEW_PROFILER_CLSID")
-
- // 2. file specified in environment
- #define JVIEWPRF_ENV_VAR_LIB_STR TEXT("JVIEW_PROFILER")
-
- // 3. on path
- #define JVIEWPRF_DEFAULT_LIB_FILENAME_STR TEXT("JVIEWPRF.DLL")
-
- // 4. default CLSID {03D9F3F2-B0E3-11d2-B081-006008039BF0}
- #ifndef DEFINES_ONLY
- DEFINE_GUID(CLSID_DefaultJVIEWProfiler, 0x3d9f3f2, 0xb0e3, 0x11d2, 0xb0, 0x81, 0x0, 0x60, 0x8, 0x3, 0x9b, 0xf0);
- #endif
-
-
- //------------------------------------------------------------------------
- // Profiler creation
- //
- // If JVIEW loads the module directly (via LoadLibrary - not
- // CoCreateInstance), it will first try to use this export to create the
- // profiler.
- //
- // If this export does not exist, DllGetClassObject will be called directly
- // for CLSID_DefaultJVIEWProfiler.
- //
- // Either way, JVIEW will register the returned object as a profiler. (Use of
- // this export eliminates the need for any COM registration stuff.)
-
- #define JVIEWPRF_CreateProfilerProcName JVIEWPRF_CreateProfiler
- #define JVIEWPRF_CreateProfilerProcNameStr "JVIEWPRF_CreateProfiler"
- #ifndef DEFINES_ONLY
- typedef IJVIEWProfiler * __stdcall JVIEWPRF_CreateProfilerProc ();
- #endif
-
-
- #endif /* __JVIEWPRF_H__ */
-
-