glib-2.0.vala 77.5 KB
Newer Older
1
/* glib-2.0.vala
2
 *
3
 * Copyright (C) 2006-2007  Jürg Billeter, Raffaele Sandrini
4
 * Copyright (C) 2007  Mathias Hasselmann
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
22
 *	Raffaele Sandrini <rasa@gmx.ch>
23
 *	Mathias Hasselmann <mathias.hasselmann@gmx.de>
24
25
 */

26
[CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", marshaller_type_name = "BOOLEAN", get_value_function = "g_value_get_boolean", set_value_function = "g_value_set_boolean", default_value = "FALSE")]
27
28
29
public struct bool {
}

30
[CCode (cname = "gpointer", cheader_filename = "glib.h", type_id = "G_TYPE_POINTER", marshaller_type_name = "POINTER", get_value_function = "g_value_get_pointer", set_value_function = "g_value_set_pointer", default_value = "NULL")]
31
public struct pointer {
32
33
34
35
	[CCode (cname ="GPOINTER_TO_INT")]
	public int to_int ();
	[CCode (cname ="GPOINTER_TO_UINT")]
	public uint to_uint ();
36
37
}

38
[CCode (cname = "gconstpointer", cheader_filename = "glib.h", type_id = "G_TYPE_POINTER", marshaller_type_name = "POINTER", get_value_function = "g_value_get_pointer", set_value_function = "g_value_set_pointer", default_value = "NULL")]
39
40
41
public struct constpointer {
}

42
[CCode (cname = "gchar", cprefix = "g_ascii_", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "\'\\0\'")]
43
[IntegerType (rank = 1)]
44
public struct char {
45
46
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
47
	public string! to_string (string! format = "%hhi");
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	public bool isalnum ();
	public bool isalpha ();
	public bool iscntrl ();
	public bool isdigit ();
	public bool isgraph ();
	public bool islower ();
	public bool isprint ();
	public bool ispunct ();
	public bool isspace ();
	public bool isupper ();
	public bool isxdigit ();
	public int digit_value ();
	public int xdigit_value ();
	public char tolower ();
	public char toupper ();
63
64
}

65
[CCode (cname = "guchar", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "\'\\0\'")]
66
[IntegerType (rank = 2)]
67
public struct uchar {
68
69
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
70
	public string! to_string (string! format = "%hhu");
71
72
}

73
[CCode (cname = "gint", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0")]
74
[IntegerType (rank = 9)]
75
public struct int {
76
77
78
79
80
	[CCode (cname = "G_MININT")]
	public static int MIN;
	[CCode (cname = "G_MAXINT")]
	public static int MAX;

81
82
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
83
	public string! to_string (string! format = "%i");
84
85
86

	[CCode (cname = "CLAMP")]
	public int clamp (int low, int high);
87
88
89

	[CCode (cname ="GINT_TO_POINTER")]
	public pointer to_pointer ();
90
91
}

92
[CCode (cname = "guint", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U")]
93
[IntegerType (rank = 10)]
94
public struct uint {
95
96
97
98
99
	[CCode (cname = "0")]
	public static uint MIN;
	[CCode (cname = "G_MAXUINT")]
	public static uint MAX;

100
101
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
102
	public string! to_string (string! format = "%u");
103
104
105

	[CCode (cname = "CLAMP")]
	public uint clamp (uint low, uint high);
106
107
108

	[CCode (cname ="GUINT_TO_POINTER")]
	public pointer to_pointer ();
109
110
}

111
[CCode (cname = "gshort", cheader_filename = "glib.h", default_value = "0")]
112
[IntegerType (rank = 5)]
113
public struct short {
114
115
116
117
118
	[CCode (cname = "G_MINSHORT")]
	public static short MIN;
	[CCode (cname = "G_MAXSHORT")]
	public static short MAX;

119
120
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
121
	public string! to_string (string! format = "%hi");
122
123
}

124
[CCode (cname = "gushort", cheader_filename = "glib.h", default_value = "0U")]
125
[IntegerType (rank = 6)]
126
public struct ushort {
127
128
129
130
131
	[CCode (cname = "0U")]
	public static ushort MIN;
	[CCode (cname = "G_MAXUSHORT")]
	public static ushort MAX;

132
133
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
134
	public string! to_string (string! format = "%hu");
135
136
}

137
[CCode (cname = "glong", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L")]
138
[IntegerType (rank = 14)]
139
public struct long {
140
141
142
143
144
	[CCode (cname = "G_MINLONG")]
	public static long MIN;
	[CCode (cname = "G_MAXLONG")]
	public static long MAX;

145
146
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
147
	public string! to_string (string! format = "%li");
148
149
}

150
[CCode (cname = "gulong", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")]
151
[IntegerType (rank = 15)]
152
public struct ulong {
153
154
155
156
157
	[CCode (cname = "0UL")]
	public static ulong MIN;
	[CCode (cname = "G_MAXULONG")]
	public static ulong MAX;

158
159
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
160
	public string! to_string (string! format = "%lu");
161
162
}

163
[CCode (cname = "gint8", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "0")]
164
165
166
167
168
169
170
171
[IntegerType (rank = 3)]
public struct int8 {
	[CCode (cname = "G_MININT8")]
	public static int8 MIN;
	[CCode (cname = "G_MAXINT8")]
	public static int8 MAX;

	[CCode (cname = "g_strdup_printf"), InstanceLast]
172
	public string! to_string (string! format = "%hhi");
173
174
}

175
[CCode (cname = "guint8", cheader_filename = "glib.h", default_value = "0U")]
176
177
178
179
180
181
182
183
[IntegerType (rank = 4)]
public struct uint8 {
	[CCode (cname = "0U")]
	public static uint8 MIN;
	[CCode (cname = "G_MAXUINT8")]
	public static uint8 MAX;

	[CCode (cname = "g_strdup_printf"), InstanceLast]
184
	public string! to_string (string! format = "%hhu");
185
186
}

187
[CCode (cname = "gint16", cheader_filename = "glib.h", default_value = "0")]
188
[IntegerType (rank = 7)]
189
public struct int16 {
190
191
192
193
194
195
	[CCode (cname = "G_MININT16")]
	public static int16 MIN;
	[CCode (cname = "G_MAXINT16")]
	public static int16 MAX;

	[CCode (cname = "g_strdup_printf"), InstanceLast]
196
	public string! to_string (string! format = "%hi");
197
198
}

199
[CCode (cname = "guint16", cheader_filename = "glib.h", default_value = "0U")]
200
[IntegerType (rank = 8)]
201
public struct uint16 {
202
203
204
205
206
207
	[CCode (cname = "0U")]
	public static uint16 MIN;
	[CCode (cname = "G_MAXUINT16")]
	public static uint16 MAX;

	[CCode (cname = "g_strdup_printf"), InstanceLast]
208
	public string! to_string (string! format = "%hu");
209
210
}

211
[CCode (cname = "gint32", cheader_filename = "glib.h", default_value = "0")]
212
[IntegerType (rank = 11)]
213
public struct int32 {
214
215
216
217
218
219
	[CCode (cname = "G_MININT32")]
	public static int32 MIN;
	[CCode (cname = "G_MAXINT32")]
	public static int32 MAX;

	[CCode (cname = "g_strdup_printf"), InstanceLast]
220
	public string! to_string (string! format = "%i");
221
222
}

223
[CCode (cname = "guint32", cheader_filename = "glib.h", default_value = "0U")]
224
[IntegerType (rank = 12)]
225
public struct uint32 {
226
227
228
229
230
231
232
	[CCode (cname = "0U")]
	public static uint32 MIN;
	[CCode (cname = "G_MAXUINT32")]
	public static uint32 MAX;

	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
233
	public string! to_string (string! format = "%u");
234
235
}

236
[CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64", get_value_function = "g_value_get_int64", set_value_function = "g_value_set_int64", default_value = "0LL")]
237
[IntegerType (rank = 16)]
238
public struct int64 {
239
240
241
242
243
	[CCode (cname = "G_MININT64")]
	public static int64 MIN;
	[CCode (cname = "G_MAXINT64")]
	public static int64 MAX;

244
245
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
246
	public string! to_string (string! format = "%lli");
247
248
}

249
[CCode (cname = "guint64", cheader_filename = "glib.h", type_id = "G_TYPE_UINT64", marshaller_type_name = "UINT64", get_value_function = "g_value_get_uint64", set_value_function = "g_value_set_uint64", default_value = "0ULL")]
250
[IntegerType (rank = 17)]
251
public struct uint64 {
252
253
254
255
256
	[CCode (cname = "0ULL")]
	public static uint64 MIN;
	[CCode (cname = "G_MAXUINT64")]
	public static uint64 MAX;

257
258
	[InstanceLast ()]
	[CCode (cname = "g_strdup_printf")]
259
	public string! to_string (string! format = "%llu");
260
261
}

262
[CCode (cname = "float", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_FLOAT", marshaller_type_name = "FLOAT", get_value_function = "g_value_get_float", set_value_function = "g_value_set_float", default_value = "0.0F")]
263
[FloatingType (rank = 1)]
264
public struct float {
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
	[CCode (cname = "FLT_MANT_DIG")]
	public static int MANT_DIG;
	[CCode (cname = "FLT_DIG")]
	public static int DIG;

	[CCode (cname = "FLT_MIN_EXP")]
	public static int MIN_EXP;
	[CCode (cname = "FLT_MAX_EXP")]
	public static int MAX_EXP;

	[CCode (cname = "FLT_MIN_10_EXP")]
	public static int MIN_10_EXP;
	[CCode (cname = "FLT_MAX_10_EXP")]
	public static int MAX_10_EXP;

	[CCode (cname = "FLT_EPSILON")]
	public static float EPSILON;
	[CCode (cname = "FLT_MIN")]
	public static float MIN;
	[CCode (cname = "FLT_MAX")]
	public static float MAX;

	[CCode (cname = "NAN")]
	public static float NAN;
	[CCode (cname = "INFINITY")]
	public static float INFINITY;

	[CCode (cname = "isnan")]
	public bool is_nan ();
	[CCode (cname = "isfinite")]
	public bool is_finite ();
	[CCode (cname = "isnormal")]
	public bool is_normal ();
	[CCode (cname = "isinf")]
	public int is_infinity ();

	[CCode (cname = "g_strdup_printf"), InstanceLast]
302
	public string! to_string (string! format = "%g");
303
304
}

305
[CCode (cname = "double", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_DOUBLE", marshaller_type_name = "DOUBLE", get_value_function = "g_value_get_double", set_value_function = "g_value_set_double", default_value = "0.0")]
306
[FloatingType (rank = 2)]
307
public struct double {
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
	[CCode (cname = "DBL_MANT_DIG")]
	public static int MANT_DIG;
	[CCode (cname = "DBL_DIG")]
	public static int DIG;

	[CCode (cname = "DBL_MIN_EXP")]
	public static int MIN_EXP;
	[CCode (cname = "DBL_MAX_EXP")]
	public static int MAX_EXP;

	[CCode (cname = "DBL_MIN_10_EXP")]
	public static int MIN_10_EXP;
	[CCode (cname = "DBL_MAX_10_EXP")]
	public static int MAX_10_EXP;

	[CCode (cname = "DBL_EPSILON")]
	public static double EPSILON;
	[CCode (cname = "DBL_MIN")]
	public static double MIN;
	[CCode (cname = "DBL_MAX")]
	public static double MAX;

	[CCode (cname = "((double) NAN)")]
	public static double NAN;
	[CCode (cname = "((double) INFINITY)")]
	public static double INFINITY;

	[CCode (cname = "isnan")]
	public bool is_nan ();
	[CCode (cname = "isfinite")]
	public bool is_finite ();
	[CCode (cname = "isnormal")]
	public bool is_normal ();
	[CCode (cname = "isinf")]
	public int is_infinity ();

	[CCode (cname = "g_strdup_printf"), InstanceLast]
345
	public string! to_string (string! format = "%g");
346
347
}

348
[CCode (cname = "gunichar", cprefix = "g_unichar_", cheader_filename = "glib.h", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0U")]
349
[IntegerType (rank = 13)]
350
public struct unichar {
351
	public bool validate ();
352
	public bool isalnum ();
353
354
	public bool isalpha ();
	public bool iscntrl ();
355
	public bool isdigit ();
356
357
358
359
	public bool isgraph ();
	public bool islower ();
	public bool isprint ();
	public bool ispunct ();
360
	public bool isspace ();
361
	public bool isupper ();
362
	public bool isxdigit ();
363
364
365
366
367
	public bool istitle ();
	public bool isdefined ();
	public bool iswide ();
	public bool iswide_cjk ();
	public bool iszerowidth ();
368
	public unichar toupper ();
369
	public unichar tolower ();
370
	public unichar totitle ();
371
372
	public int digit_value ();
	public int xdigit_value ();
373
374
375
	public UnicodeType type ();
	public UnicodeBreakType break_type ();

376
	public int to_utf8 (string outbuf);
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
[CCode (cprefix = "G_UNICODE_")]
public enum UnicodeType {
	CONTROL,
	FORMAT,
	UNASSIGNED,
	PRIVATE_USE,
	SURROGATE,
	LOWERCASE_LETTER,
	MODIFIER_LETTER,
	OTHER_LETTER,
	TITLECASE_LETTER,
	UPPERCASE_LETTER,
	COMBINING_MARK,
	ENCLOSING_MARK,
	NON_SPACING_MARK,
	DECIMAL_NUMBER,
	LETTER_NUMBER,
	OTHER_NUMBER,
	CONNECT_PUNCTUATION,
	DASH_PUNCTUATION,
	CLOSE_PUNCTUATION,
	FINAL_PUNCTUATION,
	INITIAL_PUNCTUATION,
	OTHER_PUNCTUATION,
	OPEN_PUNCTUATION,
	CURRENCY_SYMBOL,
	MODIFIER_SYMBOL,
	MATH_SYMBOL,
	OTHER_SYMBOL,
	LINE_SEPARATOR,
	PARAGRAPH_SEPARATOR,
	SPACE_SEPARATOR
}

[CCode (cprefix = "G_UNICODE_BREAK_")]
public enum UnicodeBreakType {
	MANDATORY,
	CARRIAGE_RETURN,
	LINE_FEED,
	COMBINING_MARK,
	SURROGATE,
	ZERO_WIDTH_SPACE,
	INSEPARABLE,
	NON_BREAKING_GLUE,
	CONTINGENT,
	SPACE,
	AFTER,
	BEFORE,
	BEFORE_AND_AFTER,
	HYPHEN,
	NON_STARTER,
	OPEN_PUNCTUATION,
	CLOSE_PUNCTUATION,
	QUOTATION,
	EXCLAMATION,
	IDEOGRAPHIC,
	NUMERIC,
	INFIX_SEPARATOR,
	SYMBOL,
	ALPHABETIC,
	PREFIX,
	POSTFIX,
	COMPLEX_CONTEXT,
	AMBIGUOUS,
	UNKNOWN,
	NEXT_LINE,
	WORD_JOINER,
	HANGUL_L_JAMO,
	HANGUL_V_JAMO,
	HANGUL_T_JAMO,
	HANGUL_LV_SYLLABLE,
	HANGUL_LVT_SYLLABLE
}

Jürg Billeter's avatar
Jürg Billeter committed
453
[ReferenceType (dup_function = "g_strdup", free_function = "g_free", type_id = "G_TYPE_STRING")]
454
[CCode (cname = "char", const_cname = "const char", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string")]
455
public struct string {
456
	[CCode (cname = "strstr")]
457
	public weak string str (string! needle);
458
459
	[CCode (cname = "g_str_has_prefix")]
	public bool has_prefix (string! prefix);
460
	[CCode (cname = "g_str_has_suffix")]
461
	public bool has_suffix (string! suffix);
462
	[CCode (cname = "g_strdup_printf"), PrintfFormat]
463
	public string printf (...);
464
	[CCode (cname = "g_strconcat")]
465
	public string concat (string string2, ...);
466
	[CCode (cname = "g_strndup")]
467
	public string ndup (ulong n); /* FIXME: only UTF-8 */
468
	[CCode (cname = "g_strcompress")]
469
	public string compress ();
470
	[CCode (cname = "g_strsplit")]
471
	[NoArrayLength]
472
	public string[] split (string! delimiter, int max_tokens = 0);
473
	[CCode (cname = "g_strsplit_set")]
474
	[NoArrayLength]
475
	public string[] split_set (string! delimiters, int max_tokens = 0);
476
477
478
	[CCode (cname = "g_strjoinv")]
	[NoArrayLength]
	public static string joinv (string! separator, string[] str_array);
479
	
480
	[CCode (cname = "g_utf8_next_char")]
481
	public weak string next_char ();
482
483
	[CCode (cname = "g_utf8_get_char")]
	public unichar get_char ();
484
485
	[CCode (cname = "g_utf8_get_char_validated")]
	public unichar get_char_validated (long max_len = -1);
486
487
	[CCode (cname = "g_utf8_offset_to_pointer")]
	[PlusOperator ()]
488
	public weak string offset (long offset);
489
490
	[CCode (cname = "g_utf8_pointer_to_offset")]
	public long pointer_to_offset (string pos);
491
	[CCode (cname = "g_utf8_prev_char")]
492
	public weak string prev_char ();
493
	[CCode (cname = "g_utf8_strlen")]
494
	public long len (long max = -1);
495
	[CCode (cname = "g_utf8_strchr")]
496
	public weak string chr (long len, unichar c);
497
498
	[CCode (cname = "g_utf8_strrchr")]
	public weak string rchr (long len, unichar c);
499
	[CCode (cname = "g_utf8_strreverse")]
500
	public string! reverse (int len = -1);
501
502
	[CCode (cname = "g_utf8_validate")]
	public bool validate (long max_len = -1, out string end = null);
503
504
	
	[CCode (cname = "g_utf8_strup")]
505
	public string up (long len = -1);
506
	[CCode (cname = "g_utf8_strdown")]
507
	public string down (long len = -1);
508
	[CCode (cname = "g_utf8_casefold")]
509
	public string casefold (long len = -1);
510
511
	[CCode (cname = "g_utf8_collate")]
	public int collate (string str2);
512

513
514
515
516
	[CCode (cname = "g_locale_to_utf8")]
	public string! locale_to_utf8 (long len, out ulong bytes_read, out ulong bytes_written, out GLib.Error error = null);
  
	[CCode (cname = "g_strchomp")]
517
	public weak string chomp();
518
	[CCode (cname = "g_strchug")]
519
	public weak string chug();
520
521
	[CCode (cname = "g_strstrip")]
	public weak string strip ();
522
	
523
524
525
	[CCode (cname = "g_str_hash")]
	public uint hash ();
	
526
527
	[CCode (cname = "atoi")]
	public int to_int ();
528
529
	[CCode (cname = "strtoul")]
	public ulong to_ulong (out string endptr = null, int _base = 0);
530
	[CCode (cname = "g_ascii_strtoll")]
531
	public int64 to_int64 (out string endptr = null, int _base = 0);
532
533
	[CCode (cname = "strlen")]
	public long size ();
534
535
536

	[CCode (cname = "g_utf8_skip")]
	public static char[] skip;
537
538

	public string! substring (long offset, long len);
539
540
541
}

[Import ()]
542
[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h")]
543
namespace GLib {
544
	public struct Type {
545
546
		[CCode (cname = "G_TYPE_IS_OBJECT")]
		public bool is_object ();
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
		[CCode (cname = "G_TYPE_IS_ABSTRACT")]
		public bool is_abstract ();
		[CCode (cname = "G_TYPE_IS_CLASSED")]
		public bool is_classed ();
		[CCode (cname = "G_TYPE_IS_DERIVABLE")]
		public bool is_derivable ();
		[CCode (cname = "G_TYPE_IS_DEEP_DERIVABLE")]
		public bool is_deep_derivable ();
		[CCode (cname = "G_TYPE_IS_DERIVED")]
		public bool is_derived ();
		[CCode (cname = "G_TYPE_IS_FUNDAMENTAL")]
		public bool is_fundamental ();
		[CCode (cname = "G_TYPE_IS_INSTANTIATABLE")]
		public bool is_instantiatable ();
		[CCode (cname = "G_TYPE_IS_INTERFACE")]
		public bool is_interface ();
		[CCode (cname = "G_TYPE_IS_VALUE_TYPE")]
		public bool is_value_type ();
565
		
566
		//public Type[] children (out uint n_children = null);
567
568
		public uint depth ();
		public static Type from_name (string! name);
569
		//public Type[] interfaces (out uint n_interfaces = null);
570
		public bool is_a (Type is_a_type);
571
		public weak string! name ();
572
573
		public Type parent ();
				
574
		public TypeClass class_ref ();
575
		
576
	}
Jürg Billeter's avatar
Jürg Billeter committed
577
578
579
580
581

	[ReferenceType]
	public struct TypeInstance {
	}

582
	[ReferenceType]
583
	public struct TypeClass {
584
585
		[CCode (cname = "G_TYPE_FROM_CLASS")]
		public Type get_type ();
586
	}
587
588
589
590
591
592
593
594
595
596

	public interface TypePlugin {
	}

	public class TypeModule : TypePlugin {
		public bool use ();
		public void unuse ();
		public void set_name (string! name);
	}

597
598
	[ReferenceType ()]
	public struct ParamSpec {
Mathias Hasselmann's avatar
Mathias Hasselmann committed
599
600
601
602
603
		public TypeInstance g_type_instance;
		public string name;
		public ParamFlags flags;
		public Type value_type;
		public Type owner_type;
604
	}
Jürg Billeter's avatar
Jürg Billeter committed
605
606
607
608
609
610
611
612
613
614
615
616
617

	[CCode (cprefix = "G_PARAM_")]
	public enum ParamFlags {
		READABLE,
		WRITABLE,
		CONSTRUCT,
		CONSTRUCT_ONLY,
		LAX_VALIDATION,
		STATIC_NAME,
		STATIC_NICK,
		STATIC_BLURB
	}

618
619
	[ReferenceType ()]
	public struct ObjectClass {
620
		public ParamSpec[] list_properties (out int n_properties);
621
622
623
624
625
	}
	
	public struct ObjectConstructParam {
	}

626
	[CCode (cheader_filename = "glib-object.h")]
627
	public class Object {
628
629
		[CCode (cname = "G_TYPE_FROM_INSTANCE")]
		public Type get_type ();
630
631
632
		public Object @ref ();
		public void unref ();
		public Object ref_sink ();
Jürg Billeter's avatar
Jürg Billeter committed
633
		public void set (...);
634
		public void get_property (string! property_name, Value value);
Jürg Billeter's avatar
Jürg Billeter committed
635
636
637
		public virtual void dispose ();
		public virtual void finalize ();
		public virtual void constructed ();
638
639
640
641
642
643

		/* FIXME The notify passes a ParamSpec where the
		 * wrapper expects a string. Fortunatly Vala doesn't
		 * verify signatures of signal handlers yet.*/
		[HasEmitter]
		public signal void notify(string! property_name);
Mathias Hasselmann's avatar
Mathias Hasselmann committed
644
645

		public Object connect(string! signal_spec, ...);
646
	}
647
	
648
	public class InitiallyUnowned : Object {
649
	}
650
651
652
653
654
655

	public /* static */ interface Boxed<G> {
		public abstract G copy ();
		public abstract void free ();
	}

656
657
	[ReferenceType (free_function = "g_free")]
	public struct Value {
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
		public weak Value init (Type g_type);
		public void copy (Value dest_value);
		public weak Value reset ();
		public void unset ();
		public void set_instance (pointer instance);
		public bool fits_pointer ();
		public pointer peek_pointer ();
		public static bool type_compatible (Type src_type, Type dest_type);
		public static bool type_transformable (Type src_type, Type dest_type);
		public bool transform (Value dest_value);
		[CCode (cname = "g_strdup_value_contents")]
		public string strdup_contents ();
		public void set_boolean (bool v_boolean);
		public bool get_boolean ();
		public void set_char (char v_char);
		public char get_char ();
		public void set_uchar (uchar v_uchar);
		public uchar get_uchar ();
		public void set_int (int v_int);
		public int get_int ();
		public void set_uint (uint v_uint);
		public uint get_uint ();
		public void set_long (long v_long);
		public long get_long ();
		public void set_ulong (ulong v_ulong);
		public ulong get_ulong ();
		public void set_int64 (int64 v_int64);
		public int64 get_int64 ();
		public void set_uint64 (uint64 v_uint64);
		public uint64 get_uint64 ();
		public void set_float (float v_float);
		public float get_float ();
		public void set_double (double v_double);
		public double get_double ();
		public void set_enum (int v_enum);
		public int get_enum ();
		public void set_flags (uint v_flags);
		public uint get_flags ();
		public void set_string (string v_string);
		public void set_static_string (string v_string);
		public void take_string (string# v_string);
		public weak string get_string ();
		public string dup_string ();
		public void set_pointer (pointer v_pointer);
		public pointer get_pointer ();
		public void set_object (Object v_object);
		public void take_object (Object# v_object);
705
		public weak Object get_object ();
706
707
708
		public Object dup_object ();
		public void set_gtype (Type v_gtype);
		public Type get_gtype ();
709
710
	}
	
711
712
713
714
715
716
	public struct SignalInvocationHint {
		public uint signal_id;
		public Quark detail;
		public SignalFlags run_type;
	}
	
717
	[NoArrayLength ()]
718
	public static delegate bool SignalEmissionHook (SignalInvocationHint ihint, uint n_param_values, Value[] param_values, pointer data);
719
720
721
722
723
724
725
726
727
728
	
	[CCode (cprefix = "G_SIGNAL_")]
	public enum SignalFlags {
		RUN_FIRST,
		RUN_LAST,
		RUN_CLEANUP,
		DETAILED,
		ACTION,
		NO_HOOKS
	}
729
730
731
732
733
734
735

	[CCode (cprefix = "G_CONNECT_")]
	public enum ConnectFlags {
		AFTER,
		SWAPPED
	}

736
	public static delegate void Callback ();
737
738

	[ReferenceType]
739
740
	public struct Closure {
	}
Mathias Hasselmann's avatar
Mathias Hasselmann committed
741
742
743

	public static delegate void ClosureNotify (pointer data, Closure closure);

744
745
746
	public struct ValueArray {
	}

747
	[CCode (cprefix = "", cheader_filename = "math.h")]
748
749
750
751
752
753
	public struct Math {
		[CCode (cname = "G_E")]
		public static double E;
		
		[CCode (cname = "G_PI")]
		public static double PI;
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903

		/* generated from <bits/mathcalls.h> of glibc */
		public static double acos (double x);
		public static float acosf (float x);
		public static double asin (double x);
		public static float asinf (float x);
		public static double atan (double x);
		public static float atanf (float x);
		public static double atan2 (double y, double x);
		public static float atan2f (float y, float x);
		public static double cos (double x);
		public static float cosf (float x);
		public static double sin (double x);
		public static float sinf (float x);
		public static double tan (double x);
		public static float tanf (float x);
		public static double cosh (double x);
		public static float coshf (float x);
		public static double sinh (double x);
		public static float sinhf (float x);
		public static double tanh (double x);
		public static float tanhf (float x);
		public static void sincos (double x, out double sinx, ref double cosx);
		public static void sincosf (float x, out float sinx, out float cosx);
		public static double acosh (double x);
		public static float acoshf (float x);
		public static double asinh (double x);
		public static float asinhf (float x);
		public static double atanh (double x);
		public static float atanhf (float x);
		public static double exp (double x);
		public static float expf (float x);
		public static double frexp (double x, out int exponent);
		public static float frexpf (float x, out int exponent);
		public static double ldexp (double x, int exponent);
		public static float ldexpf (float x, int exponent);
		public static double log (double x);
		public static float logf (float x);
		public static double log10 (double x);
		public static float log10f (float x);
		public static double modf (double x, out double iptr);
		public static float modff (float x, out float iptr);
		public static double exp10 (double x);
		public static float exp10f (float x);
		public static double pow10 (double x);
		public static float pow10f (float x);
		public static double expm1 (double x);
		public static float expm1f (float x);
		public static double log1p (double x);
		public static float log1pf (float x);
		public static double logb (double x);
		public static float logbf (float x);
		public static double exp2 (double x);
		public static float exp2f (float x);
		public static double log2 (double x);
		public static float log2f (float x);
		public static double pow (double x, double y);
		public static float powf (float x, float y);
		public static double sqrt (double x);
		public static float sqrtf (float x);
		public static double hypot (double x, double y);
		public static float hypotf (float x, float y);
		public static double cbrt (double x);
		public static float cbrtf (float x);
		public static double ceil (double x);
		public static float ceilf (float x);
		public static double fabs (double x);
		public static float fabsf (float x);
		public static double floor (double x);
		public static float floorf (float x);
		public static double fmod (double x, double y);
		public static float fmodf (float x, float y);
		public static int isinf (double value);
		public static int isinff (float value);
		public static int finite (double value);
		public static int finitef (float value);
		public static double drem (double x, double y);
		public static float dremf (float x, float y);
		public static double significand (double x);
		public static float significandf (float x);
		public static double copysign (double x, double y);
		public static float copysignf (float x, float y);
		public static double nan (string tagb);
		public static float nanf (string tagb);
		public static int isnan (double value);
		public static int isnanf (float value);
		public static double j0 (double x0);
		public static float j0f (float x0);
		public static double j1 (double x0);
		public static float j1f (float x0);
		public static double jn (int x0, double x1);
		public static float jnf (int x0, float x1);
		public static double y0 (double x0);
		public static float y0f (float x0);
		public static double y1 (double x0);
		public static float y1f (float x0);
		public static double yn (int x0, double x1);
		public static float ynf (int x0, float x1);
		public static double erf (double x0);
		public static float erff (float x0);
		public static double erfc (double x0);
		public static float erfcf (float x0);
		public static double lgamma (double x0);
		public static float lgammaf (float x0);
		public static double tgamma (double x0);
		public static float tgammaf (float x0);
		public static double gamma (double x0);
		public static float gammaf (float x0);
		public static double lgamma_r (double x0, out int signgamp);
		public static float lgamma_rf (float x0, out int signgamp);
		public static double rint (double x);
		public static float rintf (float x);
		public static double nextafter (double x, double y);
		public static float nextafterf (float x, float y);
		public static double nexttoward (double x, double y);
		public static float nexttowardf (float x, double y);
		public static double remainder (double x, double y);
		public static float remainderf (float x, float y);
		public static double scalbn (double x, int n);
		public static float scalbnf (float x, int n);
		public static int ilogb (double x);
		public static int ilogbf (float x);
		public static double scalbln (double x, long n);
		public static float scalblnf (float x, long n);
		public static double nearbyint (double x);
		public static float nearbyintf (float x);
		public static double round (double x);
		public static float roundf (float x);
		public static double trunc (double x);
		public static float truncf (float x);
		public static double remquo (double x, double y, out int quo);
		public static float remquof (float x, float y, out int quo);
		public static long lrint (double x);
		public static long lrintf (float x);
		public static int64 llrint (double x);
		public static int64 llrintf (float x);
		public static long lround (double x);
		public static long lroundf (float x);
		public static int64 llround (double x);
		public static int64 llroundf (float x);
		public static double fdim (double x, double y);
		public static float fdimf (float x, float y);
		public static double fmax (double x, double y);
		public static float fmaxf (float x, float y);
		public static double fmin (double x, double y);
		public static float fminf (float x, float y);
		public static double fma (double x, double y, double z);
		public static float fmaf (float x, float y, float z);
		public static double scalb (double x, double n);
		public static float scalbf (float x, float n);
904
	}
905

Jürg Billeter's avatar
Jürg Billeter committed
906
907
	/* The Main Event Loop */
	
908
909
	[ReferenceType (dup_function = "g_main_loop_ref", free_function = "g_main_loop_unref")]
	public struct MainLoop {
910
		public MainLoop (MainContext context, bool is_running);
911
912
913
		public void run ();
		public void quit ();
		public bool is_running ();
914
		public weak MainContext get_context ();
915
916
	}
	
Jürg Billeter's avatar
Jürg Billeter committed
917
918
919
920
921
922
923
924
	public enum Priority {
		HIGH,
		DEFAULT,
		HIGH_IDLE,
		DEFAULT_IDLE,
		LOW
	}
	
925
926
	[ReferenceType (dup_function = "g_main_context_ref", free_function = "g_main_context_unref")]
	public struct MainContext {
927
		public MainContext ();
928
		public static weak MainContext @default ();
929
930
		public bool iteration (bool may_block);
		public bool pending ();
931
932
933
		public weak Source find_source_by_id (uint source_id);
		public weak Source find_source_by_user_data (pointer user_data);
		public weak Source find_source_by_funcs_user_data (SourceFuncs funcs, pointer user_data);
934
935
936
937
		public void wakeup ();
		public bool acquire ();
		public void release ();
		public bool is_owner ();
Jürg Billeter's avatar
Jürg Billeter committed
938
		public bool wait (Cond cond, Mutex mutex);
939
		public bool prepare (out int priority);
Jürg Billeter's avatar
Jürg Billeter committed
940
		[NoArrayLength ()]
941
		public int query (int max_priority, out int timeout_, PollFD[] fds, int n_fds);
Jürg Billeter's avatar
Jürg Billeter committed
942
943
944
945
946
947
948
		public int check (int max_priority, PollFD[] fds, int n_fds);
		public void dispatch ();
		public void set_poll_func (PollFunc func);
		public PollFunc get_poll_func ();
		public void add_poll (ref PollFD fd, int priority);
		public void remove_poll (ref PollFD fd);
		public int depth ();
949
		public weak Source current_source ();
950
951
	}
	
952
	public static delegate int PollFunc (PollFD[] ufds, uint nfsd, int timeout_);
Jürg Billeter's avatar
Jürg Billeter committed
953
954
	
	public struct TimeoutSource : Source {
955
		public TimeoutSource (uint interval);
Jürg Billeter's avatar
Jürg Billeter committed
956
957
	}

958
959
	public struct Timeout {
		public static uint add (uint interval, SourceFunc function, pointer data);
Jürg Billeter's avatar
Jürg Billeter committed
960
		public static uint add_full (int priority, uint interval, SourceFunc function, pointer data, DestroyNotify notify);
961
962
	}
	
963
	[ReferenceType ()]
Jürg Billeter's avatar
Jürg Billeter committed
964
	public struct IdleSource : Source {
965
		public IdleSource ();
Jürg Billeter's avatar
Jürg Billeter committed
966
967
968
	}

	public struct Idle {
969
		public static uint add (SourceFunc function, pointer data);
Jürg Billeter's avatar
Jürg Billeter committed
970
971
		public static uint add_full (int priority, SourceFunc function, pointer data, DestroyNotify notify);
		public static bool remove_by_data (pointer data);
972
	}
Jürg Billeter's avatar
Jürg Billeter committed
973
974

	[CCode (default_value = "0")]
975
976
	public struct Pid {
	}
Jürg Billeter's avatar
Jürg Billeter committed
977

978
	public static delegate void ChildWatchFunc (Pid pid, int status, pointer data);
Jürg Billeter's avatar
Jürg Billeter committed
979
980
981
	
	[ReferenceType ()]
	public struct ChildWatchSource : Source {
982
		public ChildWatchSource (Pid pid, int status, pointer data);
Jürg Billeter's avatar
Jürg Billeter committed
983
984
985
986
987
988
989
990
	}
	
	public struct ChildWatch {
		public static uint add (Pid pid, ChildWatchFunc function, pointer data);
		public static uint add_full (int priority, Pid pid, ChildWatchFunc function, pointer data, DestroyNotify notify);
	}
	
	public struct PollFD {
Jürg Billeter's avatar
Jürg Billeter committed
991
992
993
		public int fd;
		public IOCondition events;
		public IOCondition revents;
Jürg Billeter's avatar
Jürg Billeter committed
994
995
	}
	
996
997
	[ReferenceType (dup_function = "g_source_ref", free_function = "g_source_unref")]
	public struct Source {
998
		public Source (SourceFuncs source_funcs, uint struct_size /* = sizeof (Source) */);
Jürg Billeter's avatar
Jürg Billeter committed
999
		public void set_funcs (SourceFuncs funcs);
1000
		public uint attach (MainContext context);
Jürg Billeter's avatar
Jürg Billeter committed
1001
1002
1003
1004
1005
1006
1007
		public void destroy ();
		public bool is_destroyed ();
		public void set_priority (int priority);
		public int get_priority ();
		public void set_can_recurse (bool can_recurse);
		public bool get_can_recurse ();
		public uint get_id ();
1008
		public weak MainContext get_context ();
1009
		public void set_callback (SourceFunc func, pointer data, DestroyNotify notify);
Jürg Billeter's avatar
Jürg Billeter committed
1010
1011
1012
		public void set_callback_indirect (pointer callback_data, SourceCallbackFuncs callback_funcs);
		public void add_poll (ref PollFD fd);
		public void remove_poll (ref PollFD fd);
1013
		public void get_current_time (out TimeVal timeval);
1014
		public static void remove (uint id);
Jürg Billeter's avatar
Jürg Billeter committed
1015
1016
		public static bool remove_by_funcs_user_data (pointer user_data);
		public static bool remove_by_user_data (pointer user_data);
1017
1018
	}
	
1019
	public static delegate void SourceDummyMarshal ();
Jürg Billeter's avatar
Jürg Billeter committed
1020
	
1021
1022
1023
1024
	public static delegate bool SourcePrepareFunc (Source source, out int timeout_);
	public static delegate bool SourceCheckFunc (Source source);
	public static delegate bool SourceDispatchFunc (Source source, SourceFunc _callback, pointer user_data);
	public static delegate void SourceFinalizeFunc (Source source);
1025
1026
1027
1028
1029
1030
1031
1032
1033
	
	[ReferenceType ()]
	public struct SourceFuncs {
		public SourcePrepareFunc prepare;
		public SourceCheckFunc check;
		public SourceDispatchFunc dispatch;
		public SourceFinalizeFunc finalize;
	}
	
1034
1035
1036
	public static delegate void SourceCallbackRefFunc (pointer cb_data);
	public static delegate void SourceCallbackUnrefFunc (pointer cb_data);
	public static delegate void SourceCallbackGetFunc (pointer cb_data, Source source, SourceFunc func, pointer data);
Jürg Billeter's avatar
Jürg Billeter committed
1037
1038
1039
1040
1041
1042
1043
1044
	
	[ReferenceType ()]
	public struct SourceCallbackFuncs {
		public SourceCallbackRefFunc @ref;
		public SourceCallbackUnrefFunc unref;
		public SourceCallbackGetFunc @get;
	}
	
1045
	public static delegate bool SourceFunc (pointer data);
1046
1047
1048
1049
1050
1051

	[ErrorDomain]
	public enum ThreadError {
		AGAIN
	}

1052
	/* Thread support */
1053
1054
1055
1056
	[ReferenceType ()]
	public struct ThreadFunctions {
	}
	
1057
1058
	public static delegate pointer ThreadFunc (pointer data);
	public static delegate void Func (pointer data, pointer user_data);
1059
1060
1061
1062
1063
1064
1065
1066
	
	public enum ThreadPriority {
		LOW,
		NORMAL,
		HIGH,
		URGENT
	}
	
1067
1068
	[ReferenceType ()]
	public struct Thread {
1069
		public static void init (ThreadFunctions vtable = null);
1070
		public static bool supported ();
1071
1072
		public static weak Thread create (ThreadFunc func, pointer data, bool joinable) throws ThreadError;
		public static weak Thread create_full (ThreadFunc func, pointer data, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError;
1073
		public static weak Thread self ();
1074
1075
1076
1077
1078
		public pointer join ();
		public void set_priority (ThreadPriority priority);
		public static void yield ();
		public static void exit (pointer retval);
		public static void @foreach (Func thread_func, pointer user_data);
1079
1080
1081
		
		[CCode (cname = "g_usleep")]
		public static void usleep (ulong microseconds);
1082
1083
	}
	
1084
1085
	[ReferenceType (free_function = "g_mutex_free")]
	public struct Mutex {
1086
		public Mutex ();
1087
1088
1089
1090
1091
1092
1093
		public void @lock ();
		public bool try_lock ();
		public void unlock ();
	}
	
	[ReferenceType (free_function = "g_cond_free")]
	public struct Cond {
1094
		public Cond ();
1095
1096
1097
1098
1099
1100
		public void @signal ();
		public void broadcast ();
		public void wait (Mutex mutex);
		public bool timed_wait (Mutex mutex, TimeVal abs_time);
	}
	
Jürg Billeter's avatar
Jürg Billeter committed
1101
1102
1103
1104
	/* Thread Pools */
	
	[ReferenceType (free_function = "g_thread_pool_free")]
	public struct ThreadPool {
1105
1106
1107
		public ThreadPool (Func func, pointer user_data, int max_threads, bool exclusive) throws ThreadError;
		public void push (pointer data) throws ThreadError;
		public void set_max_threads (int max_threads) throws ThreadError;
Jürg Billeter's avatar
Jürg Billeter committed
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
		public int get_max_threads ();
		public uint get_num_threads ();
		public uint unprocessed ();
		public static void set_max_unused_threads (int max_threads);
		public static int get_max_unused_threads ();
		public static uint get_num_unused_threads ();
		public static void stop_unused_threads ();
		public void set_sort_function (CompareDataFunc func, pointer user_data);
		public static void set_max_idle_time (uint interval);
		public static uint get_max_idle_time ();
	}
	
	/* Asynchronous Queues */
	
	[ReferenceType (dup_function = "g_async_queue_ref", free_function = "g_async_queue_unref")]
	public struct AsyncQueue {
1124
		public AsyncQueue ();
Jürg Billeter's avatar
Jürg Billeter committed
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
		public void push (pointer data);
		public void push_sorted (pointer data, CompareDataFunc func, pointer user_data);
		public pointer pop ();
		public pointer try_pop ();
		public pointer timed_pop (ref TimeVal end_time);
		public int length ();
		public void sort (CompareDataFunc func, pointer user_data);
		public void @lock ();
		public void unlock ();
		public void ref_unlocked ();
		public void unref_and_unlock ();
		public void push_unlocked (pointer data);
		public void push_sorted_unlocked (pointer data, CompareDataFunc func, pointer user_data);
		public pointer pop_unlocked ();
		public pointer try_pop_unlocked ();
		public pointer timed_pop_unlocked (ref TimeVal end_time);
		public int length_unlocked ();
		public void sort_unlocked (CompareDataFunc func, pointer user_data);
	}
	
	/* Dynamic Loading of Modules */
	
	[ReferenceType (free_function = "g_module_close")]
	public struct Module {
		public static bool supported ();
1150
1151
1152
		public static string build_path (string directory, string module_name);
		public static Module open (string file_name, ModuleFlags @flags);
		public bool symbol (string! symbol_name, out pointer symbol);
1153
		public weak string name ();
Jürg Billeter's avatar
Jürg Billeter committed
1154
		public void make_resident ();
1155
		public weak string error ();
Jürg Billeter's avatar
Jürg Billeter committed
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
	}
	
	[CCode (cprefix = "G_MODULE_")]
	public enum ModuleFlags {
		BIND_LAZY,
		BIND_LOCAL,
		BIND_MASK
	}
	
	/* Memory Allocation */
	
	public static pointer malloc (ulong n_bytes);
1168
	public static pointer malloc0 (ulong n_bytes);
Jürg Billeter's avatar
Jürg Billeter committed
1169
1170
1171
1172
1173
	public static pointer realloc (pointer mem, ulong n_bytes);

	public static pointer try_malloc (ulong n_bytes);
	public static pointer try_malloc0 (ulong n_bytes);
	public static pointer try_realloc (pointer mem, ulong n_bytes);
1174
	
Jürg Billeter's avatar
Jürg Billeter committed
1175
1176
1177
1178
1179
	public static void free (pointer mem);
	
	/* IO Channels */
	
	[ReferenceType (dup_function = "g_io_channel_ref", free_function = "g_io_channel_unref")]
1180
	public struct IOChannel {
1181
		public IOChannel.file (string! filename, string! mode) throws FileError;
1182
1183
1184
		[CCode (cname = "g_io_channel_unix_new")]
		public IOChannel.unix_new (int fd);
		public int unix_get_fd ();
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
		public IOStatus read_chars (string! buf, ulong count, out ulong bytes_read) throws ConvertError, IOChannelError;
		public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError;
		public IOStatus read_line (out string str_return, out ulong length, out ulong terminator_pos) throws ConvertError, IOChannelError;
		public IOStatus read_line_string (String! buffer, out ulong terminator_pos) throws ConvertError, IOChannelError;
		public IOStatus read_to_end (out string str_return, out ulong length) throws ConvertError, IOChannelError;
		public IOStatus write_chars (string! buf, long count, out ulong bytes_written) throws ConvertError, IOChannelError;
		public IOStatus write_unichar (unichar thechar) throws ConvertError, IOChannelError;
		public IOStatus flush () throws IOChannelError;
		public IOStatus seek_position (int64 offset, SeekType type) throws IOChannelError;
		public IOStatus shutdown (bool flush) throws IOChannelError;
1195
	}
Jürg Billeter's avatar
Jürg Billeter committed
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206

	[CCode (cprefix = "G_IO_")]
	public enum IOCondition {
		IN,
		OUT,
		PRI,
		ERR,
		HUP,
		NVAL
	}

Jürg Billeter's avatar
Jürg Billeter committed
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219