This file is indexed.

/usr/share/gtk-doc/html/cattle-1.0/io-handling.html is in libcattle-1.0-doc 1.2.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>I/O Handling: Cattle Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Cattle Reference Manual">
<link rel="up" href="ch04.html" title="Miscellaneous Topics">
<link rel="prev" href="ch04.html" title="Miscellaneous Topics">
<link rel="next" href="api-index-full.html" title="API Index">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch04.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ch04.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="api-index-full.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="io-handling"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">I/O Handling</span></h2>
<p>I/O Handling — 
			Explanation of the way Cattle performs I/O
		</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect2">
<a name="id-1.5.2.3"></a><h3>I/O Basics</h3>
<p>
			Cattle uses an I/O mechanism which allows for a huge degree
			of flexibility while remaining relatively simple.
		</p>
<p>
			The I/O mechanism is based on callbacks: every time a
			<a class="link" href="CattleInterpreter.html" title="CattleInterpreter">CattleInterpreter</a>
			executes a Brainfuck instruction which requires some sort of
			I/O, it invokes a user provided handler, and expects it to
			perform the I/O operation.
		</p>
<p>
			Default I/O handlers are built into Cattle, so usually there
			is no need to define a custom handler.
		</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.5.2.4"></a><h3>Error reporting</h3>
<p>
			Since I/O is not guaranteed to always be succesful, handlers
			are provided a mean to report errors to the caller.
		</p>
<p>
			All handlers are passed a <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError">GError</a>
			as last argument: if a handler fails, it is required to return
			<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a> and to fill the
			error with detailed information.
		</p>
<p>
			If the hanler returns <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a>, but
			the error is set, the operation is not considered succesful;
			this is because handlers written in languages other than C might
			not be able to both return a value and fill the error at the
			same time.
		</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.5.2.5"></a><h3>Output handler</h3>
<p>
			Implementing an output handler is pretty straightforward: the
			handler is passed a single <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint8">gint8</a>
			and has to display it to the user in some way.
		</p>
<p>
			As an example, here is an handler which shows the output of
			a Brainfuck program on a
			GtkTextView:
		</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>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</pre></td>
        <td class="listing_code"><pre class="programlisting">gboolean
<span class="function">output_handler</span> <span class="gtkdoc opt">(</span>CattleInterpreter  <span class="gtkdoc opt">*</span>interpreter<span class="gtkdoc opt">,</span>
                gint8               output<span class="gtkdoc opt">,</span>
                gpointer            data<span class="gtkdoc opt">,</span>
                GError            <span class="gtkdoc opt">**</span>error<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
	GtkTextView   <span class="gtkdoc opt">*</span>view<span class="gtkdoc opt">;</span>
	GtkTextBuffer <span class="gtkdoc opt">*</span>buffer<span class="gtkdoc opt">;</span>
	GtkTextIter    iter<span class="gtkdoc opt">;</span>
	gchar          text<span class="gtkdoc opt">[</span><span class="number">2</span><span class="gtkdoc opt">];</span>

	view <span class="gtkdoc opt">=</span> <span class="function">GTK_TEXT_VIEW</span> <span class="gtkdoc opt">(</span>data<span class="gtkdoc opt">);</span>

	<span class="comment">/* Get the buffer used by the GtkTextView */</span>
	buffer <span class="gtkdoc opt">=</span> <span class="function">gtk_text_view_get_buffer</span> <span class="gtkdoc opt">(</span>view<span class="gtkdoc opt">);</span>
	<span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-ref">g_object_ref</a></span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">);</span>

	<span class="comment">/* Get a reference to the end of the buffer */</span>
	<span class="function">gtk_text_buffer_get_end_iter</span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">, &amp;</span>iter<span class="gtkdoc opt">);</span>

	<span class="comment">/* Create a string */</span>
	text<span class="gtkdoc opt">[</span><span class="number">0</span><span class="gtkdoc opt">] = (</span>gchat<span class="gtkdoc opt">)</span> output<span class="gtkdoc opt">;</span>
	text<span class="gtkdoc opt">[</span><span class="number">1</span><span class="gtkdoc opt">] =</span> <span class="string">&apos;\0&apos;</span><span class="gtkdoc opt">;</span>

	<span class="comment">/* Insert the char at the end of the buffer */</span>
	<span class="function">gtk_text_buffer_insert</span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">, &amp;</span>iter<span class="gtkdoc opt">,</span> text<span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">);</span>

	<span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">);</span>

	<span class="keyword">return</span> TRUE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
			The code assumes a GtkTextView
			has been provided when the signal handler has been assigned to
			the interpreter, like in the following code:
		</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9</pre></td>
        <td class="listing_code"><pre class="programlisting">CattleInterpreter <span class="gtkdoc opt">*</span>interpreter<span class="gtkdoc opt">;</span>
