~ubuntu-branches/ubuntu/oneiric/bombono-dvd/oneiric

« back to all changes in this revision

Viewing changes to .pc/05-fix_boost.patch/src/mlib/tech.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-01-03 10:25:30 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110103102530-mos2l5do984anaw8
Tags: 1.0.0-0ubuntu1
* New upstream release (LP: #695754).
* Build-depends on libavformat-dev,libswscale-dev.
* Recommends on ttf-freefont.
* Don't install FreeSans.ttf, already available in ttf-freefont.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//
2
 
// mlib/tech.h
3
 
// This file is part of Bombono DVD project.
4
 
//
5
 
// Copyright (c) 2007-2010 Ilya Murav'jov
6
 
//
7
 
// This program is free software; you can redistribute it and/or modify
8
 
// it under the terms of the GNU General Public License as published by
9
 
// the Free Software Foundation; either version 2 of the License, or
10
 
// (at your option) any later version.
11
 
//
12
 
// This program is distributed in the hope that it will be useful,
13
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
// GNU General Public License for more details.
16
 
//
17
 
// You should have received a copy of the GNU General Public License
18
 
// along with this program; if not, write to the Free Software
19
 
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
// 
21
 
 
22
 
#ifndef __MLIB_TECH_H__
23
 
#define __MLIB_TECH_H__
24
 
 
25
 
//
26
 
//  Технические вещи
27
 
// 
28
 
#include <boost/current_function.hpp>  // для BOOST_CURRENT_FUNCTION
29
 
#include <boost/detail/endian.hpp>     // для BOOST_XXX_ENDIAN
30
 
 
31
 
// для С-шного кода в С++
32
 
#if defined(__cplusplus) || defined(c_plusplus)
33
 
#define C_LINKAGE extern "C"
34
 
#define C_LINKAGE_BEGIN extern "C" {
35
 
#define C_LINKAGE_END }
36
 
#else
37
 
#define C_LINKAGE
38
 
#define C_LINKAGE_BEGIN
39
 
#define C_LINKAGE_END
40
 
#endif
41
 
 
42
 
// посчитать размер C-массива (T arr[] = {...}; )
43
 
#define ARR_SIZE(arr) ( sizeof(arr)/sizeof(arr[0]) ) 
44
 
 
45
 
// используем конструкцию наподобие
46
 
//     #include PACKON
47
 
//     struct packed_data { ... };
48
 
//     #include PACKOFF
49
 
// , чтобы у аттрибутов packed_data не было выравнивания;
50
 
// другой вариант - __attribute__ ((packed)), но он есть только у gcc
51
 
#undef HAS_PACK_STACK
52
 
#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__COMO__) || defined(_MSC_VER)
53
 
#   define HAS_PACK_STACK
54
 
#endif
55
 
 
56
 
#define PACK_ON  <mlib/pack_on.h>
57
 
#define PACK_OFF <mlib/pack_off.h>
58
 
 
59
 
// ASSERT(), ASSERT_RTL()
60
 
#define ASSERT_IMPL(expr)  ((expr) ? ((void)0) : AssertImpl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
61
 
 
62
 
 
63
 
#ifdef NDEBUG
64
 
#define ASSERT(expr)       ((void)0)
65
 
#else
66
 
#define ASSERT(expr)       ASSERT_IMPL(expr)
67
 
#endif // NDEBUG
68
 
 
69
 
#define ASSERT_RTL(expr)   ASSERT_IMPL(expr)
70
 
 
71
 
// ErrorMsg(), Error()
72
 
void ErrorMsg(const char* str);
73
 
void Error(const char* str);
74
 
 
75
 
 
76
 
void AssertImpl(const char* assertion, const char* file, 
77
 
                long line, const char* function);
78
 
 
79
 
// endianness
80
 
#if defined(BOOST_BIG_ENDIAN)
81
 
#   define HAS_BIG_ENDIAN
82
 
#elif defined(BOOST_LITTLE_ENDIAN)
83
 
#   define HAS_LITTLE_ENDIAN
84
 
#else
85
 
#   error mlib/tech.h: unknown endianness (legacy PDP arch?)
86
 
#endif
87
 
 
88
 
// gcc 4.4 вываливает кучу предупреждений о strict-alias rules
89
 
// (только при >= -O2), но чувствую, что неправильно
90
 
 
91
 
#if defined(NDEBUG) && defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
92
 
#define __GNUC_INCORRECT_SAR__
93
 
#endif
94
 
 
95
 
// помечаем так переменные, чтобы убрать warning: unused variable;
96
 
// которые тем не менее используются, но не всегда, см. ASSERT()
97
 
#define UNUSED_VAR(x) ((void)(x))
98
 
#ifdef NDEBUG
99
 
#define ASSERT_OR_UNUSED(expr)        UNUSED_VAR(expr)
100
 
#define ASSERT_OR_UNUSED_VAR(expr, x) UNUSED_VAR(x)
101
 
#else
102
 
#define ASSERT_OR_UNUSED(expr)        ASSERT(expr)
103
 
#define ASSERT_OR_UNUSED_VAR(expr, x) ASSERT(expr)
104
 
#endif // NDEBUG
105
 
 
106
 
// тоже самое, но для функций (только gcc)
107
 
#ifdef __GNUC__
108
 
#define UNUSED_FUNCTION __attribute__((unused))
109
 
#else
110
 
#define UNUSED_FUNCTION
111
 
#endif
112
 
 
113
 
#endif // #ifndef __MLIB_TECH_H__
114
 
 
115