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
|
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-Error-handling">
<refmeta>
<refentrytitle role="top_of_page">Error handling</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Error handling</refname>
<refpurpose>Decoding cairo's status</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
enum <link linkend="cairo-status-t">cairo_status_t</link>;
const <link linkend="char">char</link>* <link linkend="cairo-status-to-string">cairo_status_to_string</link> (<link linkend="cairo-status-t">cairo_status_t</link> status);
<link linkend="void">void</link> <link linkend="cairo-debug-reset-static-data">cairo_debug_reset_static_data</link> (void);
</synopsis>
</refsynopsisdiv>
<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>
<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="cairo-status-t" role="enum"/>enum cairo_status_t</title>
<indexterm><primary>cairo_status_t</primary></indexterm><programlisting>typedef enum _cairo_status {
CAIRO_STATUS_SUCCESS = 0,
CAIRO_STATUS_NO_MEMORY,
CAIRO_STATUS_INVALID_RESTORE,
CAIRO_STATUS_INVALID_POP_GROUP,
CAIRO_STATUS_NO_CURRENT_POINT,
CAIRO_STATUS_INVALID_MATRIX,
CAIRO_STATUS_INVALID_STATUS,
CAIRO_STATUS_NULL_POINTER,
CAIRO_STATUS_INVALID_STRING,
CAIRO_STATUS_INVALID_PATH_DATA,
CAIRO_STATUS_READ_ERROR,
CAIRO_STATUS_WRITE_ERROR,
CAIRO_STATUS_SURFACE_FINISHED,
CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
CAIRO_STATUS_INVALID_CONTENT,
CAIRO_STATUS_INVALID_FORMAT,
CAIRO_STATUS_INVALID_VISUAL,
CAIRO_STATUS_FILE_NOT_FOUND,
CAIRO_STATUS_INVALID_DASH,
CAIRO_STATUS_INVALID_DSC_COMMENT
} cairo_status_t;
</programlisting>
<para>
<link linkend="cairo-status-t"><type>cairo_status_t</type></link> is used to indicate errors that can occur when
using Cairo. In some cases it is returned directly by functions.
but when using <link linkend="cairo-t"><type>cairo_t</type></link>, the last error, if any, is stored in
the context and can be retrieved with <link linkend="cairo-status"><function>cairo_status()</function></link>.
</para>
<para>
New entries may be added in future versions. Use <link linkend="cairo-status-to-string"><function>cairo_status_to_string()</function></link>
to get a human-readable representation of an error message.</para>
<para>
</para><variablelist role="enum">
<varlistentry>
<term><anchor id="CAIRO-STATUS-SUCCESS:CAPS" role="constant"/><literal>CAIRO_STATUS_SUCCESS</literal></term>
<listitem><simpara> no error has occurred
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-NO-MEMORY:CAPS" role="constant"/><literal>CAIRO_STATUS_NO_MEMORY</literal></term>
<listitem><simpara> out of memory
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-RESTORE:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_RESTORE</literal></term>
<listitem><simpara> cairo_restore without matching cairo_save
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-POP-GROUP:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_POP_GROUP</literal></term>
<listitem><simpara> no saved group to pop
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-NO-CURRENT-POINT:CAPS" role="constant"/><literal>CAIRO_STATUS_NO_CURRENT_POINT</literal></term>
<listitem><simpara> no current point defined
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-MATRIX:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_MATRIX</literal></term>
<listitem><simpara> invalid matrix (not invertible)
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-STATUS:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_STATUS</literal></term>
<listitem><simpara> invalid value for an input cairo_status_t
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-NULL-POINTER:CAPS" role="constant"/><literal>CAIRO_STATUS_NULL_POINTER</literal></term>
<listitem><simpara> NULL pointer
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-STRING:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_STRING</literal></term>
<listitem><simpara> input string not valid UTF-8
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-PATH-DATA:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_PATH_DATA</literal></term>
<listitem><simpara> input path data not valid
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-READ-ERROR:CAPS" role="constant"/><literal>CAIRO_STATUS_READ_ERROR</literal></term>
<listitem><simpara> error while reading from input stream
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-WRITE-ERROR:CAPS" role="constant"/><literal>CAIRO_STATUS_WRITE_ERROR</literal></term>
<listitem><simpara> error while writing to output stream
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-SURFACE-FINISHED:CAPS" role="constant"/><literal>CAIRO_STATUS_SURFACE_FINISHED</literal></term>
<listitem><simpara> target surface has been finished
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-SURFACE-TYPE-MISMATCH:CAPS" role="constant"/><literal>CAIRO_STATUS_SURFACE_TYPE_MISMATCH</literal></term>
<listitem><simpara> the surface type is not appropriate for the operation
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS" role="constant"/><literal>CAIRO_STATUS_PATTERN_TYPE_MISMATCH</literal></term>
<listitem><simpara> the pattern type is not appropriate for the operation
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-CONTENT:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_CONTENT</literal></term>
<listitem><simpara> invalid value for an input cairo_content_t
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-FORMAT:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_FORMAT</literal></term>
<listitem><simpara> invalid value for an input cairo_format_t
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-VISUAL:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_VISUAL</literal></term>
<listitem><simpara> invalid value for an input Visual*
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-FILE-NOT-FOUND:CAPS" role="constant"/><literal>CAIRO_STATUS_FILE_NOT_FOUND</literal></term>
<listitem><simpara> file not found
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-DASH:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_DASH</literal></term>
<listitem><simpara> invalid value for a dash setting
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="CAIRO-STATUS-INVALID-DSC-COMMENT:CAPS" role="constant"/><literal>CAIRO_STATUS_INVALID_DSC_COMMENT</literal></term>
<listitem><simpara> invalid value for a DSC comment (Since 1.2)
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-status-to-string" role="function"/>cairo_status_to_string ()</title>
<indexterm><primary>cairo_status_to_string</primary></indexterm><programlisting>const <link linkend="char">char</link>* cairo_status_to_string (<link linkend="cairo-status-t">cairo_status_t</link> status);</programlisting>
<para>
Provides a human-readable description of a <link linkend="cairo-status-t"><type>cairo_status_t</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>status</parameter> :</term>
<listitem><simpara> a cairo status
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>a string representation of the status
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-debug-reset-static-data" role="function"/>cairo_debug_reset_static_data ()</title>
<indexterm><primary>cairo_debug_reset_static_data</primary></indexterm><programlisting><link linkend="void">void</link> cairo_debug_reset_static_data (void);</programlisting>
<para>
Resets all static data within cairo to its original state,
(ie. identical to the state at the time of program invocation). For
example, all caches within cairo will be flushed empty.
</para>
<para>
This function is intended to be useful when using memory-checking
tools such as valgrind. When valgrind's memcheck analyzes a
cairo-using program without a call to cairo_debug_reset_static_data,
it will report all data reachable via cairo's static objects as
"still reachable". Calling cairo_debug_reset_static_data just prior
to program termination will make it easier to get squeaky clean
reports from valgrind.
</para>
<para>
WARNING: It is only safe to call this function when there are no
active cairo objects remaining, (ie. the appropriate destroy
functions have been called as necessary). If there are active cairo
objects, this call is likely to cause a crash, (eg. an assertion
failure due to a hash table being destroyed when non-empty).</para>
<para>
</para></refsect2>
</refsect1>
</refentry>
|