GtkWidget         <span class="gtkdoc opt">*</span>view<span class="gtkdoc opt">;</span>

interpreter <span class="gtkdoc opt">=</span> <span class="function"><a href="CattleInterpreter.html#cattle-interpreter-new">cattle_interpreter_new</a></span> <span class="gtkdoc opt">();</span>
view <span class="gtkdoc opt">=</span> <span class="function">gtk_text_view_new</span> <span class="gtkdoc opt">();</span>

<span class="function"><a href="CattleInterpreter.html#cattle-interpreter-set-output-handler">cattle_interpreter_set_output_handler</a></span> <span class="gtkdoc opt">(</span>interpreter<span class="gtkdoc opt">,</span>
                                       output_handler<span class="gtkdoc opt">,</span>
                                       <span class="gtkdoc opt">(</span>gpointer<span class="gtkdoc opt">)</span> view<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
			Depending on the case, it may make sense for the application
			to buffer an entire line of output, or even the whole output,
			before sending it to its intended destination.
		</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.5.2.6"></a><h3>Input handler</h3>
<p>
			Here is an input handler which uses readline to fetch input
			from the user:
		</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>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</pre></td>
        <td class="listing_code"><pre class="programlisting">gboolean
<span class="function">input_handler</span> <span class="gtkdoc opt">(</span>CattleInterpreter  <span class="gtkdoc opt">*</span>interpreter<span class="gtkdoc opt">,</span>
               gpointer            data<span class="gtkdoc opt">,</span>
               GError            <span class="gtkdoc opt">**</span>error<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
	CattleBuffer <span class="gtkdoc opt">*</span>buffer<span class="gtkdoc opt">;</span>
	gchar        <span class="gtkdoc opt">*</span>input<span class="gtkdoc opt">;</span>
	gulong        size<span class="gtkdoc opt">;</span>

	<span class="comment">/* Read an input line using readline (no prompt) */</span>
	input <span class="gtkdoc opt">=</span> <span class="function">readline</span> <span class="gtkdoc opt">(</span>NULL<span class="gtkdoc opt">);</span>

	<span class="keyword">if</span> <span class="gtkdoc opt">(</span>input <span class="gtkdoc opt">!=</span> NULL<span class="gtkdoc opt">)</span>
	<span class="gtkdoc opt">{</span>
		<span class="comment">/* A line of input has been read successfully, but it</span>
<span class="comment">		 * needs to be copied into a CattleBuffer before</span>
<span class="comment">		 * feeding it to the interpreter. */</span>

		<span class="comment">/* Calculate the size of the CattleBuffer. readline</span>
<span class="comment">		 * returns a null-terminated string with the trailing</span>
<span class="comment">		 * newline stripped; a CattleBuffer doesn&apos;t need to be</span>
<span class="comment">		 * null-terminated, but stripping the newline would mean</span>
<span class="comment">		 * losing part of the input. We can just create a</span>
<span class="comment">		 * CattleBuffer as big as the string, and replace the</span>
<span class="comment">		 * trailing null byte with a newline. */</span>
		size <span class="gtkdoc opt">=</span> <span class="function">strlen</span> <span class="gtkdoc opt">(</span>input<span class="gtkdoc opt">) +</span> <span class="number">1</span><span class="gtkdoc opt">;</span>

		buffer <span class="gtkdoc opt">=</span> <span class="function"><a href="CattleBuffer.html#cattle-buffer-new">cattle_buffer_new</a></span> <span class="gtkdoc opt">(</span>size<span class="gtkdoc opt">);</span>
		<span class="function"><a href="CattleBuffer.html#cattle-buffer-set-contents">cattle_buffer_set_contents</a></span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">,</span> input<span class="gtkdoc opt">);</span>
		<span class="function"><a href="CattleBuffer.html#cattle-buffer-set-value">cattle_buffer_set_value</a></span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">,</span> size <span class="gtkdoc opt">-</span> <span class="number">1</span><span class="gtkdoc opt">,</span> <span class="string">&apos;</span><span class="gtkdoc esc">\n</span><span class="string">&apos;</span><span class="gtkdoc opt">);</span>

		<span class="comment">/* The CattleBuffer now contains a copy of the input, so</span>
<span class="comment">		 * the string returned by readline can be safely freed */</span>
		<span class="function">free</span> <span class="gtkdoc opt">(</span>input<span class="gtkdoc opt">);</span>

		<span class="function"><a href="CattleInterpreter.html#cattle-interpreter-feed">cattle_interpreter_feed</a></span> <span class="gtkdoc opt">(</span>interpreter<span class="gtkdoc opt">,</span> buffer<span class="gtkdoc opt">);</span>
	<span class="gtkdoc opt">}</span>
	<span class="keyword">else</span>
	<span class="gtkdoc opt">{</span>
		<span class="comment">/* readline returns NULL when the end of input has</span>
<span class="comment">		 * been reached; to let the interpreter know no more</span>
<span class="comment">		 * input is available, feed it an empty buffer */</span>

		buffer <span class="gtkdoc opt">=</span> <span class="function"><a href="CattleBuffer.html#cattle-buffer-new">cattle_buffer_new</a></span> <span class="gtkdoc opt">(</span><span class="number">0</span><span class="gtkdoc opt">);</span>

		<span class="function"><a href="CattleInterpreter.html#cattle-interpreter-feed">cattle_interpreter_feed</a></span> <span class="gtkdoc opt">(</span>interpreter<span class="gtkdoc opt">,</span> buffer<span class="gtkdoc opt">);</span>
	<span class="gtkdoc opt">}</span>

	<span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>buffer<span class="gtkdoc opt">);</span>

	<span class="keyword">return</span> TRUE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
			Input works on a per-line basis: the handler must retrieve
			a full line of input, including the trailing newline character,
			and feed it to the interpreter.
		</p>
<p>
			If it is not possible to retrieve the whole line in a single
			step, a part of it can be passed to the interpreter.
		</p>
<p>
			When the whole input has been consumed, the handler must feed
			the interpreter an empty
			<a class="link" href="CattleBuffer.html" title="CattleBuffer">CattleBuffer</a> to let it
			know no more input is available.
		</p>
</div>
<hr>
<div class="refsect2">
<a name="id-1.5.2.7"></a><h3>Debug</h3>
<p>
			The debug handler is called whenever a <code class="code">#</code>
			instruction is executed; the interpreter can be configured
			to ignore this instruction, since it's not (strictly
			speaking) part of the Brainfuck language.
		</p>
