home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / system / debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.9 KB  |  97 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    System library component
  3. //    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. //
  5. //    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. //    differently than the remainder of VirtualDub.  This particular file is
  7. //    thus licensed as follows (the "zlib" license):
  8. //
  9. //    This software is provided 'as-is', without any express or implied
  10. //    warranty.  In no event will the authors be held liable for any
  11. //    damages arising from the use of this software.
  12. //
  13. //    Permission is granted to anyone to use this software for any purpose,
  14. //    including commercial applications, and to alter it and redistribute it
  15. //    freely, subject to the following restrictions:
  16. //
  17. //    1.    The origin of this software must not be misrepresented; you must
  18. //        not claim that you wrote the original software. If you use this
  19. //        software in a product, an acknowledgment in the product
  20. //        documentation would be appreciated but is not required.
  21. //    2.    Altered source versions must be plainly marked as such, and must
  22. //        not be misrepresented as being the original software.
  23. //    3.    This notice may not be removed or altered from any source
  24. //        distribution.
  25.  
  26. #ifndef f_VD2_SYSTEM_DEBUG_H
  27. #define f_VD2_SYSTEM_DEBUG_H
  28.  
  29. #include <vd2/system/vdtypes.h>
  30.  
  31. class IVDExternalCallTrap {
  32. public:
  33.     virtual void OnMMXTrap(const wchar_t *context, const char *file, int line) = 0;
  34.     virtual void OnFPUTrap(const wchar_t *context, const char *file, int line, uint16 fpucw) = 0;
  35.     virtual void OnSSETrap(const wchar_t *context, const char *file, int line, uint32 mxcsr) = 0;
  36. };
  37.  
  38. void VDSetExternalCallTrap(IVDExternalCallTrap *);
  39.  
  40. bool IsMMXState();
  41. void ClearMMXState();
  42. void VDClearEvilCPUStates();
  43. void VDPreCheckExternalCodeCall(const char *file, int line);
  44. void VDPostCheckExternalCodeCall(const wchar_t *mpContext, const char *mpFile, int mLine);
  45.  
  46. struct VDSilentExternalCodeBracket {
  47.     VDSilentExternalCodeBracket() {
  48.         VDClearEvilCPUStates();
  49.     }
  50.  
  51.     ~VDSilentExternalCodeBracket() {
  52.         VDClearEvilCPUStates();
  53.     }
  54. };
  55.  
  56. struct VDExternalCodeBracketLocation {
  57.     VDExternalCodeBracketLocation(const wchar_t *pContext, const char *file, const int line)
  58.         : mpContext(pContext)
  59.         , mpFile(file)
  60.         , mLine(line)
  61.     {
  62.     }
  63.  
  64.     const wchar_t *mpContext;
  65.     const char *mpFile;
  66.     const int mLine;    
  67. };
  68.  
  69. struct VDExternalCodeBracket {
  70.     VDExternalCodeBracket(const wchar_t *pContext, const char *file, const int line)
  71.         : mpContext(pContext)
  72.         , mpFile(file)
  73.         , mLine(line)
  74.     {
  75.         VDPreCheckExternalCodeCall(file, line);
  76.     }
  77.  
  78.     VDExternalCodeBracket(const VDExternalCodeBracketLocation& loc)
  79.         : mpContext(loc.mpContext)
  80.         , mpFile(loc.mpFile)
  81.         , mLine(loc.mLine)
  82.     {
  83.     }
  84.  
  85.     ~VDExternalCodeBracket() {
  86.         VDPostCheckExternalCodeCall(mpContext, mpFile, mLine);
  87.     }
  88.  
  89.     operator bool() const { return false; }
  90.  
  91.     const wchar_t *mpContext;
  92.     const char *mpFile;
  93.     const int mLine;
  94. };
  95.  
  96. #endif
  97.