1 /****************************************************************************
3 ** This file is based on sources of the Qt GUI Toolkit, used under the terms
4 ** of the GNU General Public License version 2 (see the original copyright
6 ** All further contributions to this file are (and are required to be)
7 ** licensed under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
11 ** The original Qt license header follows:
14 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
16 ** This file is part of the kernel module of the Qt GUI Toolkit.
18 ** This file may be distributed under the terms of the Q Public License
19 ** as defined by Trolltech AS of Norway and appearing in the file
20 ** LICENSE.QPL included in the packaging of this file.
22 ** This file may be distributed and/or modified under the terms of the
23 ** GNU General Public License version 2 as published by the Free Software
24 ** Foundation and appearing in the file LICENSE.GPL included in the
25 ** packaging of this file.
27 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
28 ** licenses may use this file in accordance with the Qt Commercial License
29 ** Agreement provided with the Software.
31 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
32 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
34 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
35 ** information about Qt Commercial License Agreements.
36 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
37 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
39 ** Contact info@trolltech.com if any conditions of this licensing are
42 **********************************************************************/
52 #define QT_NO_DATASTREAM
53 #define QT_NO_IMAGE_TEXT
54 #define QT_NO_IMAGE_TRANSFORMATION
55 #define QT_NO_IMAGE_MIRROR
56 #define QT_NO_COMPONENT
59 #define QT_NO_QIMAGEIO
60 #define QT_NO_STRINGLIST
61 #define QT_NO_XFTFREETYPE
65 #ifndef QT_NO_ASCII_CAST
66 #define QT_NO_ASCII_CAST
68 #ifndef QT_NO_CAST_ASCII
69 #define QT_NO_CAST_ASCII
72 #define QT_NO_IMAGEIO_BMP
73 #define QT_NO_IMAGEIO_PPM
74 #define QT_NO_IMAGEIO_XBM
75 #define QT_NO_IMAGEIO_XPM
76 #define QT_NO_IMAGEIO_MNG
77 #define QT_NO_IMAGEIO_JPEG
78 #define QT_NO_ASYNC_IMAGE_IO
80 #define QT_STATIC_CONST static const
81 #define QT_STATIC_CONST_IMPL const
83 typedef int QCOORD
; // coordinate type
84 const QCOORD QCOORD_MAX
= 2147483647;
85 const QCOORD QCOORD_MIN
= -QCOORD_MAX
- 1;
87 typedef unsigned int QRgb
; // RGB triplet
89 #define qMax(a, b) ((b) < (a) ? (a) : (b))
90 #define qMin(a, b) ((a) < (b) ? (a) : (b))
91 #define qAbs(a) ((a) >= 0 ? (a) : -(a))
93 #define Q_UNUSED(x) (void)x;
95 #define Q_CHECK_PTR(p)
99 typedef unsigned char uchar
;
100 typedef unsigned uint
;
102 typedef signed char Q_INT8
; // 8 bit signed
103 typedef unsigned char Q_UINT8
; // 8 bit unsigned
104 typedef short Q_INT16
; // 16 bit signed
105 typedef unsigned short Q_UINT16
; // 16 bit unsigned
106 typedef int Q_INT32
; // 32 bit signed
107 typedef unsigned int quint32
; // 32 bit unsigned
108 #if defined(Q_OS_WIN64)
109 typedef __int64 Q_LONG
; // word up to 64 bit signed
110 typedef unsigned __int64 Q_ULONG
; // word up to 64 bit unsigned
112 typedef long Q_LONG
; // word up to 64 bit signed
113 typedef unsigned long Q_ULONG
; // word up to 64 bit unsigned
118 const QRgb RGB_MASK
= 0x00ffffff; // masks RGB values
120 Q_EXPORT
inline int qRed( QRgb rgb
) // get red part of RGB
121 { return (int)((rgb
>> 16) & 0xff); }
123 Q_EXPORT
inline int qGreen( QRgb rgb
) // get green part of RGB
124 { return (int)((rgb
>> 8) & 0xff); }
126 Q_EXPORT
inline int qBlue( QRgb rgb
) // get blue part of RGB
127 { return (int)(rgb
& 0xff); }
129 Q_EXPORT
inline int qAlpha( QRgb rgb
) // get alpha part of RGBA
130 { return (int)((rgb
>> 24) & 0xff); }
132 Q_EXPORT
inline QRgb
qRgb( int r
, int g
, int b
)// set RGB value
133 { return (0xff << 24) | ((r
& 0xff) << 16) | ((g
& 0xff) << 8) | (b
& 0xff); }
135 Q_EXPORT
inline QRgb
qRgba( int r
, int g
, int b
, int a
)// set RGBA value
136 { return ((a
& 0xff) << 24) | ((r
& 0xff) << 16) | ((g
& 0xff) << 8) | (b
& 0xff); }
138 Q_EXPORT
inline int qGray( int r
, int g
, int b
)// convert R,G,B to gray 0..255
139 { return (r
*11+g
*16+b
*5)/32; }
141 Q_EXPORT
inline int qGray( QRgb rgb
) // convert RGB to gray 0..255
142 { return qGray( qRed(rgb
), qGreen(rgb
), qBlue(rgb
) ); }
146 Q_EXPORT
void qWarning( const char *, ... ) // print warning message
147 #if defined(Q_CC_GNU) && !defined(__INSURE__)
148 __attribute__ ((format (printf
, 1, 2)))
153 Q_EXPORT
void qFatal( const char *, ... ) // print fatal message and exit
154 #if defined(Q_CC_GNU)
155 __attribute__ ((format (printf
, 1, 2)))
163 bool freadline( char* buf
, int bufsize
, FILE* datafile
);
164 void strip_whitespace( char* line
);
165 bool begins_with( const char* line
, const char* str
);
168 int round( double num
)
170 return num
>= 0 ? int( num
+ 0.5 ) : int( num
- 0.5 );