File: waffle_error.3.xml

package info (click to toggle)
waffle 1.6.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,092 kB
  • sloc: ansic: 19,173; xml: 2,906; cpp: 489; objc: 465; sh: 100; makefile: 20
file content (309 lines) | stat: -rw-r--r-- 11,100 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "file:///usr/share/xml/docbook/schema/dtd/4.2/docbookx.dtd">

<!--
  Copyright Intel 2012

  This manual page is licensed under the Creative Commons Attribution-ShareAlike 3.0 United States License (CC BY-SA 3.0
  US). To view a copy of this license, visit http://creativecommons.org.license/by-sa/3.0/us.
-->

<refentry
    id="waffle_error"
    xmlns:xi="http://www.w3.org/2001/XInclude">

  <!-- See http://www.docbook.org/tdg/en/html/refentry.html. -->

  <refmeta>
    <refentrytitle>waffle_init</refentrytitle>
    <manvolnum>3</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>waffle_error</refname>
    <refname>waffle_error_get_info</refname>
    <refname>waffle_error_get_code</refname>
    <refname>waffle_error_to_string</refname>
    <refpurpose>Thread-local error state</refpurpose>
  </refnamediv>

  <refentryinfo>
    <title>Waffle Manual</title>
    <productname>waffle</productname>
    <xi:include href="common/author-chad.versace.xml"/>
    <xi:include href="common/copyright.xml"/>
    <xi:include href="common/legalnotice.xml"/>
  </refentryinfo>

  <refsynopsisdiv>

    <funcsynopsis language="C">

      <funcsynopsisinfo>
#include &lt;waffle.h&gt;

enum waffle_error {...};

