source: trunk/include/qt_os2.h@ 139

Last change on this file since 139 was 139, checked in by dmik, 19 years ago

Kernel/Tools: Improved OS/2 exception handling:

  • Moved the excpetion handler code from the kernel module to the tools module (defines are now in qt_os2.h instead of qwindowdefs_pm.h);
  • QT_PM_NO_SYSEXCEPTIONS is renamed to QT_OS2_NO_SYSEXCEPTIONS;
  • Added the QtOS2SysXcptMainHandler stack-based class to correctly install the exception handler on the main thread, as well as provide an optional callback.
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1/****************************************************************************
2** $Id: qt_os2.h 139 2006-10-20 21:44:52Z dmik $
3**
4** Includes OS/2 system header files.
5**
6** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
7** Copyright (C) 2004 Norman ASA. Initial OS/2 Port.
8** Copyright (C) 2005 netlabs.org. Further OS/2 Development.
9**
10** This file is part of the kernel module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QT_OS2_H
39#define QT_OS2_H
40
41#include "qwindowdefs.h"
42
43#define INCL_BASE
44#define INCL_PM
45#include <os2.h>
46
47// OS/2 system exception handler callback interface
48
49#if !defined(QT_OS2_NO_SYSEXCEPTIONS)
50
51enum QtOS2SysXcptReq
52{
53 QtOS2SysXcptReq_AppName = 0,
54 QtOS2SysXcptReq_AppVer = 1,
55 QtOS2SysXcptReq_ReportTo = 2,
56 QtOS2SysXcptReq_ReportSubj = 3,
57};
58
59typedef void (*QtOS2SysXcptWriter)( const char *str );
60typedef int (*QtOS2SysXcptCallback)( QtOS2SysXcptReq req,
61 QtOS2SysXcptWriter writer,
62 int reserved );
63
64class Q_EXPORT QtOS2SysXcptMainHandler
65{
66public:
67 QtOS2SysXcptMainHandler( QtOS2SysXcptCallback cb = NULL );
68 ~QtOS2SysXcptMainHandler();
69
70 class Private;
71
72private:
73 EXCEPTIONREGISTRATIONRECORD rec;
74
75 static bool installed;
76 static QtOS2SysXcptCallback callback;
77 static ERR libcHandler;
78
79 static ULONG APIENTRY handler( PEXCEPTIONREPORTRECORD pReportRec,
80 PEXCEPTIONREGISTRATIONRECORD pRegRec,
81 PCONTEXTRECORD pContextRec,
82 PVOID pv );
83
84 friend class QtOS2SysXcptMainHandlerInternal;
85 friend class QThreadInstance;
86
87 // these are private to allow only stack-based instances
88 QtOS2SysXcptMainHandler( QtOS2SysXcptMainHandler &/*that*/ ) {}
89 QtOS2SysXcptMainHandler &operator =( QtOS2SysXcptMainHandler &/*that*/) {
90 return *this;
91 }
92 static void *operator new( size_t /*size*/ ) throw() { return NULL; }
93 static void operator delete( void */*memory*/ ) {}
94};
95
96#endif // !defined(QT_OS2_NO_SYSEXCEPTIONS)
97
98#endif // QT_OS2_H
Note: See TracBrowser for help on using the repository browser.