<p>
			The handler must display useful debugging information to
			the developer; usually, this means dumping the contents of
			the memory tape.
		</p>
<p>
			The following handler appends the contents of the tape to
			a log file:
		</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>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</pre></td>
        <td class="listing_code"><pre class="programlisting">gboolean
<span class="function">debug_handler</span> <span class="gtkdoc opt">(</span>CattleInterpreter  <span class="gtkdoc opt">*</span>interpreter<span class="gtkdoc opt">,</span>
               gpointer            data<span class="gtkdoc opt">,</span>
               GError            <span class="gtkdoc opt">**</span>error<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
	CattleTape <span class="gtkdoc opt">*</span>tape<span class="gtkdoc opt">;</span>
	gint8       value<span class="gtkdoc opt">;</span>
	<span class="gtkdoc kwb">FILE</span><span class="gtkdoc opt">*</span>       fp<span class="gtkdoc opt">;</span>

	tape <span class="gtkdoc opt">=</span> <span class="function"><a href="CattleInterpreter.html#cattle-interpreter-get-tape">cattle_interpreter_get_tape</a></span> <span class="gtkdoc opt">(</span>interpreter<span class="gtkdoc opt">);</span>

	<span class="comment">/* Save the current tape position */</span>
	<span class="function"><a href="CattleTape.html#cattle-tape-push-bookmark">cattle_tape_push_bookmark</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>

	fp <span class="gtkdoc opt">=</span> <span class="function">fopen</span> <span class="gtkdoc opt">(</span>LOG_FILE<span class="gtkdoc opt">,</span> <span class="string">&quot;a&quot;</span><span class="gtkdoc opt">);</span>

	<span class="keyword">if</span> <span class="gtkdoc opt">(</span>fp <span class="gtkdoc opt">==</span> NULL<span class="gtkdoc opt">) {</span>

		<span class="comment">/* Set the error, release resources and return */</span>
		<span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#g-set-error-literal">g_set_error_literal</a></span> <span class="gtkdoc opt">(</span>error<span class="gtkdoc opt">,</span>
		                     CATTLE_INTERPRETER_ERROR<span class="gtkdoc opt">,</span>
		                     CATTLE_INTERPRETER_ERROR_IO<span class="gtkdoc opt">,</span>
		                     <span class="function">strerror</span> <span class="gtkdoc opt">(</span>errno<span class="gtkdoc opt">));</span>
		<span class="function"><a href="CattleTape.html#cattle-tape-pop-bookmark">cattle_tape_pop_bookmark</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>
		<span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>

		<span class="keyword">return</span> FALSE<span class="gtkdoc opt">;</span>
	<span class="gtkdoc opt">}</span>

	<span class="comment">/* Rewind to the beginning of the tape */</span>
	<span class="keyword">while</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="CattleTape.html#cattle-tape-is-at-beginning">cattle_tape_is_at_beginning</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">)) {</span>

		<span class="function"><a href="CattleTape.html#cattle-tape-move-left">cattle_tape_move_left</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>
	<span class="gtkdoc opt">}</span>

	<span class="function">fprintf</span> <span class="gtkdoc opt">(</span>fp<span class="gtkdoc opt">,</span> <span class="string">&quot;[ &quot;</span><span class="gtkdoc opt">);</span>

	<span class="comment">/* Repeat until the end of the tape is reached */</span>
	<span class="keyword">while</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="CattleTape.html#cattle-tape-is-at-end">cattle_tape_is_at_end</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">)) {</span>

		<span class="comment">/* Get the current value */</span>
		value <span class="gtkdoc opt">=</span> <span class="function"><a href="CattleTape.html#cattle-tape-get-current-value">cattle_tape_get_current_value</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>

		<span class="comment">/* Show printable values directly and non-printable</span>
<span class="comment">		 * values as their decimal ASCII value */</span>
		<span class="keyword">if</span> <span class="gtkdoc opt">(</span>value <span class="gtkdoc opt">&gt;=</span> <span class="number">33</span> <span class="gtkdoc opt">&amp;&amp;</span> value <span class="gtkdoc opt">&lt;=</span> <span class="number">126</span><span class="gtkdoc opt">) {</span>
			<span class="function">fprintf</span> <span class="gtkdoc opt">(</span>fp<span class="gtkdoc opt">,</span> <span class="string">&quot;%c &quot;</span><span class="gtkdoc opt">,</span> value<span class="gtkdoc opt">);</span>
		<span class="gtkdoc opt">}</span>
		<span class="keyword">else</span> <span class="gtkdoc opt">{</span>
			<span class="function">fprintf</span> <span class="gtkdoc opt">(</span>fp<span class="gtkdoc opt">,</span> <span class="string">&quot;</span><span class="gtkdoc esc">\\</span><span class="string">%d &quot;</span><span class="gtkdoc opt">, (</span>gint<span class="gtkdoc opt">)</span> value<span class="gtkdoc opt">);</span>
		<span class="gtkdoc opt">}</span>

		<span class="function"><a href="CattleTape.html#cattle-tape-move-right">cattle_tape_move_right</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>
	<span class="gtkdoc opt">}</span>

	<span class="function">fprintf</span> <span class="gtkdoc opt">(</span>fp<span class="gtkdoc opt">,</span> <span class="string">&quot;]</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">);</span>
	<span class="function">fclose</span> <span class="gtkdoc opt">(</span>fp<span class="gtkdoc opt">);</span>

	<span class="comment">/* Restore the original tape position */</span>
	<span class="function"><a href="CattleTape.html#cattle-tape-pop-bookmark">cattle_tape_pop_bookmark</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>

	<span class="function"><a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>tape<span class="gtkdoc opt">);</span>

	<span class="keyword">return</span> TRUE<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
			After the handler has run, the tape must be in the same exact
			state it was before the signal emission, including the
			position. The best way to ensure it is to use
			<a class="link" href="CattleTape.html#cattle-tape-push-bookmark" title="cattle_tape_push_bookmark ()">cattle_tape_push_bookmark()</a>
			at the beginning of the handler and
			<a class="link" href="CattleTape.html#cattle-tape-pop-bookmark" title="cattle_tape_pop_bookmark ()">cattle_tape_pop_bookmark()</a>
			at the end.
		</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>