struct waffle_error_info {
    enum waffle_error code;
    const char *message;
    size_t message_length;
};
      </funcsynopsisinfo>

      <funcprototype>
        <funcdef>const struct waffle_error_info* <function>waffle_error_get_info</function></funcdef>
        <void/>
      </funcprototype>

      <funcprototype>
        <funcdef>enum waffle_error <function>waffle_error_get_code</function></funcdef>
        <void/>
      </funcprototype>

      <funcprototype>
        <funcdef>const char* <function>waffle_error_to_string</function></funcdef>
        <paramdef>enum waffle_error<parameter>e</parameter></paramdef>
      </funcprototype>

    </funcsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para>
      Waffle functions usually return either a <type>bool</type>, in which false indicates failure, or a pointer, in
      which null indicates failure. In addition to returning a flag indicating failure, most functions also clear and
      then set some thread-local error state.
    </para>
    <para>
      The only functions that do not alter waffle's error state are listed here and are explicitly documented as such.
      All functions listed here can be called before waffle has been successfully initialized with
      <citerefentry><refentrytitle><function>waffle_init</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>
    </para>

    <variablelist>

      <varlistentry>
        <term><type>struct waffle_error_info</type></term>
        <listitem>
          <para>
            This struct contains the user-visible portion of waffle's thread-local error state.
          </para>
          <para>
            <structfield>code</structfield> may be any token from <type>enum waffle_error</type>.
          </para>
          <para>
            <structfield>message</structfield> often contains a descriptive message about the error.
            It is never null, though it may be the empty string.
          </para>
          <para>
            <structfield>message_length</structfield> is the length of <structfield>message</structfield> according to
            <citerefentry><refentrytitle><function>strlen</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><function>waffle_error_to_string()</function></term>
        <listitem>
          <para>
            Convert a <type>waffle_error</type> token to a string.
            For example, convert <constant>WAFFLE_ERROR_UNKNOWN</constant> to <code>"WAFFLE_ERROR_UNKNOWN"</code>.
            Return null if the token is not a valid error token.
          </para>
          <para>
            This function always sets the error code to <constant>WAFFLE_ERROR_NONE</constant>.
          </para>
        </listitem>
      </varlistentry>


      <varlistentry>
        <term><function>waffle_error_get_info()</function></term>
        <listitem>
          <para>
            Get information about the current thread's error state.
          </para>
          <para>
            This function never returns null. The returned pointer becomes invalid when the thread-local error state
            changes.
          </para>
          <para>
            This function does not alter waffle's error state.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><function>waffle_error_get_code()</function></term>
        <listitem>
          <para>
            Get the current thread's error code. Calling this function is equivalent to obtaining the error code with
            <code>waffle_error_get_info()->code</code>.
          </para>
          <para>
            This function does not alter waffle's error state.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><type>enum waffle_error</type></term>
        <listitem>
          <para>
            For reference, below is the complete list of waffle's error codes.

            <variablelist>

              <varlistentry>
                <term><constant>WAFFLE_NO_ERROR</constant> = 0x00</term>
                <listitem>
                  <para>
                    The function succeeded.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_FATAL</constant> = 0x01</term>
                <listitem>
                  <para>
                    Waffle encountered a fatal error.  All future waffle calls result in
                    undefined behavior.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_UNKNOWN</constant> = 0x02</term>
                <listitem>
                  <para>
                    Waffle encountered an error for which it lacks an error code.  This is
                    usually produced when an underlying native call, such as
                    <citerefentry><refentrytitle><function>XOpenDisplay</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>,
                    fails for an unknown reason.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_INTERNAL</constant> = 0x03</term>
                <listitem>
                  <para>
                    You found a bug in waffle.  Please report it.  The error message, obtained by
                    <function>waffle_error_get_info()</function>, should contain a description of the bug.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_BAD_ALLOC</constant> = 0x04</term>
                <listitem>
                  <para>
                    Waffle failed to allocate memory.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_NOT_INITIALIZED</constant> = 0x05</term>
                <listitem>
                  <para>
                    The failed function requires waffle to be initialized with
                    <citerefentry><refentrytitle><function>waffle_init</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_ALREADY_INITIALIZED</constant> = 0x06</term>
                <listitem>
                  <para>
                    If waffle has already been initialized by a successful call to
                    <citerefentry><refentrytitle><function>waffle_init</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>,
                    then subsequent calls to <function>waffle_init()</function> produce this error.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_BAD_ATTRIBUTE</constant> = 0x08</term>
                <listitem>
                  <para>
                    An unrecognized attribute name or attribute value was passed in an
                    attribute list.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_BAD_PARAMETER</constant> = 0x10</term>
                <listitem>
                  <para>
                    The failed function was passed an invalid argument.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_BAD_DISPLAY_MATCH</constant> = 0x11</term>
                <listitem>
                  <para>
                    The waffle objects passed to the failed function belong to different
                    displays.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM</constant> = 0x12</term>
                <listitem>
                  <para>
                    The requested action is unsupported on the current system or platform, but is otherwise valid.
                  </para>
                  <para>
                    For example, attempting to choose a <type>waffle_config</type> whose API is OpenGL ES1 on a system
                    that doesn't OpenGL ES1 will produce this error.
                  </para>
                </listitem>
              </varlistentry>

              <varlistentry>
                <term><constant>WAFFLE_ERROR_BUILT_WITHOUT_SUPPORT</constant> = 0x13</term>
                <listitem>
                  <para>
                    Waffle was built without support for the requested action.
                  </para>
                  <para>
                    For example, if waffle was built without support for GBM, then calling <code>waffle_init()</code>
                    with attribute <code>WAFFLE_PLATFORM=WAFFLE_PLATFORM_GBM</code> will produce this error.
                </para>
                </listitem>
              </varlistentry>

            </variablelist>
          </para>
        </listitem>
      </varlistentry>

    </variablelist>

  </refsect1>

  <xi:include href="common/issues.xml"/>

  <refsect1>
    <title>See Also</title>
    <para>
      <citerefentry><refentrytitle>waffle</refentrytitle><manvolnum>7</manvolnum></citerefentry>
    </para>
  </refsect1>

</refentry>

<!--
vim:tw=120 et ts=2 sw=2:
-->