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_ASYNC_IMAGE_IO
79
#define QT_STATIC_CONST static const
80
#define QT_STATIC_CONST_IMPL const
82
typedef int QCOORD; // coordinate type
83
const QCOORD QCOORD_MAX = 2147483647;
84
const QCOORD QCOORD_MIN = -QCOORD_MAX - 1;
86
typedef unsigned int QRgb; // RGB triplet
88
#define qMax(a, b) ((b) < (a) ? (a) : (b))
89
#define qMin(a, b) ((a) < (b) ? (a) : (b))
90
#define qAbs(a) ((a) >= 0 ? (a) : -(a))
92
#define Q_UNUSED(x) (void)x;
94
#define Q_CHECK_PTR(p)
98
typedef unsigned char uchar;
99
typedef unsigned uint;
101
typedef signed char Q_INT8; // 8 bit signed
102
typedef unsigned char Q_UINT8; // 8 bit unsigned
103
typedef short Q_INT16; // 16 bit signed
104
typedef unsigned short Q_UINT16; // 16 bit unsigned
105
typedef int Q_INT32; // 32 bit signed
106
typedef unsigned int quint32; // 32 bit unsigned
107
#if defined(Q_OS_WIN64)
108
typedef __int64 Q_LONG; // word up to 64 bit signed
109
typedef unsigned __int64 Q_ULONG; // word up to 64 bit unsigned
111
typedef long Q_LONG; // word up to 64 bit signed
112
typedef unsigned long Q_ULONG; // word up to 64 bit unsigned
117
const QRgb RGB_MASK = 0x00ffffff; // masks RGB values
119
Q_EXPORT inline int qRed( QRgb rgb ) // get red part of RGB
120
{ return (int)((rgb >> 16) & 0xff); }
122
Q_EXPORT inline int qGreen( QRgb rgb ) // get green part of RGB
123
{ return (int)((rgb >> 8) & 0xff); }
125
Q_EXPORT inline int qBlue( QRgb rgb ) // get blue part of RGB
126
{ return (int)(rgb & 0xff); }
128
Q_EXPORT inline int qAlpha( QRgb rgb ) // get alpha part of RGBA
129
{ return (int)((rgb >> 24) & 0xff); }
131
Q_EXPORT inline QRgb qRgb( int r, int g, int b )// set RGB value
132
{ return (0xff << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
134
Q_EXPORT inline QRgb qRgba( int r, int g, int b, int a )// set RGBA value
135
{ return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
137
Q_EXPORT inline int qGray( int r, int g, int b )// convert R,G,B to gray 0..255
138
{ return (r*11+g*16+b*5)/32; }
140
Q_EXPORT inline int qGray( QRgb rgb ) // convert RGB to gray 0..255
141
{ return qGray( qRed(rgb), qGreen(rgb), qBlue(rgb) ); }
145
Q_EXPORT void qWarning( const char *, ... ) // print warning message
146
#if defined(Q_CC_GNU) && !defined(__INSURE__)
147
__attribute__ ((format (printf, 1, 2)))
152
Q_EXPORT void qFatal( const char *, ... ) // print fatal message and exit
153
#if defined(Q_CC_GNU)
154
__attribute__ ((format (printf, 1, 2)))
162
bool freadline( char* buf, int bufsize, FILE* datafile );
163
void strip_whitespace( char* line );
164
bool begins_with( const char* line, const char* str );