diff --git a/.gitignore b/.gitignore index 10001c2e..8b4b2910 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ Makefile.in /INSTALL /test-driver /stamp-h1 +/README diff --git a/Makefile.am b/Makefile.am index c79ace28..b8e7724d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,7 @@ ALL_SOURCE_FILES = \ lib/*.vala \ src/Makefile.am \ src/*.h \ - src/enchant*.c \ + src/enchant*.vala \ providers/Makefile.am \ providers/*.[ch] \ providers/*.cpp \ @@ -52,7 +52,7 @@ doxygen: Doxyfile dist: doxygen loc: - cloc --force-lang="Bourne Shell",conf $(ALL_SOURCE_FILES) + $(CLOC) $(ALL_SOURCE_FILES) # Ignore built files that are part of the distribution (specifically, # doxygen/*). diff --git a/configure.ac b/configure.ac index 445d406f..4601379a 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ # along with this program; if not, see . AC_PREREQ([2.71]) -AC_INIT([enchant],[2.8.2]) +AC_INIT([Enchant],[2.8.2]) AC_CONFIG_SRCDIR(lib/enchant.h) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([subdir-objects tar-ustar]) @@ -199,6 +199,10 @@ AM_CONDITIONAL(WITH_APPLESPELL, test "$with_applespell" = yes) dnl Experimental/deprecated providers ENCHANT_CHECK_PKG_CONFIG_PROVIDER([zemberek], [ZEMBEREK], [dbus-glib-1 >= 0.62], [no]) +dnl Counting code +CLOC="cloc --force-lang='Bourne Shell',conf" +AC_SUBST([CLOC]) + dnl ======================================================================================= AC_CONFIG_HEADERS([config.h]) diff --git a/doxygen/html/enchant-provider_8h_source.html b/doxygen/html/enchant-provider_8h_source.html deleted file mode 100644 index 22977ec8..00000000 --- a/doxygen/html/enchant-provider_8h_source.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - -Enchant: lib/enchant-provider.h Source File - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
enchant-provider.h
-
-
-
1 /* enchant
-
2  * Copyright (C) 2003 Dom Lachowicz
-
3  * Copyright (C) 2017-2024 Reuben Thomas
-
4  *
-
5  * This library is free software; you can redistribute it and/or
-
6  * modify it under the terms of the GNU Lesser General Public
-
7  * License as published by the Free Software Foundation; either
-
8  * version 2.1 of the License, or (at your option) any later version.
-
9  *
-
10  * This library is distributed in the hope that it will be useful,
-
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-
13  * Lesser General Public License for more details.
-
14  *
-
15  * You should have received a copy of the GNU Lesser General Public License
-
16  * along along with this program; if not, see
-
17  * <https://www.gnu.org/licenses/>.
-
18  *
-
19  * In addition, as a special exception, the copyright holders
-
20  * give permission to link the code of this program with
-
21  * non-LGPL Spelling Provider libraries (eg: a MSFT Office
-
22  * spell checker backend) and distribute linked combinations including
-
23  * the two. You must obey the GNU Lesser General Public License in all
-
24  * respects for all of the code used other than said providers. If you modify
-
25  * this file, you may extend this exception to your version of the
-
26  * file, but you are not obligated to do so. If you do not wish to
-
27  * do so, delete this exception statement from your version.
-
28  */
-
29 
-
30 #ifndef ENCHANT_PROVIDER_H
-
31 #define ENCHANT_PROVIDER_H
-
32 
-
33 #include <enchant.h>
-
34 #include <glib.h>
-
35 #include <glib-object.h>
-
36 #include <stddef.h>
-
37 
-
38 #ifdef __cplusplus
-
39 extern "C" {
-
40 #endif
-
41 
-
42 typedef struct _EnchantProvider EnchantProvider;
-
43 
-
53 char *enchant_get_user_language(void);
-
54 
-
66 char *enchant_get_user_config_dir (void);
-
67 
-
76 char *enchant_provider_get_user_dict_dir (EnchantProvider * provider);
-
77 
-
91 GSList *enchant_get_conf_dirs (void);
-
92 
-
103 char *enchant_get_prefix_dir(void);
-
104 
-
113 char *enchant_relocate (const char *path);
-
114 
-
120 EnchantDict *enchant_broker_new_dict (EnchantBroker *broker);
-
121 
-
130 void enchant_dict_set_error (EnchantDict * dict, const char * const err);
-
131 
-
137 EnchantProvider *enchant_provider_new (void);
-
138 
-
147 void enchant_provider_set_error (EnchantProvider * provider, const char * const err);
-
148 
-
149 typedef struct _EnchantDictPrivate *EnchantDictPrivate;
-
150 
-
151 struct _EnchantDict
-
152 {
-
153  GTypeInstance parent_instance;
-
154  volatile int ref_count;
-
155  EnchantDictPrivate * priv;
-
156  void *user_data;
-
157  void *enchant_private_data;
-
158 
-
159  int (*check) (struct _EnchantDict * me, const char *const word,
-
160  size_t len);
-
161 
-
162  /* returns utf8*/
-
163  char **(*suggest) (struct _EnchantDict * me,
-
164  const char *const word, size_t len,
-
165  size_t * out_n_suggs);
-
166 
-
167  void (*add_to_session) (struct _EnchantDict * me,
-
168  const char *const word, size_t len);
-
169 
-
170  void (*remove_from_session) (struct _EnchantDict * me,
-
171  const char *const word, size_t len);
-
172 
-
173  const char * (*get_extra_word_characters) (struct _EnchantDict * me);
-
174 
-
175  int (*is_word_character) (struct _EnchantDict * me,
-
176  uint32_t uc_in, size_t n);
-
177 };
-
178 
-
179 typedef struct _EnchantProviderPrivate *EnchantProviderPrivate;
-
180 
-
181 struct _EnchantProvider {
-
182  GTypeInstance parent_instance;
-
183  volatile int ref_count;
-
184  EnchantProviderPrivate * priv;
-
185  void* user_data;
-
186  void* enchant_private_data;
-
187  EnchantBroker* owner;
-
188 
-
189  void (*dispose) (struct _EnchantProvider * me);
-
190 
-
191  EnchantDict *(*request_dict) (struct _EnchantProvider * me,
-
192  const char *const tag);
-
193 
-
194  void (*dispose_dict) (struct _EnchantProvider * me,
-
195  EnchantDict * dict);
-
196 
-
197  int (*dictionary_exists) (struct _EnchantProvider * me,
-
198  const char *const tag);
-
199 
-
200  /* returns utf8*/
-
201  const char * (*identify) (struct _EnchantProvider * me);
-
202  /* returns utf8*/
-
203  const char * (*describe) (struct _EnchantProvider * me);
-
204 
-
205  char ** (*list_dicts) (struct _EnchantProvider * me,
-
206  size_t * out_n_dicts);
-
207 };
-
208 
-
216 EnchantDict *composite_provider_create_dict (GSList *dicts);
-
217 
-
218 #ifdef __cplusplus
-
219 }
-
220 #endif
-
221 
-
222 #endif /* ENCHANT_PROVIDER_H */
- -
Definition: broker.c:147
-
Definition: broker.c:196
-
Definition: broker.c:154
-
-
- - - - diff --git a/doxygen/html/inherit_graph_10.map b/doxygen/html/inherit_graph_10.map deleted file mode 100644 index bde78d96..00000000 --- a/doxygen/html/inherit_graph_10.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_10.md5 b/doxygen/html/inherit_graph_10.md5 deleted file mode 100644 index 391b5ea4..00000000 --- a/doxygen/html/inherit_graph_10.md5 +++ /dev/null @@ -1 +0,0 @@ -267630a27e2ef1c540d8a61317319431 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_10.png b/doxygen/html/inherit_graph_10.png deleted file mode 100644 index 6e5539e8..00000000 Binary files a/doxygen/html/inherit_graph_10.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_11.map b/doxygen/html/inherit_graph_11.map deleted file mode 100644 index 7272303d..00000000 --- a/doxygen/html/inherit_graph_11.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_11.md5 b/doxygen/html/inherit_graph_11.md5 deleted file mode 100644 index 456b8d80..00000000 --- a/doxygen/html/inherit_graph_11.md5 +++ /dev/null @@ -1 +0,0 @@ -1d62ed0d3660e9c27392776ece635138 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_11.png b/doxygen/html/inherit_graph_11.png deleted file mode 100644 index f9358b81..00000000 Binary files a/doxygen/html/inherit_graph_11.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_12.map b/doxygen/html/inherit_graph_12.map deleted file mode 100644 index ec23308e..00000000 --- a/doxygen/html/inherit_graph_12.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_12.md5 b/doxygen/html/inherit_graph_12.md5 deleted file mode 100644 index 9a9828f6..00000000 --- a/doxygen/html/inherit_graph_12.md5 +++ /dev/null @@ -1 +0,0 @@ -ac4bcf3afcb07eeb5e1dfd43b47dbcbd \ No newline at end of file diff --git a/doxygen/html/inherit_graph_12.png b/doxygen/html/inherit_graph_12.png deleted file mode 100644 index f4ca13bd..00000000 Binary files a/doxygen/html/inherit_graph_12.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_13.map b/doxygen/html/inherit_graph_13.map deleted file mode 100644 index d4a05a31..00000000 --- a/doxygen/html/inherit_graph_13.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_13.md5 b/doxygen/html/inherit_graph_13.md5 deleted file mode 100644 index 45b673e1..00000000 --- a/doxygen/html/inherit_graph_13.md5 +++ /dev/null @@ -1 +0,0 @@ -e2fe1a6033dfe419f9a028dbde74f525 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_13.png b/doxygen/html/inherit_graph_13.png deleted file mode 100644 index 2e677037..00000000 Binary files a/doxygen/html/inherit_graph_13.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_14.map b/doxygen/html/inherit_graph_14.map deleted file mode 100644 index 94469f61..00000000 --- a/doxygen/html/inherit_graph_14.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_14.md5 b/doxygen/html/inherit_graph_14.md5 deleted file mode 100644 index 70a670fd..00000000 --- a/doxygen/html/inherit_graph_14.md5 +++ /dev/null @@ -1 +0,0 @@ -4a31ea244e4c94c9c5afc201749b9458 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_14.png b/doxygen/html/inherit_graph_14.png deleted file mode 100644 index 635dd9dd..00000000 Binary files a/doxygen/html/inherit_graph_14.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_15.map b/doxygen/html/inherit_graph_15.map deleted file mode 100644 index 8d938dba..00000000 --- a/doxygen/html/inherit_graph_15.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_15.md5 b/doxygen/html/inherit_graph_15.md5 deleted file mode 100644 index b3a7d380..00000000 --- a/doxygen/html/inherit_graph_15.md5 +++ /dev/null @@ -1 +0,0 @@ -56e4883d31c73e59d45f8bb057360444 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_15.png b/doxygen/html/inherit_graph_15.png deleted file mode 100644 index 4f5df83d..00000000 Binary files a/doxygen/html/inherit_graph_15.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_16.map b/doxygen/html/inherit_graph_16.map deleted file mode 100644 index 06538194..00000000 --- a/doxygen/html/inherit_graph_16.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_16.md5 b/doxygen/html/inherit_graph_16.md5 deleted file mode 100644 index 2627747b..00000000 --- a/doxygen/html/inherit_graph_16.md5 +++ /dev/null @@ -1 +0,0 @@ -090114f30e9051e37bd207179fcea1e3 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_16.png b/doxygen/html/inherit_graph_16.png deleted file mode 100644 index f4857e98..00000000 Binary files a/doxygen/html/inherit_graph_16.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_17.map b/doxygen/html/inherit_graph_17.map deleted file mode 100644 index cf09061d..00000000 --- a/doxygen/html/inherit_graph_17.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_17.md5 b/doxygen/html/inherit_graph_17.md5 deleted file mode 100644 index 3e5e6dec..00000000 --- a/doxygen/html/inherit_graph_17.md5 +++ /dev/null @@ -1 +0,0 @@ -ef6aae001ef9032fc33155189007c152 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_17.png b/doxygen/html/inherit_graph_17.png deleted file mode 100644 index d5022deb..00000000 Binary files a/doxygen/html/inherit_graph_17.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_18.map b/doxygen/html/inherit_graph_18.map deleted file mode 100644 index bc1a2c8b..00000000 --- a/doxygen/html/inherit_graph_18.map +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/doxygen/html/inherit_graph_18.md5 b/doxygen/html/inherit_graph_18.md5 deleted file mode 100644 index c8bd9a70..00000000 --- a/doxygen/html/inherit_graph_18.md5 +++ /dev/null @@ -1 +0,0 @@ -f889f20b274878a0d96b48c44d1dd37e \ No newline at end of file diff --git a/doxygen/html/inherit_graph_18.png b/doxygen/html/inherit_graph_18.png deleted file mode 100644 index f6cff19f..00000000 Binary files a/doxygen/html/inherit_graph_18.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_3.map b/doxygen/html/inherit_graph_3.map deleted file mode 100644 index 231bdc97..00000000 --- a/doxygen/html/inherit_graph_3.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_3.md5 b/doxygen/html/inherit_graph_3.md5 deleted file mode 100644 index 209901d0..00000000 --- a/doxygen/html/inherit_graph_3.md5 +++ /dev/null @@ -1 +0,0 @@ -4583bf0522c52f20a7c31ee6e52ae844 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_3.png b/doxygen/html/inherit_graph_3.png deleted file mode 100644 index 3cd2465e..00000000 Binary files a/doxygen/html/inherit_graph_3.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_4.map b/doxygen/html/inherit_graph_4.map deleted file mode 100644 index c7275b02..00000000 --- a/doxygen/html/inherit_graph_4.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_4.md5 b/doxygen/html/inherit_graph_4.md5 deleted file mode 100644 index 6be8b630..00000000 --- a/doxygen/html/inherit_graph_4.md5 +++ /dev/null @@ -1 +0,0 @@ -23c405c7bf24c638339f9514aa19efe3 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_4.png b/doxygen/html/inherit_graph_4.png deleted file mode 100644 index 13ddd7f2..00000000 Binary files a/doxygen/html/inherit_graph_4.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_5.map b/doxygen/html/inherit_graph_5.map deleted file mode 100644 index e3fc5431..00000000 --- a/doxygen/html/inherit_graph_5.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_5.md5 b/doxygen/html/inherit_graph_5.md5 deleted file mode 100644 index 1895a991..00000000 --- a/doxygen/html/inherit_graph_5.md5 +++ /dev/null @@ -1 +0,0 @@ -d65bff7d47058d87ea9f8bdfff921bf0 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_5.png b/doxygen/html/inherit_graph_5.png deleted file mode 100644 index c9f8ed36..00000000 Binary files a/doxygen/html/inherit_graph_5.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_6.map b/doxygen/html/inherit_graph_6.map deleted file mode 100644 index 91b11ed8..00000000 --- a/doxygen/html/inherit_graph_6.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_6.md5 b/doxygen/html/inherit_graph_6.md5 deleted file mode 100644 index 764c8f74..00000000 --- a/doxygen/html/inherit_graph_6.md5 +++ /dev/null @@ -1 +0,0 @@ -6657e9ce633a5e6d37cb0d5de8b4e0d6 \ No newline at end of file diff --git a/doxygen/html/inherit_graph_6.png b/doxygen/html/inherit_graph_6.png deleted file mode 100644 index be2dfc72..00000000 Binary files a/doxygen/html/inherit_graph_6.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_7.map b/doxygen/html/inherit_graph_7.map deleted file mode 100644 index 31a92518..00000000 --- a/doxygen/html/inherit_graph_7.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_7.md5 b/doxygen/html/inherit_graph_7.md5 deleted file mode 100644 index ab3783f6..00000000 --- a/doxygen/html/inherit_graph_7.md5 +++ /dev/null @@ -1 +0,0 @@ -39a081b5db8c2fc8838d9233baf0ee8a \ No newline at end of file diff --git a/doxygen/html/inherit_graph_7.png b/doxygen/html/inherit_graph_7.png deleted file mode 100644 index e2661a87..00000000 Binary files a/doxygen/html/inherit_graph_7.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_8.map b/doxygen/html/inherit_graph_8.map deleted file mode 100644 index dd2f77b6..00000000 --- a/doxygen/html/inherit_graph_8.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_8.md5 b/doxygen/html/inherit_graph_8.md5 deleted file mode 100644 index 40c5dad5..00000000 --- a/doxygen/html/inherit_graph_8.md5 +++ /dev/null @@ -1 +0,0 @@ -2def8f0734e7e60d5c8e62fe1f3d810e \ No newline at end of file diff --git a/doxygen/html/inherit_graph_8.png b/doxygen/html/inherit_graph_8.png deleted file mode 100644 index 6bb22b9b..00000000 Binary files a/doxygen/html/inherit_graph_8.png and /dev/null differ diff --git a/doxygen/html/inherit_graph_9.map b/doxygen/html/inherit_graph_9.map deleted file mode 100644 index d1a02eb6..00000000 --- a/doxygen/html/inherit_graph_9.map +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/doxygen/html/inherit_graph_9.md5 b/doxygen/html/inherit_graph_9.md5 deleted file mode 100644 index 99bb1b58..00000000 --- a/doxygen/html/inherit_graph_9.md5 +++ /dev/null @@ -1 +0,0 @@ -7f94640f202664fff048f239ddff03eb \ No newline at end of file diff --git a/doxygen/html/inherit_graph_9.png b/doxygen/html/inherit_graph_9.png deleted file mode 100644 index 8bb2a22d..00000000 Binary files a/doxygen/html/inherit_graph_9.png and /dev/null differ diff --git a/doxygen/html/pwl_8h_source.html b/doxygen/html/pwl_8h_source.html deleted file mode 100644 index 0c872230..00000000 --- a/doxygen/html/pwl_8h_source.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - -Enchant: lib/pwl.h Source File - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
pwl.h
-
-
-
1 /* enchant
-
2  * Copyright (C) 2003 Dom Lachowicz
-
3  * Copyright (C) 2016-2023 Reuben Thomas
-
4  *
-
5  * This library is free software; you can redistribute it and/or
-
6  * modify it under the terms of the GNU Lesser General Public
-
7  * License as published by the Free Software Foundation; either
-
8  * version 2.1 of the License, or (at your option) any later version.
-
9  *
-
10  * This library is distributed in the hope that it will be useful,
-
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-
13  * Lesser General Public License for more details.
-
14  *
-
15  * You should have received a copy of the GNU Lesser General Public License
-
16  * along along with this program; if not, see
-
17  * <https://www.gnu.org/licenses/>.
-
18  *
-
19  * In addition, as a special exception, the copyright holders
-
20  * give permission to link the code of this program with
-
21  * non-LGPL Spelling Provider libraries (eg: a MSFT Office
-
22  * spell checker backend) and distribute linked combinations including
-
23  * the two. You must obey the GNU Lesser General Public License in all
-
24  * respects for all of the code used other than said providers. If you modify
-
25  * this file, you may extend this exception to your version of the
-
26  * file, but you are not obligated to do so. If you do not wish to
-
27  * do so, delete this exception statement from your version.
-
28  */
-
29 
-
30 #ifndef PWL_H
-
31 #define PWL_H
-
32 
-
33 #include "enchant.h"
-
34 
-
35 #ifdef __cplusplus
-
36 extern "C" {
-
37 #endif
-
38 
-
39 typedef struct str_enchant_pwl EnchantPWL;
-
40 
-
41 /* Create and initialise a new, empty PWL */
-
42 EnchantPWL* enchant_pwl_init(void);
-
43 EnchantPWL* enchant_pwl_init_with_file(const char * file);
-
44 
-
45 void enchant_pwl_add(EnchantPWL * me, const char *const word, ssize_t len);
-
46 void enchant_pwl_remove(EnchantPWL * me, const char *const word, ssize_t len);
-
47 int enchant_pwl_check(EnchantPWL * me, const char *const word, ssize_t len);
-
48 void enchant_pwl_free(EnchantPWL* me);
-
49 
-
50 #ifdef __cplusplus
-
51 }
-
52 #endif
-
53 
-
54 #endif /* PWL_H */
- -
Definition: pwl.c:79
-
-
- - - - diff --git a/doxygen/html/search/all_3.html b/doxygen/html/search/all_3.html deleted file mode 100644 index 39767b85..00000000 --- a/doxygen/html/search/all_3.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doxygen/html/search/all_3.js b/doxygen/html/search/all_3.js deleted file mode 100644 index ea0c6658..00000000 --- a/doxygen/html/search/all_3.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['dict_18',['Dict',['../classenchant_1_1Dict.html',1,'enchant']]] -]; diff --git a/doxygen/html/search/all_4.html b/doxygen/html/search/all_4.html deleted file mode 100644 index fc40463c..00000000 --- a/doxygen/html/search/all_4.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doxygen/html/search/all_4.js b/doxygen/html/search/all_4.js deleted file mode 100644 index c9c38fa2..00000000 --- a/doxygen/html/search/all_4.js +++ /dev/null @@ -1,31 +0,0 @@ -var searchData= -[ - ['enchant_2eh_19',['enchant.h',['../enchant_8h.html',1,'']]], - ['enchant_5fbroker_5fdict_5fexists_20',['enchant_broker_dict_exists',['../enchant_8h.html#a86b33de92d029e5992f7ce91b5a1af7a',1,'enchant.h']]], - ['enchant_5fbroker_5ffree_21',['enchant_broker_free',['../enchant_8h.html#a5bc072d4219ef87b356c98fb2b17285d',1,'broker.c']]], - ['enchant_5fbroker_5ffree_5fdict_22',['enchant_broker_free_dict',['../enchant_8h.html#ab5ccc8d6c8786eacb86db6545db191fc',1,'broker.c']]], - ['enchant_5fbroker_5fget_5ferror_23',['enchant_broker_get_error',['../enchant_8h.html#af86d247b5659355f980f25259f87152a',1,'broker.c']]], - ['enchant_5fbroker_5finit_24',['enchant_broker_init',['../enchant_8h.html#a522f99adcebfeb75479b08583e22a73b',1,'broker.c']]], - ['enchant_5fbroker_5frequest_5fdict_25',['enchant_broker_request_dict',['../enchant_8h.html#a3e35f16fba7e2fd0bbc3c2b4d3a9b348',1,'enchant.h']]], - ['enchant_5fbroker_5frequest_5fdict_5fwith_5fpwl_26',['enchant_broker_request_dict_with_pwl',['../enchant_8h.html#a1be37fcb41affc4df61456934fb9285a',1,'enchant.h']]], - ['enchant_5fbroker_5frequest_5fpwl_5fdict_27',['enchant_broker_request_pwl_dict',['../enchant_8h.html#a8c306936bd023ff3f640186311ea89da',1,'enchant.h']]], - ['enchant_5fbroker_5fset_5fordering_28',['enchant_broker_set_ordering',['../enchant_8h.html#a0df3477d50a3c7d2f2d8cb4b2629871f',1,'enchant.h']]], - ['enchant_5fdict_5fadd_29',['enchant_dict_add',['../enchant_8h.html#ad43bcd8c01a03f7bee462c7956ca659a',1,'enchant.h']]], - ['enchant_5fdict_5fadd_5fto_5fsession_30',['enchant_dict_add_to_session',['../enchant_8h.html#a95ae78fc67e8af8e5adecf8822d307b5',1,'enchant.h']]], - ['enchant_5fdict_5fcheck_31',['enchant_dict_check',['../enchant_8h.html#af4fba3a4aa3c2619238c47a006ae77a3',1,'enchant.h']]], - ['enchant_5fdict_5fdescribe_32',['enchant_dict_describe',['../enchant_8h.html#a9c0caedc9fba2884d79b572c92460801',1,'dict.c']]], - ['enchant_5fdict_5ffree_5fstring_5flist_33',['enchant_dict_free_string_list',['../enchant_8h.html#ac5905848a3d7342bd5f2124a5f4563ec',1,'enchant.h']]], - ['enchant_5fdict_5fget_5ferror_34',['enchant_dict_get_error',['../enchant_8h.html#a60b563b07b51327e2224612fc7ed15c2',1,'dict.c']]], - ['enchant_5fdict_5fget_5fextra_5fword_5fcharacters_35',['enchant_dict_get_extra_word_characters',['../enchant_8h.html#a3125d7ce1a2ec8f532bc4221b9c1d41c',1,'enchant.h']]], - ['enchant_5fdict_5fis_5fadded_36',['enchant_dict_is_added',['../enchant_8h.html#a746d3fb3a35346be0009bc50452cf330',1,'enchant.h']]], - ['enchant_5fdict_5fis_5fremoved_37',['enchant_dict_is_removed',['../enchant_8h.html#ad616d47eeb0ab7e1a7db158f0d4bde07',1,'enchant.h']]], - ['enchant_5fdict_5fis_5fword_5fcharacter_38',['enchant_dict_is_word_character',['../enchant_8h.html#a31b5162ee1039b3289458429620f1954',1,'enchant.h']]], - ['enchant_5fdict_5fremove_39',['enchant_dict_remove',['../enchant_8h.html#af25d45a0b62a7eba72b020292ade061b',1,'enchant.h']]], - ['enchant_5fdict_5fremove_5ffrom_5fsession_40',['enchant_dict_remove_from_session',['../enchant_8h.html#a2fad6dc171d28cf184a1c2823ab6a702',1,'enchant.h']]], - ['enchant_5fdict_5fstore_5freplacement_41',['enchant_dict_store_replacement',['../enchant_8h.html#a0201b7beed5d5122835a02b41f7213e6',1,'enchant.h']]], - ['enchant_5fdict_5fsuggest_42',['enchant_dict_suggest',['../enchant_8h.html#a457fe52741e5cedae922776f4060a9c4',1,'enchant.h']]], - ['enchant_5fset_5fprefix_5fdir_43',['enchant_set_prefix_dir',['../enchant_8h.html#a0e121c0d31f4f8c6aca4825d82c879b9',1,'enchant.h']]], - ['enchantbrokerdescribefn_44',['EnchantBrokerDescribeFn',['../enchant_8h.html#a028e0e8bfcbbdb605868151c602b73ec',1,'enchant.h']]], - ['enchantdictdescribefn_45',['EnchantDictDescribeFn',['../enchant_8h.html#ad554f6e4788e95bd4119c00f49f6ddcc',1,'enchant.h']]], - ['exception_46',['Exception',['../classenchant_1_1Exception.html',1,'enchant']]] -]; diff --git a/doxygen/html/search/classes_3.html b/doxygen/html/search/classes_3.html deleted file mode 100644 index d33343bc..00000000 --- a/doxygen/html/search/classes_3.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doxygen/html/search/classes_3.js b/doxygen/html/search/classes_3.js deleted file mode 100644 index 2d6ca426..00000000 --- a/doxygen/html/search/classes_3.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['exception_65',['Exception',['../classenchant_1_1Exception.html',1,'enchant']]] -]; diff --git a/doxygen/html/search/functions_1.html b/doxygen/html/search/functions_1.html deleted file mode 100644 index ef4088b8..00000000 --- a/doxygen/html/search/functions_1.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doxygen/html/search/functions_1.js b/doxygen/html/search/functions_1.js deleted file mode 100644 index 3ecf3fdb..00000000 --- a/doxygen/html/search/functions_1.js +++ /dev/null @@ -1,27 +0,0 @@ -var searchData= -[ - ['enchant_5fbroker_5fdict_5fexists_68',['enchant_broker_dict_exists',['../enchant_8h.html#a86b33de92d029e5992f7ce91b5a1af7a',1,'enchant.h']]], - ['enchant_5fbroker_5ffree_69',['enchant_broker_free',['../enchant_8h.html#a5bc072d4219ef87b356c98fb2b17285d',1,'broker.c']]], - ['enchant_5fbroker_5ffree_5fdict_70',['enchant_broker_free_dict',['../enchant_8h.html#ab5ccc8d6c8786eacb86db6545db191fc',1,'broker.c']]], - ['enchant_5fbroker_5fget_5ferror_71',['enchant_broker_get_error',['../enchant_8h.html#af86d247b5659355f980f25259f87152a',1,'broker.c']]], - ['enchant_5fbroker_5finit_72',['enchant_broker_init',['../enchant_8h.html#a522f99adcebfeb75479b08583e22a73b',1,'broker.c']]], - ['enchant_5fbroker_5frequest_5fdict_73',['enchant_broker_request_dict',['../enchant_8h.html#a3e35f16fba7e2fd0bbc3c2b4d3a9b348',1,'enchant.h']]], - ['enchant_5fbroker_5frequest_5fdict_5fwith_5fpwl_74',['enchant_broker_request_dict_with_pwl',['../enchant_8h.html#a1be37fcb41affc4df61456934fb9285a',1,'enchant.h']]], - ['enchant_5fbroker_5frequest_5fpwl_5fdict_75',['enchant_broker_request_pwl_dict',['../enchant_8h.html#a8c306936bd023ff3f640186311ea89da',1,'enchant.h']]], - ['enchant_5fbroker_5fset_5fordering_76',['enchant_broker_set_ordering',['../enchant_8h.html#a0df3477d50a3c7d2f2d8cb4b2629871f',1,'enchant.h']]], - ['enchant_5fdict_5fadd_77',['enchant_dict_add',['../enchant_8h.html#ad43bcd8c01a03f7bee462c7956ca659a',1,'enchant.h']]], - ['enchant_5fdict_5fadd_5fto_5fsession_78',['enchant_dict_add_to_session',['../enchant_8h.html#a95ae78fc67e8af8e5adecf8822d307b5',1,'enchant.h']]], - ['enchant_5fdict_5fcheck_79',['enchant_dict_check',['../enchant_8h.html#af4fba3a4aa3c2619238c47a006ae77a3',1,'enchant.h']]], - ['enchant_5fdict_5fdescribe_80',['enchant_dict_describe',['../enchant_8h.html#a9c0caedc9fba2884d79b572c92460801',1,'dict.c']]], - ['enchant_5fdict_5ffree_5fstring_5flist_81',['enchant_dict_free_string_list',['../enchant_8h.html#ac5905848a3d7342bd5f2124a5f4563ec',1,'enchant.h']]], - ['enchant_5fdict_5fget_5ferror_82',['enchant_dict_get_error',['../enchant_8h.html#a60b563b07b51327e2224612fc7ed15c2',1,'dict.c']]], - ['enchant_5fdict_5fget_5fextra_5fword_5fcharacters_83',['enchant_dict_get_extra_word_characters',['../enchant_8h.html#a3125d7ce1a2ec8f532bc4221b9c1d41c',1,'enchant.h']]], - ['enchant_5fdict_5fis_5fadded_84',['enchant_dict_is_added',['../enchant_8h.html#a746d3fb3a35346be0009bc50452cf330',1,'enchant.h']]], - ['enchant_5fdict_5fis_5fremoved_85',['enchant_dict_is_removed',['../enchant_8h.html#ad616d47eeb0ab7e1a7db158f0d4bde07',1,'enchant.h']]], - ['enchant_5fdict_5fis_5fword_5fcharacter_86',['enchant_dict_is_word_character',['../enchant_8h.html#a31b5162ee1039b3289458429620f1954',1,'enchant.h']]], - ['enchant_5fdict_5fremove_87',['enchant_dict_remove',['../enchant_8h.html#af25d45a0b62a7eba72b020292ade061b',1,'enchant.h']]], - ['enchant_5fdict_5fremove_5ffrom_5fsession_88',['enchant_dict_remove_from_session',['../enchant_8h.html#a2fad6dc171d28cf184a1c2823ab6a702',1,'enchant.h']]], - ['enchant_5fdict_5fstore_5freplacement_89',['enchant_dict_store_replacement',['../enchant_8h.html#a0201b7beed5d5122835a02b41f7213e6',1,'enchant.h']]], - ['enchant_5fdict_5fsuggest_90',['enchant_dict_suggest',['../enchant_8h.html#a457fe52741e5cedae922776f4060a9c4',1,'enchant.h']]], - ['enchant_5fset_5fprefix_5fdir_91',['enchant_set_prefix_dir',['../enchant_8h.html#a0e121c0d31f4f8c6aca4825d82c879b9',1,'enchant.h']]] -]; diff --git a/doxygen/html/struct__EnchantBroker-members.html b/doxygen/html/struct__EnchantBroker-members.html deleted file mode 100644 index aab8ad65..00000000 --- a/doxygen/html/struct__EnchantBroker-members.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantBroker Member List
-
-
- -

This is the complete list of members for _EnchantBroker, including all inherited members.

- - - - - -
_error (defined in _EnchantBroker)_EnchantBroker
dicts (defined in _EnchantBroker)_EnchantBroker
provider_list (defined in _EnchantBroker)_EnchantBroker
provider_ordering (defined in _EnchantBroker)_EnchantBroker
-
- - - - diff --git a/doxygen/html/struct__EnchantBroker.html b/doxygen/html/struct__EnchantBroker.html deleted file mode 100644 index 3381ab57..00000000 --- a/doxygen/html/struct__EnchantBroker.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - -Enchant: _EnchantBroker Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantBroker Struct Reference
-
-
- - - - - - - - - - -

-Public Attributes

-GSList * provider_list
 
-GHashTable * provider_ordering
 
-GHashTable * dicts
 
-gchar * _error
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/broker.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantBroker.js b/doxygen/html/struct__EnchantBroker.js deleted file mode 100644 index 2e15d515..00000000 --- a/doxygen/html/struct__EnchantBroker.js +++ /dev/null @@ -1,7 +0,0 @@ -var struct__EnchantBroker = -[ - [ "_error", "struct__EnchantBroker.html#a88844610d8bba32f8ee527efdc987d9b", null ], - [ "dicts", "struct__EnchantBroker.html#accd6f11dd22ef7cf5060bc709649ff30", null ], - [ "provider_list", "struct__EnchantBroker.html#a1e9e2151bb451d8b7b3e5c1fe6017ad3", null ], - [ "provider_ordering", "struct__EnchantBroker.html#afb3003e5e7ba68c446d0a016e8a8f0f1", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantCompositeDict-members.html b/doxygen/html/struct__EnchantCompositeDict-members.html deleted file mode 100644 index 40ed2758..00000000 --- a/doxygen/html/struct__EnchantCompositeDict-members.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantCompositeDict Member List
-
-
- -

This is the complete list of members for _EnchantCompositeDict, including all inherited members.

- - - - - -
dict_list (defined in _EnchantCompositeDict)_EnchantCompositeDict
parent_instance (defined in _EnchantCompositeDict)_EnchantCompositeDict
priv (defined in _EnchantCompositeDict)_EnchantCompositeDict
ref_count (defined in _EnchantCompositeDict)_EnchantCompositeDict
-
- - - - diff --git a/doxygen/html/struct__EnchantCompositeDict.html b/doxygen/html/struct__EnchantCompositeDict.html deleted file mode 100644 index e696df29..00000000 --- a/doxygen/html/struct__EnchantCompositeDict.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - -Enchant: _EnchantCompositeDict Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantCompositeDict Struct Reference
-
-
- - - - - - - - - - -

-Public Attributes

-GTypeInstance parent_instance
 
-volatile int ref_count
 
-EnchantCompositeDictPrivate * priv
 
-GSList * dict_list
 
-
The documentation for this struct was generated from the following files:
    -
  • lib/broker.c
  • -
  • lib/composite.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantCompositeDict.js b/doxygen/html/struct__EnchantCompositeDict.js deleted file mode 100644 index 5e6512aa..00000000 --- a/doxygen/html/struct__EnchantCompositeDict.js +++ /dev/null @@ -1,7 +0,0 @@ -var struct__EnchantCompositeDict = -[ - [ "dict_list", "struct__EnchantCompositeDict.html#a936c81b376b76b217867177f5c0348a9", null ], - [ "parent_instance", "struct__EnchantCompositeDict.html#a4239b7e1c2903e774a73e37b3b2a216d", null ], - [ "priv", "struct__EnchantCompositeDict.html#a9446022e8b98692d192b6afbe761e129", null ], - [ "ref_count", "struct__EnchantCompositeDict.html#a4c83259121d472610d97e3036ac43d63", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantCompositeDictClass-members.html b/doxygen/html/struct__EnchantCompositeDictClass-members.html deleted file mode 100644 index 6e6764f2..00000000 --- a/doxygen/html/struct__EnchantCompositeDictClass-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantCompositeDictClass Member List
-
-
- -

This is the complete list of members for _EnchantCompositeDictClass, including all inherited members.

- - - -
finalize (defined in _EnchantCompositeDictClass)_EnchantCompositeDictClass
parent_class (defined in _EnchantCompositeDictClass)_EnchantCompositeDictClass
-
- - - - diff --git a/doxygen/html/struct__EnchantCompositeDictClass.html b/doxygen/html/struct__EnchantCompositeDictClass.html deleted file mode 100644 index f7f5572f..00000000 --- a/doxygen/html/struct__EnchantCompositeDictClass.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - -Enchant: _EnchantCompositeDictClass Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantCompositeDictClass Struct Reference
-
-
- - - - - - -

-Public Attributes

-GTypeClass parent_class
 
-void(* finalize )(EnchantCompositeDict *self)
 
-
The documentation for this struct was generated from the following files:
    -
  • lib/broker.c
  • -
  • lib/composite.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantCompositeDictClass.js b/doxygen/html/struct__EnchantCompositeDictClass.js deleted file mode 100644 index 29341f91..00000000 --- a/doxygen/html/struct__EnchantCompositeDictClass.js +++ /dev/null @@ -1,5 +0,0 @@ -var struct__EnchantCompositeDictClass = -[ - [ "finalize", "struct__EnchantCompositeDictClass.html#a41bd15e2ac79c64cd114e7ef2f0ab8bc", null ], - [ "parent_class", "struct__EnchantCompositeDictClass.html#ab269b1b3b2a8f137beb9710c3fe0df58", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantDict-members.html b/doxygen/html/struct__EnchantDict-members.html deleted file mode 100644 index 83c3042c..00000000 --- a/doxygen/html/struct__EnchantDict-members.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantDict Member List
-
-
- -

This is the complete list of members for _EnchantDict, including all inherited members.

- - - - - - - - - - - - - - - - - - - -
add_to_session (defined in _EnchantDict)_EnchantDict
add_to_session_method (defined in _EnchantDict)_EnchantDict
check (defined in _EnchantDict)_EnchantDict
check_method (defined in _EnchantDict)_EnchantDict
enchant_private_data (defined in _EnchantDict)_EnchantDict
get_extra_word_characters (defined in _EnchantDict)_EnchantDict
get_extra_word_characters_method (defined in _EnchantDict)_EnchantDict
is_word_character (defined in _EnchantDict)_EnchantDict
is_word_character_method (defined in _EnchantDict)_EnchantDict
parent_instance (defined in _EnchantDict)_EnchantDict
priv (defined in _EnchantDict)_EnchantDict
ref_count (defined in _EnchantDict)_EnchantDict
remove_from_session (defined in _EnchantDict)_EnchantDict
remove_from_session_method (defined in _EnchantDict)_EnchantDict
session (defined in _EnchantDict)_EnchantDict
suggest (defined in _EnchantDict)_EnchantDict
suggest_method (defined in _EnchantDict)_EnchantDict
user_data (defined in _EnchantDict)_EnchantDict
-
- - - - diff --git a/doxygen/html/struct__EnchantDict.html b/doxygen/html/struct__EnchantDict.html deleted file mode 100644 index 993763cf..00000000 --- a/doxygen/html/struct__EnchantDict.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - -Enchant: _EnchantDict Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantDict Struct Reference
-
-
-
-Collaboration diagram for _EnchantDict:
-
-
Collaboration graph
- - - - - - - -
[legend]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Attributes

-GTypeInstance parent_instance
 
-volatile int ref_count
 
-EnchantDictPrivate * priv
 
-void * user_data
 
-EnchantSessionsession
 
-DictCheck check_method
 
-DictSuggest suggest_method
 
-DictAddToSession add_to_session_method
 
-DictRemoveFromSession remove_from_session_method
 
-DictGetExtraWordCharacters get_extra_word_characters_method
 
-DictIsWordCharacter is_word_character_method
 
-void * enchant_private_data
 
-int(* check )(struct _EnchantDict *me, const char *const word, size_t len)
 
-char **(* suggest )(struct _EnchantDict *me, const char *const word, size_t len, size_t *out_n_suggs)
 
-void(* add_to_session )(struct _EnchantDict *me, const char *const word, size_t len)
 
-void(* remove_from_session )(struct _EnchantDict *me, const char *const word, size_t len)
 
-const char *(* get_extra_word_characters )(struct _EnchantDict *me)
 
-int(* is_word_character )(struct _EnchantDict *me, uint32_t uc_in, size_t n)
 
-
The documentation for this struct was generated from the following files: -
-
- - - - diff --git a/doxygen/html/struct__EnchantDict.js b/doxygen/html/struct__EnchantDict.js deleted file mode 100644 index 9dc2903c..00000000 --- a/doxygen/html/struct__EnchantDict.js +++ /dev/null @@ -1,21 +0,0 @@ -var struct__EnchantDict = -[ - [ "add_to_session", "struct__EnchantDict.html#a37ee5c5607096c9afa8edec9712bbca0", null ], - [ "add_to_session_method", "struct__EnchantDict.html#a47adbf4ade4560fce106e1764e237b40", null ], - [ "check", "struct__EnchantDict.html#ae0e6444e4aaf8245954fb6b7862069fb", null ], - [ "check_method", "struct__EnchantDict.html#abb8f406484da48271d6bc30439a5b1ae", null ], - [ "enchant_private_data", "struct__EnchantDict.html#a5b0952d8e1eee05f911ce6e9c9536200", null ], - [ "get_extra_word_characters", "struct__EnchantDict.html#aee83745d189e847a28bb144daed0af16", null ], - [ "get_extra_word_characters_method", "struct__EnchantDict.html#af563ed7d3ea325ebaf2f9f8c852727df", null ], - [ "is_word_character", "struct__EnchantDict.html#a5e21819cf075937d0c50f3fa7f0629a3", null ], - [ "is_word_character_method", "struct__EnchantDict.html#ad86aab553f2280426d56c4942b2a2410", null ], - [ "parent_instance", "struct__EnchantDict.html#ac6caf6cad5e3542db517fdc00b14bc99", null ], - [ "priv", "struct__EnchantDict.html#a5462dec2e68f57cba971352a98f095b2", null ], - [ "ref_count", "struct__EnchantDict.html#a102eababd52ac5d649e631e8654960a1", null ], - [ "remove_from_session", "struct__EnchantDict.html#ad34e47ed4b9637d24af638497aa6735f", null ], - [ "remove_from_session_method", "struct__EnchantDict.html#a29badc9629eb701b33c254ba92a0fe91", null ], - [ "session", "struct__EnchantDict.html#a31807a31c3c8fdbb634c32675d18f3ba", null ], - [ "suggest", "struct__EnchantDict.html#a6317b645a348bd49707b8e37dbc71748", null ], - [ "suggest_method", "struct__EnchantDict.html#abee2ae77ba6c0676054a0be12aeaf411", null ], - [ "user_data", "struct__EnchantDict.html#aaf661a0737ca915439c2afd31297d46d", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantDictClass-members.html b/doxygen/html/struct__EnchantDictClass-members.html deleted file mode 100644 index 3da0b03c..00000000 --- a/doxygen/html/struct__EnchantDictClass-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantDictClass Member List
-
-
- -

This is the complete list of members for _EnchantDictClass, including all inherited members.

- - - -
finalize (defined in _EnchantDictClass)_EnchantDictClass
parent_class (defined in _EnchantDictClass)_EnchantDictClass
-
- - - - diff --git a/doxygen/html/struct__EnchantDictClass.html b/doxygen/html/struct__EnchantDictClass.html deleted file mode 100644 index ac524e00..00000000 --- a/doxygen/html/struct__EnchantDictClass.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - -Enchant: _EnchantDictClass Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantDictClass Struct Reference
-
-
- - - - - - -

-Public Attributes

-GTypeClass parent_class
 
-void(* finalize )(EnchantDict *self)
 
-
The documentation for this struct was generated from the following files:
    -
  • lib/broker.c
  • -
  • lib/composite.c
  • -
  • lib/dict.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantDictClass.js b/doxygen/html/struct__EnchantDictClass.js deleted file mode 100644 index 62730a33..00000000 --- a/doxygen/html/struct__EnchantDictClass.js +++ /dev/null @@ -1,5 +0,0 @@ -var struct__EnchantDictClass = -[ - [ "finalize", "struct__EnchantDictClass.html#ae2c8001a0966b3584a00e7b5cacb9c5e", null ], - [ "parent_class", "struct__EnchantDictClass.html#a4f6e3964cd52eb3e8aeffad2bd8b8d53", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantDict__coll__graph.map b/doxygen/html/struct__EnchantDict__coll__graph.map deleted file mode 100644 index c5cb26a8..00000000 --- a/doxygen/html/struct__EnchantDict__coll__graph.map +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/doxygen/html/struct__EnchantDict__coll__graph.md5 b/doxygen/html/struct__EnchantDict__coll__graph.md5 deleted file mode 100644 index 821b341a..00000000 --- a/doxygen/html/struct__EnchantDict__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -da6d888db96994c4d130bbab34d54baa \ No newline at end of file diff --git a/doxygen/html/struct__EnchantDict__coll__graph.png b/doxygen/html/struct__EnchantDict__coll__graph.png deleted file mode 100644 index 683ec26a..00000000 Binary files a/doxygen/html/struct__EnchantDict__coll__graph.png and /dev/null differ diff --git a/doxygen/html/struct__EnchantPWL-members.html b/doxygen/html/struct__EnchantPWL-members.html deleted file mode 100644 index 58592dc0..00000000 --- a/doxygen/html/struct__EnchantPWL-members.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantPWL Member List
-
-
- -

This is the complete list of members for _EnchantPWL, including all inherited members.

- - - - - - -
filename (defined in _EnchantPWL)_EnchantPWL
parent_instance (defined in _EnchantPWL)_EnchantPWL
priv (defined in _EnchantPWL)_EnchantPWL
ref_count (defined in _EnchantPWL)_EnchantPWL
words (defined in _EnchantPWL)_EnchantPWL
-
- - - - diff --git a/doxygen/html/struct__EnchantPWL.html b/doxygen/html/struct__EnchantPWL.html deleted file mode 100644 index 5f39d85f..00000000 --- a/doxygen/html/struct__EnchantPWL.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - -Enchant: _EnchantPWL Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantPWL Struct Reference
-
-
- - - - - - - - - - - - -

-Public Attributes

-GTypeInstance parent_instance
 
-volatile int ref_count
 
-EnchantPWLPrivate * priv
 
-gchar * filename
 
-GHashTable * words
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/pwl.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantPWL.js b/doxygen/html/struct__EnchantPWL.js deleted file mode 100644 index ed28c6ef..00000000 --- a/doxygen/html/struct__EnchantPWL.js +++ /dev/null @@ -1,8 +0,0 @@ -var struct__EnchantPWL = -[ - [ "filename", "struct__EnchantPWL.html#a53d4a20126b39c7f1b0532504315f6a9", null ], - [ "parent_instance", "struct__EnchantPWL.html#a5683ad4455502ba42adf3916459599dc", null ], - [ "priv", "struct__EnchantPWL.html#ac976f15c0106bc099ab0f011390dc04b", null ], - [ "ref_count", "struct__EnchantPWL.html#a7a71181d7983144f3ff93dbf40d84625", null ], - [ "words", "struct__EnchantPWL.html#a9a38b5d08e6582bd6eb5d9dd4e7e7b51", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantPWLClass-members.html b/doxygen/html/struct__EnchantPWLClass-members.html deleted file mode 100644 index 7edc9120..00000000 --- a/doxygen/html/struct__EnchantPWLClass-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantPWLClass Member List
-
-
- -

This is the complete list of members for _EnchantPWLClass, including all inherited members.

- - - -
finalize (defined in _EnchantPWLClass)_EnchantPWLClass
parent_class (defined in _EnchantPWLClass)_EnchantPWLClass
-
- - - - diff --git a/doxygen/html/struct__EnchantPWLClass.html b/doxygen/html/struct__EnchantPWLClass.html deleted file mode 100644 index 7139a581..00000000 --- a/doxygen/html/struct__EnchantPWLClass.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - -Enchant: _EnchantPWLClass Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantPWLClass Struct Reference
-
-
- - - - - - -

-Public Attributes

-GTypeClass parent_class
 
-void(* finalize )(EnchantPWL *self)
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/pwl.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantPWLClass.js b/doxygen/html/struct__EnchantPWLClass.js deleted file mode 100644 index b1fb8bca..00000000 --- a/doxygen/html/struct__EnchantPWLClass.js +++ /dev/null @@ -1,5 +0,0 @@ -var struct__EnchantPWLClass = -[ - [ "finalize", "struct__EnchantPWLClass.html#ab47e9c70dda9bb94ffacaac60d9a999b", null ], - [ "parent_class", "struct__EnchantPWLClass.html#ab888967be9df774538c4882f90084b7d", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantProvider-members.html b/doxygen/html/struct__EnchantProvider-members.html deleted file mode 100644 index 3d4df315..00000000 --- a/doxygen/html/struct__EnchantProvider-members.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantProvider Member List
-
-
- -

This is the complete list of members for _EnchantProvider, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - -
describe (defined in _EnchantProvider)_EnchantProvider
describe (defined in _EnchantProvider)_EnchantProvider
dictionary_exists (defined in _EnchantProvider)_EnchantProvider
dictionary_exists (defined in _EnchantProvider)_EnchantProvider
dispose (defined in _EnchantProvider)_EnchantProvider
dispose (defined in _EnchantProvider)_EnchantProvider
dispose_dict (defined in _EnchantProvider)_EnchantProvider
dispose_dict (defined in _EnchantProvider)_EnchantProvider
enchant_private_data (defined in _EnchantProvider)_EnchantProvider
identify (defined in _EnchantProvider)_EnchantProvider
identify (defined in _EnchantProvider)_EnchantProvider
list_dicts (defined in _EnchantProvider)_EnchantProvider
list_dicts (defined in _EnchantProvider)_EnchantProvider
module (defined in _EnchantProvider)_EnchantProvider
owner (defined in _EnchantProvider)_EnchantProvider
parent_instance (defined in _EnchantProvider)_EnchantProvider
priv (defined in _EnchantProvider)_EnchantProvider
ref_count (defined in _EnchantProvider)_EnchantProvider
request_dict (defined in _EnchantProvider)_EnchantProvider
request_dict (defined in _EnchantProvider)_EnchantProvider
user_data (defined in _EnchantProvider)_EnchantProvider
-
- - - - diff --git a/doxygen/html/struct__EnchantProvider.html b/doxygen/html/struct__EnchantProvider.html deleted file mode 100644 index 50d936b1..00000000 --- a/doxygen/html/struct__EnchantProvider.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - -Enchant: _EnchantProvider Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantProvider Struct Reference
-
-
-
-Collaboration diagram for _EnchantProvider:
-
-
Collaboration graph
- - - - - - - -
[legend]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Attributes

-GTypeInstance parent_instance
 
-volatile int ref_count
 
-EnchantProviderPrivate * priv
 
-void * user_data
 
-GModule * module
 
-EnchantBrokerowner
 
-ProviderDispose dispose
 
-ProviderRequestDict request_dict
 
-ProviderDisposeDict dispose_dict
 
-ProviderDictionaryExists dictionary_exists
 
-ProviderIdentify identify
 
-ProviderDescribe describe
 
-ProviderListDicts list_dicts
 
-void * enchant_private_data
 
-void(* dispose )(struct _EnchantProvider *me)
 
-EnchantDict *(* request_dict )(struct _EnchantProvider *me, const char *const tag)
 
-void(* dispose_dict )(struct _EnchantProvider *me, EnchantDict *dict)
 
-int(* dictionary_exists )(struct _EnchantProvider *me, const char *const tag)
 
-const char *(* identify )(struct _EnchantProvider *me)
 
-const char *(* describe )(struct _EnchantProvider *me)
 
-char **(* list_dicts )(struct _EnchantProvider *me, size_t *out_n_dicts)
 
-
The documentation for this struct was generated from the following files: -
-
- - - - diff --git a/doxygen/html/struct__EnchantProvider.js b/doxygen/html/struct__EnchantProvider.js deleted file mode 100644 index 3e7b0147..00000000 --- a/doxygen/html/struct__EnchantProvider.js +++ /dev/null @@ -1,24 +0,0 @@ -var struct__EnchantProvider = -[ - [ "describe", "struct__EnchantProvider.html#a5e8aa6726aacc87f76fbf36e01fe4acd", null ], - [ "describe", "struct__EnchantProvider.html#a5b7b828b2705f496b9fbbf749ffeee6a", null ], - [ "dictionary_exists", "struct__EnchantProvider.html#a5a6194783f649ac3db4960dd81deb581", null ], - [ "dictionary_exists", "struct__EnchantProvider.html#a2da784f6922178166d666a0e5fedf312", null ], - [ "dispose", "struct__EnchantProvider.html#adbf945b88a79660a939d21df260f8e75", null ], - [ "dispose", "struct__EnchantProvider.html#ac2801031e913d96d2b9ebc3c6ffa4d51", null ], - [ "dispose_dict", "struct__EnchantProvider.html#af9d38487a4c3b48274abd0ec4c2781e3", null ], - [ "dispose_dict", "struct__EnchantProvider.html#aebfdc96ca16eebf83eb402c7776ff36f", null ], - [ "enchant_private_data", "struct__EnchantProvider.html#a00df3ed87e9fa4f4f35c85fd51e1caa0", null ], - [ "identify", "struct__EnchantProvider.html#a40cce0f2747334aa161f563f2249307d", null ], - [ "identify", "struct__EnchantProvider.html#a6bfdf5c4967a66c2992a9193cb9eef37", null ], - [ "list_dicts", "struct__EnchantProvider.html#a1f9383f3fed04a4047885b3baac8b5d8", null ], - [ "list_dicts", "struct__EnchantProvider.html#a6ccef138077cb054be5f46afb086cf0d", null ], - [ "module", "struct__EnchantProvider.html#a0d5fe95c1cbdc3528689892e54d27b89", null ], - [ "owner", "struct__EnchantProvider.html#a90c030eb107ad5170e090caa9b024bf2", null ], - [ "parent_instance", "struct__EnchantProvider.html#ab809fc8ea27990f981ea21e7326c5d08", null ], - [ "priv", "struct__EnchantProvider.html#a7acd093af81f869aa66f3421eb5cdbe0", null ], - [ "ref_count", "struct__EnchantProvider.html#ac667e633d27b13c813b8b273fc09771f", null ], - [ "request_dict", "struct__EnchantProvider.html#a2cc8f06fd4b148a467fd175b8fef6aa0", null ], - [ "request_dict", "struct__EnchantProvider.html#ac20f3aa0101c25e560bce4380da35eb0", null ], - [ "user_data", "struct__EnchantProvider.html#ac5eb53fa1f5f11fd6209b8aa980e1a80", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantProviderClass-members.html b/doxygen/html/struct__EnchantProviderClass-members.html deleted file mode 100644 index 2335522e..00000000 --- a/doxygen/html/struct__EnchantProviderClass-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantProviderClass Member List
-
-
- -

This is the complete list of members for _EnchantProviderClass, including all inherited members.

- - - -
finalize (defined in _EnchantProviderClass)_EnchantProviderClass
parent_class (defined in _EnchantProviderClass)_EnchantProviderClass
-
- - - - diff --git a/doxygen/html/struct__EnchantProviderClass.html b/doxygen/html/struct__EnchantProviderClass.html deleted file mode 100644 index 27e97cbd..00000000 --- a/doxygen/html/struct__EnchantProviderClass.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - -Enchant: _EnchantProviderClass Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantProviderClass Struct Reference
-
-
- - - - - - -

-Public Attributes

-GTypeClass parent_class
 
-void(* finalize )(EnchantProvider *self)
 
-
The documentation for this struct was generated from the following files:
    -
  • lib/broker.c
  • -
  • lib/dict.c
  • -
  • lib/provider.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantProviderClass.js b/doxygen/html/struct__EnchantProviderClass.js deleted file mode 100644 index de9cdf10..00000000 --- a/doxygen/html/struct__EnchantProviderClass.js +++ /dev/null @@ -1,5 +0,0 @@ -var struct__EnchantProviderClass = -[ - [ "finalize", "struct__EnchantProviderClass.html#ab51c3f89cac1b01c4e872cb7f950e5a0", null ], - [ "parent_class", "struct__EnchantProviderClass.html#a88bb3b4f60fb962dc0b12e6c60349234", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantProvider__coll__graph.map b/doxygen/html/struct__EnchantProvider__coll__graph.map deleted file mode 100644 index de85aa79..00000000 --- a/doxygen/html/struct__EnchantProvider__coll__graph.map +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/doxygen/html/struct__EnchantProvider__coll__graph.md5 b/doxygen/html/struct__EnchantProvider__coll__graph.md5 deleted file mode 100644 index bb63e918..00000000 --- a/doxygen/html/struct__EnchantProvider__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -f6cf7af3330a888ae5aafd9f2e1e8fd3 \ No newline at end of file diff --git a/doxygen/html/struct__EnchantProvider__coll__graph.png b/doxygen/html/struct__EnchantProvider__coll__graph.png deleted file mode 100644 index 7533541a..00000000 Binary files a/doxygen/html/struct__EnchantProvider__coll__graph.png and /dev/null differ diff --git a/doxygen/html/struct__EnchantSession-members.html b/doxygen/html/struct__EnchantSession-members.html deleted file mode 100644 index 887e7cef..00000000 --- a/doxygen/html/struct__EnchantSession-members.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantSession Member List
-
-
- -

This is the complete list of members for _EnchantSession, including all inherited members.

- - - - - - - - - - - - - - -
error (defined in _EnchantSession)_EnchantSession
exclude_filename (defined in _EnchantSession)_EnchantSession
exclude_pwl (defined in _EnchantSession)_EnchantSession
is_pwl (defined in _EnchantSession)_EnchantSession
language_tag (defined in _EnchantSession)_EnchantSession
parent_instance (defined in _EnchantSession)_EnchantSession
personal_filename (defined in _EnchantSession)_EnchantSession
priv (defined in _EnchantSession)_EnchantSession
provider (defined in _EnchantSession)_EnchantSession
pwl (defined in _EnchantSession)_EnchantSession
ref_count (defined in _EnchantSession)_EnchantSession
session_exclude (defined in _EnchantSession)_EnchantSession
session_include (defined in _EnchantSession)_EnchantSession
-
- - - - diff --git a/doxygen/html/struct__EnchantSession.html b/doxygen/html/struct__EnchantSession.html deleted file mode 100644 index 5339c56b..00000000 --- a/doxygen/html/struct__EnchantSession.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - -Enchant: _EnchantSession Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantSession Struct Reference
-
-
-
-Collaboration diagram for _EnchantSession:
-
-
Collaboration graph
- - - - - - - -
[legend]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Attributes

-GTypeInstance parent_instance
 
-volatile int ref_count
 
-EnchantSessionPrivate * priv
 
-GHashTable * session_include
 
-GHashTable * session_exclude
 
-EnchantPWLpwl
 
-EnchantPWLexclude_pwl
 
-gchar * personal_filename
 
-gchar * exclude_filename
 
-gchar * language_tag
 
-gchar * error
 
-gboolean is_pwl
 
-EnchantProviderprovider
 
-
The documentation for this struct was generated from the following files:
    -
  • lib/broker.c
  • -
  • lib/dict.c
  • -
  • lib/session.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantSession.js b/doxygen/html/struct__EnchantSession.js deleted file mode 100644 index d29ed241..00000000 --- a/doxygen/html/struct__EnchantSession.js +++ /dev/null @@ -1,16 +0,0 @@ -var struct__EnchantSession = -[ - [ "error", "struct__EnchantSession.html#ae0e9d253f411402b4fef9daf7fcd80a0", null ], - [ "exclude_filename", "struct__EnchantSession.html#ac8f93274b34a2a3a9f9012d4d0bc8ed2", null ], - [ "exclude_pwl", "struct__EnchantSession.html#a46f1e18720d082b353aea3a5a52eee84", null ], - [ "is_pwl", "struct__EnchantSession.html#af4e585e3c44b68eefc317556197a031c", null ], - [ "language_tag", "struct__EnchantSession.html#aecc9391598695f8682910f9a674e6bb0", null ], - [ "parent_instance", "struct__EnchantSession.html#a32fdba98eff42f2841001d2ebe13995b", null ], - [ "personal_filename", "struct__EnchantSession.html#aec8c7a054174297762e9e0d85c11bd2f", null ], - [ "priv", "struct__EnchantSession.html#a1dd829f488da7b3cc486f85daedc03b1", null ], - [ "provider", "struct__EnchantSession.html#a40cbb028d14a202514796f6919836a77", null ], - [ "pwl", "struct__EnchantSession.html#a3ff96d93b41ee68abd43b9f5fe14067b", null ], - [ "ref_count", "struct__EnchantSession.html#a66d2e728455d841abef5238529614756", null ], - [ "session_exclude", "struct__EnchantSession.html#a28f43125605c62922eee5853ac770c28", null ], - [ "session_include", "struct__EnchantSession.html#a3067866ca603884b4022baa86872869f", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantSessionClass-members.html b/doxygen/html/struct__EnchantSessionClass-members.html deleted file mode 100644 index d7dc6d7a..00000000 --- a/doxygen/html/struct__EnchantSessionClass-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_EnchantSessionClass Member List
-
-
- -

This is the complete list of members for _EnchantSessionClass, including all inherited members.

- - - -
finalize (defined in _EnchantSessionClass)_EnchantSessionClass
parent_class (defined in _EnchantSessionClass)_EnchantSessionClass
-
- - - - diff --git a/doxygen/html/struct__EnchantSessionClass.html b/doxygen/html/struct__EnchantSessionClass.html deleted file mode 100644 index 4a72b0c6..00000000 --- a/doxygen/html/struct__EnchantSessionClass.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - -Enchant: _EnchantSessionClass Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_EnchantSessionClass Struct Reference
-
-
- - - - - - -

-Public Attributes

-GTypeClass parent_class
 
-void(* finalize )(EnchantSession *self)
 
-
The documentation for this struct was generated from the following files:
    -
  • lib/broker.c
  • -
  • lib/dict.c
  • -
  • lib/session.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__EnchantSessionClass.js b/doxygen/html/struct__EnchantSessionClass.js deleted file mode 100644 index e44713f0..00000000 --- a/doxygen/html/struct__EnchantSessionClass.js +++ /dev/null @@ -1,5 +0,0 @@ -var struct__EnchantSessionClass = -[ - [ "finalize", "struct__EnchantSessionClass.html#a65c299e415409286b2e2a0986901ad44", null ], - [ "parent_class", "struct__EnchantSessionClass.html#a8f082afdae22de5402382b487e82f58a", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__EnchantSession__coll__graph.map b/doxygen/html/struct__EnchantSession__coll__graph.map deleted file mode 100644 index 2e58fe1c..00000000 --- a/doxygen/html/struct__EnchantSession__coll__graph.map +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/doxygen/html/struct__EnchantSession__coll__graph.md5 b/doxygen/html/struct__EnchantSession__coll__graph.md5 deleted file mode 100644 index c00139e3..00000000 --- a/doxygen/html/struct__EnchantSession__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -b12055cbb4935c5080ce75be62952da8 \ No newline at end of file diff --git a/doxygen/html/struct__EnchantSession__coll__graph.png b/doxygen/html/struct__EnchantSession__coll__graph.png deleted file mode 100644 index 31c87849..00000000 Binary files a/doxygen/html/struct__EnchantSession__coll__graph.png and /dev/null differ diff --git a/doxygen/html/struct__ParamSpecEnchantCompositeDict-members.html b/doxygen/html/struct__ParamSpecEnchantCompositeDict-members.html deleted file mode 100644 index 04906d7b..00000000 --- a/doxygen/html/struct__ParamSpecEnchantCompositeDict-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_ParamSpecEnchantCompositeDict Member List
-
-
- -

This is the complete list of members for _ParamSpecEnchantCompositeDict, including all inherited members.

- - -
parent_instance (defined in _ParamSpecEnchantCompositeDict)_ParamSpecEnchantCompositeDict
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantCompositeDict.html b/doxygen/html/struct__ParamSpecEnchantCompositeDict.html deleted file mode 100644 index c9f2e4ab..00000000 --- a/doxygen/html/struct__ParamSpecEnchantCompositeDict.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Enchant: _ParamSpecEnchantCompositeDict Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_ParamSpecEnchantCompositeDict Struct Reference
-
-
- - - - -

-Public Attributes

-GParamSpec parent_instance
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/composite.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantCompositeDict.js b/doxygen/html/struct__ParamSpecEnchantCompositeDict.js deleted file mode 100644 index c8c6aed3..00000000 --- a/doxygen/html/struct__ParamSpecEnchantCompositeDict.js +++ /dev/null @@ -1,4 +0,0 @@ -var struct__ParamSpecEnchantCompositeDict = -[ - [ "parent_instance", "struct__ParamSpecEnchantCompositeDict.html#a64e52cdaa451adccbd4dcbf1832c50af", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__ParamSpecEnchantDict-members.html b/doxygen/html/struct__ParamSpecEnchantDict-members.html deleted file mode 100644 index e39e01f3..00000000 --- a/doxygen/html/struct__ParamSpecEnchantDict-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_ParamSpecEnchantDict Member List
-
-
- -

This is the complete list of members for _ParamSpecEnchantDict, including all inherited members.

- - -
parent_instance (defined in _ParamSpecEnchantDict)_ParamSpecEnchantDict
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantDict.html b/doxygen/html/struct__ParamSpecEnchantDict.html deleted file mode 100644 index 274feb81..00000000 --- a/doxygen/html/struct__ParamSpecEnchantDict.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Enchant: _ParamSpecEnchantDict Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_ParamSpecEnchantDict Struct Reference
-
-
- - - - -

-Public Attributes

-GParamSpec parent_instance
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/dict.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantDict.js b/doxygen/html/struct__ParamSpecEnchantDict.js deleted file mode 100644 index ac234f74..00000000 --- a/doxygen/html/struct__ParamSpecEnchantDict.js +++ /dev/null @@ -1,4 +0,0 @@ -var struct__ParamSpecEnchantDict = -[ - [ "parent_instance", "struct__ParamSpecEnchantDict.html#a2c49c046c2ffa68f5050117bfaa5f19e", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__ParamSpecEnchantPWL-members.html b/doxygen/html/struct__ParamSpecEnchantPWL-members.html deleted file mode 100644 index 027056c7..00000000 --- a/doxygen/html/struct__ParamSpecEnchantPWL-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_ParamSpecEnchantPWL Member List
-
-
- -

This is the complete list of members for _ParamSpecEnchantPWL, including all inherited members.

- - -
parent_instance (defined in _ParamSpecEnchantPWL)_ParamSpecEnchantPWL
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantPWL.html b/doxygen/html/struct__ParamSpecEnchantPWL.html deleted file mode 100644 index 66a8cc2f..00000000 --- a/doxygen/html/struct__ParamSpecEnchantPWL.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Enchant: _ParamSpecEnchantPWL Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_ParamSpecEnchantPWL Struct Reference
-
-
- - - - -

-Public Attributes

-GParamSpec parent_instance
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/pwl.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantPWL.js b/doxygen/html/struct__ParamSpecEnchantPWL.js deleted file mode 100644 index fad3dc00..00000000 --- a/doxygen/html/struct__ParamSpecEnchantPWL.js +++ /dev/null @@ -1,4 +0,0 @@ -var struct__ParamSpecEnchantPWL = -[ - [ "parent_instance", "struct__ParamSpecEnchantPWL.html#ae84fc75e37b6171a9385d5fbc79e923f", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__ParamSpecEnchantProvider-members.html b/doxygen/html/struct__ParamSpecEnchantProvider-members.html deleted file mode 100644 index c0f544f5..00000000 --- a/doxygen/html/struct__ParamSpecEnchantProvider-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_ParamSpecEnchantProvider Member List
-
-
- -

This is the complete list of members for _ParamSpecEnchantProvider, including all inherited members.

- - -
parent_instance (defined in _ParamSpecEnchantProvider)_ParamSpecEnchantProvider
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantProvider.html b/doxygen/html/struct__ParamSpecEnchantProvider.html deleted file mode 100644 index 66c4fa19..00000000 --- a/doxygen/html/struct__ParamSpecEnchantProvider.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Enchant: _ParamSpecEnchantProvider Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_ParamSpecEnchantProvider Struct Reference
-
-
- - - - -

-Public Attributes

-GParamSpec parent_instance
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/provider.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantProvider.js b/doxygen/html/struct__ParamSpecEnchantProvider.js deleted file mode 100644 index 22aedb20..00000000 --- a/doxygen/html/struct__ParamSpecEnchantProvider.js +++ /dev/null @@ -1,4 +0,0 @@ -var struct__ParamSpecEnchantProvider = -[ - [ "parent_instance", "struct__ParamSpecEnchantProvider.html#a6cf646862c761c7989965eacad8ec181", null ] -]; \ No newline at end of file diff --git a/doxygen/html/struct__ParamSpecEnchantSession-members.html b/doxygen/html/struct__ParamSpecEnchantSession-members.html deleted file mode 100644 index 76a25f7d..00000000 --- a/doxygen/html/struct__ParamSpecEnchantSession-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -Enchant: Member List - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
_ParamSpecEnchantSession Member List
-
-
- -

This is the complete list of members for _ParamSpecEnchantSession, including all inherited members.

- - -
parent_instance (defined in _ParamSpecEnchantSession)_ParamSpecEnchantSession
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantSession.html b/doxygen/html/struct__ParamSpecEnchantSession.html deleted file mode 100644 index 9ac065a9..00000000 --- a/doxygen/html/struct__ParamSpecEnchantSession.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Enchant: _ParamSpecEnchantSession Struct Reference - - - - - - - - - - - - - -
-
- - - - - - -
-
Enchant -  2.7.3 -
-
Generic spell checking library
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
- -
-
_ParamSpecEnchantSession Struct Reference
-
-
- - - - -

-Public Attributes

-GParamSpec parent_instance
 
-
The documentation for this struct was generated from the following file:
    -
  • lib/session.c
  • -
-
-
- - - - diff --git a/doxygen/html/struct__ParamSpecEnchantSession.js b/doxygen/html/struct__ParamSpecEnchantSession.js deleted file mode 100644 index 95425617..00000000 --- a/doxygen/html/struct__ParamSpecEnchantSession.js +++ /dev/null @@ -1,4 +0,0 @@ -var struct__ParamSpecEnchantSession = -[ - [ "parent_instance", "struct__ParamSpecEnchantSession.html#af65f5ea55457b3435285ca4b01afc843", null ] -]; \ No newline at end of file diff --git a/lib/Makefile.am b/lib/Makefile.am index 996621f3..5b47714f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,19 +11,14 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, see . -AM_VALAFLAGS = --debug --no-color --vapidir=$(srcdir) --pkg config --pkg internal --pkg posix --pkg gnu --pkg gio-2.0 --pkg gmodule-2.0 +AM_VALAFLAGS = --debug --no-color --vapidir=$(srcdir) --pkg configmake --pkg internal --pkg posix --pkg gnu --pkg gio-2.0 --pkg gmodule-2.0 AM_CPPFLAGS = --include config.h -I$(top_srcdir) $(ISYSTEM)$(top_builddir)/libgnu $(ISYSTEM)$(top_srcdir)/libgnu $(GLIB_CFLAGS) $(WARN_CFLAGS) -DG_LOG_DOMAIN='"libenchant"' # FIXME: Require Vala 0.58 when released, and remove copy of gnu.vapi -VAPIS = config.vapi internal.vapi gnu.vapi +VAPIS = configmake.vapi internal.vapi gnu.vapi lib_LTLIBRARIES = libenchant-@ENCHANT_MAJOR_VERSION@.la -BUILT_SOURCES = dummy.vala - -dummy.vala: $(VAPIS) - touch $@ - libenchant_@ENCHANT_MAJOR_VERSION@_la_CPPFLAGS = $(AM_CPPFLAGS) -D_ENCHANT_BUILD=1 -DENCHANT_VERSION_STRING=\"@ENCHANT_MAJOR_VERSION@.@ENCHANT_MINOR_VERSION@.@ENCHANT_MICRO_VERSION@\" -DENCHANT_MAJOR_VERSION=\"@ENCHANT_MAJOR_VERSION@\" libenchant_@ENCHANT_MAJOR_VERSION@_la_LIBADD = $(top_builddir)/libgnu/libgnu.la $(GLIB_LIBS) $(LTLIBOBJS) @@ -65,3 +60,10 @@ enchant.html: enchant.5 groff -mandoc -Thtml $< > $@ EXTRA_DIST = $(libenchant_data_DATA) $(VAPIS) + +loc: + $(CLOC) $(ALL_SOURCE_FILES) + +ALL_SOURCE_FILES = \ + Makefile.am \ + *.vala diff --git a/lib/api.vala b/lib/api.vala index 4a2888bc..8cd07ae4 100644 --- a/lib/api.vala +++ b/lib/api.vala @@ -37,9 +37,3 @@ public void enchant_set_prefix_dir(string new_prefix) { public unowned string enchant_get_version() { return ENCHANT_VERSION_STRING; } - -public string enchant_get_user_language() { - // The returned list always contains "C". - unowned string[] languages = Intl.get_language_names(); - return languages[0] == "C" ? "en" : languages[0]; -} diff --git a/lib/config.vapi b/lib/configmake.vapi similarity index 97% rename from lib/config.vapi rename to lib/configmake.vapi index 20939a6c..25d543cd 100644 --- a/lib/config.vapi +++ b/lib/configmake.vapi @@ -1,4 +1,4 @@ -/* config.vapi +/* VAPI for constants from configmake.h * Copyright (C) 2024 Reuben Thomas * * This library is free software; you can redistribute it and/or diff --git a/lib/enchant.html b/lib/enchant.html index fc9ca943..52664955 100644 --- a/lib/enchant.html +++ b/lib/enchant.html @@ -1,5 +1,5 @@ - + diff --git a/libgnu/Makefile.am b/libgnu/Makefile.am index b1adce6d..79a3fbfe 100644 --- a/libgnu/Makefile.am +++ b/libgnu/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the libgnu subdirectory of Enchant # -# Copyright (C) 2017 Reuben Thomas +# Copyright (C) 2017-2024 Reuben Thomas # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,5 +27,10 @@ else AM_CPPFLAGS += -DINSTALLDIR=\"$(libdir)\" endif +loc: + $(CLOC) $(ALL_SOURCE_FILES) + +ALL_SOURCE_FILES = libgnu/Makefile.am + # Include auto-generated makefile include Makefile.gnulib diff --git a/providers/Makefile.am b/providers/Makefile.am index 94a2c1f7..9b910925 100644 --- a/providers/Makefile.am +++ b/providers/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the providers subdirectory of Enchant # -# Copyright (C) 2017-2023 Reuben Thomas +# Copyright (C) 2017-2024 Reuben Thomas # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -63,3 +63,12 @@ endif enchant_applespell_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag=CXX enchant_applespell_la_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) enchant_applespell_la_SOURCES = applespell_checker.mm + +loc: + $(CLOC) $(ALL_SOURCE_FILES) + +ALL_SOURCE_FILES = \ + Makefile.am \ + *.[ch] \ + *.cpp \ + *.mm diff --git a/src/.gitignore b/src/.gitignore index 570d4163..291bca87 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -3,8 +3,16 @@ /enchant-[1-9].1 /enchant-[1-9].html /enchant-[1-9].exe +/enchant_*_vala.stamp /enchant-lsmod-[1-9] /enchant-lsmod-[1-9].html /enchant-lsmod-[1-9].exe /enchant-lsmod.1 /enchant-lsmod-[1-9].1 +/enchant.c +/enchant-lsmod.c +/util.[ch] +/util.vapi +/libutil_la_vala.stamp +/libutil_la_vala.stamp-t +/dummy.vala diff --git a/src/Makefile.am b/src/Makefile.am index acaa6721..6c5e77ec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,16 +11,24 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, see . -AM_CPPFLAGS = -I$(top_srcdir) $(ISYSTEM)$(top_builddir)/libgnu $(ISYSTEM)$(top_srcdir)/libgnu -I$(top_srcdir)/lib $(GLIB_CFLAGS) $(WARN_CFLAGS) -DG_LOG_DOMAIN='"libenchant"' +AM_VALAFLAGS = --debug --no-color --vapidir=. --vapidir=$(top_srcdir)/lib --pkg config --pkg posix --pkg gio-2.0 --pkg gmodule-2.0 --pkg enchant-2 +AM_CPPFLAGS = --include config.h -I$(top_srcdir) $(ISYSTEM)$(top_builddir)/libgnu $(ISYSTEM)$(top_srcdir)/libgnu -I$(top_srcdir)/lib $(GLIB_CFLAGS) + +VAPIS = config.vapi enchant-2.vapi + +dummy.vala: $(BUILT_VAPIS) $(VAPIS) + touch $@ + +BUILT_SOURCES = dummy.vala $(BUILT_VAPIS) util.h + +BUILT_VAPIS = util.vapi + +util.h util.vapi: libutil.la dist_man_MANS = enchant-@ENCHANT_MAJOR_VERSION@.1 enchant-lsmod-@ENCHANT_MAJOR_VERSION@.1 nodist_doc_DATA = enchant-@ENCHANT_MAJOR_VERSION@.html enchant-lsmod-@ENCHANT_MAJOR_VERSION@.html -edit = sed \ - -e 's|@PKGDATADIR[@]|$(pkgdatadir)|g' \ - -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g' - -DISTCLEANFILES = $(dist_man_MANS) $(nodist_doc_DATA) +DISTCLEANFILES = $(dist_man_MANS) $(nodist_doc_DATA) dummy.vala .1.html: groff -mandoc -Thtml $< > $@ @@ -31,9 +39,23 @@ enchant-@ENCHANT_MAJOR_VERSION@.1: $(builddir)/enchant.1 Makefile.am $(top_build enchant-lsmod-@ENCHANT_MAJOR_VERSION@.1: $(builddir)/enchant-lsmod.1 Makefile.am $(top_builddir)/config.status cp $(abs_builddir)/enchant-lsmod.1 $@ -LDADD = $(top_builddir)/lib/libenchant-@ENCHANT_MAJOR_VERSION@.la $(GLIB_LIBS) $(top_builddir)/libgnu/libgnu.la +noinst_LTLIBRARIES = libutil.la +libutil_la_SOURCES = util.vala +libutil_la_VALAFLAGS = $(AM_VALAFLAGS) --vapi=util.vapi --header=util.h +libutil_la_LIBADD = $(GLIB_LIBS) + +LDADD = $(top_builddir)/lib/libenchant-@ENCHANT_MAJOR_VERSION@.la $(GLIB_LIBS) $(top_builddir)/libgnu/libgnu.la libutil.la bin_PROGRAMS = enchant-@ENCHANT_MAJOR_VERSION@ enchant-lsmod-@ENCHANT_MAJOR_VERSION@ -enchant_@ENCHANT_MAJOR_VERSION@_SOURCES = enchant.c -enchant_lsmod_@ENCHANT_MAJOR_VERSION@_SOURCES = enchant-lsmod.c +enchant_@ENCHANT_MAJOR_VERSION@_SOURCES = enchant.vala +enchant_@ENCHANT_MAJOR_VERSION@_VALAFLAGS = $(AM_VALAFLAGS) --pkg util +enchant_lsmod_@ENCHANT_MAJOR_VERSION@_SOURCES = enchant-lsmod.vala +enchant_lsmod_@ENCHANT_MAJOR_VERSION@_VALAFLAGS = $(AM_VALAFLAGS) --pkg util + +EXTRA_DIST = enchant.1.in enchant-lsmod.1.in util.h $(VAPIS) + +loc: + $(CLOC) $(ALL_SOURCE_FILES) -EXTRA_DIST = enchant.1.in enchant-lsmod.1.in +ALL_SOURCE_FILES = \ + Makefile.am \ + *.vala diff --git a/src/config.vapi b/src/config.vapi new file mode 100644 index 00000000..fc0c5212 --- /dev/null +++ b/src/config.vapi @@ -0,0 +1,30 @@ +/* VAPI for constants from config.h + * Copyright (C) 2024 Reuben Thomas + * + * 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.1 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 along with this program; if not, see + * . + * + * In addition, as a special exception, the copyright holders + * give permission to link the code of this program with + * non-LGPL Spelling Provider libraries (eg: a MSFT Office + * spell checker backend) and distribute linked combinations including + * the two. You must obey the GNU Lesser General Public License in all + * respects for all of the code used other than said providers. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ + +[CCode (cheader_filename = "config.h")] +const string PACKAGE_VERSION; diff --git a/src/enchant-2.html b/src/enchant-2.html index 090fef78..9d83a5b2 100644 --- a/src/enchant-2.html +++ b/src/enchant-2.html @@ -1,5 +1,5 @@ - + diff --git a/src/enchant-2.vapi b/src/enchant-2.vapi new file mode 100644 index 00000000..480eb9e2 --- /dev/null +++ b/src/enchant-2.vapi @@ -0,0 +1,56 @@ +[CCode (cheader_filename = "enchant.h")] +namespace Enchant { + public unowned string get_version (); + public void set_prefix_dir (string dir); + + [CCode(has_target = false)] + public delegate void BrokerDescribeFn (string provider_name, string provider_desc, string provider_dll_file, void *user_data = null); + [CCode(has_target = false)] + public delegate void DictDescribeFn (string lang_tag, string provider_name, string provider_desc, string provider_file, void *user_data = null); + + [Compact] + [CCode (free_function = "enchant_broker_free")] + public class Broker { + [CCode (cname = "enchant_broker_init")] + public Broker (); + + public unowned Dict request_dict (string tag); + public unowned Dict request_pwl_dict (string pwl); + public unowned Dict request_dict_with_pwl (string tag, string pwl); + public void free_dict (Dict dict); + public int dict_exists (string tag); + public void set_ordering (string tag, string ordering); + public unowned string get_error (); + public void describe (BrokerDescribeFn fn, void *user_data = null); + public void list_dicts (DictDescribeFn fn, void *user_data = null); + } + + [Compact] + public class Dict { + public int check (string word, long len = -1); + [CCode (array_length_type = "size_t")] + public unowned string[] suggest (string word, long len = -1); + public void add (string word, long len = -1); + public void add_to_session (string word, long len = -1); + public void remove (string word, long len = -1); + public void remove_from_session (string word, long len = -1); + public int is_added (string word, long len = -1); + public int is_removed (string word, long len = -1); + public void store_replacement (string mis, string cor, [CCode (pos = 1.1)] long mis_len = -1, long cor_len = -1); + public void free_string_list ([CCode (array_length = false)] string[] string_list); + public unowned string get_error (); + public unowned string get_extra_word_characters (); + public bool is_word_character (uint32 uc, WordPosition n); + public void describe (DictDescribeFn fn, void *user_data = null); + } + + [CCode (cname = "size_t", has_type_id = false)] + public enum WordPosition { + [CCode (cname = "0")] + START, + [CCode (cname = "1")] + MIDDLE, + [CCode (cname = "2")] + END + } +} diff --git a/src/enchant-lsmod-2.html b/src/enchant-lsmod-2.html index 11e67edd..fe73ecdd 100644 --- a/src/enchant-lsmod-2.html +++ b/src/enchant-lsmod-2.html @@ -1,5 +1,5 @@ - + diff --git a/src/enchant-lsmod.c b/src/enchant-lsmod.c deleted file mode 100644 index 3098538f..00000000 --- a/src/enchant-lsmod.c +++ /dev/null @@ -1,134 +0,0 @@ -/* enchant - * Copyright (C) 2003 Dom Lachowicz - * Copyright (C) 2017-2021 Reuben Thomas - * - * 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.1 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 along with this program; if not, see - * . - * - * In addition, as a special exception, the copyright holders - * give permission to link the code of this program with - * the non-LGPL Spelling Provider libraries (eg: a MSFT Office - * spell checker backend) and distribute linked combinations including - * the two. You must obey the GNU Lesser General Public License in all - * respects for all of the code used other than said providers. If you modify - * this file, you may extend this exception to your version of the - * file, but you are not obligated to do so. If you do not wish to - * do so, delete this exception statement from your version. - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "enchant.h" -#include "enchant-provider.h" - -static void -describe_dict (const char * const lang_tag, - const char * const provider_name, - const char * const provider_desc _GL_UNUSED, - const char * const provider_file _GL_UNUSED, - void * user_data _GL_UNUSED) -{ - printf ("%s (%s)\n", lang_tag, provider_name); -} - -static void -describe_word_chars (const char * const lang_tag _GL_UNUSED, - const char * const provider_name _GL_UNUSED, - const char * const provider_desc _GL_UNUSED, - const char * const provider_file _GL_UNUSED, - void * user_data) -{ - EnchantDict *dict = (EnchantDict *)user_data; - const char *word_chars = ""; - if (dict) - word_chars = enchant_dict_get_extra_word_characters(dict); - printf ("%s\n", word_chars ? word_chars : ""); -} - -static void -describe_provider (const char * name, - const char * desc, - const char * file _GL_UNUSED, - void * user_data _GL_UNUSED) -{ - printf ("%s (%s)\n", name, desc); -} - -static void -usage (const char *progname) -{ - fprintf (stderr, "%s [[-lang|-word-chars] [language_tag]|-list-dicts|-help|-version]\n", progname); -} - -int -main (int argc, char **argv) -{ - EnchantBroker *broker = enchant_broker_init (); - char * lang_tag = NULL; - int retcode = 0; - - if (argc > 1) { - if (!strcmp (argv[1], "-lang") || !strcmp(argv[1], "-word-chars")) { - if (argc > 2) { - lang_tag = strdup (argv[2]); - } else { - lang_tag = enchant_get_user_language(); - - if (!lang_tag || !strcmp (lang_tag, "C")) { - free(lang_tag); - lang_tag = strdup ("en"); - } - } - if (!lang_tag) { - fprintf (stderr, "Error: language tag not specified and environment variable $LANG not set\n"); - retcode = 1; - } else { - EnchantDict *dict = enchant_broker_request_dict (broker, lang_tag); - if (!dict) { - fprintf (stderr, "No dictionary available for '%s'", lang_tag); - const char *errmsg = enchant_broker_get_error (broker); - if (errmsg != NULL) - fprintf (stderr, ": %s", errmsg); - putc('\n', stderr); - retcode = 1; - } else { - enchant_dict_describe (dict, - !strcmp (argv[1], "-lang") ? describe_dict : describe_word_chars, - dict); - enchant_broker_free_dict (broker, dict); - } - } - } else if (!strcmp (argv[1], "-h") || !strcmp(argv[1], "-help")) { - usage (argv[0]); - } else if (!strcmp (argv[1], "-v") || !strcmp (argv[1], "-version")) { - fprintf (stderr, "%s %s\n", argv[0], PACKAGE_VERSION); - } else if (!strcmp (argv[1], "-list-dicts")) { - enchant_broker_list_dicts (broker, describe_dict, NULL); - } else { - fprintf (stderr, "Invalid argument %s\n", argv[1]); - usage (argv[0]); - retcode = 1; - } - } else - enchant_broker_describe (broker, describe_provider, NULL); - - free (lang_tag); - enchant_broker_free (broker); - return retcode; -} diff --git a/src/enchant-lsmod.vala b/src/enchant-lsmod.vala new file mode 100644 index 00000000..ee479085 --- /dev/null +++ b/src/enchant-lsmod.vala @@ -0,0 +1,108 @@ +/* enchant + * Copyright (C) 2003 Dom Lachowicz + * Copyright (C) 2017-2024 Reuben Thomas + * + * 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.1 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 along with this program; if not, see + * . + * + * In addition, as a special exception, the copyright holders + * give permission to link the code of this program with + * the non-LGPL Spelling Provider libraries (eg: a MSFT Office + * spell checker backend) and distribute linked combinations including + * the two. You must obey the GNU Lesser General Public License in all + * respects for all of the code used other than said providers. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ + +using Enchant; + +void describe_dict(string lang_tag, + string provider_name, + string provider_desc, + string provider_file) { + print("%s (%s)\n", lang_tag, provider_name); +} + +void describe_word_chars(string lang_tag, + string provider_name, + string provider_desc, + string provider_file, + Dict self) { + string word_chars = ""; + if (self != null) + word_chars = self.get_extra_word_characters(); + print("%s\n", word_chars != null ? word_chars : ""); +} + +void describe_provider(string name, string desc, string file) { + print("%s (%s)\n", name, desc); +} + +void usage(string progname) { + stderr.printf("%s [[-lang|-word-chars] [language_tag]|-list-dicts|-help|-version]\n", progname); +} + +public int main(string[] args) { + var broker = new Broker(); + string lang_tag = null; + int retcode = 0; + + if (args.length > 1) { + if (args[1] == "-lang" || args[1] == "-word-chars") { + if (args.length > 2) { + lang_tag = args[2]; + } else { + lang_tag = enchant_get_user_language(); + if (lang_tag == null || lang_tag == "C") + lang_tag = "en"; + } + if (lang_tag == null) { + stderr.printf("Error: language tag not specified and no default language set\n"); + retcode = 1; + } else { + unowned var dict = broker.request_dict(lang_tag); + if (dict == null) { + stderr.printf("No dictionary available for '%s'", lang_tag); + string errmsg = broker.get_error(); + if (errmsg != null) + stderr.printf(": %s", errmsg); + stderr.putc('\n'); + retcode = 1; + } else { + DictDescribeFn fn; + if (args[1] == "-lang") + fn = describe_dict; + else + fn = describe_word_chars; + dict.describe(fn, dict); + } + } + } else if (args[1] == "-h" || args[1] == "-help") { + usage(args[0]); + } else if (args[1] == "-v" || args[1] == "-version") { + stderr.printf("%s %s\n", args[0], PACKAGE_VERSION); + } else if (args[1] == "-list-dicts") { + broker.list_dicts(describe_dict); + } else { + stderr.printf("Invalid argument %s\n", args[1]); + usage(args[0]); + retcode = 1; + } + } else + broker.describe(describe_provider); + + return retcode; +} diff --git a/src/enchant.c b/src/enchant.c deleted file mode 100644 index e8522364..00000000 --- a/src/enchant.c +++ /dev/null @@ -1,495 +0,0 @@ -/* enchant: An ispell-compatible command-line front-end for libenchant. - * - * Copyright (C) 2003 Dom Lachowicz - * 2007 Hannu Väisänen - * 2016-2024 Reuben Thomas - * - * 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.1 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 along with this program; if not, see - * . - * - * In addition, as a special exception, the copyright holders - * give permission to link the code of this program with - * the non-LGPL Spelling Provider libraries (eg: a MSFT Office - * spell checker backend) and distribute linked combinations including - * the two. You must obey the GNU Lesser General Public License in all - * respects for all of the code used other than said providers. If you modify - * this file, you may extend this exception to your version of the - * file, but you are not obligated to do so. If you do not wish to - * do so, delete this exception statement from your version. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif - -#include "enchant.h" -#include "enchant-provider.h" - - -/* word has to be bigger than this to be checked */ -#define MIN_WORD_LENGTH 1 - -static const char *charset; - -typedef enum - { - MODE_NONE, - MODE_A, - MODE_L - } IspellMode_t; - -static void -print_version (FILE * to) -{ - fprintf (to, "@(#) International Ispell Version 3.1.20 (but really Enchant %s)\n", PACKAGE_VERSION); - fflush (to); -} - -static void -print_help (const char * prog) -{ - fprintf (stderr, - "Usage: %s -a|-l|-h|-v [-L] [-d DICTIONARY] [FILE]\n\ - -d DICTIONARY use the given dictionary\n\ - -p FILE use the given personal word list\n\ - -a communicate non-interactively through a pipe like Ispell\n\ - -l list only the misspellings\n\ - -L display line numbers\n\ - -h display help and exit\n\ - -v display version information and exit\n", prog); -} - -static gboolean -consume_line (FILE * in, GString * str) -{ - int ch; - gsize bytes_read, bytes_written; - gchar * utf; - gboolean ret = TRUE; - - g_string_truncate (str, 0); - - while (ret && (ch = fgetc (in)) != EOF) { - if (ch == '\r') - continue; - else { - if (ch == '\n') - ret = FALSE; - else - g_string_append_c (str, ch); - } - } - - if (str->len) { - utf = g_convert(str->str, str->len, "UTF-8", charset, &bytes_read, &bytes_written, NULL); - if (utf) { - g_string_assign (str, utf); - g_free (utf); - } - /* Else str->str stays the same. we'll assume that it's - already utf8 and glib is just being stupid. */ - } - - return ret; -} - -static void -print_utf (const char * str) -{ - gsize bytes_read, bytes_written; - gchar * native; - - native = g_locale_from_utf8 (str, -1, &bytes_read, &bytes_written, NULL); - if (native) { - fwrite (native, 1, bytes_written, stdout); - g_free (native); - } else - /* Assume that it's already utf8 and glib is just being stupid. */ - printf ("%s", str); -} - -static int -check_word (EnchantDict * dict, GString * word) -{ - return word->len <= MIN_WORD_LENGTH || - enchant_dict_check (dict, word->str, word->len) == 0; -} - -static void -do_mode_a (EnchantDict * dict, GString * word, size_t start_pos, size_t lineCount, gboolean terse_mode) -{ - if (check_word (dict, word)) { - if (!terse_mode) { - if (lineCount) - printf ("* %u\n", (unsigned int)lineCount); - else - printf ("*\n"); - } - } else { - size_t n_suggs; - char ** suggs = enchant_dict_suggest (dict, word->str, word->len, &n_suggs); - if (!n_suggs || !suggs) { - printf ("# "); - if (lineCount) - printf ("%u ", (unsigned int)lineCount); - print_utf (word->str); - printf (" %u\n", (unsigned int)start_pos); - } else { - printf ("& "); - if (lineCount) - printf ("%u ", (unsigned int)lineCount); - print_utf (word->str); - printf (" %u %u:", (unsigned int)n_suggs, (unsigned int)start_pos); - - for (size_t i = 0; i < n_suggs; i++) { - putchar (' '); - print_utf (suggs[i]); - - if (i != (n_suggs - 1)) - putchar(','); - } - putchar('\n'); - - enchant_dict_free_string_list (dict, suggs); - } - } -} - -static void -do_mode_l (EnchantDict * dict, GString * word, size_t lineCount) -{ - if (!check_word (dict, word)) { - if (lineCount) - printf ("%u ", (unsigned int)lineCount); - print_utf (word->str); - putchar ('\n'); - } -} - - -/* Splits a line into a set of (word,word_position) tuples. */ -static GSList * -tokenize_line (EnchantDict * dict, GString * line) -{ - GSList * tokens = NULL; - gchar *utf = (char *) line->str; - size_t cur_pos = 0; - size_t start_pos = 0; - GString * word = g_string_new (NULL); - - while (cur_pos < line->len && *utf) { - gunichar uc; - - /* Skip non-word characters. */ - cur_pos = g_utf8_pointer_to_offset ((const char*)line->str, utf); - uc = g_utf8_get_char (utf); - while (cur_pos < line->len && *utf && !enchant_dict_is_word_character (dict, uc, 0)) { - utf = g_utf8_next_char (utf); - uc = g_utf8_get_char (utf); - cur_pos = g_utf8_pointer_to_offset ((const char*)line->str, utf); - } - start_pos = cur_pos; - - /* Skip over word characters. */ - while (cur_pos < line->len && *utf && enchant_dict_is_word_character (dict, uc, 1)) { - g_string_append_unichar (word, uc); - utf = g_utf8_next_char (utf); - uc = g_utf8_get_char (utf); - cur_pos = g_utf8_pointer_to_offset ((const char*)line->str, utf); - } - - /* Skip backwards over any characters that can't appear at the end of a word. */ - for (gchar *i_utf = word->str + word->len; - (i_utf = g_utf8_find_prev_char (word->str, i_utf)) != NULL; - g_string_truncate (word, i_utf - word->str)) { - uc = g_utf8_get_char (i_utf); - if (enchant_dict_is_word_character(dict, uc, 2)) - break; - } - - /* Save (word, position) tuple. */ - if (word->len) { - tokens = g_slist_append (tokens, g_string_new_len (word->str, word->len)); - tokens = g_slist_append (tokens, GINT_TO_POINTER(start_pos)); - g_string_truncate (word, 0); - } - } - g_string_free (word, TRUE); - - return tokens; -} - -static int -parse_file (FILE * in, IspellMode_t mode, gboolean countLines, gchar *dictionary, gchar *perslist) -{ - EnchantBroker * broker; - EnchantDict * dict; - - GString * str, * word = NULL; - GSList * tokens, *token_ptr; - gchar * lang; - size_t pos, lineCount = 0; - - gboolean was_last_line = FALSE, corrected_something = FALSE, terse_mode = FALSE; - - if (mode == MODE_A) - print_version (stdout); - - if (dictionary) - lang = strdup (dictionary); - else { - lang = enchant_get_user_language(); - if(!lang) - return 1; - } - - /* Enchant will get rid of trailing information like de_DE@euro or de_DE.ISO-8859-15 */ - - broker = enchant_broker_init (); - dict = enchant_broker_request_dict_with_pwl (broker, lang, perslist); - - if (!dict) { - fprintf (stderr, "No dictionary available for '%s'", lang); - const char *errmsg = enchant_broker_get_error (broker); - if (errmsg != NULL) - fprintf (stderr, ": %s", errmsg); - putc('\n', stderr); - - free (lang); - enchant_broker_free (broker); - return 1; - } - - free (lang); - - str = g_string_new (NULL); - - while (!was_last_line) { - gboolean mode_A_no_command = FALSE; - was_last_line = consume_line (in, str); - - if (countLines) - lineCount++; - - if (str->len) { - corrected_something = FALSE; - - if (mode == MODE_A) { - switch (*str->str) { - case '&': /* Insert uncapitalised in personal word list */ - if (str->len > 1) { - gunichar c = g_utf8_get_char_validated(str->str + 1, str->len); - if (c > 0) { - str = g_string_erase(str, 1, g_utf8_next_char(str->str + 1) - (str->str + 1)); - g_string_insert_unichar(str, 1, g_unichar_tolower(c)); - } - } - /* FALLTHROUGH */ - case '*': /* Insert in personal word list */ - if (str->len == 1) - goto empty_word; - enchant_dict_add (dict, str->str + 1, -1); - break; - case '@': /* Accept for this session */ - if (str->len == 1) - goto empty_word; - enchant_dict_add_to_session(dict, str->str + 1, -1); - break; - case '/': /* Remove from personal word list */ - if (str->len == 1) - goto empty_word; - enchant_dict_remove (dict, str->str + 1, -1); - break; - case '_': /* Remove from this session */ - if (str->len == 1) - goto empty_word; - enchant_dict_remove_from_session (dict, str->str + 1, -1); - break; - - case '%': /* Exit terse mode */ - terse_mode = FALSE; - break; - case '!': /* Enter terse mode */ - terse_mode = TRUE; - break; - - /* Ignore these commands */ - case '#': /* Save personal word list (enchant does this automatically) */ - case '+': /* LaTeX mode */ - case '-': /* nroff mode [default] */ - case '~': /* change string character type (enchant is fixed to UTF-8) */ - case '`': /* Enter verbose-correction mode */ - break; - - case '$': /* Miscellaneous commands */ - { - const gchar *prefix = "$$ra "; /* Save correction for rest of session [aspell extension] */ - if (g_str_has_prefix(str->str, prefix)) { /* Syntax: $$ra , */ - gchar *comma = g_utf8_strchr(str->str, -1, (gunichar)','); - char *mis = str->str + strlen(prefix); - char *cor = comma + 1; - ssize_t mis_len = comma - mis; - ssize_t cor_len = strlen(str->str) - (cor - str->str); - enchant_dict_store_replacement(dict, mis, mis_len, cor, cor_len); - } else if (g_str_has_prefix(str->str, "$$wc")) - /* Return the extra word chars list */ - printf("%s\n", enchant_dict_get_extra_word_characters(dict)); - } - break; - - case '^': /* ^ is used as prefix to prevent interpretation of original - first character as a command */ - /* FALLTHROUGH */ - default: /* A word or words to check */ - mode_A_no_command = TRUE; - break; - - empty_word: - printf ("Error: The word \"\" is invalid. Empty string.\n"); - } - } - - if (mode != MODE_A || mode_A_no_command) { - token_ptr = tokens = tokenize_line (dict, str); - if (tokens == NULL) - putchar('\n'); - while (tokens != NULL) { - corrected_something = TRUE; - - word = (GString *)tokens->data; - tokens = tokens->next; - pos = GPOINTER_TO_INT(tokens->data); - tokens = tokens->next; - - if (mode == MODE_A) - do_mode_a (dict, word, pos, lineCount, terse_mode); - else if (mode == MODE_L) - do_mode_l (dict, word, lineCount); - - g_string_free(word, TRUE); - } - if (token_ptr) - g_slist_free (token_ptr); - } - } - - if (mode == MODE_A && corrected_something) - putchar('\n'); - g_string_truncate (str, 0); - fflush (stdout); - } - - enchant_broker_free_dict (broker, dict); - enchant_broker_free (broker); - - g_string_free (str, TRUE); - - return 0; -} - -int main (int argc, char ** argv) -{ - IspellMode_t mode = MODE_NONE; - char * file = NULL; - int rval = 0; - FILE * fp = stdin; - gboolean countLines = FALSE; - gchar *dictionary = NULL; /* -d dictionary */ - gchar *perslist = NULL ; /* -p personal_word_list */ - - /* Initialize system locale */ - setlocale(LC_ALL, ""); - - g_get_charset(&charset); -#ifdef _WIN32 - /* If reading from stdin, its CP may not be the system CP (which glib's locale gives us) */ - if (GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR) - charset = g_strdup_printf("CP%u", GetConsoleCP()); -#endif - - int optchar; - while ((optchar = getopt (argc, argv, ":d:p:alvLmBh")) != -1) { - switch (optchar) { - case 'd': - dictionary = optarg; /* Emacs calls ispell with '-d dictionary'. */ - break; - case 'p': - perslist = optarg; - break; - /* The first mode specified takes precedence. */ - case 'a': - if (mode == MODE_NONE) - mode = MODE_A; - break; - case 'l': - if (mode == MODE_NONE) - mode = MODE_L; - break; - case 'L': - countLines = TRUE; - break; - case 'v': - print_version (stdout); - exit (0); - case 'm': - case 'B': - /* Ignore: Emacs calls ispell with '-m' and '-B'. */ - break; - case 'h': - print_help (argv[0]); - exit (0); - case ':': - fprintf (stderr, "missing argument to option\n"); - /* FALLTHROUGH */ - case '?': - print_help (argv[0]); - exit (1); - } - } - - /* Get file argument if given. */ - if (optind < argc) { - file = argv[optind++]; - } - - /* Exit with usage if either no mode is set, or if there are excess - non-option arguments. */ - if (mode == MODE_NONE || optind < argc) { - print_help (argv[0]); - exit (1); - } - - /* Process the file or standard input. */ - if (file) { - fp = g_fopen (file, "rb"); - if (!fp) { - fprintf (stderr, "Error: Could not open the file \"%s\" for reading.\n", file); - exit (1); - } - } - rval = parse_file (fp, mode, countLines, dictionary, perslist); - if (file) - fclose (fp); - - return rval; -} diff --git a/src/enchant.vala b/src/enchant.vala new file mode 100644 index 00000000..87cc257c --- /dev/null +++ b/src/enchant.vala @@ -0,0 +1,419 @@ +/* enchant: An ispell-compatible command-line front-end for libenchant. + * + * Copyright (C) 2003 Dom Lachowicz + * 2007 Hannu Väisänen + * 2016-2024 Reuben Thomas + * + * 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.1 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 along with this program; if not, see + * . + * + * In addition, as a special exception, the copyright holders + * give permission to link the code of this program with + * the non-LGPL Spelling Provider libraries (eg: a MSFT Office + * spell checker backend) and distribute linked combinations including + * the two. You must obey the GNU Lesser General Public License in all + * respects for all of the code used other than said providers. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ + +using Enchant; + +using Posix; + +/* word has to be bigger than this to be checked */ +const uint MIN_WORD_LENGTH = 1; + +string charset; + +enum Mode { + NONE, + A, + L, +} + +void print_version(FileStream to) { + to.printf("@(#) International Ispell Version 3.1.20 (but really Enchant %s)\n", PACKAGE_VERSION); + to.flush(); +} + +string? get_line(FileStream fin) { + string str = fin.read_line(); + if (str != null && str.length > 0) { + try { + return convert(str, str.length, "UTF-8", charset); + } catch (ConvertError e) { + /* Assume that str is already utf8 and glib is just being stupid. */ + } + } + return str; +} + +void print_utf(string str) { + size_t bytes_written; + try { + string native = str.locale_from_utf8(str.length, null, out bytes_written); + /* Print arbitrary bytes (including potential NULs). */ + unowned uint8[] buf = (uint8[]) native; + buf.length = (int)bytes_written; + GLib.stdout.write(buf); + } catch (GLib.ConvertError e) { + /* Assume that it's already utf8 and glib is just being stupid. */ + print("%s", str); + } +} + +bool check_word(Dict dict, string word) { + return word.length <= MIN_WORD_LENGTH || + dict.check(word, word.length) == 0; +} + +void do_mode_a(Dict dict, string word, size_t start_pos, size_t line_count, bool terse_mode) { + if (check_word(dict, word)) { + if (!terse_mode) { + if (line_count > 0) + print("* %zu\n", line_count); + else + print("*\n"); + } + } else { + string[] suggs = dict.suggest(word, word.length); + if (suggs == null || suggs.length == 0) { + print("# "); + if (line_count > 0) + print("%zu ", line_count); + print_utf(word); + print(" %zu\n", start_pos); + } else { + print("& "); + if (line_count > 0) + print("%zu ", line_count); + print_utf (word); + print(" %zu %zu:", suggs.length, start_pos); + + for (size_t i = 0; i < suggs.length; i++) { + GLib.stdout.putc(' '); + print_utf(suggs[i]); + + if (i != suggs.length - 1) + GLib.stdout.putc(','); + } + GLib.stdout.putc('\n'); + + dict.free_string_list(suggs); + } + } +} + +void do_mode_l(Dict dict, string word, size_t line_count) { + if (!check_word(dict, word)) { + if (line_count > 0) + print("%zu ", line_count); + print_utf(word); + GLib.stdout.putc('\n'); + } +} + + +/* Splits a line into a set of (word,word_position) tuples. */ +class Token { + public string word; + public long pos; + + public Token(string word, long pos) { + this.word = word; + this.pos = pos; + } +} + +SList tokenize_line(Dict dict, string line) { + var tokens = new SList(); + long start_pos = 0; + long cur_pos = 0; + unowned string utf = line; + + while (utf[0] != '\0') { + unichar uc; + + /* Skip non-word characters. */ + for (uc = utf.get_char(); + uc != 0 && !dict.is_word_character(uc, WordPosition.START); + uc = utf.get_char()) { + utf = utf.next_char(); + } + start_pos = line.pointer_to_offset(utf); + + /* Skip over word characters. */ + for (; + uc != 0 && dict.is_word_character(uc, WordPosition.MIDDLE); + uc = utf.get_char()) { + utf = utf.next_char(); + } + + /* Skip backwards over any characters that can't appear at the end of a word. */ + unowned string i_utf = utf.prev_char(); + for (; + !dict.is_word_character(i_utf.get_char(), WordPosition.END); + i_utf = i_utf.prev_char()); + + /* Save (word, position) tuple. */ + cur_pos = line.pointer_to_offset(i_utf); + if (cur_pos > start_pos) { + var word = line.substring(start_pos, cur_pos - start_pos + 1); + tokens.append(new Token(word, start_pos)); + } + } + + return tokens; +} + +errordomain Spelling { + EMPTY_WORD, + SYNTAX_ERROR, +} + +void usage(OptionContext ctx) { + print("%s", ctx.get_help(false, null)); + exit(1); +} + +public class Main : Object { + private static Mode mode = Mode.NONE; + private static string dictionary = null; /* -d dictionary */ + private static string perslist = null; /* -p personal_word_list */ + [CCode (array_length = false, array_null_terminated = true)] + private static string[] files; /* FILE... */ + private static bool version = false; + private static bool count_lines = false; + private static bool ignored; + + private const OptionEntry[] main_options = { + {"pipe", 'a', OptionFlags.NO_ARG, OptionArg.CALLBACK, (void *)Main.set_mode, "Talk to another program through a pipe, like Ispell", null}, + {"errors-only", 'l', OptionFlags.NO_ARG, OptionArg.CALLBACK, (void *)Main.set_mode, "List only the misspellings", null}, + {"dictionary", 'd', OptionFlags.NONE, OptionArg.STRING, ref dictionary, "Use the given dictionary", null}, + {"pwl", 'p', OptionFlags.NONE, OptionArg.FILENAME, ref perslist, "Use the given personal word list", null}, + {"show-lines", 'L', OptionFlags.NONE, OptionArg.NONE, ref count_lines, "Display line numbers", null}, + {"version", 'v', OptionFlags.NONE, OptionArg.NONE, ref version, "Display version information and exit", null}, + + /* Ignore: Emacs calls ispell with '-m' and '-B'. */ + {" ", 'm', OptionFlags.HIDDEN, OptionArg.NONE, ref ignored, null, null}, + {" ", 'B', OptionFlags.HIDDEN, OptionArg.NONE, ref ignored, null, null}, + + /* Files */ + {OPTION_REMAINING, '\0', OptionFlags.NONE, OptionArg.FILENAME_ARRAY, ref files, null, "FILE..."}, + {null} + }; + + private static bool set_mode(string option_name, string? val, void *data) { + /* The first mode specified takes precedence. */ + if (mode == Mode.NONE) { + if (option_name == "--pipe" || option_name == "-a") + mode = Mode.A; + else if (option_name == "--errors-only" || option_name == "-l") + mode = Mode.L; + } + return true; + } + + private static bool parse_file(FileStream fin) { + var terse_mode = false; + + if (mode == Mode.A) + print_version(GLib.stdout); + + string lang; + if (dictionary != null) + lang = dictionary; + else { + lang = enchant_get_user_language(); + if (lang == null) + return false; + if (lang == "C") + lang = "en"; + } + + var broker = new Broker(); + unowned var dict = broker.request_dict_with_pwl(lang, perslist); + + if (dict == null) { + GLib.stderr.printf("No dictionary available for '%s'", lang); + string errmsg = broker.get_error(); + if (errmsg != null) + GLib.stderr.printf(": %s", errmsg); + GLib.stderr.putc('\n'); + + return false; + } + + var corrected_something = false; + size_t line_count = 0; + string str; + while ((str = get_line(fin)) != null) { + bool mode_A_no_command = false; + + if (count_lines) + line_count++; + + if (str.length > 0) { + corrected_something = false; + + if (mode == Mode.A) { + try { + switch (str[0]) { + case '&': /* Insert uncapitalised in personal word list */ + if (str.length == 1) + throw new Spelling.EMPTY_WORD("Word missing"); + if (str.length > 1) { + unowned string new_word = str.next_char(); + unichar c = new_word.get_char_validated(); + if (c > 0) { + dict.add(c.tolower().to_string() + new_word.next_char()); + } else + dict.add(new_word); + } + break; + case '*': /* Insert in personal word list */ + if (str.length == 1) + throw new Spelling.EMPTY_WORD("Word missing"); + dict.add(str.next_char()); + break; + case '@': /* Accept for this session */ + if (str.length == 1) + throw new Spelling.EMPTY_WORD("Word missing"); + dict.add_to_session(str.substring(1), -1); + break; + case '/': /* Remove from personal word list */ + if (str.length == 1) + throw new Spelling.EMPTY_WORD("Word missing"); + dict.remove(str.substring(1), -1); + break; + case '_': /* Remove from this session */ + if (str.length == 1) + throw new Spelling.EMPTY_WORD("Word missing"); + dict.remove_from_session(str.substring(1), -1); + break; + + case '%': /* Exit terse mode */ + terse_mode = false; + break; + case '!': /* Enter terse mode */ + terse_mode = true; + break; + + /* Ignore these commands */ + case '#': /* Save personal word list (enchant does this automatically) */ + case '+': /* LaTeX mode */ + case '-': /* nroff mode [default] */ + case '~': /* change string character type (enchant is fixed to UTF-8) */ + case '`': /* Enter verbose-correction mode */ + break; + + case '$': /* Miscellaneous commands */ + { + /* Save correction for rest of session [aspell extension] */ + if (str.has_prefix("$$ra ")) { /* Syntax: $$ra , */ + // Enchant no longer supports this. + } else if (str.has_prefix("$$wc")) + /* Return the extra word chars list */ + print("%s\n", dict.get_extra_word_characters()); + } + break; + + case '^': /* ^ is used as prefix to prevent interpretation of original + first character as a command */ + default: /* A word or words to check */ + mode_A_no_command = true; + break; + } + } catch (Spelling e) { + print("Error: The word \"\" is invalid. Empty string.\n"); + } + } + + if (mode != Mode.A || mode_A_no_command) { + var tokens = tokenize_line(dict, str); + if (tokens == null) + GLib.stdout.putc('\n'); + for (unowned var tok_ptr = tokens; tok_ptr != null; tok_ptr = tok_ptr.next) { + corrected_something = true; + + var token = tok_ptr.data; + var word = token.word; + size_t pos = token.pos; + + if (mode == Mode.A) + do_mode_a(dict, word, pos, line_count, terse_mode); + else if (mode == Mode.L) + do_mode_l(dict, word, line_count); + } + } + } + + if (mode == Mode.A && corrected_something) + GLib.stdout.putc('\n'); + GLib.stdout.flush(); + } + + return true; + } + + public static int main(string[] args) { + /* Initialize system locale */ + Intl.setlocale(); + + get_charset(out charset); + // FIXME + // #ifdef _WIN32 + // /* If reading from stdin, its CP may not be the system CP (which glib's locale gives us) */ + // if (GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR) + // charset = g_strdup_printf("CP%u", GetConsoleCP()); + // #endif + + var ctx = new OptionContext("\n\nCheck spelling non-interactively."); + ctx.set_help_enabled(true); + ctx.add_main_entries(main_options, null); + try { + ctx.parse(ref args); + } catch (OptionError e) { + printerr("error %s\n", e.message); + usage(ctx); + } + + if (version) { + print_version(GLib.stdout); + exit(0); + } + + /* Exit with usage if no mode is set. */ + if (mode == Mode.NONE) + usage(ctx); + + /* Process the file or standard input. */ + FileStream fp = null; + if (files == null) + return parse_file(GLib.stdin) ? 0 : 1; + + foreach (var f in files) { + fp = FileStream.open(f, "rb"); + if (fp == null) { + GLib.stderr.printf("Error: Could not open the file \"%s\" for reading.\n", f); + exit(1); + } + if (!parse_file(fp)) + exit(1); + } + return 0; + } +} diff --git a/src/glib-2.0.vapi b/src/glib-2.0.vapi new file mode 100644 index 00000000..c868db94 --- /dev/null +++ b/src/glib-2.0.vapi @@ -0,0 +1,7141 @@ +/* glib-2.0.vala + * + * Copyright (C) 2006-2014 Jürg Billeter + * Copyright (C) 2006-2008 Raffaele Sandrini + * Copyright (C) 2007 Mathias Hasselmann + * + * 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.1 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 + * + * As a special exception, if you use inline functions from this file, this + * file does not by itself cause the resulting executable to be covered by + * the GNU Lesser General Public License. + * + * Author: + * Jürg Billeter + * Raffaele Sandrini + * Mathias Hasselmann + */ + +[SimpleType] +[GIR (name = "gboolean")] +[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", type_signature = "b")] +[BooleanType] +public struct bool { + public string to_string () { + if (this) { + return "true"; + } else { + return "false"; + } + } + + public static bool parse (string str) { + if (str == "true") { + return true; + } else { + return false; + } + } + public static bool try_parse (string str, out bool result = null) { + if (str == "true") { + result = true; + return true; + } else if (str == "false") { + result = false; + return true; + } else { + result = false; + return false; + } + } +} + +[SimpleType] +[GIR (name = "gint8")] +[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_schar", set_value_function = "g_value_set_schar", default_value = "\'\\0\'", type_signature = "y")] +[IntegerType (rank = 2, min = 0, max = 127)] +public struct char { + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%c"); + 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 (); + + [CCode (cname = "MIN")] + public static char min (char a, char b); + [CCode (cname = "MAX")] + public static char max (char a, char b); + [CCode (cname = "CLAMP")] + public char clamp (char low, char high); +} + +[SimpleType] +[GIR (name = "guint8")] +[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\'", type_signature = "y")] +[IntegerType (rank = 3, min = 0, max = 255)] +public struct uchar { + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%hhu"); + + [CCode (cname = "MIN")] + public static uchar min (uchar a, uchar b); + [CCode (cname = "MAX")] + public static uchar max (uchar a, uchar b); + [CCode (cname = "CLAMP")] + public uchar clamp (uchar low, uchar high); +} + +[SimpleType] +[GIR (name = "gint")] +[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", default_value_on_error = "-1", type_signature = "i")] +[IntegerType (rank = 6)] +public struct int { + [CCode (cname = "G_MININT")] + public const int MIN; + [CCode (cname = "G_MAXINT")] + public const int MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%i"); + + [CCode (cname = "MIN")] + public static int min (int a, int b); + [CCode (cname = "MAX")] + public static int max (int a, int b); + [CCode (cname = "CLAMP")] + public int clamp (int low, int high); + + [CCode (cname = "GINT_TO_POINTER")] + public void* to_pointer (); + [CCode (cname = "GPOINTER_TO_INT")] + public static int from_pointer (void* p); + + [CCode (cname = "abs", cheader_filename = "stdlib.h")] + public int abs (); + + [CCode (cname = "GINT_TO_BE")] + public int to_big_endian (); + [CCode (cname = "GINT_TO_LE")] + public int to_little_endian (); + + [CCode (cname = "GINT_FROM_BE")] + public static int from_big_endian (int val); + [CCode (cname = "GINT_FROM_LE")] + public static int from_little_endian (int val); + + [CCode (cname = "atoi", cheader_filename = "stdlib.h")] + public static int parse (string str); + + [CCode (cname = "strtol", cheader_filename = "stdlib.h")] + static long strtol (string nptr, out char* endptr, int _base); + + public static bool try_parse (string str, out int result = null, out unowned string unparsed = null, uint _base = 0) { + char* endptr; + errno = 0; + long long_result = strtol (str, out endptr, (int) _base); + if (endptr == (char*) str + str.length) { + unparsed = ""; + } else { + unparsed = (string) endptr; + } + if (int.MIN <= long_result <= int.MAX) { + result = (int) long_result; + return errno != ERANGE && errno != EINVAL && unparsed != endptr; + } else { + result = int.MAX; + return false; + } + } +} + +[SimpleType] +[GIR (name = "guint")] +[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", type_signature = "u")] +[IntegerType (rank = 7)] +public struct uint { + [CCode (cname = "0")] + public const uint MIN; + [CCode (cname = "G_MAXUINT")] + public const uint MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%u"); + + [CCode (cname = "MIN")] + public static uint min (uint a, uint b); + [CCode (cname = "MAX")] + public static uint max (uint a, uint b); + [CCode (cname = "CLAMP")] + public uint clamp (uint low, uint high); + + [CCode (cname = "GUINT_TO_POINTER")] + public void* to_pointer (); + [CCode (cname = "GPOINTER_TO_UINT")] + public static uint from_pointer (void* p); + + [CCode (cname = "GUINT_TO_BE")] + public uint to_big_endian (); + [CCode (cname = "GUINT_TO_LE")] + public uint to_little_endian (); + + [CCode (cname = "GUINT_FROM_BE")] + public static uint from_big_endian (uint val); + [CCode (cname = "GUINT_FROM_LE")] + public static uint from_little_endian (uint val); + + [CCode (cname = "strtoul", cheader_filename = "stdlib.h")] + static ulong strtoul (string nptr, out char* endptr, int _base); + + public static uint parse (string str, uint _base = 0) { + return (uint) strtoul (str, null, (int) _base); + } + + public static bool try_parse (string str, out uint result = null, out unowned string unparsed = null, uint _base = 0) { + char* endptr; + errno = 0; + ulong ulong_result = strtoul (str, out endptr, (int) _base); + if (endptr == (char*) str + str.length) { + unparsed = ""; + } else { + unparsed = (string) endptr; + } + if (uint.MIN <= ulong_result <= uint.MAX) { + result = (uint) ulong_result; + return errno != ERANGE && errno != EINVAL && unparsed != endptr; + } else { + result = uint.MAX; + return false; + } + } +} + +[SimpleType] +[GIR (name = "gshort")] +[CCode (cname = "gshort", 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", default_value_on_error = "-1", type_signature = "n")] +[IntegerType (rank = 4, min = -32768, max = 32767)] +public struct short { + [CCode (cname = "G_MINSHORT")] + public const short MIN; + [CCode (cname = "G_MAXSHORT")] + public const short MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%hi"); + + [CCode (cname = "MIN")] + public static short min (short a, short b); + [CCode (cname = "MAX")] + public static short max (short a, short b); + [CCode (cname = "CLAMP")] + public short clamp (short low, short high); + [CCode (cname = "abs", cheader_filename = "stdlib.h")] + public short abs (); +} + +[SimpleType] +[GIR (name = "gushort")] +[CCode (cname = "gushort", 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", type_signature = "q")] +[IntegerType (rank = 5, min = 0, max = 65535)] +public struct ushort { + [CCode (cname = "0U")] + public const ushort MIN; + [CCode (cname = "G_MAXUSHORT")] + public const ushort MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%hu"); + + [CCode (cname = "MIN")] + public static ushort min (ushort a, ushort b); + [CCode (cname = "MAX")] + public static ushort max (ushort a, ushort b); + [CCode (cname = "CLAMP")] + public ushort clamp (ushort low, ushort high); +} + +[SimpleType] +[GIR (name = "glong")] +[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", default_value_on_error = "-1L")] +[IntegerType (rank = 8)] +public struct long { + [CCode (cname = "G_MINLONG")] + public const long MIN; + [CCode (cname = "G_MAXLONG")] + public const long MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%li"); + + [CCode (cname = "MIN")] + public static long min (long a, long b); + [CCode (cname = "MAX")] + public static long max (long a, long b); + [CCode (cname = "CLAMP")] + public long clamp (long low, long high); + [CCode (cname = "labs", cheader_filename = "stdlib.h")] + public long abs (); + + [CCode (cname = "GLONG_TO_BE")] + public long to_big_endian (); + [CCode (cname = "GLONG_TO_LE")] + public long to_little_endian (); + + [CCode (cname = "GLONG_FROM_BE")] + public static long from_big_endian (long val); + [CCode (cname = "GLONG_FROM_LE")] + public static long from_little_endian (long val); + + [CCode (cname = "strtol", cheader_filename = "stdlib.h")] + static long strtol (string nptr, out char* endptr, int _base); + + public static long parse (string str, uint _base = 0) { + return strtol (str, null, (int) _base); + } + + public static bool try_parse (string str, out long result = null, out unowned string unparsed = null, uint _base = 0) { + char* endptr; + errno = 0; + result = strtol (str, out endptr, (int) _base); + if (endptr == (char*) str + str.length) { + unparsed = ""; + return errno != ERANGE && errno != EINVAL; + } else { + unparsed = (string) endptr; + return false; + } + } +} + +[SimpleType] +[GIR (name = "gulong")] +[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")] +[IntegerType (rank = 9)] +public struct ulong { + [CCode (cname = "0UL")] + public const ulong MIN; + [CCode (cname = "G_MAXULONG")] + public const ulong MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%lu"); + + [CCode (cname = "MIN")] + public static ulong min (ulong a, ulong b); + [CCode (cname = "MAX")] + public static ulong max (ulong a, ulong b); + [CCode (cname = "CLAMP")] + public ulong clamp (ulong low, ulong high); + + [CCode (cname = "GULONG_TO_BE")] + public ulong to_big_endian (); + [CCode (cname = "GULONG_TO_LE")] + public ulong to_little_endian (); + + [CCode (cname = "GULONG_FROM_BE")] + public static ulong from_big_endian (ulong val); + [CCode (cname = "GULONG_FROM_LE")] + public static ulong from_little_endian (ulong val); + + [CCode (cname = "strtoul", cheader_filename = "stdlib.h")] + static ulong strtoul (string nptr, out char* endptr, int _base); + + public static ulong parse (string str, uint _base = 0) { + return strtoul (str, null, (int) _base); + } + + public static bool try_parse (string str, out ulong result = null, out unowned string unparsed = null, uint _base = 0) { + char* endptr; + errno = 0; + result = strtoul (str, out endptr, (int) _base); + if (endptr == (char*) str + str.length) { + unparsed = ""; + return errno != ERANGE && errno != EINVAL; + } else { + unparsed = (string) endptr; + return false; + } + } +} + +[SimpleType] +[GIR (name = "gulong")] +[CCode (cname = "gsize", 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")] +[IntegerType (rank = 9)] +public struct size_t { + [CCode (cname = "0UL")] + public const ulong MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXSIZE")] + public const ulong MAX; + + [Version (since = "2.6")] + [CCode (cname = "G_GSIZE_FORMAT")] + public const string FORMAT; + [Version (since = "2.6")] + [CCode (cname = "G_GSIZE_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "GSIZE_TO_POINTER")] + public void* to_pointer (); + [CCode (cname = "GPOINTER_TO_SIZE")] + public static size_t from_pointer (void* p); + + [CCode (cname = "MIN")] + public static size_t min (size_t a, size_t b); + [CCode (cname = "MAX")] + public static size_t max (size_t a, size_t b); + [CCode (cname = "CLAMP")] + public size_t clamp (size_t low, size_t high); +} + +[SimpleType] +[GIR (name = "glong")] +[CCode (cname = "gssize", 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", default_value_on_error = "-1L")] +[IntegerType (rank = 8)] +public struct ssize_t { + [Version (since = "2.14")] + [CCode (cname = "G_MINSSIZE")] + public const long MIN; + [Version (since = "2.14")] + [CCode (cname = "G_MAXSSIZE")] + public const long MAX; + + [Version (since = "2.6")] + [CCode (cname = "G_GSSIZE_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GSIZE_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "MIN")] + public static ssize_t min (ssize_t a, ssize_t b); + [CCode (cname = "MAX")] + public static ssize_t max (ssize_t a, ssize_t b); + [CCode (cname = "CLAMP")] + public ssize_t clamp (ssize_t low, ssize_t high); + [CCode (cname = "ABS")] + public ssize_t abs (); +} + +[SimpleType] +[GIR (name = "gulong")] +[CCode (cname = "guintptr", 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")] +[IntegerType (rank = 9)] +public struct uintptr { + [CCode (cname = "0UL")] + public const ulong MIN; + [CCode (cname = "G_MAXSIZE")] + public const ulong MAX; + + [CCode (cname = "G_GUINTPTR_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINTPTR_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "GSIZE_TO_POINTER")] + public void* to_pointer (); + [CCode (cname = "GPOINTER_TO_SIZE")] + public static uintptr from_pointer (void* p); + + [CCode (cname = "MIN")] + public static uintptr min (uintptr a, uintptr b); + [CCode (cname = "MAX")] + public static uintptr max (uintptr a, uintptr b); + [CCode (cname = "CLAMP")] + public uintptr clamp (uintptr low, uintptr high); +} + +[SimpleType] +[GIR (name = "glong")] +[CCode (cname = "gintptr", 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")] +[IntegerType (rank = 8)] +public struct intptr { + [CCode (cname = "G_MINSSIZE")] + public const long MIN; + [CCode (cname = "G_MAXSSIZE")] + public const long MAX; + + [CCode (cname = "G_GINTPTR_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINTPTR_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "MIN")] + public static intptr min (intptr a, intptr b); + [CCode (cname = "MAX")] + public static intptr max (intptr a, intptr b); + [CCode (cname = "CLAMP")] + public intptr clamp (intptr low, intptr high); +} + +[SimpleType] +[GIR (name = "gint8")] +[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", default_value_on_error = "-1", type_signature = "y")] +[IntegerType (rank = 1, min = -128, max = 127)] +public struct int8 { + [Version (since = "2.4")] + [CCode (cname = "G_MININT8")] + public const int8 MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXINT8")] + public const int8 MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%hhi"); + + [CCode (cname = "MIN")] + public static int8 min (int8 a, int8 b); + [CCode (cname = "MAX")] + public static int8 max (int8 a, int8 b); + [CCode (cname = "CLAMP")] + public int8 clamp (int8 low, int8 high); + [CCode (cname = "ABS")] + public int8 abs (); +} + +[SimpleType] +[GIR (name = "guint8")] +[CCode (cname = "guint8", 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 = "0U", type_signature = "y")] +[IntegerType (rank = 3, min = 0, max = 255)] +public struct uint8 { + [CCode (cname = "0U")] + public const uint8 MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXUINT8")] + public const uint8 MAX; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%hhu"); + + [CCode (cname = "MIN")] + public static uint8 min (uint8 a, uint8 b); + [CCode (cname = "MAX")] + public static uint8 max (uint8 a, uint8 b); + [CCode (cname = "CLAMP")] + public uint8 clamp (uint8 low, uint8 high); +} + +[SimpleType] +[GIR (name = "gint16")] +[CCode (cname = "gint16", 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", default_value_on_error = "-1", type_signature = "n")] +[IntegerType (rank = 4, min = -32768, max = 32767)] +public struct int16 { + [Version (since = "2.4")] + [CCode (cname = "G_MININT16")] + public const int16 MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXINT16")] + public const int16 MAX; + + [CCode (cname = "G_GINT16_FORMAT")] + public const string FORMAT; + [Version (since = "2.4")] + [CCode (cname = "G_GINT16_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "MIN")] + public static int16 min (int16 a, int16 b); + [CCode (cname = "MAX")] + public static int16 max (int16 a, int16 b); + [CCode (cname = "CLAMP")] + public int16 clamp (int16 low, int16 high); + [CCode (cname = "ABS")] + public int16 abs (); + + [CCode (cname = "GINT16_TO_BE")] + public int16 to_big_endian (); + [CCode (cname = "GINT16_TO_LE")] + public int16 to_little_endian (); + + [CCode (cname = "GINT16_FROM_BE")] + public static int16 from_big_endian (int16 val); + [CCode (cname = "GINT16_FROM_LE")] + public static int16 from_little_endian (int16 val); +} + +[SimpleType] +[GIR (name = "guint16")] +[CCode (cname = "guint16", 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", type_signature = "q")] +[IntegerType (rank = 5, min = 0, max = 65535)] +public struct uint16 { + [CCode (cname = "0U")] + public const uint16 MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXUINT16")] + public const uint16 MAX; + + [CCode (cname = "G_GUINT16_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINT16_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%hu"); + + [CCode (cname = "MIN")] + public static uint16 min (uint16 a, uint16 b); + [CCode (cname = "MAX")] + public static uint16 max (uint16 a, uint16 b); + [CCode (cname = "CLAMP")] + public uint16 clamp (uint16 low, uint16 high); + + [CCode (cname = "GUINT16_TO_BE")] + public uint16 to_big_endian (); + [CCode (cname = "GUINT16_TO_LE")] + public uint16 to_little_endian (); + + [CCode (cname = "GUINT16_FROM_BE")] + public static uint16 from_big_endian (uint16 val); + [CCode (cname = "GUINT16_FROM_LE")] + public static uint16 from_little_endian (uint16 val); + + [CCode (cname = "g_htons")] + public static uint16 to_network (uint16 val); + [CCode (cname = "g_ntohs")] + public static uint16 from_network (uint16 val); + + [CCode (cname = "GUINT16_SWAP_BE_PDP")] + public uint16 swap_big_endian_pdp (); + [CCode (cname = "GUINT16_SWAP_LE_BE")] + public uint16 swap_little_endian_big_endian (); + [CCode (cname = "GUINT16_SWAP_LE_PDP")] + public uint16 swap_little_endian_pdp (); +} + +[SimpleType] +[GIR (name = "gint32")] +[CCode (cname = "gint32", 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", default_value_on_error = "-1", type_signature = "i")] +[IntegerType (rank = 6)] +public struct int32 { + [Version (since = "2.4")] + [CCode (cname = "G_MININT32")] + public const int32 MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXINT32")] + public const int32 MAX; + + [CCode (cname = "G_GINT32_FORMAT")] + public const string FORMAT; + [Version (since = "2.4")] + [CCode (cname = "G_GINT32_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%i"); + + [CCode (cname = "MIN")] + public static int32 min (int32 a, int32 b); + [CCode (cname = "MAX")] + public static int32 max (int32 a, int32 b); + [CCode (cname = "CLAMP")] + public int32 clamp (int32 low, int32 high); + [CCode (cname = "ABS")] + public int32 abs (); + + [CCode (cname = "GINT32_TO_BE")] + public int32 to_big_endian (); + [CCode (cname = "GINT32_TO_LE")] + public int32 to_little_endian (); + + [CCode (cname = "GINT32_FROM_BE")] + public static int32 from_big_endian (int32 val); + [CCode (cname = "GINT32_FROM_LE")] + public static int32 from_little_endian (int32 val); +} + +[SimpleType] +[GIR (name = "guint32")] +[CCode (cname = "guint32", 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", type_signature = "u")] +[IntegerType (rank = 7)] +public struct uint32 { + [CCode (cname = "0U")] + public const uint32 MIN; + [Version (since = "2.4")] + [CCode (cname = "G_MAXUINT32")] + public const uint32 MAX; + + [CCode (cname = "G_GUINT32_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINT32_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%u"); + + [CCode (cname = "MIN")] + public static uint32 min (uint32 a, uint32 b); + [CCode (cname = "MAX")] + public static uint32 max (uint32 a, uint32 b); + [CCode (cname = "CLAMP")] + public uint32 clamp (uint32 low, uint32 high); + + [CCode (cname = "GUINT32_TO_BE")] + public uint32 to_big_endian (); + [CCode (cname = "GUINT32_TO_LE")] + public uint32 to_little_endian (); + + [CCode (cname = "GUINT32_FROM_BE")] + public static uint32 from_big_endian (uint32 val); + [CCode (cname = "GUINT32_FROM_LE")] + public static uint32 from_little_endian (uint32 val); + + [CCode (cname = "g_htonl")] + public static uint32 to_network (uint32 val); + [CCode (cname = "g_ntohl")] + public static uint32 from_network (uint32 val); + + [CCode (cname = "GUINT32_SWAP_BE_PDP")] + public uint32 swap_big_endian_pdp (); + [CCode (cname = "GUINT32_SWAP_LE_BE")] + public uint32 swap_little_endian_big_endian (); + [CCode (cname = "GUINT32_SWAP_LE_PDP")] + public uint32 swap_little_endian_pdp (); +} + +[SimpleType] +[GIR (name = "gint64")] +[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", default_value_on_error = "-1LL", type_signature = "x")] +[IntegerType (rank = 10)] +public struct int64 { + [CCode (cname = "G_MININT64")] + public const int64 MIN; + [CCode (cname = "G_MAXINT64")] + public const int64 MAX; + + [CCode (cname = "G_GINT64_FORMAT")] + public const string FORMAT; + [Version (since = "2.4")] + [CCode (cname = "G_GINT64_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "MIN")] + public static int64 min (int64 a, int64 b); + [CCode (cname = "MAX")] + public static int64 max (int64 a, int64 b); + [CCode (cname = "CLAMP")] + public int64 clamp (int64 low, int64 high); + [CCode (cname = "llabs", cheader_filename = "stdlib.h")] + public int64 abs (); + + [CCode (cname = "GINT64_TO_BE")] + public int64 to_big_endian (); + [CCode (cname = "GINT64_TO_LE")] + public int64 to_little_endian (); + + [CCode (cname = "GINT64_FROM_BE")] + public static int64 from_big_endian (int64 val); + [CCode (cname = "GINT64_FROM_LE")] + public static int64 from_little_endian (int64 val); + + [CCode (cname = "GUINT64_SWAP_LE_BE")] + public uint64 swap_little_endian_big_endian (); + + [CCode (cname = "g_ascii_strtoll")] + static int64 ascii_strtoll (string nptr, out char* endptr, uint _base); + + [Version (since = "2.12")] + public static int64 parse (string str, uint _base = 0) { + return ascii_strtoll (str, null, _base); + } + + [Version (since = "2.12")] + public static bool try_parse (string str, out int64 result = null, out unowned string unparsed = null, uint _base = 0) { + char* endptr; + errno = 0; + result = ascii_strtoll (str, out endptr, _base); + if (endptr == (char*) str + str.length) { + unparsed = ""; + return errno != ERANGE && errno != EINVAL; + } else { + unparsed = (string) endptr; + return false; + } + } + + [CCode (cname = "g_ascii_string_to_signed")] + [Version (since = "2.54")] + public static bool from_string (string str, [CCode (pos = 5.1)] out int64 out_num = null, uint @base = 10U, int64 min = int64.MIN, int64 max = int64.MAX) throws GLib.NumberParserError; +} + +[SimpleType] +[GIR (name = "guint64")] +[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", type_signature = "t")] +[IntegerType (rank = 11)] +public struct uint64 { + [CCode (cname = "0ULL")] + public const uint64 MIN; + [CCode (cname = "G_MAXUINT64")] + public const uint64 MAX; + + [CCode (cname = "G_GUINT64_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINT64_MODIFIER")] + public const string FORMAT_MODIFIER; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + + [CCode (cname = "MIN")] + public static uint64 min (uint64 a, uint64 b); + [CCode (cname = "MAX")] + public static uint64 max (uint64 a, uint64 b); + [CCode (cname = "CLAMP")] + public uint64 clamp (uint64 low, uint64 high); + + [CCode (cname = "GUINT64_TO_BE")] + public uint64 to_big_endian (); + [CCode (cname = "GUINT64_TO_LE")] + public uint64 to_little_endian (); + + [CCode (cname = "GUINT64_FROM_BE")] + public static uint64 from_big_endian (uint64 val); + [CCode (cname = "GUINT64_FROM_LE")] + public static uint64 from_little_endian (uint64 val); + + [CCode (cname = "g_ascii_strtoull")] + static uint64 ascii_strtoull (string nptr, out char* endptr, uint _base); + + public static uint64 parse (string str, uint _base = 0) { + return ascii_strtoull (str, null, _base); + } + + public static bool try_parse (string str, out uint64 result = null, out unowned string unparsed = null, uint _base = 0) { + char* endptr; + errno = 0; + result = ascii_strtoull (str, out endptr, _base); + if (endptr == (char*) str + str.length) { + unparsed = ""; + return errno != ERANGE && errno != EINVAL; + } else { + unparsed = (string) endptr; + return false; + } + } + + [CCode (cname = "g_ascii_string_to_unsigned")] + [Version (since = "2.54")] + public static bool from_string (string str, [CCode (pos = 5.1)] out uint64 out_num = null, uint @base = 10U, uint64 min = uint64.MIN, uint64 max = uint64.MAX) throws GLib.NumberParserError; +} + +[SimpleType] +[GIR (name = "gfloat")] +[CCode (cname = "gfloat", 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", default_value_on_error = "-1.0F")] +[FloatingType (rank = 1)] +public struct float { + [CCode (cname = "FLT_ROUNDS")] + public const int ROUNDS; + [CCode (cname = "FLT_RADIX")] + public const int RADIX; + [CCode (cname = "FLT_MANT_DIG")] + public const int MANT_DIG; + [CCode (cname = "FLT_DIG")] + public const int DIG; + + [CCode (cname = "FLT_MIN_EXP")] + public const int MIN_EXP; + [CCode (cname = "FLT_MAX_EXP")] + public const int MAX_EXP; + + [CCode (cname = "FLT_MIN_10_EXP")] + public const int MIN_10_EXP; + [CCode (cname = "FLT_MAX_10_EXP")] + public const int MAX_10_EXP; + + [CCode (cname = "FLT_EPSILON")] + public const float EPSILON; + [CCode (cname = "FLT_MIN")] + public const float MIN; + [CCode (cname = "FLT_MAX")] + public const float MAX; + + [CCode (cname = "NAN")] + public const float NAN; + [CCode (cname = "INFINITY")] + public const 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", instance_pos = -1)] + public string to_string (string format = "%g"); + + [CCode (cname = "MIN")] + public static float min (float a, float b); + [CCode (cname = "MAX")] + public static float max (float a, float b); + [CCode (cname = "CLAMP")] + public float clamp (float low, float high); + [CCode (cname = "fabsf")] + public float abs (); + + [CCode (cname = "strtof", cheader_filename = "stdlib.h")] + static float strtof (string nptr, out char* endptr); + + public static float parse (string str) { + return strtof (str, null); + } + + public static bool try_parse (string str, out float result = null, out unowned string unparsed = null) { + char* endptr; + errno = 0; + result = strtof (str, out endptr); + if (endptr == (char*) str + str.length) { + unparsed = ""; + return errno != ERANGE; + } else { + unparsed = (string) endptr; + return false; + } + } +} + +[SimpleType] +[GIR (name = "gdouble")] +[CCode (cname = "gdouble", 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", default_value_on_error = "-1.0", type_signature = "d")] +[FloatingType (rank = 2)] +public struct double { + [CCode (cname = "DBL_MANT_DIG")] + public const int MANT_DIG; + [CCode (cname = "DBL_DIG")] + public const int DIG; + + [CCode (cname = "DBL_MIN_EXP")] + public const int MIN_EXP; + [CCode (cname = "DBL_MAX_EXP")] + public const int MAX_EXP; + + [CCode (cname = "DBL_MIN_10_EXP")] + public const int MIN_10_EXP; + [CCode (cname = "DBL_MAX_10_EXP")] + public const int MAX_10_EXP; + + [CCode (cname = "DBL_EPSILON")] + public const double EPSILON; + [CCode (cname = "DBL_MIN")] + public const double MIN; + [CCode (cname = "DBL_MAX")] + public const double MAX; + + [CCode (cname = "((double) NAN)")] + public const double NAN; + [CCode (cname = "((double) INFINITY)")] + public const 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 = "MIN")] + public static double min (double a, double b); + [CCode (cname = "MAX")] + public static double max (double a, double b); + [CCode (cname = "CLAMP")] + public double clamp (double low, double high); + [CCode (cname = "fabs")] + public double abs (); + + [CCode (cname = "G_ASCII_DTOSTR_BUF_SIZE")] + public const int DTOSTR_BUF_SIZE; + [CCode (cname = "g_ascii_dtostr", instance_pos = -1)] + public unowned string to_str (char[] buffer); + [CCode (cname = "g_ascii_formatd", instance_pos = -1)] + public unowned string format (char[] buffer, string format = "%g"); + + public string to_string () { + return this.to_str(new char[DTOSTR_BUF_SIZE]); + } + + [CCode (cname = "g_ascii_strtod")] + static double ascii_strtod (string nptr, out char* endptr); + + public static double parse (string str) { + return ascii_strtod (str, null); + } + + public static bool try_parse (string str, out double result = null, out unowned string unparsed = null) { + char* endptr; + errno = 0; + result = ascii_strtod (str, out endptr); + if (endptr == (char*) str + str.length) { + unparsed = ""; + return errno != ERANGE; + } else { + unparsed = (string) endptr; + return false; + } + } +} + +//FIXME [GIR (name = "off_t")] +[GIR (name = "gsize")] +[CCode (cheader_filename = "sys/types.h", has_type_id = false, default_value = "0")] +[IntegerType (rank = 9)] +public struct off_t { +} + +//FIXME [GIR (name = "pid_t")] +[GIR (name = "gint")] +[IntegerType (rank = 9)] +[CCode (cheader_filename = "sys/types.h", has_type_id = false, default_value = "0")] +public struct pid_t { +} + +//FIXME [GIR (name = "uid_t")] +[GIR (name = "guint")] +[IntegerType (rank = 9)] +[CCode (cheader_filename = "sys/types.h", has_type_id = false, default_value = "0")] +public struct uid_t { +} + +//FIXME [GIR (name = "gid_t")] +[GIR (name = "guint")] +[IntegerType (rank = 9)] +[CCode (cheader_filename = "sys/types.h", has_type_id = false, default_value = "0")] +public struct gid_t { +} + +//FIXME [GIR (name = "dev_t")] +[GIR (name = "gint")] +[IntegerType (rank = 9)] +[CCode (cheader_filename = "sys/types.h", has_type_id = false, default_value = "0")] +public struct dev_t { +} + +//FIXME [GIR (name = "socklen_t")] +[GIR (name = "gint32")] +[IntegerType (rank = 9)] +[CCode (cheader_filename = "sys/socket.h", has_type_id = false, default_value = "0")] +public struct socklen_t { +} + +//FIXME [GIR (name = "time_t")] +[GIR (name = "glong")] +[CCode (cheader_filename = "time.h", has_type_id = false, default_value = "0")] +[IntegerType (rank = 8)] +public struct time_t { + [CCode (cname = "time")] + public time_t (out time_t result = null); +} + +[SimpleType] +[CCode (cheader_filename="stdarg.h", cprefix="va_", has_type_id = false, destroy_function = "va_end", lvalue_access = false)] +public struct va_list { + [CCode (cname = "va_start")] + public va_list (); + [CCode (cname = "va_copy")] + public va_list.copy (va_list src); + [CCode (generic_type_pos = 1.1, simple_generics = true)] + public unowned G arg (); +} + +[SimpleType] +[GIR (name = "gunichar")] +[CCode (cname = "gunichar", cprefix = "g_unichar_", 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", type_signature = "u")] +[IntegerType (rank = 7)] +public struct unichar { + public bool validate (); + public bool isalnum (); + public bool isalpha (); + public bool iscntrl (); + public bool isdigit (); + public bool isgraph (); + public bool islower (); + [Version (since = "2.14")] + public bool ismark (); + public bool isprint (); + public bool ispunct (); + public bool isspace (); + public bool isupper (); + public bool isxdigit (); + public bool istitle (); + public bool isdefined (); + public bool iswide (); + [Version (since = "2.12")] + public bool iswide_cjk (); + [Version (since = "2.14")] + public bool iszerowidth (); + public unichar toupper (); + public unichar tolower (); + public unichar totitle (); + public int digit_value (); + public int xdigit_value (); + public GLib.UnicodeType type (); + public GLib.UnicodeBreakType break_type (); + [Version (since = "2.14")] + public GLib.UnicodeScript get_script(); + + public int to_utf8 (string? outbuf); + + public string to_string () { + string str = (string) new char[7]; + this.to_utf8 (str); + return str; + } + + [Version (since = "2.30")] + public bool compose (unichar b, out unichar ch); + [Version (since = "2.30")] + public bool decompose (out unichar a, out unichar b); + [Version (since = "2.30")] + public size_t fully_decompose (bool compat, unichar[] result); + + [CCode (cname = "MIN")] + public static unichar min (unichar a, unichar b); + [CCode (cname = "MAX")] + public static unichar max (unichar a, unichar b); + [CCode (cname = "CLAMP")] + public unichar clamp (unichar low, unichar high); + + [CCode (cname = "G_UNICHAR_MAX_DECOMPOSITION_LENGTH")] + public const int MAX_DECOMPOSITION_LENGTH; + + [CCode (cname = "G_GUINT32_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINT32_MODIFIER")] + public const string FORMAT_MODIFIER; +} + +[SimpleType] +[GIR (name = "guint16")] +[CCode (cname = "gunichar2", cheader_filename = "glib.h", default_value = "0U", type_signature = "q", has_type_id = false)] +[IntegerType (rank = 5)] +public struct unichar2 { + [CCode (cname = "G_GUINT16_FORMAT")] + public const string FORMAT; + [CCode (cname = "G_GINT16_MODIFIER")] + public const string FORMAT_MODIFIER; +} + +[Compact] +[Immutable] +[GIR (name = "utf8")] +[CCode (cname = "gchar", const_cname = "const gchar", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string", type_signature = "s")] +public class string { + [Version (replacement = "string.index_of")] + [CCode (cname = "strstr")] + public unowned string? str (string needle); + [Version (replacement = "string.last_index_of")] + [CCode (cname = "g_strrstr")] + public unowned string? rstr (string needle); + [CCode (cname = "g_strrstr_len")] + public unowned string? rstr_len (ssize_t haystack_len, string needle); + + [CCode (cname = "strstr")] + static char* strstr (char* haystack, char* needle); + [CCode (cname = "g_strrstr")] + static char* strrstr (char* haystack, char* needle); + [CCode (cname = "g_utf8_strchr")] + static char* utf8_strchr (char* str, ssize_t len, unichar c); + [CCode (cname = "g_utf8_strrchr")] + static char* utf8_strrchr (char* str, ssize_t len, unichar c); + + public int index_of (string needle, int start_index = 0) { + char* result = strstr ((char*) this + start_index, (char*) needle); + + if (result != null) { + return (int) (result - (char*) this); + } else { + return -1; + } + } + + public int last_index_of (string needle, int start_index = 0) { + char* result = strrstr ((char*) this + start_index, (char*) needle); + + if (result != null) { + return (int) (result - (char*) this); + } else { + return -1; + } + } + + public int index_of_char (unichar c, int start_index = 0) { + char* result = utf8_strchr ((char*) this + start_index, -1, c); + + if (result != null) { + return (int) (result - (char*) this); + } else { + return -1; + } + } + + public int last_index_of_char (unichar c, int start_index = 0) { + char* result = utf8_strrchr ((char*) this + start_index, -1, c); + + if (result != null) { + return (int) (result - (char*) this); + } else { + return -1; + } + } + + [Version (since = "2.2")] + [CCode (cname = "g_str_has_prefix")] + public bool has_prefix (string prefix); + [Version (since = "2.2")] + [CCode (cname = "g_str_has_suffix")] + public bool has_suffix (string suffix); + [CCode (cname = "g_strdup_printf"), PrintfFormat] + public string printf (...); + [CCode (cname = "g_strdup_vprintf")] + public string vprintf (va_list args); + [CCode (cname = "sscanf", cheader_filename = "stdio.h"), ScanfFormat] + public int scanf (string format, ...); + [CCode (cname = "g_strconcat")] + public string concat (string string2, ...); + [CCode (cname = "g_strescape")] + public string escape (string? exceptions = null); + [CCode (cname = "g_strcompress")] + public string compress (); + [CCode (cname = "g_strsplit", array_length = false, array_null_terminated = true)] + public string[] split (string delimiter, int max_tokens = 0); + [Version (since = "2.4")] + [CCode (cname = "g_strsplit_set", array_length = false, array_null_terminated = true)] + public string[] split_set (string delimiters, int max_tokens = 0); + [CCode (cname = "g_stpcpy")] + private static void* copy_to_buffer (void* dest, string src); + [CCode (cname = "_vala_g_strjoinv")] + public static string joinv (string? separator, string?[]? str_array) { + if (separator == null) { + separator = ""; + } + if (str_array != null && (str_array.length > 0 || (str_array.length == -1 && str_array[0] != null))) { + int i; + size_t len = 1; + for (i = 0 ; (str_array.length != -1 && i < str_array.length) || (str_array.length == -1 && str_array[i] != null) ; i++) { + len += (str_array[i] != null) ? ((!) str_array[i]).length : 0; + } + if (i == 0) { + return ""; + } + str_array.length = i; + len += ((!) separator).length * (i - 1); + + string* res = GLib.malloc (len); + void* ptr = string.copy_to_buffer ((void*) res, (str_array[0] != null) ? ((!) str_array[0]) : ""); + for (i = 1 ; i < str_array.length ; i++) { + ptr = string.copy_to_buffer (ptr, (!) separator); + ptr = string.copy_to_buffer (ptr, (str_array[i] != null) ? ((!) str_array[i]) : ""); + } + + return (owned) res; + } else { + return ""; + } + } + [CCode (cname = "g_strjoin")] + public static string join (string separator, ...); + [CCode (cname = "g_strnfill")] + public static string nfill (size_t length, char fill_char); + + public char get (long index) { + return ((char*) this)[index]; + } + + // checks whether valid string character starts at specified index + // embedded NULs are not supported by the string class + public bool valid_char (int index) { + uint8 c = ((uint8*) this)[index]; + if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) { + return false; + } else { + return true; + } + } + + [CCode (cname = "g_utf8_next_char")] + public unowned string next_char (); + [CCode (cname = "g_utf8_next_char")] + static char* utf8_next_char (char* str); + public bool get_next_char (ref int index, out unichar c) { + c = utf8_get_char ((char*) this + index); + if (c != 0) { + index = (int) (utf8_next_char ((char*) this + index) - (char*) this); + return true; + } else { + return false; + } + } + [CCode (cname = "g_utf8_get_char")] + static unichar utf8_get_char (char* str); + public unichar get_char (long index = 0) { + return utf8_get_char ((char*) this + index); + } + [CCode (cname = "g_utf8_get_char_validated")] + public unichar get_char_validated (ssize_t max_len = -1); + + [Version (replacement = "string.index_of_nth_char")] + [CCode (cname = "g_utf8_offset_to_pointer")] + public unowned string utf8_offset (long offset); + public unowned string offset (long offset) { + return (string) ((char*) this + offset); + } + [Version (replacement = "string.char_count")] + public long pointer_to_offset (string pos) { + return (long) ((char*) pos - (char*) this); + } + + [CCode (cname = "g_utf8_offset_to_pointer")] + char* utf8_offset_to_pointer (long offset); + + public int index_of_nth_char (long c) { + return (int) (this.utf8_offset_to_pointer (c) - (char*) this); + } + + [CCode (cname = "g_utf8_prev_char")] + public unowned string prev_char (); + [CCode (cname = "g_utf8_prev_char")] + static char* utf8_prev_char (char* str); + public bool get_prev_char (ref int index, out unichar c) { + if (0 < index) { + index = (int) (utf8_prev_char ((char*) this + index) - (char*) this); + c = utf8_get_char ((char*) this + index); + return true; + } else { + c = 0; + return false; + } + } + + [Version (replacement = "string.length")] + [CCode (cname = "strlen")] + public long len (); + [Version (replacement = "string.index_of_char")] + [CCode (cname = "g_utf8_strchr")] + public unowned string chr (ssize_t len, unichar c); + [Version (replacement = "string.last_index_of_char")] + [CCode (cname = "g_utf8_strrchr")] + public unowned string rchr (ssize_t len, unichar c); + [Version (since = "2.2")] + [CCode (cname = "g_utf8_strreverse")] + public string reverse (ssize_t len = -1); + [CCode (cname = "g_utf8_validate")] + public bool validate (ssize_t max_len = -1, out char* end = null); + [Version (since = "2.60")] + [CCode (cname = "g_utf8_validate_len")] + public bool validate_len (size_t max_len, out char* end = null); + [Version (since = "2.52")] + [CCode (cname = "g_utf8_make_valid")] + public string make_valid (ssize_t len = -1); + [CCode (cname = "g_utf8_normalize")] + public string normalize (ssize_t len = -1, GLib.NormalizeMode mode = GLib.NormalizeMode.DEFAULT); + [Version (since = "2.78")] + [CCode (cname = "g_utf8_truncate_middle")] + public string truncate_middle (size_t truncate_length); + + [CCode (cname = "g_utf8_strup")] + public string up (ssize_t len = -1); + [CCode (cname = "g_utf8_strdown")] + public string down (ssize_t len = -1); + [CCode (cname = "g_utf8_casefold")] + public string casefold (ssize_t len = -1); + [CCode (cname = "g_utf8_collate")] + public int collate (string str2); + [CCode (cname = "g_utf8_collate_key")] + public string collate_key (ssize_t len = -1); + [Version (since = "2.8")] + [CCode (cname = "g_utf8_collate_key_for_filename")] + public string collate_key_for_filename (ssize_t len = -1); + + [CCode (cname = "g_locale_to_utf8")] + public string locale_to_utf8 (ssize_t len, out size_t bytes_read = null, out size_t bytes_written = null) throws GLib.ConvertError; + [CCode (cname = "g_locale_from_utf8")] + public string locale_from_utf8 (ssize_t len, out size_t bytes_read = null, out size_t bytes_written = null) throws GLib.ConvertError; + + [CCode (cname = "g_strchomp")] + public unowned string _chomp(); + public string chomp () { + string result = this.dup (); + result._chomp (); + return result; + } + + [CCode (cname = "g_strchug")] + public unowned string _chug(); + public string chug () { + string result = this.dup (); + result._chug (); + return result; + } + + [CCode (cname = "g_strstrip")] + public unowned string _strip (); + public string strip () { + string result = this.dup (); + result._strip (); + return result; + } + + [CCode (cname = "g_strdelimit")] + public unowned string _delimit (string delimiters, char new_delimiter); + public string delimit (string delimiters, char new_delimiter) { + string result = this.dup (); + result._delimit (delimiters, new_delimiter); + return result; + } + + [CCode (cname = "g_str_hash")] + public uint hash (); + + [Version (since = "2.40")] + [CCode (cname = "g_str_is_ascii")] + public bool is_ascii (); + [Version (since = "2.40")] + [CCode (instance_pos = "1.5", cname = "g_str_match_string")] + public bool match_string (string search_term, bool accept_alternates); + [Version (since = "2.40")] + [CCode (cname = "g_str_to_ascii")] + public string to_ascii (string? from_locale = null); + [Version (replacement = "int.parse")] + [CCode (cname = "atoi")] + public int to_int (); + [Version (replacement = "long.parse")] + [CCode (cname = "strtol")] + public long to_long (out unowned string endptr = null, int _base = 0); + [Version (replacement = "double.parse")] + [CCode (cname = "g_ascii_strtod")] + public double to_double (out unowned string endptr = null); + [Version (replacement = "ulong.parse")] + [CCode (cname = "strtoul")] + public ulong to_ulong (out unowned string endptr = null, int _base = 0); + [Version (replacement = "int64.parse")] + [CCode (cname = "g_ascii_strtoll")] + public int64 to_int64 (out unowned string endptr = null, int _base = 0); + [Version (replacement = "uint64.parse", since = "2.2")] + [CCode (cname = "g_ascii_strtoull")] + public uint64 to_uint64 (out unowned string endptr = null, int _base = 0); + [CCode (cname = "g_str_tokenize_and_fold", array_length = false, array_null_terminated = true)] + [Version (since = "2.40")] + public string[] tokenize_and_fold (string transit_locale, [CCode (array_length = false, array_null_terminated = true)] out string[] ascii_alternates); + + [Version (replacement = "bool.parse")] + public bool to_bool () { + if (this == "true") { + return true; + } else { + return false; + } + } + + [Version (replacement = "string.length")] + [CCode (cname = "strlen")] + public size_t size (); + + [CCode (cname = "g_ascii_strcasecmp")] + public int ascii_casecmp (string s2); + [CCode (cname = "g_ascii_strncasecmp")] + public int ascii_ncasecmp (string s2, size_t n); + [CCode (cname = "g_ascii_strup")] + public string ascii_up (ssize_t len = -1); + [CCode (cname = "g_ascii_strdown")] + public string ascii_down (ssize_t len = -1); + + [CCode (cname = "g_utf8_skip")] + public static char skip[256]; + + /* modifies string in place */ + [CCode (cname = "g_strcanon")] + public void canon (string valid_chars, char substitutor); + + [CCode (cname = "g_strdup")] + public string dup (); + [Version (replacement = "string.substring")] + [CCode (cname = "g_strndup")] + public string ndup (size_t n); + + [CCode (cname = "memchr")] + static char* memchr (char* s, int c, size_t n); + + // strnlen is not available on all systems + static long strnlen (char* str, long maxlen) { + char* end = memchr (str, 0, maxlen); + if (end == null) { + return maxlen; + } else { + return (long) (end - str); + } + } + + [CCode (cname = "g_strndup")] + static string strndup (char* str, size_t n); + + public string substring (long offset, long len = -1) { + long string_length; + if (offset >= 0 && len >= 0) { + // avoid scanning whole string + string_length = strnlen ((char*) this, offset + len); + } else { + string_length = this.length; + } + + if (offset < 0) { + offset = string_length + offset; + GLib.return_val_if_fail (offset >= 0, null); + } else { + GLib.return_val_if_fail (offset <= string_length, null); + } + if (len < 0) { + len = string_length - offset; + } + GLib.return_val_if_fail (offset + len <= string_length, null); + return strndup ((char*) this + offset, len); + } + + public string slice (long start, long end) { + long string_length = this.length; + if (start < 0) { + start = string_length + start; + } + if (end < 0) { + end = string_length + end; + } + GLib.return_val_if_fail (start >= 0 && start <= string_length, null); + GLib.return_val_if_fail (end >= 0 && end <= string_length, null); + GLib.return_val_if_fail (start <= end, null); + return strndup ((char*) this + start, end - start); + } + + public string splice (long start, long end, string? str = null) { + long string_length = this.length; + if (start < 0) { + start = string_length + start; + } + if (end < 0) { + end = string_length + end; + } + GLib.return_val_if_fail (start >= 0 && start <= string_length, null); + GLib.return_val_if_fail (end >= 0 && end <= string_length, null); + GLib.return_val_if_fail (start <= end, null); + + size_t str_size; + if (str == null) { + str_size = 0; + } else { + str_size = ((!)(str)).length; + } + + string* result = GLib.malloc0 (string_length - (end - start) + str_size + 1); + + char* dest = (char*) result; + + GLib.Memory.copy (dest, this, start); + dest += start; + + if (str != null) { + GLib.Memory.copy (dest, str, str_size); + dest += str_size; + } + + GLib.Memory.copy (dest, (char*) this + end, string_length - end); + + return (owned) result; + } + + public bool contains (string needle) { + return strstr ((char*) this, (char*) needle) != null; + } + + public string replace (string old, string replacement, int max_tokens = -1) { + if (*((char*) this) == '\0' || *((char*) old) == '\0' + || max_tokens == 0 || old == replacement) { + return this; + } + return string.joinv (replacement, (string?[]?) this.split (old, max_tokens + 1)); + } + + [CCode (cname = "g_utf8_strlen")] + public int char_count (ssize_t max = -1); + + public int length { + [CCode (cname = "strlen")] + get; + } + + public uint8[] data { + get { + unowned uint8[] res = (uint8[]) this; + res.length = (int) this.length; + return res; + } + } + + public char[] to_utf8 () { + var string_length = this.length; + char[] result = new char[string_length + 1]; + result.length--; + GLib.Memory.copy (result, this, string_length); + return result; + } + + public unowned string to_string () { + return this; + } + + [CCode (cname = "g_utf8_to_utf16")] + public string16 to_utf16 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError; + [CCode (cname = "g_utf8_to_ucs4")] + public string32 to_utf32 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError; + [CCode (cname = "g_utf8_to_ucs4_fast")] + public string32 to_utf32_fast (long len = -1, out long items_written = null); + + [Version (since = "2.76")] + [CCode (cname = "g_set_str")] + public static bool set_str (ref string str, string new_str); +} + +[Compact] +[Immutable] +[GIR (name = "gunichar")] +[CCode (cname = "gunichar", const_cname = "const gunichar", free_function = "g_free", cheader_filename = "glib.h")] +public class string32 { + [CCode (cname = "g_ucs4_to_utf16")] + public string16 to_utf16 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError; + [CCode (cname = "g_ucs4_to_utf8")] + public string to_utf8 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError; + + public string? to_string () { + try { + return this.to_utf8 (); + } catch (GLib.ConvertError e) { + return null; + } + } +} + +[Compact] +[Immutable] +[GIR (name = "guint16")] +[CCode (cname = "gunichar2", const_cname = "const gunichar2", free_function = "g_free", cheader_filename = "glib.h")] +public class string16 { + [CCode (cname = "g_utf16_to_ucs4")] + public string32 to_utf32 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError; + [CCode (cname = "g_utf16_to_utf8")] + public string to_utf8 (long len = -1, out long items_read = null, out long items_written = null) throws GLib.ConvertError; + + public string? to_string () { + try { + return this.to_utf8 (); + } catch (GLib.ConvertError e) { + return null; + } + } +} + +// Required for proper error checking in *.try_parse() +[CCode (cheader_filename = "errno.h")] +private int errno; +[CCode (cheader_filename = "errno.h")] +private const int ERANGE; +[CCode (cheader_filename = "errno.h")] +private const int EINVAL; + +[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")] +namespace GLib { + [PointerType] + [GIR (fullname = "gpointer")] + [CCode (cname = "gpointer", const_cname = "gconstpointer", cheader_filename = "glib.h", default_value = "NULL", type_id = "G_TYPE_POINTER")] + public struct pointer { + } + + /** + * Binding to the C standard library's maths functions + * + * When compiling binary output with ``valac`` and some ``libc`` + * implementations, such as GNU's ``libc``, you will need to pass through + * the math library linker flags, ``-lm``, if a function is not found. + * For example: + * + * {{{valac -X -lm my_maths_program.vala}}} + */ + [CCode (lower_case_cprefix = "", cheader_filename = "math.h")] + namespace Math { + [CCode (cname = "G_E", cheader_filename = "glib.h")] + public const double E; + + [CCode (cname = "G_PI", cheader_filename = "glib.h")] + public const double PI; + + [CCode (cname = "G_LN2", cheader_filename = "glib.h")] + public const double LN2; + + [CCode (cname = "G_LN10", cheader_filename = "glib.h")] + public const double LN10; + + [CCode (cname = "G_PI_2", cheader_filename = "glib.h")] + public const double PI_2; + + [CCode (cname = "G_PI_4", cheader_filename = "glib.h")] + public const double PI_4; + + [CCode (cname = "G_SQRT2", cheader_filename = "glib.h")] + public const double SQRT2; + + [CCode (cname = "G_LOG_2_BASE_10", cheader_filename = "glib.h")] + public const double LOG_2_BASE_10; + + /* generated from 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); + [CCode (feature_test_macro = "_GNU_SOURCE")] + public static void sincos (double x, out double sinx, out double cosx); + [CCode (feature_test_macro = "_GNU_SOURCE")] + 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); + [CCode (feature_test_macro = "_GNU_SOURCE")] + public static double exp10 (double x); + [CCode (feature_test_macro = "_GNU_SOURCE")] + public static float exp10f (float x); + [CCode (feature_test_macro = "_GNU_SOURCE")] + public static double pow10 (double x); + [CCode (feature_test_macro = "_GNU_SOURCE")] + 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); + } + + /* Byte order */ + [CCode (cprefix = "G_", cname = "int", has_type_id = false)] + public enum ByteOrder { + [CCode (cname = "G_BYTE_ORDER")] + HOST, + LITTLE_ENDIAN, + BIG_ENDIAN, + PDP_ENDIAN + } + + public const ByteOrder BYTE_ORDER; + + /* Atomic Operations */ + +#if GLIB_2_68 + [Version (since = "2.4")] + namespace AtomicInt { + public static int get (ref int atomic); + public static void set (ref int atomic, int newval); + [Version (since = "2.30")] + public static int add (ref int atomic, int val); + [Version (since = "2.74")] + public static int exchange (ref int atomic, int newval); + [Version (deprecated_since = "2.30", replacement = "add")] + public static int exchange_and_add (ref int atomic, int val); + public static bool compare_and_exchange (ref int atomic, int oldval, int newval); + [Version (since = "2.74")] + public static bool compare_and_exchange_full (ref int atomic, int oldval, int newval, out int preval); + public static void inc (ref int atomic); + public static bool dec_and_test (ref int atomic); + } + + [Version (since = "2.4")] + namespace AtomicUint { + [CCode (cname = "g_atomic_int_get")] + public static uint get (ref uint atomic); + [CCode (cname = "g_atomic_int_set")] + public static void set (ref uint atomic, uint newval); + [Version (since = "2.30")] + [CCode (cname = "g_atomic_int_add")] + public static uint add (ref uint atomic, uint val); + [Version (since = "2.74")] + [CCode (cname = "g_atomic_int_exchange")] + public static uint exchange (ref uint atomic, uint newval); + [Version (deprecated_since = "2.30", replacement = "add")] + [CCode (cname = "g_atomic_int_exchange_and_add")] + public static uint exchange_and_add (ref uint atomic, uint val); + [CCode (cname = "g_atomic_int_compare_and_exchange")] + public static bool compare_and_exchange (ref uint atomic, uint oldval, uint newval); + [Version (since = "2.74")] + [CCode (cname = "g_atomic_int_compare_and_exchange_full")] + public static bool compare_and_exchange_full (ref uint atomic, uint oldval, uint newval, out uint preval); + [CCode (cname = "g_atomic_int_inc")] + public static void inc (ref uint atomic); + [CCode (cname = "g_atomic_int_dec_and_test")] + public static bool dec_and_test (ref uint atomic); + } + + [Version (since = "2.4")] + namespace AtomicPointer { + public static void* get (void** atomic); + public static void set (void** atomic, void* newval); + public static bool compare_and_exchange (void** atomic, void* oldval, void* newval); + [Version (since = "2.74")] + public static bool compare_and_exchange_full (void** atomic, void* oldval, void* newval, out void* preval); + } +#else + [Version (since = "2.4")] + namespace AtomicInt { + public static int get ([CCode (type = "volatile gint *")] ref int atomic); + public static void set ([CCode (type = "volatile gint *")] ref int atomic, int newval); + [Version (since = "2.30")] + public static int add ([CCode (type = "volatile gint *")] ref int atomic, int val); + [Version (deprecated_since = "2.30", replacement = "add")] + public static int exchange_and_add ([CCode (type = "volatile gint *")] ref int atomic, int val); + public static bool compare_and_exchange ([CCode (type = "volatile gint *")] ref int atomic, int oldval, int newval); + public static void inc ([CCode (type = "volatile gint *")] ref int atomic); + public static bool dec_and_test ([CCode (type = "volatile gint *")] ref int atomic); + } + + [Version (since = "2.4")] + namespace AtomicUint { + [CCode (cname = "g_atomic_int_get")] + public static uint get ([CCode (type = "volatile guint *")] ref uint atomic); + [CCode (cname = "g_atomic_int_set")] + public static void set ([CCode (type = "volatile guint *")] ref uint atomic, uint newval); + [Version (since = "2.30")] + [CCode (cname = "g_atomic_int_add")] + public static uint add ([CCode (type = "volatile guint *")] ref uint atomic, uint val); + [Version (deprecated_since = "2.30", replacement = "add")] + [CCode (cname = "g_atomic_int_exchange_and_add")] + public static uint exchange_and_add ([CCode (type = "volatile guint *")] ref uint atomic, uint val); + [CCode (cname = "g_atomic_int_compare_and_exchange")] + public static bool compare_and_exchange ([CCode (type = "volatile guint *")] ref uint atomic, uint oldval, uint newval); + [CCode (cname = "g_atomic_int_inc")] + public static void inc ([CCode (type = "volatile guint *")] ref uint atomic); + [CCode (cname = "g_atomic_int_dec_and_test")] + public static bool dec_and_test ([CCode (type = "volatile guint *")] ref uint atomic); + } + + [Version (since = "2.4")] + namespace AtomicPointer { + public static void* get ([CCode (type = "volatile gpointer *")] void** atomic); + public static void set ([CCode (type = "volatile gpointer *")] void** atomic, void* newval); + public static bool compare_and_exchange ([CCode (type = "volatile gpointer *")] void** atomic, void* oldval, void* newval); + } +#endif + + /* The Main Event Loop */ + + [Compact] + [CCode (ref_function = "g_main_loop_ref", unref_function = "g_main_loop_unref", type_id = "G_TYPE_MAIN_LOOP")] + public class MainLoop { + public MainLoop (MainContext? context = null, bool is_running = false); + public void run (); + public void quit (); + public bool is_running (); + public unowned MainContext get_context (); + } + + namespace Priority { + public const int HIGH; + public const int DEFAULT; + public const int HIGH_IDLE; + public const int DEFAULT_IDLE; + public const int LOW; + } + + [Version (since = "2.72")] + [CCode (has_type_id = false)] + [Flags] + public enum MainContextFlags { + NONE, + OWNERLESS_POLLING + } + + [Compact] + [CCode (ref_function = "g_main_context_ref", unref_function = "g_main_context_unref", type_id = "G_TYPE_MAIN_CONTEXT")] + public class MainContext { + public MainContext (); + [Version (since = "2.72")] + public MainContext.with_flags (MainContextFlags flags); + public static unowned MainContext @default (); + public bool iteration (bool may_block); + public bool pending (); + public unowned Source find_source_by_id (uint source_id); + public unowned Source find_source_by_user_data (void* user_data); + public unowned Source find_source_by_funcs_user_data (SourceFuncs funcs, void* user_data); + public void wakeup (); + public bool acquire (); + public void release (); + [Version (since = "2.10")] + public bool is_owner (); + public bool wait (Cond cond, Mutex mutex); + public bool prepare (out int priority); + public int query (int max_priority, out int timeout_, PollFD[] fds); + public bool check (int max_priority, PollFD[] 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 (); + [Version (since = "2.12")] + [CCode (cname = "g_main_current_source")] + public static unowned Source current_source (); + [Version (since = "2.22")] + public static unowned MainContext? get_thread_default (); + [Version (since = "2.32")] + public static MainContext ref_thread_default (); + [Version (since = "2.22")] + public void push_thread_default (); + [Version (since = "2.22")] + public void pop_thread_default (); + [Version (since = "2.28")] + [CCode (cname = "g_main_context_invoke_full")] + public void invoke (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT); + [Version (since = "2.28")] + public void invoke_full (int priority, owned SourceFunc function); + } + + [Compact] + [Version (since = "2.64")] + [CCode (free_function = "g_main_context_pusher_free")] + public class MainContextPusher { + public MainContextPusher (MainContext context); + [DestroysInstance] + public void free (); + } + + [CCode (has_target = false)] + public delegate int PollFunc (PollFD[] ufds, int timeout_); + + public int poll ([CCode (array_length_type = "guint")] PollFD[] fds, int timeout); + + [CCode (cname = "GSource")] + public class TimeoutSource : Source { + public TimeoutSource (uint interval); + [Version (since = "2.14")] + public TimeoutSource.seconds (uint interval); + } + + namespace Timeout { + [CCode (cname = "g_timeout_add_full")] + public static uint add (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT); + public static uint add_full (int priority, uint interval, owned SourceFunc function); + [Version (since = "2.74")] + public static uint add_once (uint interval, SourceOnceFunc function); + [Version (since = "2.14")] + [CCode (cname = "g_timeout_add_seconds_full")] + public static uint add_seconds (uint interval, owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT); + [Version (since = "2.14")] + public static uint add_seconds_full (int priority, uint interval, owned SourceFunc function); + [Version (since = "2.78")] + public static uint add_seconds_once (uint interval, SourceOnceFunc function); + } + + [CCode (cname = "GSource")] + public class IdleSource : Source { + public IdleSource (); + } + + namespace Idle { + [CCode (cname = "g_idle_add_full")] + public static uint add (owned SourceFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE); + public static uint add_full (int priority, owned SourceFunc function); + [Version (since = "2.74")] + public static uint add_once (SourceOnceFunc function); + public static bool remove_by_data (void* data); + } + + [CCode (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")] + [IntegerType (rank = 6)] + public struct Pid : int { + [CCode (cname = "G_PID_FORMAT")] + [Version (since = "2.50")] + public const string FORMAT; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + } + + public delegate void ChildWatchFunc (Pid pid, int wait_status); + [Version (since = "2.64")] + [CCode (has_target = false)] + public delegate void SourceDisposeFunc (Source source); + + [CCode (cname = "GSource")] + public class ChildWatchSource : Source { + public ChildWatchSource (Pid pid); + } + + namespace ChildWatch { + [Version (since = "2.4")] + [CCode (cname = "g_child_watch_add_full")] + public static uint add (Pid pid, owned ChildWatchFunc function, [CCode (pos = 0.1)] int priority = Priority.DEFAULT_IDLE); + [Version (since = "2.4")] + public static uint add_full (int priority, Pid pid, owned ChildWatchFunc function); + } + + [CCode (type_id = "G_TYPE_POLLFD")] + public struct PollFD { + public int fd; + public IOCondition events; + public IOCondition revents; + + [CCode (cname = "G_POLLFD_FORMAT")] + public const string FORMAT; + + [CCode (cname = "g_strdup_printf", instance_pos = -1)] + public string to_string (string format = "%" + FORMAT); + } + + [Compact] + [CCode (ref_function = "g_source_ref", unref_function = "g_source_unref", type_id = "G_TYPE_SOURCE")] + public abstract class Source { + protected Source (); + [Version (since = "2.12")] + public void set_funcs (SourceFuncs funcs); + public uint attach (MainContext? context = null); + public void destroy (); + [Version (since = "2.12")] + 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 (); + [Version (since = "2.26")] + public unowned string? get_name (); + [Version (since = "2.26")] + public void set_name (string? name); + [Version (since = "2.70")] + public void set_static_name (string name); + [Version (since = "2.26")] + public static void set_name_by_id (uint tag, string? name); + public unowned MainContext get_context (); + public void set_callback (owned SourceFunc func); + public void set_callback_indirect (void* callback_data, SourceCallbackFuncs callback_funcs); + [Version (since = "2.64")] + public void set_dispose_function (SourceDisposeFunc dispose); + [Version (since = "2.36")] + public void* add_unix_fd (int fd, IOCondition events); + [Version (since = "2.36")] + public void remove_unix_fd (void* tag); + [Version (since = "2.36")] + public void modify_unix_fd (void* tag, IOCondition new_events); + [Version (since = "2.36")] + public IOCondition query_unix_fd (void* tag); + public void add_poll (ref PollFD fd); + public void remove_poll (ref PollFD fd); + [Version (since = "2.28")] + public void add_child_source (Source child_source); + [Version (since = "2.28")] + public void remove_child_source (Source child_source); + [Version (since = "2.28")] + public int64 get_time (); + [Version (deprecated_since = "2.28", replacement = "get_time")] + public void get_current_time (out TimeVal timeval); + [Version (since = "2.36")] + public void set_ready_time (int64 ready_time); + public int64 get_ready_time (); + public static bool remove (uint id); + public static bool remove_by_funcs_user_data (SourceFuncs funcs, void* user_data); + public static bool remove_by_user_data (void* user_data); + [Version (since = "2.32")] + [CCode (cname = "G_SOURCE_CONTINUE")] + public const bool CONTINUE; + [Version (since = "2.32")] + [CCode (cname = "G_SOURCE_REMOVE")] + public const bool REMOVE; + +#if VALA_0_18 + protected virtual bool prepare (out int timeout_); + protected virtual bool check (); +#else + protected abstract bool prepare (out int timeout_); + protected abstract bool check (); +#endif + protected abstract bool dispatch (SourceFunc? _callback); + } + + [CCode (has_target = false)] + public delegate void SourceDummyMarshal (); + + [CCode (has_target = false, has_typedef = false)] + public delegate bool SourcePrepareFunc (Source source, out int timeout_); + [CCode (has_target = false, has_typedef = false)] + public delegate bool SourceCheckFunc (Source source); + [CCode (has_target = false, has_typedef = false)] + public delegate bool SourceDispatchFunc (Source source, SourceFunc? _callback); + [CCode (has_target = false, has_typedef = false)] + public delegate void SourceFinalizeFunc (Source source); + + [CCode (has_type_id = false)] + public struct SourceFuncs { + public SourcePrepareFunc? prepare; + public SourceCheckFunc? check; + public SourceDispatchFunc dispatch; + public SourceFinalizeFunc? finalize; + } + + [CCode (has_target = false)] + public delegate void SourceCallbackRefFunc (void* cb_data); + [CCode (has_target = false)] + public delegate void SourceCallbackUnrefFunc (void* cb_data); + [CCode (has_target = false)] + public delegate void SourceCallbackGetFunc (void* cb_data, Source source, SourceFunc func); + + [Compact] + public class SourceCallbackFuncs { + public SourceCallbackRefFunc @ref; + public SourceCallbackUnrefFunc unref; + public SourceCallbackGetFunc @get; + } + + public delegate bool SourceFunc (); + [Version (since = "2.74")] + public delegate void SourceOnceFunc (); + + [CCode (has_type_id = false)] + public errordomain ThreadError { + AGAIN; + public static GLib.Quark quark (); + } + + /* Thread support */ + + [CCode (scope = "async")] + public delegate G ThreadFunc (); + public delegate void Func (G data); + + [Version (since = "2.36")] + public uint get_num_processors (); + + [CCode (has_type_id = false)] + public enum ThreadPriority { + LOW, + NORMAL, + HIGH, + URGENT + } + + [Compact] + [Version (since = "2.32")] + [CCode (ref_function = "g_thread_ref", unref_function = "g_thread_unref", type_id = "G_TYPE_THREAD")] + public class Thread { + [Version (since = "2.32")] + public Thread (string? name, owned ThreadFunc func); + [Version (since = "2.32")] + [CCode (cname = "g_thread_try_new")] + public Thread.try (string? name, owned ThreadFunc func) throws GLib.Error; + public static bool supported (); + [Version (deprecated_since = "2.32", replacement = "new Thread ()")] + [CCode (simple_generics = true)] + public static unowned Thread create (owned ThreadFunc func, bool joinable) throws ThreadError; + [Version (deprecated_since = "2.32", replacement = "new Thread ()")] + [CCode (simple_generics = true)] + public static unowned Thread create_full (owned ThreadFunc func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError; + [CCode (simple_generics = true)] + public static unowned Thread self (); + [DestroysInstance] + public T join (); + [Version (deprecated_since = "2.32")] + public void set_priority (ThreadPriority priority); + public static void yield (); + public static void exit (T retval); + [Version (deprecated_since = "2.32", since = "2.10")] + public static void @foreach (Func> thread_func); + + [CCode (cname = "g_usleep")] + public static void usleep (ulong microseconds); + } + + [Version (since = "2.32")] + [CCode (destroy_function = "g_mutex_clear", has_type_id = false, lvalue_access = false)] + public struct Mutex { + public Mutex (); + public void @lock (); + public bool trylock (); + public void unlock (); + } + + [Version (since = "2.44")] + [Compact] + [CCode (free_function = "g_mutex_locker_free")] + public class MutexLocker { + public MutexLocker (Mutex mutex); + [DestroysInstance] + public void free (); + } + + [Version (since = "2.32")] + [CCode (destroy_function = "g_rec_mutex_clear", has_type_id = false)] + public struct RecMutex { + public RecMutex (); + public void @lock (); + public bool trylock (); + public void unlock (); + } + + [Version (since = "2.60")] + [Compact] + [CCode (free_function = "g_rec_mutex_locker_free")] + public class RecMutexLocker { + public RecMutexLocker (RecMutex rec_mutex); + [DestroysInstance] + public void free (); + } + + [Version (since = "2.32")] + [CCode (destroy_function = "g_rw_lock_clear", has_type_id = false)] + public struct RWLock { + public RWLock (); + public void writer_lock (); + public bool writer_trylock (); + public void writer_unlock (); + public void reader_lock (); + public bool reader_trylock (); + public void reader_unlock (); + } + + [Version (since = "2.62")] + [Compact] + [CCode (free_function = "g_rw_lock_reader_locker_free")] + public class RWLockReaderLocker { + public RWLockReaderLocker (RWLock rw_lock); + [DestroysInstance] + public void free (); + } + + [Version (since = "2.62")] + [Compact] + [CCode (free_function = "g_rw_lock_writer_locker_free")] + public class RWLockWriterLocker { + public RWLockWriterLocker (RWLock rw_lock); + [DestroysInstance] + public void free (); + } + + [Version (deprecated_since = "2.32", replacement = "Mutex")] + [CCode (destroy_function = "g_static_mutex_free", default_value = "G_STATIC_MUTEX_INIT", has_type_id = false)] + public struct StaticMutex { + public StaticMutex (); + public void lock (); + public bool trylock (); + public void unlock (); + } + + [Version (deprecated_since = "2.32", replacement = "RecMutex")] + [CCode (destroy_function = "g_static_rec_mutex_free", default_value = "G_STATIC_REC_MUTEX_INIT", has_type_id = false)] + public struct StaticRecMutex { + public StaticRecMutex (); + public void lock (); + public bool trylock (); + public void unlock (); + public void lock_full (uint depth); + } + + [Version (deprecated_since = "2.32", replacement = "RWLock")] + [CCode (destroy_function = "g_static_rw_lock_free", default_value = "G_STATIC_RW_LOCK_INIT", has_type_id = false)] + public struct StaticRWLock { + public StaticRWLock (); + public void reader_lock (); + public bool reader_trylock (); + public void reader_unlock (); + public void writer_lock (); + public bool writer_trylock (); + public void writer_unlock (); + } + + [Compact] + [CCode (ref_function = "", unref_function = "")] + public class Private { + public Private (DestroyNotify? destroy_func = null); + public void* get (); + public void set (void* data); + public void replace (void* data); + } + + [CCode (destroy_function = "g_static_private_free", default_value = "G_STATIC_PRIVATE_INIT", has_type_id = false)] + [Version (deprecated_since = "2.32")] + public struct StaticPrivate { + public StaticPrivate (); + public void* get (); + public void set (void* data, DestroyNotify? destroy_func); + } + + [Version (since = "2.32")] + [CCode (destroy_function = "g_cond_clear", has_type_id = false, lvalue_access = false)] + public struct Cond { + public Cond (); + public void @signal (); + public void broadcast (); + public void wait (Mutex mutex); + [Version (deprecated_since = "2.32", replacement = "wait_until")] + public bool timed_wait (Mutex mutex, TimeVal abs_time); + [Version (since = "2.32")] + public bool wait_until (Mutex mutex, int64 end_time); + } + + [CCode (cname = "GThreadFunc")] + public delegate G OnceFunc (); + + [Version (since = "2.4")] + [CCode (default_value = "G_ONCE_INIT", has_type_id = false)] + public struct Once { + [CCode (cname = "g_once")] + public unowned G once (OnceFunc function); +#if GLIB_2_68 + [Version (since = "2.14")] + public static bool init_enter (size_t *value); + [Version (since = "2.14")] + public static void init_leave (size_t *value, size_t set_value); +#else + [Version (since = "2.14")] + public static bool init_enter ([CCode (type="volatile gsize *")] size_t *value); + [Version (since = "2.14")] + public static void init_leave ([CCode (type="volatile gsize *")] size_t *value, size_t set_value); +#endif + public OnceStatus status; + } + + [CCode (cprefix = "G_ONCE_STATUS_", has_type_id = false)] + public enum OnceStatus { + NOTCALLED, + PROGRESS, + READY + } + + /* Thread Pools */ + + [CCode (cname = "GFunc")] + public delegate void ThreadPoolFunc (owned G data); + + [Compact] + [CCode (free_function = "g_thread_pool_free")] + public class ThreadPool { + [Version (deprecated_since = "vala-0.18", replacement = "ThreadPool.with_owned_data")] + public ThreadPool (Func func, int max_threads, bool exclusive) throws ThreadError; + [Version (since = "2.70")] + [CCode (cname = "g_thread_pool_new_full")] + public ThreadPool.full (Func func, DestroyNotify? item_free_func, int max_threads, bool exclusive) throws ThreadError; + [CCode (cname = "g_thread_pool_new")] + public ThreadPool.with_owned_data (ThreadPoolFunc func, int max_threads, bool exclusive) throws ThreadError; + [Version (deprecated_since = "vala-0.18", replacement = "add")] + public void push (T data) throws ThreadError; + [CCode (cname = "g_thread_pool_push")] + public void add (owned T data) throws ThreadError; + public void set_max_threads (int max_threads) throws ThreadError; + public int get_max_threads (); + public uint get_num_threads (); + [Version (since = "2.46")] + public bool move_to_front (T data); + public uint unprocessed (); + [CCode (cname = "g_thread_pool_free")] + void _free (bool immediate, bool wait); + [CCode (cname = "vala__g_thread_pool_free_wrapper")] + public static void free (owned ThreadPool? pool, bool immediate, bool wait) { + ThreadPool* ptr = (owned) pool; + if (ptr != null) { + ((ThreadPool)ptr)._free (immediate, wait); + } + } + 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 (); + [Version (since = "2.10")] + public void set_sort_function (CompareDataFunc func); + [Version (since = "2.10")] + public static void set_max_idle_time (uint interval); + [Version (since = "2.10")] + public static uint get_max_idle_time (); + } + + /* Asynchronous Queues */ + + [Compact] + [CCode (ref_function = "g_async_queue_ref", unref_function = "g_async_queue_unref")] + public class AsyncQueue { + [Version (since = "2.16")] + [CCode (cname = "g_async_queue_new_full", simple_generics = true)] + public AsyncQueue (); + public void push (owned G data); + [Version (since = "2.10")] + public void push_sorted (owned G data, CompareDataFunc func); + public G pop (); + public G? try_pop (); + public G? timed_pop (ref TimeVal end_time); + public int length (); + [Version (since = "2.10")] + public void sort (CompareDataFunc func); + public void @lock (); + public void unlock (); + public void ref_unlocked (); + public void unref_and_unlock (); + [Version (since = "2.46")] + public void push_front (owned G data); + [Version (since = "2.46")] + public void push_front_unlocked (owned G data); + public void push_unlocked (owned G data); + [Version (since = "2.10")] + public void push_sorted_unlocked (owned G data, CompareDataFunc func); + public G pop_unlocked (); + [Version (since = "2.46")] + public bool remove (G data); + [Version (since = "2.46")] + public bool remove_unlocked (G data); + public G? try_pop_unlocked (); + public G? timed_pop_unlocked (ref TimeVal end_time); + public G? timeout_pop (uint64 timeout); + public G? timeout_pop_unlocked (uint64 timeout); + public int length_unlocked (); + public void sort_unlocked (CompareDataFunc func); + } + + /* Memory Allocation */ + + public static void* malloc (size_t n_bytes); + public static void* malloc0 (size_t n_bytes); + public static void* realloc (void* mem, size_t n_bytes); + + public static void* try_malloc (size_t n_bytes); + [Version (since = "2.8")] + public static void* try_malloc0 (size_t n_bytes); + public static void* try_realloc (void* mem, size_t n_bytes); + + public static void free (void* mem); + [Version (since = "2.76")] + public static void free_sized (void* mem, size_t size); + + public class MemVTable { + } + + [Version (deprecated_since = "2.46")] + [CCode (cname = "glib_mem_profiler_table")] + public static MemVTable mem_profiler_table; + + [Version (deprecated_since = "2.46")] + public static bool mem_is_system_malloc (); + [Version (deprecated_since = "2.46")] + public static void mem_set_vtable (MemVTable vtable); + [Version (deprecated_since = "2.46")] + public static void mem_profile (); + + [CCode (cheader_filename = "string.h")] + namespace Memory { + [CCode (cname = "memcmp")] + public static int cmp (void* s1, void* s2, size_t n); + [CCode (cname = "memcpy")] + public static void* copy (void* dest, void* src, size_t n); + [CCode (cname = "memset")] + public static void* set (void* dest, int src, size_t n); + [CCode (cname = "memmove")] + public static void* move (void* dest, void* src, size_t n); + [CCode (cname = "g_memdup")] + public static void* dup (void* mem, uint n); + [Version (since = "2.68")] + [CCode (cname = "g_memdup2")] + public static void* dup2 (void* mem, size_t n); + } + + [Version (since = "2.72")] + namespace Aligned { + public static void* alloc (size_t n_blocks, size_t n_blocks_bytes, size_t alignment); + public static void* alloc0 (size_t n_blocks, size_t n_blocks_bytes, size_t alignment); + public static void free (void* mem); + [Version (since = "2.74")] + public static void free_sized (void* mem, size_t alignment, size_t size); + } + + [Version (since = "2.10")] + namespace Slice { + public static void* alloc (size_t block_size); + public static void* alloc0 (size_t block_size); + [Version (since = "2.14")] + public static void* copy (size_t block_size, void* mem_block); + [CCode (cname = "g_slice_free1")] + public static void free (size_t block_size, void* mem_block); + public static void free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset); + public static int64 get_config (SliceConfig ckey); + [CCode (array_length_cname = "n_values", array_length_type = "guint")] + public static int64[] get_config_state (SliceConfig ckey, int64 address); + public static void set_config (SliceConfig ckey, int64 value); + } + + [CCode (cprefix = "G_SLICE_CONFIG_", has_type_id = false)] + public enum SliceConfig { + ALWAYS_MALLOC, + BYPASS_MAGAZINES, + WORKING_SET_MSECS, + COLOR_INCREMENT, + CHUNK_SIZES, + CONTENTION_COUNTER + } + + /* IO Channels */ + + [Compact] + [CCode (ref_function = "g_io_channel_ref", unref_function = "g_io_channel_unref", type_id = "G_TYPE_IO_CHANNEL")] + public class IOChannel { + [CCode (cname = "g_io_channel_unix_new")] + public IOChannel.unix_new (int fd); + public int unix_get_fd (); + [CCode (cname = "g_io_channel_win32_new_fd")] + public IOChannel.win32_new_fd (int fd); + public int win32_get_fd (); + [CCode (cname = "g_io_channel_win32_new_socket")] + public IOChannel.win32_socket (int socket); + [CCode (cname = "g_io_channel_win32_new_messages")] + public IOChannel.win32_messages (size_t hwnd); + public void init (); + public IOChannel.file (string filename, string mode) throws FileError; + public IOStatus read_chars (char[] buf, out size_t bytes_read) throws ConvertError, IOChannelError; + public IOStatus read_unichar (out unichar thechar) throws ConvertError, IOChannelError; + public IOStatus read_line (out string str_return, out size_t length, out size_t terminator_pos) throws ConvertError, IOChannelError; + public IOStatus read_line_string (StringBuilder buffer, out size_t terminator_pos) throws ConvertError, IOChannelError; + public IOStatus read_to_end (out string str_return, out size_t length) throws ConvertError, IOChannelError; + public IOStatus write_chars (char[] buf, out size_t 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; + [CCode (cname = "g_io_create_watch")] + public IOSource create_watch (IOCondition condition); + [CCode (cname = "g_io_add_watch")] + public uint add_watch (IOCondition condition, IOFunc func); + [CCode (cname = "g_io_add_watch_full")] + public uint add_watch_full (int priority, IOCondition condition, owned IOFunc func); + public size_t get_buffer_size (); + public void set_buffer_size (size_t size); + public IOCondition get_buffer_condition (); + public IOFlags get_flags (); + public IOStatus set_flags (IOFlags flags) throws IOChannelError; + public unowned string get_line_term (out int length); + public void set_line_term (string line_term, int length); + public bool get_buffered (); + public void set_buffered (bool buffered); + public unowned string get_encoding (); + public IOStatus set_encoding (string? encoding) throws IOChannelError; + public bool get_close_on_unref (); + public void set_close_on_unref (bool do_close); + public void win32_make_pollfd (IOCondition condition, ref PollFD fd); + public static int win32_poll (PollFD[] fds, int timeout); + public void win32_set_debug (bool flag); + } + + [Compact] + [CCode (cname = "GSource")] + public class IOSource : Source { + [CCode (cname = "g_io_create_watch")] + public IOSource (IOChannel channel, IOCondition condition); + [CCode (cname = "g_source_set_callback")] + public void set_callback ([CCode (type = "GSourceFunc")] owned IOFunc func); + } + + [CCode (cprefix = "G_SEEK_", has_type_id = false)] + public enum SeekType { + CUR, + SET, + END + } + + [CCode (has_type_id = false)] + public enum IOStatus { + ERROR, + NORMAL, + EOF, + AGAIN + } + + [CCode (has_type_id = false)] + public errordomain IOChannelError { + FBIG, + INVAL, + IO, + ISDIR, + NOSPC, + NXIO, + OVERFLOW, + PIPE, + FAILED; + public static GLib.Quark quark (); + } + + [Flags] + [CCode (cprefix = "G_IO_", type_id = "G_TYPE_IO_CONDITION")] + public enum IOCondition { + IN, + OUT, + PRI, + ERR, + HUP, + NVAL + } + + public delegate bool IOFunc (IOChannel source, IOCondition condition); + + [CCode (cprefix = "G_IO_FLAG_", has_type_id = false)] + [Flags] + public enum IOFlags { + [Version (since = "2.74")] + NONE, + APPEND, + NONBLOCK, + IS_READABLE, + IS_WRITABLE, + IS_WRITEABLE, + IS_SEEKABLE, + MASK, + GET_MASK, + SET_MASK + } + + /* Error Reporting */ + + [Compact] + [ErrorBase] + [CCode (copy_function = "g_error_copy", free_function = "g_error_free", type_id = "G_TYPE_ERROR")] + public class Error { + [PrintfFormat] + public Error (Quark domain, int code, string format, ...); + public Error.literal (Quark domain, int code, string message); + [PrintfFormat] + public Error.valist (Quark domain, int code, string format, va_list args); + public Error copy (); + public bool matches (Quark domain, int code); + [CCode (cname = "g_prefix_error")] + public static void prefix (out Error? dest, string format, ...); + [Version (since = "2.70")] + [CCode (cname = "g_prefix_error_literal")] + public static void prefix_literal (out Error? dest, string prefix); + [CCode (cname = "g_propagate_error")] + public static void propagate (out Error? dest, owned Error src); + [CCode (cname = "g_propagate_prefixed_error")] + public static void propagate_prefixed (out Error? dest, owned Error src, string format, ...); + [CCode (cname = "g_set_error")] + public static void @set (out Error? dest, Quark domain, int code, string format, ...); + [CCode (cname = "g_set_error_literal")] + public static void set_literal (out Error? dest, Quark domain, int code, string message); + + public Quark domain; + public int code; + public string message; + } + + /* Message Output and Debugging Functions */ + + [PrintfFormat] + public static void print (string format, ...); + public static void set_print_handler (PrintFunc func); + [CCode (has_target = false)] + public delegate void PrintFunc (string text); + [PrintfFormat] + public static void printerr (string format, ...); + public static void set_printerr_handler (PrintFunc func); + + public static void return_if_fail (bool expr); + [CCode (sentinel = "")] + public static void return_val_if_fail (bool expr, ...); + [NoReturn] + public static void return_if_reached (); + [NoReturn] + [CCode (sentinel = "")] + public static void return_val_if_reached (...); + [Version (since = "2.16")] + public static void warn_if_fail (bool expr); + [Version (since = "2.16")] + public static void warn_if_reached (); + + [Assert] + public static void assert (bool expr); + [Version (since = "2.46")] + public static void assert_cmpmem (uint8[] m1, uint8[] m2); + public static void assert_error (Error? error, Quark error_domain, int error_code); + [Version (since = "2.38")] + public static void assert_false (bool expr); + [Version (since = "2.38")] + public static void assert_true (bool expr); + [Version (since = "2.38")] + public static void assert_null (void* expr); + public static void assert_no_error (Error? error); + [Version (since = "2.40")] + public static void assert_nonnull (void* expr); + [NoReturn] + public static void assert_not_reached (); + + /** + * Comparison operators for use with GLib.assert_cmp*() functions + */ + [CCode (has_type_id = false)] + public enum CompareOperator { + [CCode (cname = "==")] + EQ, + [CCode (cname = "!=")] + NE, + [CCode (cname = ">=")] + GE, + [CCode (cname = "<=")] + LE, + [CCode (cname = ">")] + GT, + [CCode (cname = "<")] + LT, + } + + [Version (since = "2.16")] + public static void assert_cmpstr (string? s1, CompareOperator cmp, string? s2); + [Version (since = "2.68")] + public static void assert_cmpstrv ([CCode (array_length = false, array_null_terminated = true)] string[] strv1, [CCode (array_length = false, array_null_terminated = true)] string[] strv2); + [Version (since = "2.16")] + public static void assert_cmpint (int n1, CompareOperator cmp, int n2); + [Version (since = "2.16")] + public static void assert_cmpuint (uint n1, CompareOperator cmp, uint n2); + [Version (since = "2.16")] + public static void assert_cmphex (uint n1, CompareOperator cmp, uint n2); + [Version (since = "2.16")] + public static void assert_cmpfloat (double n1, CompareOperator cmp, double n2); + [Version (since = "2.58")] + public static void assert_cmpfloat_with_epsilon (double n1, double n2, double epsilon); + [Version (since = "2.60")] + public static void assert_cmpvariant (Variant v1, Variant v2); + + public static void on_error_query (string? prg_name = null); + public static void on_error_stack_trace (string? prg_name = null); + [CCode (cname = "G_BREAKPOINT")] + public static void breakpoint (); + + /* Message Logging */ + + [CCode (cprefix = "G_LOG_", has_type_id = false)] + [Flags] + public enum LogLevelFlags { + /* log flags */ + FLAG_RECURSION, + FLAG_FATAL, + + /* GLib log levels */ + LEVEL_ERROR, + LEVEL_CRITICAL, + LEVEL_WARNING, + LEVEL_MESSAGE, + LEVEL_INFO, + LEVEL_DEBUG, + + LEVEL_MASK + } + + [CCode (cprefix = "G_LOG_WRITER_", has_type_id = false)] + [Version (since = "2.50")] + public enum LogWriterOutput { + HANDLED, + UNHANDLED + } + + [CCode (has_type_id = false, simple_generics = true)] + [Version (since = "2.50")] + public struct LogField { + public unowned string key; + public unowned T @value; + public ssize_t length; + } + + public void logv (string? log_domain, LogLevelFlags log_level, string format, va_list args); + [Diagnostics] + [PrintfFormat] + public void log (string? log_domain, LogLevelFlags log_level, string format, ...); + + [Version (since = "2.50")] + public void log_structured (string? log_domain, LogLevelFlags log_levels, ...); + [Version (since = "2.50")] + public void log_structured_array (LogLevelFlags log_levels, LogField[] fields); + + [Version (since = "2.50")] + public void log_variant (string? log_domain, LogLevelFlags log_levels, GLib.Variant fields); + + [Diagnostics] + [PrintfFormat] + public void message (string format, ...); + [Diagnostics] + [PrintfFormat] + public void warning (string format, ...); + [Diagnostics] + [PrintfFormat] + [Version (since = "2.64")] + public void warning_once (string format, ...); + [Diagnostics] + [PrintfFormat] + public void critical (string format, ...); + [Diagnostics] + [PrintfFormat] + [NoReturn] + public void error (string format, ...); + [Diagnostics] + [PrintfFormat] + [Version (since = "2.6")] + public void debug (string format, ...); + [Diagnostics] + [PrintfFormat] + [Version (since = "2.40")] + public void info (string format, ...); + [CCode (cname = "G_DEBUG_HERE")] + [Version (since = "2.50")] + public void debug_here (); + + public delegate void LogFunc (string? log_domain, LogLevelFlags log_levels, string message); + [Version (since = "2.50")] + public delegate LogWriterOutput LogWriterFunc (LogLevelFlags log_level, [CCode (array_length_type = "gsize")] LogField[] fields); + + namespace Log { + public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func); + [Version (since = "2.46")] + public static void set_handler_full (string? log_domain, LogLevelFlags log_levels, owned LogFunc log_func); + [Version (since = "2.6")] + public static void set_default_handler (LogFunc log_func); + [CCode (delegate_target = false)] + public static GLib.LogFunc default_handler; + public static LogLevelFlags set_fatal_mask (string log_domain, LogLevelFlags log_levels); + public static LogLevelFlags set_always_fatal (LogLevelFlags log_levels); + public static void remove_handler (string? log_domain, uint handler_id); + + public const string FILE; + public const int LINE; + public const string METHOD; + + [Version (since = "2.50")] + public static void set_writer_func (owned LogWriterFunc func); + [Version (since = "2.50")] + public static bool writer_supports_color (int output_fd); + [Version (since = "2.50")] + public static bool writer_is_journald (int output_fd); + [Version (since = "2.50")] + public static string writer_format_fields (LogLevelFlags log_levels, [CCode (array_length_type = "gsize")] LogField[] fields, bool use_color); + [Version (since = "2.68")] + public static void writer_default_set_use_stderr (bool use_stderr); + [Version (since = "2.68")] + public static bool writer_default_would_drop (LogLevelFlags log_level, string log_domain); + [Version (since = "2.50")] + [CCode (delegate_target = false)] + public static LogWriterFunc writer_journald; + [Version (since = "2.50")] + [CCode (delegate_target = false)] + public static LogWriterFunc writer_standard_streams; + [Version (since = "2.50")] + [CCode (delegate_target = false)] + public static LogWriterFunc writer_default; + + [Version (since = "2.72")] + public static bool get_debug_enabled (); + [Version (since = "2.72")] + public static void set_debug_enabled (bool enabled); + } + + [CCode (has_type_id = false)] + public struct DebugKey { + unowned string key; + uint value; + } + + public uint parse_debug_string (string? debug_string, DebugKey[] keys); + + /* String Utility Functions */ + + public string strdup (string str); + [CCode (array_length = false, array_null_terminated = true)] + public string[] strdupv ([CCode (array_length = false, array_null_terminated = true)] string[] str_array); + + public void strfreev ([CCode (array_length = false, array_null_terminated = true)] owned string[] str_array); + [Version (since = "2.6")] + public uint strv_length ([CCode (array_length = false, array_null_terminated = true)] string[] str_array); + [Version (since = "2.44")] + public bool strv_contains ([CCode (array_length = false, array_null_terminated = true)] string[] str_array, string str); + + [CCode (cname = "errno", cheader_filename = "errno.h")] + public int errno; + public unowned string strerror (int errnum); + + /* Character Set Conversions */ + + public static string convert (string str, ssize_t len, string to_codeset, string from_codeset, out size_t bytes_read = null, out size_t bytes_written = null) throws ConvertError; + public static string convert_with_fallback (string str, ssize_t len, string to_codeset, string from_codeset, string? fallback = null, out size_t bytes_read = null, out size_t bytes_written = null) throws ConvertError; + public static string convert_with_iconv (string str, ssize_t len, IConv converter, out size_t bytes_read = null, out size_t bytes_written = null) throws ConvertError; + public static bool get_charset (out unowned string charset); + [Version (since = "2.62")] + public static bool get_console_charset (out unowned string charset); + public static bool get_filename_charsets ([CCode (array_length = false, array_null_terminated = true)] out unowned string[] charsets); + + [SimpleType] + [CCode (has_type_id = false)] + public struct IConv { + public static IConv open (string to_codeset, string from_codeset); + [CCode (cname = "g_iconv")] + public size_t iconv ([CCode (array_length = false)] ref char[] inbuf, ref size_t inbytes_left, [CCode (array_length = false)] ref char[] outbuf, ref size_t outbytes_left); + public int close (); + } + + namespace Filename { + public static string to_utf8 (string opsysstring, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError; + public static string from_utf8 (string utf8string, ssize_t len, out size_t bytes_read, out size_t bytes_written) throws ConvertError; + public static string from_uri (string uri, out string hostname = null) throws ConvertError; + public static string to_uri (string filename, string? hostname = null) throws ConvertError; + [Version (since = "2.6")] + public static string display_name (string filename); + [Version (since = "2.6")] + public static string display_basename (string filename); + [Version (since = "2.58")] + [CCode (cname = "g_canonicalize_filename")] + public static string canonicalize (string filename, string? relative_to = null); + } + + [CCode (has_type_id = false)] + public errordomain ConvertError { + NO_CONVERSION, + ILLEGAL_SEQUENCE, + FAILED, + PARTIAL_INPUT, + BAD_URI, + NOT_ABSOLUTE_PATH, + [Version (since = "2.40")] + NO_MEMORY, + [Version (since = "2.56")] + EMBEDDED_NUL; + public static GLib.Quark quark (); + } + + /* Base64 Encoding */ + + [Version (since = "2.12")] + namespace Base64 { + public static size_t encode_step (uchar[] _in, bool break_lines, char* _out, ref int state, ref int save); + public static size_t encode_close (bool break_lines, char* _out, ref int state, ref int save); + public static string encode (uchar[] data); + public static size_t decode_step (char[] _in, uchar* _out, ref int state, ref uint save); + [CCode (array_length_type = "gsize")] + public static uchar[] decode (string text); + } + + /* Data Checksums */ + + [Version (since = "2.16")] + [CCode (cprefix = "G_CHECKSUM_", has_type_id = false)] + public enum ChecksumType { + MD5, + SHA1, + SHA256, + [Version (since = "2.52")] + SHA384, + [Version (since = "2.36")] + SHA512; + + public ssize_t get_length (); + } + + [Compact] + [Version (since = "2.16")] + [CCode (free_function = "g_checksum_free", type_id = "G_TYPE_CHECKSUM")] + public class Checksum { + public Checksum (ChecksumType checksum_type); + public Checksum copy (); + public void update ([CCode (array_length = false)] uchar[] data, size_t length); + public unowned string get_string (); + public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len); + [CCode (cname = "g_compute_checksum_for_data")] + public static string compute_for_data (ChecksumType checksum_type, uchar[] data); + [CCode (cname = "g_compute_checksum_for_string")] + public static string compute_for_string (ChecksumType checksum_type, string str, size_t length = -1); + [Version (since = "2.34")] + [CCode (cname = "g_compute_checksum_for_bytes")] + public static string compute_for_bytes (ChecksumType checksum_type, Bytes data); + } + + /* Secure HMAC Digests */ + + [Compact] + [Version (since = "2.30")] + [CCode (ref_function = "g_hmac_ref", unref_function = "g_hmac_unref")] + public class Hmac { + public Hmac (ChecksumType digest_type, [CCode (array_length_type = "gsize")] uint8[] key); + public Hmac copy (); + public void update ([CCode (array_length_type = "gssize")] uint8[] data); + public unowned string get_string (); + public void get_digest ([CCode (array_length = false)] uint8[] buffer, ref size_t digest_len); + [Version (since = "2.30")] + [CCode (cname = "g_compute_hmac_for_data")] + public static string compute_for_data (ChecksumType checksum_type, uint8[] key, uint8[] data); + [Version (since = "2.30")] + [CCode (cname = "g_compute_hmac_for_string")] + public static string compute_for_string (ChecksumType checksum_type, uint8[] key, string str, size_t length = -1); + [Version (since = "2.50")] + [CCode (cname = "g_compute_hmac_for_bytes")] + public static string compute_hmac_for_bytes (ChecksumType checksum_type, Bytes key, Bytes data); + } + + /* Date and Time Functions */ + + [Version (deprecated_since = "2.62")] + [CCode (has_type_id = false)] + public struct TimeVal { + public long tv_sec; + public long tv_usec; + + [CCode (cname = "g_get_current_time")] + public TimeVal (); + [Version (deprecated_since = "2.62", replacement = "get_real_time")] + [CCode (cname = "g_get_current_time")] + public void get_current_time (); + public void add (long microseconds); + [Version (since = "2.12")] + [CCode (instance_pos = -1)] + public bool from_iso8601 (string iso_date); + [Version (since = "2.12")] + public string to_iso8601 (); + } + + [Version (since = "2.28")] + public static int64 get_monotonic_time (); + [Version (since = "2.28")] + public static int64 get_real_time (); + + public struct DateDay : uchar { + [CCode (cname = "G_DATE_BAD_DAY")] + public static DateDay BAD_DAY; + + [CCode (cname = "g_date_valid_day")] + public bool valid (); + } + + [CCode (cprefix = "G_DATE_", has_type_id = false)] + public enum DateMonth { + BAD_MONTH, + JANUARY, + FEBRUARY, + MARCH, + APRIL, + MAY, + JUNE, + JULY, + AUGUST, + SEPTEMBER, + OCTOBER, + NOVEMBER, + DECEMBER; + + [CCode (cname = "g_date_get_days_in_month")] + public uchar get_days_in_month (DateYear year); + [CCode (cname = "g_date_valid_month")] + public bool valid (); + } + + public struct DateYear : ushort { + [CCode (cname = "G_DATE_BAD_YEAR")] + public static DateDay BAD_YEAR; + + [CCode (cname = "g_date_is_leap_year")] + public bool is_leap_year (); + [CCode (cname = "g_date_get_monday_weeks_in_year")] + public uchar get_monday_weeks_in_year (); + [CCode (cname = "g_date_get_sunday_weeks_in_year")] + public uchar get_sunday_weeks_in_year (); + [CCode (cname = "g_date_valid_year")] + public bool valid (); + } + + [CCode (cprefix = "G_DATE_", has_type_id = false)] + public enum DateWeekday { + BAD_WEEKDAY, + MONDAY, + TUESDAY, + WEDNESDAY, + THURSDAY, + FRIDAY, + SATURDAY, + SUNDAY; + + [CCode (cname = "g_date_valid_weekday")] + public bool valid (); + } + + [CCode (cprefix = "G_DATE_", has_type_id = false)] + public enum DateDMY { + DAY, + MONTH, + YEAR + } + + [CCode (type_id = "G_TYPE_DATE")] + public struct Date { + public void clear (uint n_dates = 1); + [Version (since = "2.56")] + public Date? copy (); + public void set_day (DateDay day); + public void set_month (DateMonth month); + public void set_year (DateYear year); + public void set_dmy (DateDay day, int month, DateYear y); + public void set_julian (uint julian_day); + [Version (since = "2.10")] + public void set_time_t (time_t timet); + [Version (deprecated_since = "2.62", since = "2.10")] + public void set_time_val (TimeVal timeval); + public void set_parse (string str); + public void add_days (uint n_days); + public void subtract_days (uint n_days); + public void add_months (uint n_months); + public void subtract_months (uint n_months); + public void add_years (uint n_years); + public void subtract_years (uint n_years); + public int days_between (Date date2); + public int compare (Date rhs); + public void clamp (Date min_date, Date max_date); + public void order (Date date2); + public DateDay get_day (); + public DateMonth get_month (); + public DateYear get_year (); + public uint get_julian (); + public DateWeekday get_weekday (); + public uint get_day_of_year (); + public bool is_first_of_month (); + public bool is_last_of_month (); + public uint get_monday_week_of_year (); + public uint get_sunday_week_of_year (); + [Version (since = "2.6")] + public uint get_iso8601_week_of_year (); + [CCode (instance_pos = -1)] + public size_t strftime (char[] s, string format); + [CCode (cname = "g_date_to_struct_tm")] + public void to_time (out Time tm); + public bool valid (); + public static uchar get_days_in_month (DateMonth month, DateYear year); + public static bool valid_day (DateDay day); + public static bool valid_dmy (DateDay day, DateMonth month, DateYear year); + public static bool valid_julian (uint julian_date); + public static bool valid_weekday (DateWeekday weekday); + } + + [CCode (cname = "struct tm", cheader_filename = "time.h", has_type_id = false)] + public struct Time { + [CCode (cname = "tm_sec")] + public int second; + [CCode (cname = "tm_min")] + public int minute; + [CCode (cname = "tm_hour")] + public int hour; + [CCode (cname = "tm_mday")] + public int day; + [CCode (cname = "tm_mon")] + public int month; + [CCode (cname = "tm_year")] + public int year; + [CCode (cname = "tm_wday")] + public int weekday; + [CCode (cname = "tm_yday")] + public int day_of_year; + [CCode (cname = "tm_isdst")] + public int isdst; + + [CCode (cname = "gmtime_r", feature_test_macro = "_XOPEN_SOURCE")] + static void gmtime_r (ref time_t time, out Time result); + [CCode (cname = "localtime_r", feature_test_macro = "_XOPEN_SOURCE")] + static void localtime_r (ref time_t time, out Time result); + + public static Time gm (time_t time) { + Time result; + gmtime_r (ref time, out result); + return result; + } + public static Time local (time_t time) { + Time result; + localtime_r (ref time, out result); + return result; + } + + public string to_string () { + return "%04d-%02d-%02d %02d:%02d:%02d".printf (year + 1900, month + 1, day, hour, minute, second); + } + + public string format (string format) { + var buffer = new char[64]; + this.strftime (buffer, format); + return (string) buffer; + } + + [CCode (cname = "mktime")] + public time_t mktime (); + + [CCode (cname = "strftime", instance_pos = -1)] + public size_t strftime (char[] s, string format); + [CCode (cname = "strptime", instance_pos = -1, feature_test_macro = "_XOPEN_SOURCE")] + public unowned string? strptime (string buf, string format); + } + + [SimpleType] + [Version (since = "2.26")] + [CCode (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", type_signature = "x")] + [IntegerType (rank = 10)] + public struct TimeSpan : int64 { + public const TimeSpan DAY; + public const TimeSpan HOUR; + public const TimeSpan MINUTE; + public const TimeSpan SECOND; + public const TimeSpan MILLISECOND; + } + + [Compact] + [Version (since = "2.26")] + [CCode (ref_function = "g_date_time_ref", unref_function = "g_date_time_unref", type_id = "G_TYPE_DATE_TIME")] + public class DateTime { + public DateTime.now (TimeZone tz = new TimeZone.local ()); + public DateTime.now_local (); + public DateTime.now_utc (); + [Version (since = "2.56")] + public DateTime.from_iso8601 (string text, TimeZone? default_tz); + public DateTime.from_unix_local (int64 t); + public DateTime.from_unix_utc (int64 t); + [Version (deprecated_since = "2.62")] + public DateTime.from_timeval_local (TimeVal tv); + [Version (deprecated_since = "2.62")] + public DateTime.from_timeval_utc (TimeVal tv); + public DateTime (TimeZone tz, int year, int month, int day, int hour, int minute, double seconds); + public DateTime.local (int year, int month, int day, int hour, int minute, double seconds); + public DateTime.utc (int year, int month, int day, int hour, int minute, double seconds); + public DateTime add (TimeSpan timespan); + public DateTime add_years (int years); + public DateTime add_months (int months); + public DateTime add_weeks (int weeks); + public DateTime add_days (int days); + public DateTime add_hours (int hours); + public DateTime add_minutes (int minutes); + public DateTime add_seconds (double seconds); + public DateTime add_full (int years, int months, int days, int hours = 0, int minutes = 0, double seconds = 0); + public int compare (DateTime dt); + public TimeSpan difference (DateTime begin); + public uint hash (); + public bool equal (DateTime dt); + public void get_ymd (out int year, out int month, out int day); + public int get_year (); + public int get_month (); + public int get_day_of_month (); + public int get_week_numbering_year (); + public int get_week_of_year (); + public int get_day_of_week (); + public int get_day_of_year (); + public int get_hour (); + public int get_minute (); + public int get_second (); + public int get_microsecond (); + public double get_seconds (); + [Version (since = "2.58")] + public unowned TimeZone get_timezone (); + public int64 to_unix (); + [Version (deprecated_since = "2.62")] + public bool to_timeval (out TimeVal tv); + public TimeSpan get_utc_offset (); + public unowned string get_timezone_abbreviation (); + public bool is_daylight_savings (); + public DateTime to_timezone (TimeZone tz); + public DateTime to_local (); + public DateTime to_utc (); + public string format (string format); + [Version (since = "2.62")] + public string format_iso8601 (); + public string to_string () { + return this.format ("%FT%H:%M:%S%z"); + } + } + + public enum TimeType { + STANDARD, + DAYLIGHT, + UNIVERSAL + } + + [Compact] + [Version (since = "2.26")] + [CCode (ref_function = "g_time_zone_ref", unref_function = "g_time_zone_unref", type_id = "G_TYPE_TIME_ZONE")] + public class TimeZone { + [Version (deprecated = true, deprecated_since = "2.68", replacement = "TimeZone.identifier")] + public TimeZone (string identifier); + [CCode (cname = "g_time_zone_new_identifier")] + TimeZone.new_identifier (string? identifier); + [Version (since = "2.68")] + [CCode (cname = "vala_g_time_zone_new_identifier")] + public TimeZone.identifier (string? identifier) throws Error { + this.new_identifier (identifier); + if ((TimeZone?) this == null) { + throw new ConvertError.ILLEGAL_SEQUENCE ("Invalid identifier argument"); + } + } + public TimeZone.utc (); + public TimeZone.local (); + [Version (since = "2.58")] + public TimeZone.offset (int32 seconds); + public int find_interval (TimeType type, int64 time); + public int adjust_time (TimeType type, ref int64 time); + public unowned string get_abbreviation (int interval); + [Version (since = "2.58")] + public unowned string get_identifier (); + public int32 get_offset (int interval); + public bool is_dst (int interval); + } + + /* Random Numbers */ + + [Compact] + [CCode (copy_function = "g_rand_copy", free_function = "g_rand_free")] + public class Rand { + public Rand.with_seed (uint32 seed); + [Version (since = "2.4")] + public Rand.with_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length); + public Rand (); + public void set_seed (uint32 seed); + [Version (since = "2.4")] + public void set_seed_array ([CCode (array_length = false)] uint32[] seed, uint seed_length); + public bool boolean (); + [CCode (cname = "g_rand_int")] + public uint32 next_int (); + public int32 int_range (int32 begin, int32 end); + [CCode (cname = "g_rand_double")] + public double next_double (); + public double double_range (double begin, double end); + } + + namespace Random { + public static void set_seed (uint32 seed); + public static bool boolean (); + [CCode (cname = "g_random_int")] + public static uint32 next_int (); + public static int32 int_range (int32 begin, int32 end); + [CCode (cname = "g_random_double")] + public static double next_double (); + public static double double_range (double begin, double end); + } + + namespace Uuid { + [Version (since = "2.52")] + public static bool string_is_valid (string str); + [Version (since = "2.52")] + public static string string_random (); + } + + /* Miscellaneous Utility Functions */ + + namespace Environment { + [Version (since = "2.2")] + [CCode (cname = "g_get_application_name")] + public static unowned string? get_application_name (); + [Version (since = "2.2")] + [CCode (cname = "g_set_application_name")] + public static void set_application_name (string application_name); + [CCode (cname = "g_get_prgname")] + public static unowned string get_prgname (); + [CCode (cname = "g_set_prgname")] + public static void set_prgname (string application_name); + [CCode (cname = "g_getenv")] + public static unowned string? get_variable (string variable); + [Version (since = "2.4")] + [CCode (cname = "g_setenv")] + public static bool set_variable (string variable, string value, bool overwrite); + [Version (since = "2.4")] + [CCode (cname = "g_unsetenv")] + public static void unset_variable (string variable); + [Version (since = "2.8")] + [CCode (cname = "g_listenv", array_length = false, array_null_terminated = true)] + public static string[] list_variables (); + [CCode (cname = "g_get_user_name")] + public static unowned string get_user_name (); + [CCode (cname = "g_get_real_name")] + public static unowned string get_real_name (); + [Version (since = "2.6")] + [CCode (cname = "g_get_user_cache_dir")] + public static unowned string get_user_cache_dir (); + [Version (since = "2.6")] + [CCode (cname = "g_get_user_data_dir")] + public static unowned string get_user_data_dir (); + [Version (since = "2.6")] + [CCode (cname = "g_get_user_config_dir")] + public static unowned string get_user_config_dir (); + [CCode (cname = "g_get_user_runtime_dir")] + public static unowned string get_user_runtime_dir (); + [Version (since = "2.14")] + [CCode (cname = "g_get_user_special_dir")] + public static unowned string get_user_special_dir (UserDirectory directory); + [Version (since = "2.72")] + [CCode (cname = "g_get_user_state_dir")] + public static unowned string get_user_state_dir (); + [Version (since = "2.6")] + [CCode (cname = "g_get_system_data_dirs", array_length = false, array_null_terminated = true)] + public static unowned string[] get_system_data_dirs (); + [Version (since = "2.6")] + [CCode (cname = "g_get_system_config_dirs", array_length = false, array_null_terminated = true)] + public static unowned string[] get_system_config_dirs (); + [Version (since = "2.8")] + [CCode (cname = "g_get_host_name")] + public static unowned string get_host_name (); + [CCode (cname = "g_get_home_dir")] + public static unowned string get_home_dir (); + [Version (since = "2.64")] + [CCode (cname = "g_get_os_info")] + public static string? get_os_info (string key_name); + [CCode (cname = "g_get_tmp_dir")] + public static unowned string get_tmp_dir (); + [CCode (cname = "g_get_current_dir")] + public static string get_current_dir (); + [CCode (cname = "g_find_program_in_path")] + public static string? find_program_in_path (string program); + [Version (deprecated_since = "2.32")] + [CCode (cname = "g_atexit")] + public static void atexit (VoidFunc func); + [Version (since = "2.8")] + [CCode (cname = "g_chdir", cheader_filename = "glib/gstdio.h")] + public static int set_current_dir (string path); + } + + namespace Environ { + [Version (since = "2.28")] + [CCode (cname = "g_get_environ", array_length = false, array_null_terminated = true)] + public static string[] get (); + [Version (since = "2.32")] + [CCode (cname = "g_environ_getenv")] + public static unowned string? get_variable ([CCode (array_length = false, array_null_terminated = true)] string[]? envp, string variable); + [Version (since = "2.32")] + [CCode (cname = "g_environ_setenv", array_length = false, array_null_terminated = true)] + public static string[] set_variable ([CCode (array_length = false, array_null_terminated = true)] owned string[]? envp, string variable, string value, bool overwrite = true); + [Version (since = "2.32")] + [CCode (cname = "g_environ_unsetenv", array_length = false, array_null_terminated = true)] + public static string[] unset_variable ([CCode (array_length = false, array_null_terminated = true)] owned string[]? envp, string variable); + } + + [Version (since = "2.14")] + [CCode (has_type_id = false)] + public enum UserDirectory { + DESKTOP, + DOCUMENTS, + DOWNLOAD, + MUSIC, + PICTURES, + PUBLIC_SHARE, + TEMPLATES, + VIDEOS, + [CCode (cname = "G_USER_N_DIRECTORIES")] + N_DIRECTORIES + } + + namespace Hostname { + public static bool is_non_ascii (string hostname); + public static bool is_ascii_encoded (string hostname); + public static bool is_ip_address (string hostname); + public static string to_ascii (string hostname); + public static string to_unicode (string hostname); + } + + [Version (since = "2.64")] + [CCode (lower_case_cprefix = "G_OS_INFO_KEY_")] + namespace OsInfoKey { + public const string NAME; + public const string PRETTY_NAME; + public const string VERSION; + public const string VERSION_CODENAME; + public const string VERSION_ID; + public const string ID; + public const string HOME_URL; + public const string DOCUMENTATION_URL; + public const string SUPPORT_URL; + public const string BUG_REPORT_URL; + public const string PRIVACY_POLICY_URL; + } + + namespace Path { + public static bool is_absolute (string file_name); + public static unowned string skip_root (string file_name); + public static string get_basename (string file_name); + public static string get_dirname (string file_name); + [CCode (cname = "g_build_filename")] + public static string build_filename (string first_element, ...); + [Version (since = "2.56")] + [CCode (cname = "g_build_filename_valist")] + public static string build_filename_valist (string first_element, va_list args); + [CCode (cname = "g_build_path")] + public static string build_path (string separator, string first_element, ...); + + [CCode (cname = "G_DIR_SEPARATOR")] + public const char DIR_SEPARATOR; + [CCode (cname = "G_DIR_SEPARATOR_S")] + public const string DIR_SEPARATOR_S; + [Version (since = "2.6")] + [CCode (cname = "G_IS_DIR_SEPARATOR")] + public static bool is_dir_separator (unichar c); + [CCode (cname = "G_SEARCHPATH_SEPARATOR")] + public const char SEARCHPATH_SEPARATOR; + [CCode (cname = "G_SEARCHPATH_SEPARATOR_S")] + public const string SEARCHPATH_SEPARATOR_S; + } + + [Version (since = "2.76")] + [Compact] + [CCode (copy_function = "g_path_buf_copy", free_function = "g_path_buf_free")] + public class PathBuf { + public PathBuf (); + public PathBuf.from_path (string path); + public bool equal (PathBuf v2); + [DestroysInstance] + public string free_to_path (); + public bool pop (); + public unowned PathBuf push (string path); + public bool set_extension (string extension); + public bool set_filename (string file_name); + public string? to_path (); + } + + namespace Bit { + public static int nth_lsf (ulong mask, int nth_bit); + public static int nth_msf (ulong mask, int nth_bit); + public static uint storage (ulong number); + } + + namespace SpacedPrimes { + public static uint closest (uint num); + } + + [CCode (has_target = false)] + public delegate void FreeFunc (void* data); + [CCode (has_target = false)] + public delegate void VoidFunc (); + + [Version (deprecated_since = "2.30", replacement = "format_size", since = "2.16")] + public string format_size_for_display (int64 size); + + [Version (since = "2.30")] + [CCode (cname = "g_format_size_full")] + public string format_size (uint64 size, FormatSizeFlags flags = FormatSizeFlags.DEFAULT); + + [Version (since = "2.30")] + [CCode (cprefix = "G_FORMAT_SIZE_", has_type_id = false)] + [Flags] + public enum FormatSizeFlags { + DEFAULT, + LONG_FORMAT, + IEC_UNITS, + BITS, + [Version (since = "2.74")] + ONLY_VALUE, + [Version (since = "2.74")] + ONLY_UNIT + } + + /* Lexical Scanner */ + [CCode (has_target = false)] + public delegate void ScannerMsgFunc (Scanner scanner, string message, bool error); + + [Compact] + [CCode (free_function = "g_scanner_destroy")] + public class Scanner { + public unowned string input_name; + public TokenType token; + public TokenValue value; + public uint line; + public uint position; + public TokenType next_token; + public TokenValue next_value; + public uint next_line; + public uint next_position; + public ScannerMsgFunc msg_handler; + public ScannerConfig? config; + public Scanner (ScannerConfig? config_templ); + public void input_file (int input_fd); + public void sync_file_offset (); + public void input_text (string text, uint text_len); + public TokenType peek_next_token (); + public TokenType get_next_token (); + public bool eof (); + public int cur_line (); + public int cur_position (); + public TokenType cur_token (); + public TokenValue cur_value (); + public uint set_scope (uint scope_id); + public void scope_add_symbol (uint scope_id, string symbol, void* value); + public void scope_foreach_symbol (uint scope_id, HFunc func); + public void* scope_lookup_symbol (uint scope_id, string symbol); + public void scope_remove_symbol (uint scope_id, string symbol); + public void* lookup_symbol (string symbol); + [PrintfFormat] + public void warn (string format, ...); + [PrintfFormat] + public void error (string format, ...); + public void unexp_token (TokenType expected_token, string? identifier_spec, string? symbol_spec, string? symbol_name, string? message, bool is_error); + } + + [CCode (has_type_id = false)] + public struct ScannerConfig { + public string* cset_skip_characters; + public string* cset_identifier_first; + public string* cset_identifier_nth; + public string* cpair_comment_single; + public bool case_sensitive; + public bool skip_comment_multi; + public bool skip_comment_single; + public bool scan_comment_multi; + public bool scan_identifier; + public bool scan_identifier_1char; + public bool scan_identifier_NULL; + public bool scan_symbols; + public bool scan_binary; + public bool scan_octal; + public bool scan_float; + public bool scan_hex; + public bool scan_hex_dollar; + public bool scan_string_sq; + public bool scan_string_dq; + public bool numbers_2_int; + public bool int_2_float; + public bool identifier_2_string; + public bool char_2_token; + public bool symbol_2_token; + public bool scope_0_fallback; + public bool store_int64; + } + + [CCode (lower_case_cprefix="G_CSET_")] + namespace CharacterSet { + public const string A_2_Z; + public const string a_2_z; + public const string DIGITS; + public const string LATINC; + public const string LATINS; + } + + [CCode (cprefix = "G_TOKEN_", has_type_id = false)] + public enum TokenType { + EOF, + LEFT_PAREN, + RIGHT_PAREN, + LEFT_CURLY, + RIGHT_CURLY, + LEFT_BRACE, + RIGHT_BRACE, + EQUAL_SIGN, + COMMA, + NONE, + ERROR, + CHAR, + BINARY, + OCTAL, + INT, + HEX, + FLOAT, + STRING, + SYMBOL, + IDENTIFIER, + IDENTIFIER_NULL, + COMMENT_SINGLE, + COMMENT_MULTI, + LAST + } + + [CCode (has_type_id = false)] + [SimpleType] + public struct TokenValue { + [CCode (cname="v_symbol")] + public void* symbol; + [CCode (cname="v_identifier")] + public unowned string identifier; + [CCode (cname="v_binary")] + public ulong binary; + [CCode (cname="v_octal")] + public ulong octal; + [CCode (cname="v_int")] + public ulong int; + [CCode (cname="v_int64")] + public ulong int64; + [CCode (cname="v_float")] + public double float; + [CCode (cname="v_hex")] + public ulong hex; + [CCode (cname="v_string")] + public unowned string string; + [CCode (cname="v_comment")] + public unowned string comment; + [CCode (cname="v_char")] + public uchar char; + [CCode (cname="v_error")] + public uint error; + } + + [CCode (cprefix = "G_ERR_", has_type_id = false)] + public enum ErrorType { + UNKNOWN, + UNEXP_EOF, + UNEXP_EOF_IN_STRING, + UNEXP_EOF_IN_COMMENT, + NON_DIGIT_IN_CONST, + DIGIT_RADIX, + FLOAT_RADIX, + FLOAT_MALFORMED + } + + /* Automatic String Completion */ + + [Version (deprecated_since = "2.26")] + [Compact] + [CCode (free_function = "g_completion_free")] + public class Completion { + public Completion (CompletionFunc? func = null); + public List items; + public CompletionFunc func; + public string prefix; + public List cache; + public CompletionStrncmpFunc strncmp_func; + public void add_items (List items); + public void remove_items (List items); + public void clear_items (); + public unowned List complete (string prefix, out string? new_prefix = null); + [Version (since = "2.4")] + public unowned List complete_utf8 (string prefix, out string? new_prefix = null); + } + + [CCode (has_target = false)] + public delegate string CompletionFunc (void* item); + [CCode (has_target = false)] + public delegate int CompletionStrncmpFunc (string s1, string s2, size_t n); + + /* Timers */ + + [Compact] + [CCode (free_function = "g_timer_destroy")] + public class Timer { + public Timer (); + public void start (); + public void stop (); + [Version (since = "2.4")] + public void @continue (); + public double elapsed (out ulong microseconds = null); + [Version (since = "2.62")] + public bool is_active (); + public void reset (); + } + + /* Spawning Processes */ + + [CCode (has_type_id = false)] + public errordomain SpawnError { + FORK, + READ, + CHDIR, + ACCES, + PERM, + TOO_BIG, + NOEXEC, + NAMETOOLONG, + NOENT, + NOMEM, + NOTDIR, + LOOP, + TXTBUSY, + IO, + NFILE, + MFILE, + INVAL, + ISDIR, + LIBBAD, + FAILED; + public static GLib.Quark quark (); + } + + [CCode (cprefix = "G_SPAWN_", has_type_id = false)] + [Flags] + public enum SpawnFlags { + LEAVE_DESCRIPTORS_OPEN, + DO_NOT_REAP_CHILD, + SEARCH_PATH, + STDOUT_TO_DEV_NULL, + STDERR_TO_DEV_NULL, + CHILD_INHERITS_STDIN, + FILE_AND_ARGV_ZERO, + SEARCH_PATH_FROM_ENVP + } + + public delegate void SpawnChildSetupFunc (); + [CCode (cname = "__sighandler_t", has_target = false, cheader_filename = "signal.h")] + public delegate void SignalHandlerFunc (int signum); + + public unowned string strsignal (int signum); + + [CCode (lower_case_cprefix = "g_")] + namespace Process { + [Version (since = "2.58")] + public static bool spawn_async_with_fds (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid = null, int stdin_fd = -1, int stdout_fd = -1, int stderr_fd = -1) throws SpawnError; + public static bool spawn_async_with_pipes (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid, out int standard_input = null, out int standard_output = null, out int standard_error = null) throws SpawnError; + [Version (since = "2.68")] + public static bool spawn_async_with_pipes_and_fds (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, int stdin_fd, int stdout_fd, int stderr_fd, [CCode (array_length_pos = 10.1, array_length_type = "gsize")] int[] source_fds, [CCode (array_length_pos = 10.1, array_length_type = "gsize")] int[] target_fds, out Pid child_pid, out int standard_input = null, out int standard_output = null, out int standard_error = null) throws SpawnError; + public static bool spawn_async (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out Pid child_pid) throws SpawnError; + public static bool spawn_sync (string? working_directory, [CCode (array_length = false, array_null_terminated = true)] string[] argv, [CCode (array_length = false, array_null_terminated = true)] string[]? envp, SpawnFlags _flags, SpawnChildSetupFunc? child_setup, out string standard_output = null, out string standard_error = null, out int wait_status = null) throws SpawnError; + public static bool spawn_command_line_async (string command_line) throws SpawnError; + public static bool spawn_command_line_sync (string command_line, out string standard_output = null, out string standard_error = null, out int wait_status = null) throws SpawnError; + [CCode (cname = "g_spawn_close_pid")] + public static void close_pid (Pid pid); + [Version (since = "2.34", deprecated_since = "2.70", replacement = "check_wait_status")] + [CCode (cname = "g_spawn_check_exit_status")] + public static bool check_exit_status (int wait_status) throws GLib.Error; + [Version (since = "2.70")] + [CCode (cname = "g_spawn_check_wait_status")] + public static bool check_wait_status (int wait_status) throws GLib.Error; + + /* these macros are required to examine the exit status of a process */ + [CCode (cname = "WIFEXITED", cheader_filename = "sys/wait.h")] + public static bool if_exited (int status); + [CCode (cname = "WEXITSTATUS", cheader_filename = "sys/wait.h")] + public static int exit_status (int status); + [CCode (cname = "WIFSIGNALED", cheader_filename = "sys/wait.h")] + public static bool if_signaled (int status); + [CCode (cname = "WTERMSIG", cheader_filename = "sys/wait.h")] + public static ProcessSignal term_sig (int status); + [CCode (cname = "WCOREDUMP", cheader_filename = "sys/wait.h")] + public static bool core_dump (int status); + [CCode (cname = "WIFSTOPPED", cheader_filename = "sys/wait.h")] + public static bool if_stopped (int status); + [CCode (cname = "WSTOPSIG", cheader_filename = "sys/wait.h")] + public static ProcessSignal stop_sig (int status); + [CCode (cname = "WIFCONTINUED", cheader_filename = "sys/wait.h")] + public static bool if_continued (int status); + + [NoReturn] + [Version (since = "2.50")] + public void abort (); + [NoReturn] + [CCode (cname = "exit", cheader_filename = "stdlib.h")] + public void exit (int status); + [CCode (cname = "raise", cheader_filename = "signal.h")] + public int raise (ProcessSignal sig); + [CCode (cname = "signal", cheader_filename = "signal.h")] + public SignalHandlerFunc @signal (ProcessSignal signum, SignalHandlerFunc handler); + } + + [CCode (cname = "int", has_type_id = false, cheader_filename = "signal.h", cprefix = "SIG")] + public enum ProcessSignal { + HUP, + INT, + QUIT, + ILL, + TRAP, + ABRT, + BUS, + FPE, + KILL, + SEGV, + PIPE, + ALRM, + TERM, + USR1, + USR2, + CHLD, + CONT, + STOP, + TSTP, + TTIN, + TTOU + } + + + /* File Utilities */ + + [CCode (has_type_id = false)] + public errordomain FileError { + EXIST, + ISDIR, + ACCES, + NAMETOOLONG, + NOENT, + NOTDIR, + NXIO, + NODEV, + ROFS, + TXTBSY, + FAULT, + LOOP, + NOSPC, + NOMEM, + MFILE, + NFILE, + BADF, + INVAL, + PIPE, + AGAIN, + INTR, + IO, + PERM, + NOSYS, + FAILED; + public static GLib.Quark quark (); + } + + [CCode (has_type_id = false)] + [Flags] + public enum FileTest { + IS_REGULAR, + IS_SYMLINK, + IS_DIR, + IS_EXECUTABLE, + EXISTS + } + + [CCode (cname = "int", cprefix = "SEEK_", has_type_id = false)] + public enum FileSeek { + SET, + CUR, + END + } + + [Compact] + [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")] + public class FileStream { + [CCode (cname = "EOF", cheader_filename = "stdio.h")] + public const int EOF; + + [Version (since = "2.6")] + [CCode (cname = "g_fopen", cheader_filename = "glib/gstdio.h")] + public static FileStream? open (string path, string mode); + [CCode (cname = "fdopen")] + public static FileStream? fdopen (int fildes, string mode); + [CCode (cname = "fprintf")] + [PrintfFormat ()] + public void printf (string format, ...); + [CCode (cname = "vfprintf")] + public void vprintf (string format, va_list args); + [CCode (cname = "fputc", instance_pos = -1)] + public int putc (char c); + [CCode (cname = "fputs", instance_pos = -1)] + public int puts (string s); + [CCode (cname = "fgetc")] + public int getc (); + [CCode (cname = "ungetc", instance_pos = -1)] + public int ungetc (int c); + [CCode (cname = "fgets", instance_pos = -1)] + public unowned string? gets (char[] s); + [CCode (cname = "feof")] + public bool eof (); + [CCode (cname = "fscanf"), ScanfFormat] + public int scanf (string format, ...); + [CCode (cname = "fflush")] + public int flush (); + [CCode (cname = "fseek")] + public int seek (long offset, FileSeek whence); + [CCode (cname = "ftell")] + public long tell (); + [CCode (cname = "rewind")] + public void rewind (); + [CCode (cname = "fileno")] + public int fileno (); + [CCode (cname = "ferror")] + public int error (); + [CCode (cname = "clearerr")] + public void clearerr (); + [CCode (cname = "fread", instance_pos = -1)] + public size_t read ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1); + [CCode (cname = "fwrite", instance_pos = -1)] + public size_t write ([CCode (array_length_pos = 2.1)] uint8[] buf, size_t size = 1); + + public string? read_line () { + int c; + StringBuilder? ret = null; + while ((c = getc ()) != EOF) { + if (ret == null) { + ret = new StringBuilder (); + } + if (c == '\n') { + break; + } + ((!)(ret)).append_c ((char) c); + } + if (ret == null) { + return null; + } else { + return (owned) ((!)(ret)).str; + } + } + } + + [CCode (cname = "struct utimbuf", cheader_filename = "sys/types.h,utime.h", has_type_id = false)] + public struct UTimBuf { + time_t actime; /* access time */ + time_t modtime; /* modification time */ + } + + [CCode (lower_case_cprefix = "g_file_", cheader_filename = "glib/gstdio.h")] + namespace FileUtils { + public static bool get_contents (string filename, out string contents, out size_t length = null) throws FileError; + [Version (since = "2.8")] + public static bool set_contents (string filename, string contents, ssize_t length = -1) throws FileError; + [Version (since = "2.66")] + public static bool set_contents_full (string filename, string contents, ssize_t length = -1, FileSetContentsFlags flags = 0, int mode = 0666) throws FileError; + [CCode (cname = "g_file_get_contents")] + public static bool get_data (string filename, [CCode (type = "gchar**", array_length_type = "gsize")] out uint8[] contents) throws FileError; + [CCode (cname = "g_file_set_contents")] + public static bool set_data (string filename, [CCode (type = "const char*", array_length_type = "gsize")] uint8[] contents) throws FileError; + public static bool test (string filename, FileTest test); + public static int open_tmp (string tmpl, out string name_used) throws FileError; + [Version (since = "2.4")] + public static string read_link (string filename) throws FileError; + public static int error_from_errno (int err_no); + + [Version (since = "2.64")] + [CCode (cname = "g_fsync")] + public static int fsync (int fd); + [CCode (cname = "g_mkstemp")] + public static int mkstemp (string tmpl); + [Version (since = "2.6")] + [CCode (cname = "g_rename")] + public static int rename (string oldfilename, string newfilename); + [Version (since = "2.6")] + [CCode (cname = "g_remove")] + public static int remove (string filename); + [CCode (cname = "g_unlink")] + public static int unlink (string filename); + [Version (since = "2.8")] + [CCode (cname = "g_chmod")] + public static int chmod (string filename, int mode); + [Version (since = "2.18")] + [CCode (cname = "g_utime")] + public static int utime (string filename, UTimBuf? times = null); + + [CCode (cname = "symlink", cheader_filename = "unistd.h")] + public static int symlink (string oldpath, string newpath); + + [CCode (cname = "close", cheader_filename = "unistd.h")] + public static int close (int fd); + + [Version (since = "2.36")] + [CCode (cname = "g_close")] + public static bool close_checked (int fd) throws FileError; + } + + [Flags] + [Version (since = "2.66")] + [CCode (cprefix = "G_FILE_SET_CONTENTS_", has_type_id = false)] + public enum FileSetContentsFlags { + NONE, + CONSISTENT, + DURABLE, + ONLY_EXISTING + } + + [CCode (cname = "GStatBuf", cheader_filename = "glib/gstdio.h", has_type_id = false)] + public struct Stat { + public time_t st_atime; + public time_t st_mtime; + public time_t st_ctime; + [CCode (cname = "g_stat", instance_pos = -1)] + public Stat (string filename); + [Version (since = "2.6")] + [CCode (cname = "g_lstat", instance_pos = -1)] + public Stat.l (string filename); + } + + [Compact] + [CCode (free_function = "g_dir_close")] + public class Dir { + public static Dir open (string filename, uint _flags = 0) throws FileError; + public unowned string? read_name (); + public void rewind (); + } + + [CCode (cheader_filename = "glib/gstdio.h")] + namespace DirUtils { + [Version (since = "2.6")] + [CCode (cname = "g_mkdir")] + public static int create (string pathname, int mode); + [Version (since = "2.8")] + [CCode (cname = "g_mkdir_with_parents")] + public static int create_with_parents (string pathname, int mode); + [Version (since = "2.30")] + [CCode (cname = "mkdtemp")] + public static string? mkdtemp (owned string template); + [Version (since = "2.30")] + [CCode (cname = "g_dir_make_tmp")] + public static string make_tmp (string? tmpl = null) throws FileError; + [Version (since = "2.6")] + [CCode (cname = "g_rmdir")] + public static int remove (string filename); + } + + [Compact] + [Version (since = "2.22")] + [CCode (ref_function = "g_mapped_file_ref", unref_function = "g_mapped_file_unref", type_id = "G_TYPE_MAPPED_FILE")] + public class MappedFile { + public MappedFile (string filename, bool writable) throws FileError; + [Version (since = "2.32")] + public MappedFile.from_fd (int fd, bool writable) throws FileError; + public size_t get_length (); + public unowned char* get_contents (); + [Version (since = "2.34")] + public Bytes get_bytes (); + } + + [CCode (cname = "stdin", cheader_filename = "stdio.h")] + public static FileStream stdin; + + [CCode (cname = "stdout", cheader_filename = "stdio.h")] + public static FileStream stdout; + + [CCode (cname = "stderr", cheader_filename = "stdio.h")] + public static FileStream stderr; + + /* URI Functions */ + + [Compact] + [CCode (ref_function = "g_uri_ref", unref_function = "g_uri_unref", type_id = "G_TYPE_URI")] + public class Uri { + [Version (since = "2.16")] + public const string RESERVED_CHARS_ALLOWED_IN_PATH; + [Version (since = "2.16")] + public const string RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT; + [Version (since = "2.16")] + public const string RESERVED_CHARS_ALLOWED_IN_USERINFO; + [Version (since = "2.16")] + public const string RESERVED_CHARS_GENERIC_DELIMITERS; + [Version (since = "2.16")] + public const string RESERVED_CHARS_SUBCOMPONENT_DELIMITERS; + + [Version (since = "2.66")] + public static bool split (string uri_string, UriFlags flags, out string? scheme, out string? userinfo, out string? host, out int port, out string? path, out string? query, out string? fragment) throws UriError; + [Version (since = "2.66")] + public static bool split_with_user (string uri_string, UriFlags flags, out string? scheme, out string? user, out string? password, out string? auth_params, out string? host, out int port, out string? path, out string? query, out string? fragment) throws UriError; + [Version (since = "2.66")] + public static bool split_network (string uri_string, UriFlags flags, out string? scheme, out string? host, out int port) throws UriError; + [Version (since = "2.66")] + public static bool is_valid (string uri_string, UriFlags flags) throws UriError; + [Version (since = "2.66")] + public static string join (UriFlags flags, string scheme, string? userinfo, string? host, int port, string path, string? query, string? fragment); + [Version (since = "2.66")] + public static string join_with_user (UriFlags flags, string scheme, string? user, string? password, string? auth_params, string? host, int port, string path, string? query, string? fragment); + + [Version (since = "2.66")] + public static Uri parse (string uri_string, UriFlags flags) throws UriError; + [Version (since = "2.66")] + public static Uri parse_relative (Uri? base_uri, string uri_string, UriFlags flags) throws UriError; + [Version (since = "2.66")] + public static string resolve_relative (string base_uri_string, string uri_string, UriFlags flags) throws UriError; + [Version (since = "2.66")] + public static Uri build (UriFlags flags, string scheme, string? userinfo, string? host, int port, string path, string? query, string? fragment); + [Version (since = "2.66")] + public static Uri build_with_user (UriFlags flags, string scheme, string? user, string? password, string? auth_params, string? host, int port, string path, string? query, string? fragment); + + [Version (since = "2.66")] + public unowned string get_scheme (); + [Version (since = "2.66")] + public unowned string? get_userinfo (); + [Version (since = "2.66")] + public unowned string? get_user (); + [Version (since = "2.66")] + public unowned string? get_password (); + [Version (since = "2.66")] + public unowned string? get_auth_params (); + [Version (since = "2.66")] + public unowned string? get_host (); + [Version (since = "2.66")] + public int get_port (); + [Version (since = "2.66")] + public unowned string get_path (); + [Version (since = "2.66")] + public unowned string? get_query (); + [Version (since = "2.66")] + public unowned string? get_fragment (); + [Version (since = "2.66")] + public UriFlags get_flags (); + [Version (since = "2.66")] + public string to_string (); + [Version (since = "2.66")] + public string to_string_partial (UriHideFlags flags); + + [Version (since = "2.66")] + public static HashTable parse_params (string uri, size_t length = -1, string separators = "&;", UriParamsFlags flags = 0) throws UriError; + [Version (since = "2.16")] + public static string? parse_scheme (string uri); + [Version (since = "2.66")] + public static unowned string? peek_scheme (string uri); + [Version (since = "2.16")] + public static string escape_string (string unescaped, string? reserved_chars_allowed = null, bool allow_utf8 = true); + [Version (since = "2.16")] + public static string? unescape_string (string escaped_string, string? illegal_characters = null); + [Version (since = "2.16")] + public static string? unescape_segment (string? escaped_string, string? escaped_string_end, string? illegal_characters = null); + [Version (since = "2.66")] + public static Bytes? unescape_bytes (string escaped_string, size_t length = -1, string? illegal_characters = null) throws UriError; + [Version (since = "2.66")] + public static string? escape_bytes ([CCode (array_length_type = "gsize")] uint8[] unescaped, string? reserved_chars_allowed = null); + [Version (since = "2.6")] + [CCode (array_length = false, array_null_terminated = true)] + public static string[] list_extract_uris (string uri_list); + } + + [Version (since = "2.66")] + public errordomain UriError { + FAILED, + BAD_SCHEME, + BAD_USER, + BAD_PASSWORD, + BAD_AUTH_PARAMS, + BAD_HOST, + BAD_PORT, + BAD_PATH, + BAD_QUERY, + BAD_FRAGMENT; + public static GLib.Quark quark (); + } + + [Flags] + [Version (since = "2.66")] + [CCode (cprefix = "G_URI_FLAGS_", has_type_id = false)] + public enum UriFlags { + NONE, + PARSE_RELAXED, + HAS_PASSWORD, + HAS_AUTH_PARAMS, + ENCODED, + NON_DNS, + ENCODED_QUERY, + ENCODED_PATH, + ENCODED_FRAGMENT, + [Version (since = "2.68")] + SCHEME_NORMALIZE + } + + [Flags] + [Version (since = "2.66")] + [CCode (cprefix = "G_URI_HIDE_", has_type_id = false)] + public enum UriHideFlags { + NONE, + USERINFO, + PASSWORD, + AUTH_PARAMS, + QUERY, + FRAGMENT + } + + [Version (since = "2.66")] + public struct UriParamsIter { + public UriParamsIter (string @params, int length = -1, string separators = "&;", UriParamsFlags flags = 0); + public bool next (out string attribute = null, out string @value = null) throws Error; + } + + [Flags] + [Version (since = "2.66")] + [CCode (cprefix = "G_URI_PARAMS_", has_type_id = false)] + public enum UriParamsFlags { + NONE, + CASE_INSENSITIVE, + WWW_FORM, + PARSE_RELAXED + } + + /* Shell-related Utilities */ + + [CCode (has_type_id = false)] + public errordomain ShellError { + BAD_QUOTING, + EMPTY_STRING, + FAILED; + public static GLib.Quark quark (); + } + + namespace Shell { + public static bool parse_argv (string command_line, [CCode (array_length_pos = 1.9)] out string[] argvp) throws ShellError; + public static string quote (string unquoted_string); + public static string unquote (string quoted_string) throws ShellError; + } + + /* Commandline option parser */ + + [CCode (has_type_id = false)] + public errordomain OptionError { + UNKNOWN_OPTION, + BAD_VALUE, + FAILED; + public static GLib.Quark quark (); + } + + [Compact] + [Version (since = "2.6")] + [CCode (free_function = "g_option_context_free")] + public class OptionContext { + public OptionContext (string? parameter_string = null); + [Version (since = "2.12")] + public void set_summary (string summary); + [Version (since = "2.12")] + public unowned string get_summary (); + [Version (since = "2.12")] + public void set_description (string description); + [Version (since = "2.12")] + public unowned string get_description (); + [Version (since = "2.12")] + public void set_translate_func (TranslateFunc func, DestroyNotify? destroy_notify); + [Version (since = "2.12")] + public void set_translation_domain (string domain); + public bool parse ([CCode (array_length_pos = 0.9)] ref unowned string[] argv) throws OptionError; + [Version (since = "2.40")] + public bool parse_strv ([CCode (array_length = false, array_null_terminated = true)] ref string[] argv) throws OptionError; + public void set_help_enabled (bool help_enabled); + public bool get_help_enabled (); + public void set_ignore_unknown_options (bool ignore_unknown); + public bool get_ignore_unknown_options (); + [Version (since = "2.14")] + public string get_help (bool main_help, OptionGroup? group); + public void add_main_entries ([CCode (array_length = false, array_null_terminated = true)] OptionEntry[] entries, string? translation_domain); + public void add_group (owned OptionGroup group); + public void set_main_group (owned OptionGroup group); + public unowned OptionGroup get_main_group (); + [Version (since = "2.44")] + public void set_strict_posix (bool strict_posix); + [Version (since = "2.44")] + public bool get_strict_posix (); + } + + public delegate unowned string TranslateFunc (string str); + + public const string OPTION_REMAINING; + + [CCode (has_type_id = false)] + public enum OptionArg { + NONE, + STRING, + INT, + CALLBACK, + FILENAME, + STRING_ARRAY, + FILENAME_ARRAY, + DOUBLE, + INT64 + } + + [Flags] + [CCode (cprefix = "G_OPTION_FLAG_", has_type_id = false)] + public enum OptionFlags { + [Version (since = "2.42")] + NONE, + HIDDEN, + IN_MAIN, + REVERSE, + NO_ARG, + FILENAME, + OPTIONAL_ARG, + NOALIAS + } + + [CCode (has_type_id = false)] + public struct OptionEntry { + [Version (since = "2.70")] + public const OptionEntry NULL; + + public unowned string long_name; + public char short_name; + [CCode (type = "gint")] + public OptionFlags flags; + + public OptionArg arg; + public void* arg_data; + + public unowned string description; + public unowned string? arg_description; + } + + [Compact] + [Version (since = "2.44")] + [CCode (ref_function = "g_option_group_ref", unref_function = "g_option_group_unref", type_id = "G_TYPE_OPTION_GROUP")] + public class OptionGroup { + public OptionGroup (string name, string description, string help_description, void* user_data = null, DestroyNotify? destroy = null); + public void add_entries ([CCode (array_length = false, array_null_terminated = true)] OptionEntry[] entries); + public void set_parse_hooks (OptionParseFunc? pre_parse_func, OptionParseFunc? post_parse_hook); + public void set_error_hook (OptionErrorFunc? error_func); + public void set_translate_func (owned TranslateFunc? func); + public void set_translation_domain (string domain); + } + + [CCode (has_target = false)] + public delegate bool OptionParseFunc (OptionContext context, OptionGroup group, void* data) throws OptionError; + [CCode (has_target = false)] + public delegate void OptionErrorFunc (OptionContext context, OptionGroup group, void* data, ref Error error); + [CCode (has_target = false)] + public delegate bool OptionArgFunc (string option_name, string val, void* data) throws OptionError; + + /* Perl-compatible regular expressions */ + + [CCode (has_type_id = false)] + [Version (since = "2.14")] + public errordomain RegexError { + COMPILE, + OPTIMIZE, + REPLACE, + MATCH, + INTERNAL, + STRAY_BACKSLASH, + MISSING_CONTROL_CHAR, + UNRECOGNIZED_ESCAPE, + QUANTIFIERS_OUT_OF_ORDER, + QUANTIFIER_TOO_BIG, + UNTERMINATED_CHARACTER_CLASS, + INVALID_ESCAPE_IN_CHARACTER_CLASS, + RANGE_OUT_OF_ORDER, + NOTHING_TO_REPEAT, + UNRECOGNIZED_CHARACTER, + POSIX_NAMED_CLASS_OUTSIDE_CLASS, + UNMATCHED_PARENTHESIS, + INEXISTENT_SUBPATTERN_REFERENCE, + UNTERMINATED_COMMENT, + EXPRESSION_TOO_LARGE, + MEMORY_ERROR, + VARIABLE_LENGTH_LOOKBEHIND, + MALFORMED_CONDITION, + TOO_MANY_CONDITIONAL_BRANCHES, + ASSERTION_EXPECTED, + UNKNOWN_POSIX_CLASS_NAME, + POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED, + HEX_CODE_TOO_LARGE, + INVALID_CONDITION, + SINGLE_BYTE_MATCH_IN_LOOKBEHIND, + INFINITE_LOOP, + MISSING_SUBPATTERN_NAME_TERMINATOR, + DUPLICATE_SUBPATTERN_NAME, + MALFORMED_PROPERTY, + UNKNOWN_PROPERTY, + SUBPATTERN_NAME_TOO_LONG, + TOO_MANY_SUBPATTERNS, + INVALID_OCTAL_VALUE, + TOO_MANY_BRANCHES_IN_DEFINE, + DEFINE_REPETION, + INCONSISTENT_NEWLINE_OPTIONS, + MISSING_BACK_REFERENCE, + INVALID_RELATIVE_REFERENCE, + BACKTRACKING_CONTROL_VERB_ARGUMENT_FORBIDDEN, + UNKNOWN_BACKTRACKING_CONTROL_VERB, + NUMBER_TOO_BIG, + MISSING_SUBPATTERN_NAME, + MISSING_DIGIT, + INVALID_DATA_CHARACTER, + EXTRA_SUBPATTERN_NAME, + BACKTRACKING_CONTROL_VERB_ARGUMENT_REQUIRED, + INVALID_CONTROL_CHAR, + MISSING_NAME, + NOT_SUPPORTED_IN_CLASS, + TOO_MANY_FORWARD_REFERENCES, + NAME_TOO_LONG, + CHARACTER_VALUE_TOO_LARGE; + public static GLib.Quark quark (); + } + + [Version (since = "2.14")] + [CCode (cprefix = "G_REGEX_", has_type_id = false)] + [Flags] + public enum RegexCompileFlags { + CASELESS, + MULTILINE, + DOTALL, + EXTENDED, + ANCHORED, + DOLLAR_ENDONLY, + UNGREEDY, + RAW, + NO_AUTO_CAPTURE, + OPTIMIZE, + DUPNAMES, + NEWLINE_CR, + NEWLINE_LF, + NEWLINE_CRLF, + NEWLINE_ANYCRLF, + BSR_ANYCRLF, + JAVASCRIPT_COMPAT + } + + [Version (since = "2.14")] + [CCode (cprefix = "G_REGEX_MATCH_", has_type_id = false)] + [Flags] + public enum RegexMatchFlags { + ANCHORED, + NOTBOL, + NOTEOL, + NOTEMPTY, + PARTIAL, + NEWLINE_CR, + NEWLINE_LF, + NEWLINE_CRLF, + NEWLINE_ANY, + NEWLINE_ANYCRLF, + BSR_ANYCRLF, + BSR_ANY, + PARTIAL_SOFT, + PARTIAL_HARD, + NOTEMPTY_ATSTART + } + + [Compact] + [Version (since = "2.14")] + [CCode (ref_function = "g_regex_ref", unref_function = "g_regex_unref", type_id = "G_TYPE_REGEX")] + public class Regex { + public Regex (string pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0) throws RegexError; + public unowned string get_pattern (); + [Version (since = "2.26")] + public RegexCompileFlags get_compile_flags (); + [Version (since = "2.34")] + public bool get_has_cr_or_lf (); + [Version (since = "2.26")] + public RegexMatchFlags get_match_flags (); + public int get_max_backref (); + [Version (since = "2.38")] + public int get_max_lookbehind (); + public int get_capture_count (); + public int get_string_number (string name); + public static string escape_string (string str, int length = -1); + public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0); + public bool match (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null); + public bool match_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError; + public bool match_all (string str, RegexMatchFlags match_options = 0, out MatchInfo match_info = null); + public bool match_all_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError; + [CCode (array_length = false, array_null_terminated = true)] + public static string[] split_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0); + [CCode (array_length = false, array_null_terminated = true)] + public string[] split (string str, RegexMatchFlags match_options = 0); + [CCode (array_length = false, array_null_terminated = true)] + public string[] split_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError; + public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError; + public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError; + public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options, RegexEvalCallback eval) throws RegexError; + public static bool check_replacement (string replacement, out bool has_references = null) throws RegexError; + } + + [Version (since = "2.14")] + public delegate bool RegexEvalCallback (MatchInfo match_info, StringBuilder result); + + [Compact] + [Version (since = "2.30")] + [CCode (ref_function = "g_match_info_ref", unref_function = "g_match_info_unref", type_id = "G_TYPE_MATCH_INFO")] + public class MatchInfo { + public unowned Regex get_regex (); + public unowned string get_string (); + public bool matches (); + public bool next () throws RegexError; + public int get_match_count (); + public bool is_partial_match (); + public string expand_references (string string_to_expand) throws RegexError; + public string? fetch (int match_num); + public bool fetch_pos (int match_num, out int start_pos, out int end_pos); + public string? fetch_named (string name); + public bool fetch_named_pos (string name, out int start_pos, out int end_pos); + [CCode (array_length = false, array_null_terminated = true)] + public string[] fetch_all (); + } + + /* Simple XML Subset Parser + See http://live.gnome.org/Vala/MarkupSample for an example */ + + [CCode (has_type_id = false)] + public errordomain MarkupError { + BAD_UTF8, + EMPTY, + PARSE, + UNKNOWN_ELEMENT, + UNKNOWN_ATTRIBUTE, + INVALID_CONTENT, + MISSING_ATTRIBUTE; + public static GLib.Quark quark (); + } + + [CCode (cprefix = "G_MARKUP_", has_type_id = false)] + [Flags] + public enum MarkupParseFlags { + TREAT_CDATA_AS_TEXT, + PREFIX_ERROR_POSITION + } + + [Compact] + [Version (since = "2.36")] + [CCode (ref_function = "g_markup_parse_context_ref", unref_function = "g_markup_parse_context_unref", type_id = "G_TYPE_MARKUP_PARSE_CONTEXT")] + public class MarkupParseContext { + public MarkupParseContext (MarkupParser parser, MarkupParseFlags _flags, void* user_data, DestroyNotify? user_data_dnotify); + public bool parse (string text, ssize_t text_len) throws MarkupError; + public bool end_parse () throws MarkupError; + [Version (since = "2.2")] + public unowned string get_element (); + [Version (since = "2.16")] + public unowned SList get_element_stack (); + public void get_position (out int line_number, out int char_number); + [Version (since = "2.18")] + public void push (MarkupParser parser, void* user_data); + [Version (since = "2.18")] + public void* pop (); + [Version (since = "2.18")] + public void* get_user_data (); + } + + [CCode (has_typedef = false)] + public delegate void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_names, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_values) throws MarkupError; + [CCode (has_typedef = false)] + public delegate void MarkupParserEndElementFunc (MarkupParseContext context, string element_name) throws MarkupError; + [CCode (has_typedef = false)] + public delegate void MarkupParserTextFunc (MarkupParseContext context, string text, size_t text_len) throws MarkupError; + [CCode (has_typedef = false)] + public delegate void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError; + [CCode (has_typedef = false)] + public delegate void MarkupParserErrorFunc (MarkupParseContext context, Error error); + + [CCode (has_type_id = false)] + public struct MarkupParser { + [CCode (delegate_target = false)] + public unowned MarkupParserStartElementFunc start_element; + [CCode (delegate_target = false)] + public unowned MarkupParserEndElementFunc end_element; + [CCode (delegate_target = false)] + public unowned MarkupParserTextFunc text; + [CCode (delegate_target = false)] + public unowned MarkupParserPassthroughFunc passthrough; + [CCode (delegate_target = false)] + public unowned MarkupParserErrorFunc error; + } + + namespace Markup { + [CCode (cprefix = "G_MARKUP_COLLECT_", has_type_id = false)] + public enum CollectType { + INVALID, + STRING, + STRDUP, + BOOLEAN, + TRISTATE, + OPTIONAL + } + + public static string escape_text (string text, ssize_t length = -1); + [Version (since = "2.4")] + [PrintfFormat] + public static string printf_escaped (string format, ...); + [Version (since = "2.4")] + public static string vprintf_escaped (string format, va_list args); + [Version (since = "2.16")] + [CCode (sentinel = "G_MARKUP_COLLECT_INVALID")] + public static bool collect_attributes (string element_name, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_names, [CCode (array_length = false, array_null_terminated = true)] string[] attribute_values, ...) throws MarkupError; + } + + /* Key-value file parser */ + + [CCode (has_type_id = false)] + public errordomain KeyFileError { + UNKNOWN_ENCODING, + PARSE, + NOT_FOUND, + KEY_NOT_FOUND, + GROUP_NOT_FOUND, + INVALID_VALUE; + public static GLib.Quark quark (); + } + + [Compact] + [Version (since = "2.32")] + [CCode (ref_function = "g_key_file_ref", unref_function = "g_key_file_unref", type_id = "G_TYPE_KEY_FILE")] + public class KeyFile { + public KeyFile (); + public void set_list_separator (char separator); + [Version (since = "2.50")] + public bool load_from_bytes (Bytes bytes, KeyFileFlags @flags) throws KeyFileError; + public bool load_from_file (string file, KeyFileFlags @flags) throws KeyFileError, FileError; + [Version (since = "2.14")] + public bool load_from_dirs (string file, [CCode (array_length = false, array_null_terminated = true)] string[] search_dirs, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError; + public bool load_from_data (string data, size_t length, KeyFileFlags @flags) throws KeyFileError; + public bool load_from_data_dirs (string file, out string full_path, KeyFileFlags @flags) throws KeyFileError, FileError; + // g_key_file_to_data never throws an error according to the documentation + public string to_data (out size_t length = null, out GLib.Error error = null); + public string get_start_group (); + [CCode (array_length_type = "gsize")] + public string[] get_groups (); + [CCode (array_length_type = "gsize")] + public string[] get_keys (string group_name) throws KeyFileError; + public bool has_group (string group_name); + public bool has_key (string group_name, string key) throws KeyFileError; + public string get_value (string group_name, string key) throws KeyFileError; + public string get_string (string group_name, string key) throws KeyFileError; + public string get_locale_string (string group_name, string key, string? locale = null) throws KeyFileError; + [Version (since = "2.56")] + public string? get_locale_for_key (string group_name, string key, string? locale = null); + public bool get_boolean (string group_name, string key) throws KeyFileError; + public int get_integer (string group_name, string key) throws KeyFileError; + [Version (since = "2.26")] + public int64 get_int64 (string group_name, string key) throws KeyFileError; + [Version (since = "2.26")] + public uint64 get_uint64 (string group_name, string key) throws KeyFileError; + [Version (since = "2.12")] + public double get_double (string group_name, string key) throws KeyFileError; + [CCode (array_length = true, array_length_type = "gsize", array_null_terminated = true)] + public string[] get_string_list (string group_name, string key) throws KeyFileError; + [CCode (array_length_type = "gsize")] + public string[] get_locale_string_list (string group_name, string key, string? locale = null) throws KeyFileError; + [CCode (array_length_type = "gsize")] + public bool[] get_boolean_list (string group_name, string key) throws KeyFileError; + [CCode (array_length_type = "gsize")] + public int[] get_integer_list (string group_name, string key) throws KeyFileError; + [Version (since = "2.12")] + [CCode (array_length_type = "gsize")] + public double[] get_double_list (string group_name, string key) throws KeyFileError; + public string get_comment (string? group_name, string? key) throws KeyFileError; + [Version (since = "2.40")] + public bool save_to_file (string filename) throws GLib.FileError; + public void set_value (string group_name, string key, string value); + public void set_string (string group_name, string key, string str); + public void set_locale_string (string group_name, string key, string locale, string str); + public void set_boolean (string group_name, string key, bool value); + public void set_integer (string group_name, string key, int value); + [Version (since = "2.26")] + public void set_int64 (string group_name, string key, int64 value); + [Version (since = "2.26")] + public void set_uint64 (string group_name, string key, uint64 value); + [Version (since = "2.12")] + public void set_double (string group_name, string key, double value); + public void set_string_list (string group_name, string key, [CCode (type = "const gchar* const*")] string[] list); + public void set_locale_string_list (string group_name, string key, string locale, string[] list); + public void set_boolean_list (string group_name, string key, bool[] list); + public void set_integer_list (string group_name, string key, int[] list); + [Version (since = "2.12")] + public void set_double_list (string group_name, string key, double[] list); + public void set_comment (string? group_name, string? key, string comment) throws KeyFileError; + public void remove_group (string group_name) throws KeyFileError; + public void remove_key (string group_name, string key) throws KeyFileError; + public void remove_comment (string group_name, string key) throws KeyFileError; + } + + [CCode (cprefix = "G_KEY_FILE_", has_type_id = false)] + [Flags] + public enum KeyFileFlags { + NONE, + KEEP_COMMENTS, + KEEP_TRANSLATIONS + } + + [Version (since = "2.14")] + [CCode (cprefix = "G_KEY_FILE_DESKTOP_")] + namespace KeyFileDesktop { + public const string GROUP; + public const string KEY_ACTIONS; + public const string KEY_CATEGORIES; + public const string KEY_COMMENT; + public const string KEY_DBUS_ACTIVATABLE; + public const string KEY_EXEC; + public const string KEY_FULLNAME; + public const string KEY_GENERIC_NAME; + public const string KEY_GETTEXT_DOMAIN; + public const string KEY_HIDDEN; + public const string KEY_ICON; + public const string KEY_KEYWORDS; + public const string KEY_MIME_TYPE; + public const string KEY_NAME; + public const string KEY_NOT_SHOW_IN; + public const string KEY_NO_DISPLAY; + public const string KEY_ONLY_SHOW_IN; + public const string KEY_PATH; + public const string KEY_STARTUP_NOTIFY; + public const string KEY_STARTUP_WM_CLASS; + public const string KEY_TERMINAL; + public const string KEY_TRY_EXEC; + public const string KEY_TYPE; + public const string KEY_URL; + public const string KEY_VERSION; + public const string TYPE_APPLICATION; + public const string TYPE_DIRECTORY; + public const string TYPE_LINK; + } + + /* Bookmark file parser */ + + [Compact] + [Version (since = "2.12")] +#if GLIB_2_76 + [CCode (copy_function = "g_bookmark_file_copy", free_function = "g_bookmark_file_free", type_id = "G_TYPE_BOOKMARK_FILE")] +#else + [CCode (free_function = "g_bookmark_file_free")] +#endif + public class BookmarkFile { + public BookmarkFile (); + [Version (since = "2.76")] + public BookmarkFile copy (); + public bool load_from_file (string file) throws BookmarkFileError, FileError; + public bool load_from_data (string data, size_t length) throws BookmarkFileError; + public bool load_from_data_dirs (string file, out string full_path) throws BookmarkFileError, FileError; + public string to_data (out size_t length) throws BookmarkFileError; + public bool to_file (string filename) throws BookmarkFileError, FileError; + public bool has_item (string uri); + public bool has_group (string uri, string group) throws BookmarkFileError; + public bool has_application (string uri, string name) throws BookmarkFileError; + public int get_size (); + [CCode (array_length_type = "gsize")] + public string[] get_uris (); + public string get_title (string uri) throws BookmarkFileError; + public string get_description (string uri) throws BookmarkFileError; + public string get_mime_type (string uri) throws BookmarkFileError; + public bool get_is_private (string uri) throws BookmarkFileError; + public bool get_icon (string uri, out string href, out string mime_type) throws BookmarkFileError; + [Version (deprecated_since = "2.66", replacement = "get_added_date_time")] + public time_t get_added (string uri) throws BookmarkFileError; + [Version (since = "2.66")] + public unowned DateTime get_added_date_time (string uri) throws BookmarkFileError; + [Version (deprecated_since = "2.66", replacement = "get_modified_date_time")] + public time_t get_modified (string uri) throws BookmarkFileError; + [Version (since = "2.66")] + public unowned DateTime get_modified_date_time (string uri) throws BookmarkFileError; + [Version (deprecated_since = "2.66", replacement = "get_visited_date_time")] + public time_t get_visited (string uri) throws BookmarkFileError; + [Version (since = "2.66")] + public unowned DateTime get_visited_date_time (string uri) throws BookmarkFileError; + [CCode (array_length_type = "gsize")] + public string[] get_groups (string uri) throws BookmarkFileError; + [CCode (array_length_type = "gsize")] + public string[] get_applications (string uri) throws BookmarkFileError; + [Version (deprecated_since = "2.66", replacement = "get_application_info")] + public bool get_app_info (string uri, string name, out string exec, out uint count, out time_t stamp) throws BookmarkFileError; + [Version (since = "2.66")] + public bool get_application_info (string uri, string name, out string exec, out uint count, out unowned DateTime? stamp) throws BookmarkFileError; + public void set_title (string uri, string title); + public void set_description (string uri, string description); + public void set_mime_type (string uri, string mime_type); + public void set_is_private (string uri, bool is_private); + public void set_icon (string uri, string href, string mime_type); + [Version (deprecated_since = "2.66", replacement = "set_added_date_time")] + public void set_added (string uri, time_t added); + [Version (since = "2.66")] + public void set_added_date_time (string uri, DateTime added); + public void set_groups (string uri, string[] groups); + [Version (deprecated_since = "2.66", replacement = "set_modified_date_time")] + public void set_modified (string uri, time_t modified); + [Version (since = "2.66")] + public void set_modified_date_time (string uri, DateTime modified); + [Version (deprecated_since = "2.66", replacement = "set_visited_date_time")] + public void set_visited (string uri, time_t visited); + [Version (since = "2.66")] + public void set_visited_date_time (string uri, DateTime visited); + [Version (deprecated_since = "2.66", replacement = "set_application_info")] + public bool set_app_info (string uri, string name, string exec, int count, time_t stamp) throws BookmarkFileError; + [Version (since = "2.66")] + public bool set_application_info (string uri, string name, string exec, int count, DateTime? stamp) throws BookmarkFileError; + public void add_group (string uri, string group); + public void add_application (string uri, string name, string exec); + public bool remove_group (string uri, string group) throws BookmarkFileError; + public bool remove_application (string uri, string name) throws BookmarkFileError; + public bool remove_item (string uri) throws BookmarkFileError; + public bool move_item (string old_uri, string new_uri) throws BookmarkFileError; + } + + [CCode (has_type_id = false)] + public errordomain BookmarkFileError { + INVALID_URI, + INVALID_VALUE, + APP_NOT_REGISTERED, + URI_NOT_FOUND, + READ, + UNKNOWN_ENCODING, + WRITE, + FILE_NOT_FOUND; + public static GLib.Quark quark (); + } + + /* Testing */ + + namespace Test { + [CCode (cprefix = "G_TEST_", has_type_id = false)] + public enum FileType { + DIST, + BUILT + } + + [PrintfFormat] + [Version (since = "2.16")] + public static void minimized_result (double minimized_quantity, string format, ...); + [PrintfFormat] + [Version (since = "2.16")] + public static void maximized_result (double maximized_quantity, string format, ...); + [Version (since = "2.16")] + public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] args, ...); + public static bool quick (); + public static bool slow (); + public static bool thorough (); + public static bool perf (); + public static bool verbose (); + public static bool quiet (); + [Version (since = "2.16")] + public static int run (); + [Version (since = "2.16")] + public static void add (string testpath, void* fixture, [CCode (delegate_target_pos = 2.9)] TestFixtureFunc fsetup, [CCode (delegate_target_pos = 2.9)] TestFixtureFunc ftest, [CCode (delegate_target_pos = 2.9)] TestFixtureFunc fteardown); + [Version (since = "2.16")] + public static void add_func (string testpath, [CCode (scope = "async")] owned TestFunc test_funcvoid); + [Version (since = "2.16")] + public static void add_data_func (string testpath, [CCode (delegate_target_pos = 1.9, scope = "async")] owned TestDataFunc test_funcvoid); + [Version (since = "2.34")] + public static void add_data_func_full (string testpath, [CCode (delegate_target_pos = 1.9)] owned TestDataFunc test_func); + [Version (since = "2.34")] + public static void assert_expected_messages (); + [Version (since = "2.38")] + public static string build_filename (GLib.Test.FileType file_type, params string[] path_segments); + [Version (since = "2.34")] + public static void expect_message (string? log_domain, LogLevelFlags log_level, string pattern); + [Version (since = "2.30")] + public static void fail (); + [PrintfFormat] + [Version (since = "2.70")] + public static void fail_printf (string format, ...); + [Version (since = "2.38")] + public static bool failed (); + [Version (since = "2.38")] + public static unowned string get_dir (GLib.Test.FileType file_type); + [Version (since = "2.38")] + public static unowned string get_filename (GLib.Test.FileType file_type, params string[] path_segments); + [Version (since = "2.68")] + public static unowned string get_path (); + [Version (since = "2.38")] + public static void incomplete (string? msg = null); + [PrintfFormat] + [Version (since = "2.70")] + public static void incomplete_printf (string format, ...); + [Version (since = "2.36")] + public static bool initialized (); + [PrintfFormat] + [Version (since = "2.16")] + public static void message (string format, ...); + [Version (since = "2.38")] + public static void set_nonfatal_assertions (); + [Version (since = "2.38")] + public static void skip (string? msg = null); + [PrintfFormat] + [Version (since = "2.70")] + public static void skip_printf (string format, ...); + [Version (since = "2.38")] + public static bool subprocess (); + [Version (since = "2.16")] + public static void bug_base (string uri_pattern); + [Version (since = "2.16")] + public static void bug (string bug_uri_snippet); + [Version (since = "2.62")] + public static void summary (string summary); + [Version (since = "2.16")] + public static void timer_start (); + [Version (since = "2.16")] + public static double timer_elapsed (); + [Version (since = "2.16")] + public static double timer_last (); + [Version (since = "2.16", deprecated_since = "2.38", replacement = "trap_subprocess")] + public static bool trap_fork (uint64 usec_timeout, TestTrapFlags test_trap_flags); + [Version (since = "2.16")] + public static bool trap_has_passed (); + [Version (since = "2.16")] + public static bool trap_reached_timeout (); + [Version (since = "2.38")] + public static void trap_subprocess (string? test_path, uint64 usec_timeout, TestSubprocessFlags test_flags); + [Version (since = "2.16")] + public static void trap_assert_passed (); + [Version (since = "2.16")] + public static void trap_assert_failed (); + [Version (since = "2.16")] + public static void trap_assert_stdout (string soutpattern); + [Version (since = "2.16")] + public static void trap_assert_stdout_unmatched (string soutpattern); + [Version (since = "2.16")] + public static void trap_assert_stderr (string serrpattern); + [Version (since = "2.16")] + public static void trap_assert_stderr_unmatched (string serrpattern); + [Version (since = "2.16")] + public static bool rand_bit (); + [Version (since = "2.16")] + public static int32 rand_int (); + [Version (since = "2.16")] + public static int32 rand_int_range (int32 begin, int32 end); + [Version (since = "2.16")] + public static double rand_double (); + [Version (since = "2.16")] + public static double rand_double_range (double begin, double end); + [Version (since = "2.22")] + public static void log_set_fatal_handler (LogFatalFunc log_func); + [Version (since = "2.78")] + public static void disable_crash_reporting (); + + public delegate bool LogFatalFunc (string? log_domain, LogLevelFlags log_levels, string message); + } + + [Compact] +#if GLIB_2_70 + [CCode (cname = "GTestCase", free_function = "g_test_case_free")] +#else + [CCode (cname = "GTestCase", ref_function = "", unref_function = "")] +#endif + public class TestCase { + [Version (since = "2.16")] + [CCode (cname = "g_test_create_case")] + public TestCase (string test_name, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_setup, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_func, [CCode (delegate_target_pos = 1.9)] TestFixtureFunc data_teardown, [CCode (pos = 1.8)] size_t data_size = 0); + [Version (since = "2.70")] + [DestroysInstance] + [CCode (cname = "g_test_case_free")] + public void free (); + } + + [Compact] +#if GLIB_2_70 + [CCode (cname = "GTestSuite", free_function = "g_test_suite_free")] +#else + [CCode (cname = "GTestSuite", ref_function = "", unref_function = "")] +#endif + public class TestSuite { + [Version (since = "2.16")] + [CCode (cname = "g_test_create_suite")] + public TestSuite (string name); + [Version (since = "2.16")] + [CCode (cname = "g_test_get_root")] +#if GLIB_2_70 + public static unowned TestSuite get_root (); +#else + public static TestSuite get_root (); +#endif + [Version (since = "2.16")] + [CCode (cname = "g_test_suite_add")] +#if GLIB_2_70 + public void add (owned TestCase test_case); +#else + public void add (TestCase test_case); +#endif + [Version (since = "2.16")] + [CCode (cname = "g_test_suite_add_suite")] +#if GLIB_2_70 + public void add_suite (owned TestSuite test_suite); +#else + public void add_suite (TestSuite test_suite); +#endif + [Version (since = "2.70")] + [DestroysInstance] + [CCode (cname = "g_test_suite_free")] + public void free (); + } + + [Version (since = "2.26")] + [CCode (has_target = false)] + public delegate void TestFunc (); + [Version (since = "2.26")] + public delegate void TestDataFunc (); + [Version (since = "2.26")] + public delegate void TestFixtureFunc (void* fixture); + + [CCode (cprefix = "G_TEST_SUBPROCESS_INHERIT_", has_type_id = false)] + [Flags] + public enum TestSubprocessFlags { + [Version (since = "2.74")] + [CCode (cname = "G_TEST_SUBPROCESS_DEFAULT")] + DEFAULT, + STDIN, + STDOUT, + STDERR + } + + [Flags] + [CCode (cprefix = "G_TEST_TRAP_", has_type_id = false)] + public enum TestTrapFlags { + SILENCE_STDOUT, + SILENCE_STDERR, + INHERIT_STDIN + } + + /* Doubly-Linked Lists */ + + [Compact] + [CCode (dup_function = "g_list_copy", free_function = "g_list_free")] + public class List { + public List (); + + [ReturnsModifiedPointer ()] + public void append (owned G data); + [ReturnsModifiedPointer ()] + public void prepend (owned G data); + [ReturnsModifiedPointer ()] + public void insert (owned G data, int position); + [ReturnsModifiedPointer ()] + public void insert_before (List sibling, owned G data); + [ReturnsModifiedPointer ()] + [Version (since = "2.62")] + public void insert_before_link (List sibling, owned List link_); + [ReturnsModifiedPointer ()] + public void insert_sorted (owned G data, CompareFunc compare_func); + [ReturnsModifiedPointer ()] + public void remove (G data); + [CCode (cname = "vala_g_list_remove_full")] + [ReturnsModifiedPointer ()] + public unowned List remove_full (G data, FreeFunc? func) { + unowned List? l = this; + while (l != null) { + if (((!) l).data != data) { + l = ((!) l).next; + } else { + func (((!) l).data); + delete_link ((!) l); + break; + } + } + return this; + } + [ReturnsModifiedPointer ()] + public void remove_link (List llink); + [ReturnsModifiedPointer ()] + public void delete_link (List link_); + [ReturnsModifiedPointer ()] + public void remove_all (G data); + [CCode (cname = "vala_g_list_remove_all_full")] + [ReturnsModifiedPointer ()] + public unowned List remove_all_full (G data, FreeFunc? func) { + unowned List? l = this; + while (l != null) { + if (((!) l).data != data) { + l = ((!) l).next; + } else { + func (((!) l).data); + delete_link ((!) l); + l = this; + } + } + return this; + } + + public uint length (); + public List copy (); + [Version (since = "2.34")] + public List copy_deep (CopyFunc func); + [ReturnsModifiedPointer ()] + public void reverse (); + [ReturnsModifiedPointer ()] + public void sort (CompareFunc compare_func); + [Version (since = "2.10")] + [ReturnsModifiedPointer ()] + public void insert_sorted_with_data (owned G data, CompareDataFunc compare_func); + [ReturnsModifiedPointer ()] + public void sort_with_data (CompareDataFunc compare_func); + [ReturnsModifiedPointer ()] + public void concat (owned List list2); + public void @foreach (Func func); + + public unowned List first (); + public unowned List last (); + public unowned List nth (uint n); + public unowned G nth_data (uint n); + public unowned List nth_prev (uint n); + + public unowned List find (G data); + public unowned List find_custom (G data, CompareFunc func); + [CCode (cname = "g_list_find_custom", simple_generics = true)] + public unowned List search (T data, SearchFunc func); + + public int position (List llink); + public int index (G data); + + [CCode (cname = "vala_g_list_is_empty")] + public inline bool is_empty () { + return (List?) this == null; + } + + public G data; + public List next; + public unowned List prev; + } + + /* Singly-Linked Lists */ + + [Compact] + [CCode (dup_function = "g_slist_copy", free_function = "g_slist_free")] + public class SList { + public SList (); + + [ReturnsModifiedPointer ()] + public void append (owned G data); + [ReturnsModifiedPointer ()] + public void prepend (owned G data); + [ReturnsModifiedPointer ()] + public void insert (owned G data, int position); + [ReturnsModifiedPointer ()] + public void insert_before (SList sibling, owned G data); + [ReturnsModifiedPointer ()] + public void insert_sorted (owned G data, CompareFunc compare_func); + [ReturnsModifiedPointer ()] + public void remove (G data); + [CCode (cname = "vala_g_slist_remove_full")] + [ReturnsModifiedPointer ()] + public unowned SList remove_full (G data, FreeFunc? func) { + unowned SList? l = this; + while (l != null) { + if (((!) l).data != data) { + l = ((!) l).next; + } else { + func (((!) l).data); + delete_link ((!) l); + break; + } + } + return this; + } + [ReturnsModifiedPointer ()] + public void remove_link (SList llink); + [ReturnsModifiedPointer ()] + public void delete_link (SList link_); + [ReturnsModifiedPointer ()] + public void remove_all (G data); + [CCode (cname = "vala_g_slist_remove_all_full")] + [ReturnsModifiedPointer ()] + public unowned SList remove_all_full (G data, FreeFunc? func) { + unowned SList? l = this; + while (l != null) { + if (((!) l).data != data) { + l = ((!) l).next; + } else { + func (((!) l).data); + delete_link ((!) l); + l = this; + } + } + return this; + } + + public uint length (); + public SList copy (); + [Version (since = "2.34")] + public SList copy_deep (CopyFunc func); + [ReturnsModifiedPointer ()] + public void reverse (); + [Version (since = "2.10")] + [ReturnsModifiedPointer ()] + public void insert_sorted_with_data (owned G data, CompareDataFunc compare_func); + [ReturnsModifiedPointer ()] + public void sort (CompareFunc compare_func); + [ReturnsModifiedPointer ()] + public void sort_with_data (CompareDataFunc compare_func); + [ReturnsModifiedPointer ()] + public void concat (owned SList list2); + public void @foreach (Func func); + + public unowned SList last (); + public unowned SList nth (uint n); + public unowned G nth_data (uint n); + + public unowned SList find (G data); + public unowned SList find_custom (G data, CompareFunc func); + [CCode (cname = "g_slist_find_custom", simple_generics = true)] + public unowned SList search (T data, SearchFunc func); + + public int position (SList llink); + public int index (G data); + + [CCode (cname = "vala_g_slist_is_empty")] + public inline bool is_empty () { + return (SList?) this == null; + } + + public G data; + public SList next; + } + + [CCode (has_target = false)] + public delegate int CompareFunc (G a, G b); + + public delegate int CompareDataFunc (G a, G b); + + [Version (since = "2.16")] + [CCode (cname = "((GCompareFunc) g_strcmp0)")] + public static GLib.CompareFunc strcmp; + + public delegate G CopyFunc (G src); + + [CCode (cname = "GCompareFunc", has_target = false)] + public delegate int SearchFunc (G a, T b); + + /* Double-ended Queues */ + + [Compact] + [CCode (dup_function = "g_queue_copy", free_function = "g_queue_free")] + public class Queue { + public unowned List head; + public unowned List tail; + public uint length; + + public Queue (); + + [Version (since = "2.14")] + public void clear (); + [Version (since = "2.60")] + public void clear_full (GLib.DestroyNotify? free_func); + public bool is_empty (); + [Version (since = "2.4")] + public uint get_length (); + [Version (since = "2.4")] + public void reverse (); + public Queue copy (); + [Version (since = "2.4")] + public unowned List find (G data); + [Version (since = "2.4")] + public unowned List find_custom (G data, CompareFunc func); + [CCode (cname = "g_queue_find_custom", simple_generics = true)] + public unowned List search (T data, SearchFunc func); + [Version (since = "2.4")] + public void sort (CompareDataFunc compare_func); + public void push_head (owned G data); + public void push_tail (owned G data); + [Version (since = "2.4")] + public void push_nth (owned G data, int n); + public G pop_head (); + public G pop_tail (); + [Version (since = "2.4")] + public G pop_nth (uint n); + public unowned G peek_head (); + public unowned G peek_tail (); + [Version (since = "2.4")] + public unowned G peek_nth (uint n); + [Version (since = "2.4")] + public int index (G data); + [Version (since = "2.4")] + public bool remove (G data); + [CCode (cname = "vala_g_queue_remove_full")] + public bool remove_full (G data, FreeFunc? func) { + unowned List? l = head.find (data); + if (l != null) { + func (((!) l).data); + delete_link ((!) l); + return true; + } else { + return false; + } + } + [Version (since = "2.4")] + public uint remove_all (G data); + [CCode (cname = "vala_g_queue_remove_all_full")] + public uint remove_all_full (G data, FreeFunc? func) { + var old_length = length; + unowned List? l = head; + while (l != null) { + unowned List? next = ((!) l).next; + if (((!) l).data == data) { + func (((!) l).data); + delete_link ((!) l); + } + l = next; + } + return old_length - length; + } + [Version (since = "2.4")] + public void delete_link (List link); + [Version (since = "2.4")] + public void unlink (List link); + [Version (since = "2.4")] + public void insert_before (List sibling, owned G data); + [Version (since = "2.62")] + public void insert_before_link (List sibling, owned List link_); + [Version (since = "2.4")] + public void insert_after (List sibling, owned G data); + [Version (since = "2.62")] + public void insert_after_link (List sibling, owned List link_); + [Version (since = "2.4")] + public void insert_sorted (owned G data, CompareDataFunc func); + } + + /* Sequences */ + + [Compact] + [Version (since = "2.14")] + [CCode (free_function = "g_sequence_free")] + public class Sequence { + [CCode (simple_generics = true)] + public Sequence (); + public int get_length (); + public void @foreach (Func func); + public void sort (CompareDataFunc cmp_func); + public void sort_iter (SequenceIterCompareFunc func); + public SequenceIter get_begin_iter (); + public SequenceIter get_end_iter (); + public SequenceIter get_iter_at_pos (int pos); + public SequenceIter append (owned G data); + public SequenceIter prepend (owned G data); + public SequenceIter insert_sorted (owned G data, CompareDataFunc cmp_func); + [Version (since = "2.48")] + public bool is_empty (); + public SequenceIter insert_sorted_iter (owned G data, SequenceIterCompareFunc iter_cmp); + public SequenceIter search (G data, CompareDataFunc cmp_func); + public SequenceIter search_iter (G data, SequenceIterCompareFunc iter_cmp); + [Version (since = "2.28")] + public SequenceIter lookup (G data, CompareDataFunc cmp_func); + [Version (since = "2.28")] + public SequenceIter lookup_iter (G data, SequenceIterCompareFunc iter_cmp); + + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.foreach_range")] + public static void foreach_range (SequenceIter begin, SequenceIter end, Func func); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.insert_before")] + public static SequenceIter insert_before (SequenceIter iter, owned G data); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.move_to")] + public static void move (SequenceIter src, SequenceIter dest); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.swap")] + public static void swap (SequenceIter src, SequenceIter dest); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.sort_changed")] + public static void sort_changed (SequenceIter iter, CompareDataFunc cmp_func); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.sort_changed_iter")] + public static void sort_changed_iter (SequenceIter iter, SequenceIterCompareFunc iter_cmp); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.remove")] + public static void remove (SequenceIter iter); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.remove_range")] + public static void remove_range (SequenceIter begin, SequenceIter end); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.move_range")] + public static void move_range (SequenceIter dest, SequenceIter begin, SequenceIter end); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.get")] + public static unowned G get (SequenceIter iter); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.set")] + public static void set (SequenceIter iter, owned G data); + [Version (deprecated_since = "vala-0.26", replacement = "SequenceIter.range_get_midpoint")] + public static SequenceIter range_get_midpoint (SequenceIter begin, SequenceIter end); + } + + [Compact] + [Version (since = "2.14")] + [CCode (ref_function = "", unref_function = "")] + public class SequenceIter { + public bool is_begin (); + public bool is_end (); + public SequenceIter next (); + public SequenceIter prev (); + public int get_position (); + public SequenceIter move (int delta); + public unowned Sequence get_sequence (); + public int compare (SequenceIter other); + + [CCode (cname = "g_sequence_foreach_range")] + public void foreach_range (SequenceIter end, Func func); + [CCode (cname = "g_sequence_insert_before")] + public SequenceIter insert_before (owned G data); + [CCode (cname = "g_sequence_move")] + public void move_to (SequenceIter dest); + [CCode (cname = "g_sequence_swap")] + public void swap (SequenceIter dest); + [CCode (cname = "g_sequence_sort_changed")] + public void sort_changed (CompareDataFunc cmp_func); + [CCode (cname = "g_sequence_sort_changed_iter")] + public void sort_changed_iter (SequenceIterCompareFunc iter_cmp); + [CCode (cname = "g_sequence_remove")] + public void remove (); + [CCode (cname = "g_sequence_remove_range")] + public void remove_range (SequenceIter end); + [CCode (cname = "g_sequence_move_range")] + public void move_range (SequenceIter begin, SequenceIter end); + [CCode (cname = "g_sequence_get")] + public unowned G get (); + [CCode (cname = "g_sequence_set")] + public void set (owned G data); + [CCode (cname = "g_sequence_range_get_midpoint")] + public SequenceIter range_get_midpoint (SequenceIter end); + } + + public delegate int SequenceIterCompareFunc (SequenceIter a, SequenceIter b); + + /* Hash Tables */ + + [Compact] + [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")] + public class HashTable { + [CCode (cname = "g_hash_table_new_full", simple_generics = true)] + public HashTable (HashFunc? hash_func, EqualFunc? key_equal_func); + public HashTable.full (HashFunc? hash_func, EqualFunc? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func); + [Version (since = "2.72")] + public HashTable.similar (HashTable other_hash_table); + public bool insert (owned K key, owned V value); + public bool replace (owned K key, owned V value); + [Version (since = "2.32", deprecated_since = "vala-0.26", replacement = "GenericSet.add")] + public bool add (owned K key); + public unowned V? lookup (K key); + public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value); + [Version (since = "2.32")] + public bool contains (K key); + public bool remove (K key); + [Version (since = "2.12")] + public void remove_all (); + public uint foreach_remove (HRFunc predicate); + public uint foreach_steal (HRFunc predicate); + [CCode (cname = "g_hash_table_lookup")] + public unowned V? @get (K key); + [CCode (cname = "g_hash_table_insert")] + public bool @set (owned K key, owned V value); + [Version (since = "2.14")] + public List get_keys (); +#if VALA_0_26 + [CCode (array_length_type = "guint")] + [Version (since = "2.40")] + public (unowned K)[] get_keys_as_array (); +#endif + [Version (since = "2.76")] + public GenericArray get_keys_as_ptr_array (); + [Version (since = "2.14")] + public List get_values (); + [Version (since = "2.76")] + public GenericArray get_values_as_ptr_array (); + public void @foreach (HFunc func); + [CCode (cname = "g_hash_table_foreach")] + public void for_each (HFunc func); + [Version (since = "2.4")] + public unowned V? find (HRFunc predicate); + public uint size (); + public bool steal (K key); + [Version (since = "2.12")] + public void steal_all (); + [Version (since = "2.76")] + public GenericArray steal_all_keys (); + [Version (since = "2.76")] + public GenericArray steal_all_values (); + [Version (since = "2.58")] + public bool steal_extended (K lookup_key, out K stolen_key, out V stolen_value); + [CCode (cname = "_vala_g_hash_table_take")] + public V? take (K key, out bool exists = null) { + GLib.HashTable? ht = null; + void** htp = &ht; + *htp = this.lookup (key); + exists = this.steal (key); + return ht; + } + public uint length { + [CCode (cname = "g_hash_table_size")] + get; + } + } + + [Version (since = "2.16")] + [CCode (has_type_id = false)] + public struct HashTableIter { + public HashTableIter (GLib.HashTable table); + public bool next ([CCode (type = "gpointer*")] out unowned K key, [CCode (type = "gpointer*")] out unowned V value); + public void remove (); + public void steal (); + public unowned GLib.HashTable get_hash_table (); + } + + [Version (since = "2.32")] + [Compact, CCode (cname = "GHashTable", lower_case_cprefix = "g_hash_table_", ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")] + public class GenericSet { + [CCode (cname = "g_hash_table_new_full", simple_generics = true)] + public GenericSet (HashFunc? hash_func, EqualFunc? equal_func, GLib.DestroyNotify? always_pass_null_here = null); + public bool add (owned T value); + public bool contains (T valule); + public bool remove (T value); + public void remove_all (); + public GLib.List get_values (); + [CCode (cname = "g_hash_table_iter_init", instance_pos = -1)] + public GLib.GenericSetIter iterator (); + [CCode (cname = "_vala_g_hash_set_foreach")] + public void @foreach (GLib.Func func) { + ((GLib.HashTable) this).foreach ((k, v) => func (v)); + } + public uint length { + [CCode (cname = "g_hash_table_size")] + get; + } + } + + [Version (since = "2.32")] + [CCode (cname = "GHashTableIter", lower_case_cprefix = "g_hash_table_iter_", has_type_id = false)] + public struct GenericSetIter { + [CCode (cname = "_vala_hash_set_next_value")] + public unowned T? next_value () { + void* vi = &this; + GLib.HashTableIter* htp = vi; + unowned T? value; + return htp->next (out value, null) ? value : null; + } + public void remove (); + } + + [CCode (has_target = false)] + public delegate uint HashFunc (K key); + [CCode (has_target = false)] + public delegate bool EqualFunc (G a, G b); + [Version (since = "2.74")] + public delegate bool EqualFuncFull (G a, G b); + public delegate void HFunc (K key, V value); + public delegate bool HRFunc (K key, V value); + + [CCode (has_target = false)] + public delegate void DestroyNotify (void* data); + + [CCode (cname = "g_direct_hash")] + public static GLib.HashFunc direct_hash; + [CCode (cname = "g_direct_equal")] + public static GLib.EqualFunc direct_equal; + [Version (since = "2.22")] + [CCode (cname = "g_double_hash")] + public static GLib.HashFunc double_hash; + [Version (since = "2.22")] + [CCode (cname = "g_double_equal")] + public static GLib.EqualFunc double_equal; + [CCode (cname = "g_int64_hash")] + public static GLib.HashFunc int64_hash; + [Version (since = "2.22")] + [CCode (cname = "g_int64_equal")] + public static GLib.EqualFunc int64_equal; + [Version (since = "2.22")] + [CCode (cname = "g_int_hash")] + public static GLib.HashFunc int_hash; + [CCode (cname = "g_int_equal")] + public static GLib.EqualFunc int_equal; + [CCode (cname = "g_str_hash")] + public static GLib.HashFunc str_hash; + [CCode (cname = "g_str_equal")] + public static GLib.EqualFunc str_equal; + [Version (since = "2.60")] + [CCode (cname = "((GEqualFunc) g_strv_equal)")] + public static GLib.EqualFunc strv_equal; + [CCode (cname = "g_free")] + public static GLib.DestroyNotify g_free; + [CCode (cname = "g_list_free")] + public static GLib.DestroyNotify g_list_free; + [CCode (cname = "((GDestroyNotify) g_variant_unref)")] + public static GLib.DestroyNotify g_variant_unref; + + /* Strings */ + + [CCode (cprefix = "g_ref_string_", ref_function = "g_ref_string_acquire", unref_function = "g_ref_string_release", type_id = "G_TYPE_STRING")] + [Version (since = "2.58")] + public class RefString { + public RefString (string str); + public RefString.intern (string str); + public RefString.len (string str, ssize_t len); + + public size_t length { + [CCode (cname = "g_ref_string_length")] + get; + } + + [CCode (cname = "(const char*)")] + public unowned string to_string (); + } + + [Compact] + [GIR (name = "String")] + [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")] + public class StringBuilder { + public StringBuilder (string init = ""); + [CCode (cname = "g_string_new_len")] + public StringBuilder.from_buffer ([CCode (array_length_type = "gssize")] char[] init); + [CCode (cname = "g_string_sized_new")] + public StringBuilder.sized (size_t dfl_size); + [Version (since = "2.78")] + [CCode (cname = "g_string_new_take")] + public StringBuilder.take (owned string init); + public unowned StringBuilder assign (string rval); + public unowned StringBuilder append (string val); + public unowned StringBuilder append_c (char c); + public unowned StringBuilder append_unichar (unichar wc); + public unowned StringBuilder append_len (string val, ssize_t len); + public unowned StringBuilder prepend (string val); + public unowned StringBuilder prepend_c (char c); + public unowned StringBuilder prepend_unichar (unichar wc); + public unowned StringBuilder prepend_len (string val, ssize_t len); + public unowned StringBuilder insert (ssize_t pos, string val); + public unowned StringBuilder insert_len (ssize_t pos, string val, ssize_t len); + public unowned StringBuilder insert_unichar (ssize_t pos, unichar wc); + [Version (since = "2.14")] + public unowned StringBuilder overwrite (size_t pos, string val); + [Version (since = "2.14")] + public unowned StringBuilder overwrite_len (size_t pos, string val, ssize_t len); + public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1); + public unowned StringBuilder truncate (size_t len = 0); + + [PrintfFormat] + public void printf (string format, ...); + [PrintfFormat] + public void append_printf (string format, ...); + [Version (since = "2.14")] + public void vprintf (string format, va_list args); + [Version (since = "2.14")] + public void append_vprintf (string format, va_list args); + [Version (since = "2.68")] + public uint replace (string find, string replace, uint limit = 0U); + + public string str; + public ssize_t len; + public ssize_t allocated_len; + + public uint8[] data { + get { + unowned uint8[] res = (uint8[]) this.str; + res.length = (int) this.len; + return res; + } + } + + [Version (since = "2.34")] + public static Bytes free_to_bytes (owned StringBuilder str); + [Version (since = "2.76")] + [DestroysInstance] + public string free_and_steal (); + } + + /* String Chunks */ + + [Compact] + [CCode (free_function = "g_string_chunk_free")] + public class StringChunk { + public StringChunk (size_t size); + public unowned string insert (string str); + public unowned string insert_const (string str); + [Version (since = "2.4")] + public unowned string insert_len (string str, ssize_t len); + [Version (since = "2.14")] + public void clear (); + } + + [Compact] + [Version (since = "2.68")] + [CCode (ref_function = "g_strv_builder_ref", unref_function = "g_strv_builder_unref", has_type_id = false)] + public class StrvBuilder { + public StrvBuilder (); + public void add (string @value); + [Version (since = "2.70")] + public void addv ([CCode (array_length = false, array_null_terminated = true)] string[] @value); + [Version (since = "2.70")] + public void add_many (...); + [CCode (array_length = false, array_null_terminated = true)] + public string[] end (); + } + + /* Pointer Arrays */ + + [Compact] + [Version (since = "2.22")] + [CCode (ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")] + public class PtrArray : GenericArray { + public PtrArray (); + [Version (since = "2.22")] + public PtrArray.with_free_func (GLib.DestroyNotify? element_free_func); + [CCode (cname = "g_ptr_array_sized_new")] + public PtrArray.sized (uint reserved_size); + [Version (since = "2.22")] + public void set_free_func (GLib.DestroyNotify? element_free_function); + } + + [CCode (cname = "GEqualFunc", has_target = false)] + public delegate bool ArraySearchFunc (G element, T needle); + + [Compact] + [CCode (cname = "GPtrArray", cprefix = "g_ptr_array_", ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")] + [GIR (name = "PtrArray")] + public class GenericArray { + [Version (since = "2.30")] + [CCode (cname = "g_ptr_array_new_full", simple_generics = true)] + public GenericArray (uint reserved_size = 0); + [Version (since = "2.74")] + [CCode (cname = "g_ptr_array_new_null_terminated", simple_generics = true)] + public GenericArray.null_terminated (uint reserved_size, [CCode (pos = -1)] bool null_terminated); + public void add (owned G data); + [Version (since = "2.62")] + public GenericArray copy (CopyFunc func); + [Version (since = "2.62")] + public void extend (GenericArray array, CopyFunc func); + [Version (since = "2.62")] + public void extend_and_steal (owned GenericArray array); + [Version (since = "2.54")] + public bool find (G needle, out uint index = null); + [Version (since = "2.54")] + [CCode (cname = "g_ptr_array_find_with_equal_func", simple_generics = true)] + public bool find_custom (T needle, GLib.ArraySearchFunc? equal_func, out uint index = null); + [Version (since = "2.54")] + public bool find_with_equal_func (G needle, GLib.EqualFunc? equal_func, out uint index = null); + public void foreach (GLib.Func func); + [CCode (cname = "g_ptr_array_index")] + public unowned G get (uint index); + [Version (since = "2.40")] + public void insert (int index, owned G data); + [Version (since = "2.74")] + public bool is_null_terminated (); + public bool remove (G data); + public void remove_index (uint index); + public bool remove_fast (G data); + public void remove_index_fast (uint index); + public void remove_range (uint index, uint length); + public void set (uint index, owned G data) { + this.add ((owned) data); + this.remove_index_fast (index); + } + [CCode (cname = "vala_g_ptr_array_sort")] + public void sort (GLib.CompareFunc compare_func) { + this._sort_with_data ((a, b) => { + return compare_func ((G**) (*a), (G**) (*b)); + }); + } + [CCode (cname = "g_ptr_array_sort_with_data")] + public void _sort_with_data (GLib.CompareDataFunc compare_func); + [CCode (cname = "vala_g_ptr_array_sort_with_data")] + public void sort_with_data (GLib.CompareDataFunc compare_func) { + this._sort_with_data ((a, b) => { + return compare_func ((G**) (*a), (G**) (*b)); + }); + } + [Version (since = "2.76")] + public void sort_values (GLib.CompareFunc compare_func); + [Version (since = "2.76")] + public void sort_values_with_data (GLib.CompareDataFunc compare_func); + [Version (since = "2.64")] + [CCode (array_length_type = "gsize")] + public G[] steal (); + [Version (since = "2.58")] + public G steal_index (uint index); + [Version (since = "2.58")] + public G steal_index_fast (uint index); + + private void set_size (int length); + + public int length { + [CCode (cname = "vala_g_ptr_array_get_length")] + get { return (int) this.len; } + [CCode (cname = "g_ptr_array_set_size")] + set; + } + + [CCode (cname = "pdata", array_length_cname = "len", array_length_type = "guint")] + public G[] data; + + private uint len; + } + + [Compact] + [Version (since = "2.32")] + [CCode (cprefix = "g_bytes_", ref_function = "g_bytes_ref", unref_function = "g_bytes_unref", type_id = "G_TYPE_BYTES")] + public class Bytes { + public Bytes ([CCode (array_length_type = "gsize")] uint8[]? data); + public Bytes.take ([CCode (array_length_type = "gsize")] owned uint8[]? data); + public Bytes.static ([CCode (array_length_type = "gsize")] uint8[]? data); + public Bytes.with_free_func ([CCode (array_length_type = "gsize")] owned uint8[]? data, GLib.DestroyNotify? free_func, void* user_data); + public Bytes.from_bytes (GLib.Bytes bytes, size_t offset, size_t length); + + [CCode (cname = "g_bytes_new_with_free_func", simple_generics = true)] + public static Bytes new_with_owner ([CCode (array_length_type = "gsize")] uint8[]? data, [CCode (destroy_notify_pos = 1.9)] owned T? owner = null); + + [CCode (array_length_type = "gsize")] + public unowned uint8[]? get_data (); + [Version (since = "2.70")] + public void* get_region (size_t element_size, size_t offset, size_t n_elements); + public size_t get_size (); + public uint hash (); + public int compare (GLib.Bytes bytes2); + [CCode (array_length_type = "gsize")] + public static uint8[] unref_to_data (owned GLib.Bytes bytes); + public static GLib.ByteArray unref_to_array (owned GLib.Bytes bytes); + + [CCode (cname = "_vala_g_bytes_get")] + public uint8 get (int index) { + assert (index >= 0 && index < (int) this.get_size ()); + unowned uint8[] data = (!) this.get_data (); + return data[index]; + } + + [CCode (cname = "_vala_g_bytes_slice")] + public GLib.Bytes slice (size_t start, size_t end) { + return new GLib.Bytes.from_bytes (this, start, end - start); + } + + public int length { + [CCode (cname = "_vala_g_bytes_get_length")] + get { + return (int) this.get_size (); + } + } + } + + /* Byte Arrays */ + + [Compact] + [Version (since = "2.22")] + [CCode (cprefix = "g_byte_array_", ref_function = "g_byte_array_ref", unref_function = "g_byte_array_unref", type_id = "G_TYPE_BYTE_ARRAY")] + public class ByteArray { + public ByteArray (); + [CCode (cname = "g_byte_array_sized_new")] + public ByteArray.sized (uint reserved_size); + [Version (since = "2.32")] + public ByteArray.take (owned uint8[] data); + public void append (uint8[] data); + [Version (since = "2.32")] + public static GLib.Bytes free_to_bytes (owned GLib.ByteArray array); + public void prepend (uint8[] data); + public void remove_index (uint index); + public void remove_index_fast (uint index); + [Version (since = "2.4")] + public void remove_range (uint index, uint length); + public void sort (CompareFunc compare_func); + public void sort_with_data (CompareDataFunc compare_func); + public void set_size (uint length); + [Version (since = "2.64")] + [CCode (array_length_type = "gsize")] + public uint8[] steal (); + + public uint len; + [CCode (array_length_cname = "len", array_length_type = "guint")] + public uint8[] data; + } + + /* N-ary Trees */ + + public delegate bool NodeTraverseFunc (Node node); + public delegate void NodeForeachFunc (Node node); + + [CCode (cprefix = "G_TRAVERSE_")] + public enum TraverseFlags { + LEAVES, + NON_LEAVES, + ALL, + MASK, + LEAFS, + NON_LEAFS + } + + [Compact] + [CCode (dup_function = "g_node_copy", free_function = "g_node_destroy")] + public class Node { + public Node(owned G? data = null); + public Node copy (); + public Node copy_deep (CopyFunc copy_func); + public unowned Node insert (int position, owned Node node); + public unowned Node insert_before (Node sibling, owned Node node); + public unowned Node insert_after (Node sibling, owned Node node); + public unowned Node append (owned Node node); + public unowned Node prepend (owned Node node); + public unowned Node insert_data (int position, owned G data); + public unowned Node insert_data_before (Node sibling, owned G data); + public unowned Node append_data (owned G data); + public unowned Node prepend_data (owned G data); + public void reverse_children (); + public void traverse (TraverseType order, TraverseFlags flags, int max_depth, NodeTraverseFunc func); + public void children_foreach (TraverseFlags flags, NodeForeachFunc func); + public unowned Node get_root (); + public unowned Node find (TraverseType order, TraverseFlags flags, G data); + public unowned Node find_child (TraverseFlags flags, G data); + public int child_index (G data); + public int child_position (Node child); + public unowned Node first_child (); + public unowned Node last_child (); + public unowned Node nth_child (uint n); + public unowned Node first_sibling (); + public unowned Node next_sibling (); + public unowned Node prev_sibling (); + public unowned Node last_sibling (); + + [CCode (cname = "G_NODE_IS_LEAF")] + public bool is_leaf (); + [CCode (cname = "G_NODE_IS_ROOT")] + public bool is_root (); + public bool is_ancestor (Node descendant); + + public uint depth (); + public uint n_nodes (TraverseFlags flags); + public uint n_children (); + public uint max_height (); + + [CCode (cname = "g_node_unlink")] + public void _unlink (); + [CCode (cname = "g_node_unlink_vala")] + public Node unlink () + { + void *ptr = this; + _unlink (); + return (Node) (owned) ptr; + } + + public G data; + public Node next; + public Node prev; + public Node parent; + public Node children; + } + + /* Quarks */ + + [CCode (type_id = "G_TYPE_UINT")] + public struct Quark : uint32 { + public static Quark from_string (string str); + public static Quark try_string (string str); + public unowned string to_string (); + } + + /* Keyed Data Lists */ + + [CCode (cname = "GData*", has_type_id = false)] + [GIR (name = "Data")] + public struct Datalist { + public Datalist (); + public void clear (); + [Version (since = "2.34")] + public G id_dup_data (Quark key_id, DuplicateFunc dup_func); + public unowned G id_get_data (Quark key_id); + public void id_set_data (Quark key_id, owned G data); + public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func); + public void id_remove_data (Quark key_id); + public G id_remove_no_notify (Quark key_id); + [Version (since = "2.34")] + public bool id_replace_data (Quark key_id, G oldval, owned G newval, GLib.DestroyNotify? destroy, out GLib.DestroyNotify? old_destroy); + public void @foreach (DataForeachFunc func); + public unowned G get_data (string key); + public void set_data_full (string key, owned G data, DestroyNotify? destry_func); + public G remove_no_notify (string key); + public void set_data (string key, owned G data); + public void remove_data (string key); + } + + public delegate void DataForeachFunc (Quark key_id, G data); + public delegate G DuplicateFunc (G data); + + /* GArray */ + + [Compact] + [Version (since = "2.22")] + [CCode (ref_function = "g_array_ref", unref_function = "g_array_unref", type_id = "G_TYPE_ARRAY")] + public class Array { + [CCode (cname = "len")] + public uint length; + [CCode (cname = "data", array_length_cname = "len", array_length_type = "uint")] + public G[] data; + + public Array (bool zero_terminated = true, bool clear = true, ulong element_size = sizeof (G)); + [Version (since = "2.76")] + public Array.take (owned G[] data, bool clear = true, size_t element_size = sizeof (G)); + [Version (since = "2.76")] + public Array.take_zero_terminated ([CCode (array_length = false, array_null_terminated = true)] owned G[] data, bool clear = true, size_t element_size = sizeof (G)); + [CCode (cname = "g_array_sized_new")] + public Array.sized (bool zero_terminated = true, bool clear = true, ulong element_size = sizeof (G), uint reserved_size = 0); + public void append_val (owned G value); + public void append_vals (void* data, uint len); + [Version (since = "2.62")] + public bool binary_search (G target, CompareFunc compare_func, out uint match_index); + [Version (since = "2.62")] + public Array copy (); + public void prepend_val (owned G value); + public void prepend_vals (void* data, uint len); + public void insert_val (uint index, owned G value); + public void insert_vals (uint index, void* data, uint len); + [CCode (cname = "g_array_remove_index")] + public void _remove_index (uint index); + [CCode (cname = "g_array_remove_index_fast")] + public void _remove_index_fast (uint index); + [CCode (cname = "g_array_remove_range")] + public void _remove_range (uint index, uint length); + [CCode (cname = "vala_g_array_remove_index")] + public G remove_index (uint index) { + assert (length > index); + G g = (owned) data[index]; + _remove_index (index); + return g; + } + [CCode (cname = "vala_g_array_remove_index_fast")] + public G remove_index_fast (uint index) { + assert (length > index); + G g = (owned) data[index]; + _remove_index_fast (index); + return g; + } + [CCode (cname = "vala_g_array_remove_range")] + public G[] remove_range (uint index, uint length) { + assert (this.length >= index + length); + G[] ga = new G[length]; + for (uint i = 0; i < length; i++) { + ga[i] = (owned) data[i + index]; + } + _remove_range (index, length); + return ga; + } + public void sort (CompareFunc compare_func); + public void sort_with_data (CompareDataFunc compare_func); + [CCode (generic_type_pos = 0.1)] + public unowned G index (uint index); + public void set_size (uint length); + [Version (since = "2.32")] + public void set_clear_func (GLib.DestroyNotify clear_func); + [Version (since = "2.64")] + [CCode (array_length_type = "gsize")] + public G[] steal (); + } + + /* GTree */ + + public delegate bool TraverseNodeFunc (TreeNode node); + + [Compact] + [Version (since = "2.68")] + [CCode (free_function = "")] + public class TreeNode { + public unowned K key (); + public unowned TreeNode? next (); + public unowned TreeNode? previous (); + public unowned V value (); + } + + public delegate bool TraverseFunc (K key, V value); + + [CCode (cprefix = "G_", has_type_id = false)] + public enum TraverseType { + IN_ORDER, + PRE_ORDER, + POST_ORDER, + LEVEL_ORDER + } + + public delegate int TreeSearchFunc (K key); + + [Compact] + [Version (since = "2.22")] +#if GLIB_2_68 + [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref", type_id = "G_TYPE_TREE")] +#else + [CCode (ref_function = "g_tree_ref", unref_function = "g_tree_unref")] +#endif + public class Tree { + [CCode (cname = "g_tree_new_full", simple_generics = true)] + public Tree (CompareDataFunc key_compare_func); + [Version (deprecated_since = "vala-0.20", replacement = "Tree ()")] + public Tree.with_data (CompareDataFunc key_compare_func); + public Tree.full (CompareDataFunc key_compare_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func); + public void insert (owned K key, owned V value); + [Version (since = "2.68")] + public unowned TreeNode insert_node (owned K key, owned V value); + public void replace (owned K key, owned V value); + [Version (since = "2.68")] + public unowned TreeNode replace_node (owned K key, owned V value); + public int nnodes (); + public int height (); + public unowned V lookup (K key); + [Version (since = "2.68")] + public unowned TreeNode lookup_node (K key); + public bool lookup_extended (K lookup_key, out unowned K orig_key, out unowned V value); + public void foreach (TraverseFunc traverse_func); + [Version (since = "2.68")] + public void foreach_node (TraverseNodeFunc traverse_func); + public unowned V search (TreeSearchFunc search_func); + [CCode (cname = "g_tree_search")] + public unowned V search_key (CompareFunc search_func, K key); + [Version (since = "2.68")] + public unowned V search_node (CompareFunc search_func, K key); + public bool remove (K key); + [Version (since = "2.70")] + public void remove_all (); + public bool steal (K key); + [Version (since = "2.68")] + public unowned TreeNode? node_first (); + [Version (since = "2.68")] + public unowned TreeNode? node_last (); + [Version (since = "2.68")] + public unowned TreeNode? lower_bound (K key); + [Version (since = "2.68")] + public unowned TreeNode? upper_bound (K key); + } + + /* Internationalization */ + + [Version (since = "2.4")] + [CCode (cname = "_", cheader_filename = "glib.h,glib/gi18n-lib.h")] + public static unowned string _ ([FormatArg] string str); + [Version (since = "2.4")] + [CCode (cname = "Q_", cheader_filename = "glib.h,glib/gi18n-lib.h")] + public static unowned string Q_ ([FormatArg] string str); + [Version (since = "2.4")] + [CCode (cname = "N_", cheader_filename = "glib.h,glib/gi18n-lib.h")] + public static unowned string N_ ([FormatArg] string str); + [Version (since = "2.16")] + [CCode (cname = "C_", cheader_filename = "glib.h,glib/gi18n-lib.h")] + public static unowned string C_ (string context, [FormatArg] string str); + [Version (since = "2.18")] + [CCode (cname = "NC_", cheader_filename = "glib.h,glib/gi18n-lib.h")] + public static unowned string NC_ (string context, [FormatArg] string str); + [CCode (cname = "gettext", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string gettext ([FormatArg] string str); + [CCode (cname = "ngettext", cheader_filename = "glib.h,glib/gi18n-lib.h")] + public static unowned string ngettext (string msgid, [FormatArg] string msgid_plural, ulong n); + [Version (since = "2.18")] + [CCode (cname = "g_dgettext", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string dgettext (string? domain, [FormatArg] string msgid); + [Version (since = "2.26")] + [CCode (cname = "g_dcgettext", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string dcgettext (string? domain, [FormatArg] string msgid, int category); + [Version (since = "2.18")] + [CCode (cname = "g_dngettext", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string dngettext (string? domain, string msgid, [FormatArg] string msgid_plural, ulong n); + [Version (since = "2.16")] + [CCode (cname = "g_dpgettext", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string dpgettext (string? domain, [FormatArg] string msgctxid, size_t msgidoffset); + [Version (since = "2.18")] + [CCode (cname = "g_dpgettext2", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string dpgettext2 (string? domain, string context, [FormatArg] string msgid); + + [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)] + public enum LocaleCategory { + ALL, + COLLATE, + CTYPE, + MESSAGES, + MONETARY, + NUMERIC, + TIME + } + + namespace Intl { + [CCode (cname = "setlocale", cheader_filename = "locale.h")] + public static unowned string? setlocale (LocaleCategory category = GLib.LocaleCategory.ALL, string? locale = ""); + [CCode (cname = "bindtextdomain", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string? bindtextdomain (string domainname, string? dirname); + [CCode (cname = "textdomain", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string? textdomain (string? domainname); + [CCode (cname = "bind_textdomain_codeset", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string? bind_textdomain_codeset (string domainname, string? codeset); + [Version (since = "2.6")] + [CCode (cname = "g_get_language_names", array_length = false, array_null_terminated = true)] + public static unowned string[] get_language_names (); + [Version (since = "2.58")] + [CCode (cname = "g_get_language_names_with_category", array_length = false, array_null_terminated = true)] + public static unowned string[] get_language_names_with_category (string category_name); + [Version (since = "2.4")] + [CCode (cname = "g_strip_context", cheader_filename = "glib/gi18n-lib.h")] + public static unowned string strip_context (string msgid, string msgval); + } + + [Compact] +#if GLIB_2_70 + [CCode (copy_function = "g_pattern_spec_copy", free_function = "g_pattern_spec_free", type_id = "G_TYPE_PATTERN_SPEC")] +#else + [CCode (free_function = "g_pattern_spec_free")] +#endif + public class PatternSpec { + public PatternSpec (string pattern); + public bool equal (PatternSpec pspec); +#if GLIB_2_70 + [Version (since = "2.70")] + public bool match (size_t string_length, string str, string? str_reversed); + [Version (since = "2.70")] + public bool match_string (string str); +#else + [Version (deprecated_since = "2.70")] + [CCode (cname = "g_pattern_match")] + public bool match (uint string_length, string str, string? str_reversed); + [Version (deprecated_since = "2.70")] + [CCode (cname = "g_pattern_match_string")] + public bool match_string (string str); +#endif + [CCode (cname = "g_pattern_match_simple")] + public static bool match_simple (string pattern, string str); + } + + [CCode (lower_case_cprefix = "glib_version_")] + namespace Version { + [CCode (cname = "glib_major_version")] + public const uint major; + [CCode (cname = "glib_minor_version")] + public const uint minor; + [CCode (cname = "glib_micro_version")] + public const uint micro; + [CCode (cname = "glib_check_version")] + public static unowned string? check (uint required_major, uint required_minor = 0, uint required_micro = 0); + + [CCode (cname = "GLIB_MAJOR_VERSION")] + public const uint MAJOR; + [CCode (cname = "GLIB_MINOR_VERSION")] + public const uint MINOR; + [CCode (cname = "GLIB_MICRO_VERSION")] + public const uint MICRO; + [CCode (cname = "GLIB_CHECK_VERSION")] + public static bool CHECK (uint required_major, uint required_minor = 0, uint required_micro = 0); + + [CCode (cname = "G_ENCODE_VERSION")] + public static uint encode (uint major, uint minor); + + public const uint CUR_STABLE; + public const uint PREV_STABLE; + public const uint MIN_REQUIRED; + public const uint MAX_ALLOWED; + + public const uint @2_26; + public const uint @2_28; + public const uint @2_30; + public const uint @2_32; + public const uint @2_34; + public const uint @2_36; + public const uint @2_38; + public const uint @2_40; + public const uint @2_42; + public const uint @2_44; + public const uint @2_46; + public const uint @2_48; + public const uint @2_50; + public const uint @2_52; + public const uint @2_54; + public const uint @2_56; + public const uint @2_58; + public const uint @2_60; + public const uint @2_62; + public const uint @2_64; + public const uint @2_66; + public const uint @2_68; + public const uint @2_70; + public const uint @2_72; + public const uint @2_74; + public const uint @2_76; + public const uint @2_78; + + [CCode (cname = "glib_binary_age")] + public const uint binary_age; + [CCode (cname = "glib_interface_age")] + public const uint interface_age; + } + + namespace Win32 { + public enum OSType { + [CCode (cname = "G_WIN32_OS_ANY")] + ANY, + [CCode (cname = "G_WIN32_OS_WORKSTATION")] + WORKSTATION, + [CCode (cname = "G_WIN32_OS_SERVER")] + SERVER, + } + [Version (since = "2.44")] + public bool check_windows_version (int major, int minor, int spver, GLib.Win32.OSType os_type); + + public string error_message (int error); + public int ftruncate (int f, uint size); + public string getlocale (); + [Version (since = "2.16")] + public string get_package_installation_directory_of_module (void* hmodule); + public uint get_windows_version (); + [Version (since = "2.8")] + public string locale_filename_from_utf8 (string utf8filename); + [CCode (cname = "G_WIN32_HAVE_WIDECHAR_API")] + public bool have_widechar_api (); + [CCode (cname = "G_WIN32_IS_NT_BASED")] + public bool is_nt_based (); + [Version (since = "2.40")] + [CCode (array_length = false, array_null_terminated = true)] + public string[] get_command_line (); + + [CCode (cname = "G_WIN32_MSG_HANDLE")] + public const int MSG_HANDLE; + } + + [Compact] + [Immutable] + [Version (since = "2.24")] + [CCode (copy_function = "g_variant_type_copy", free_function = "g_variant_type_free", type_id = "G_TYPE_VARIANT_TYPE")] + public class VariantType { + [CCode (cname = "G_VARIANT_TYPE_BOOLEAN")] + public static VariantType BOOLEAN; + [CCode (cname = "G_VARIANT_TYPE_BYTE")] + public static VariantType BYTE; + [CCode (cname = "G_VARIANT_TYPE_INT16")] + public static VariantType INT16; + [CCode (cname = "G_VARIANT_TYPE_UINT16")] + public static VariantType UINT16; + [CCode (cname = "G_VARIANT_TYPE_INT32")] + public static VariantType INT32; + [CCode (cname = "G_VARIANT_TYPE_UINT32")] + public static VariantType UINT32; + [CCode (cname = "G_VARIANT_TYPE_INT64")] + public static VariantType INT64; + [CCode (cname = "G_VARIANT_TYPE_UINT64")] + public static VariantType UINT64; + [CCode (cname = "G_VARIANT_TYPE_HANDLE")] + public static VariantType HANDLE; + [CCode (cname = "G_VARIANT_TYPE_DOUBLE")] + public static VariantType DOUBLE; + [CCode (cname = "G_VARIANT_TYPE_STRING")] + public static VariantType STRING; + [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH")] + public static VariantType OBJECT_PATH; + [CCode (cname = "G_VARIANT_TYPE_SIGNATURE")] + public static VariantType SIGNATURE; + [CCode (cname = "G_VARIANT_TYPE_VARIANT")] + public static VariantType VARIANT; + [CCode (cname = "G_VARIANT_TYPE_UNIT")] + public static VariantType UNIT; + [CCode (cname = "G_VARIANT_TYPE_ANY")] + public static VariantType ANY; + [CCode (cname = "G_VARIANT_TYPE_BASIC")] + public static VariantType BASIC; + [CCode (cname = "G_VARIANT_TYPE_MAYBE")] + public static VariantType MAYBE; + [CCode (cname = "G_VARIANT_TYPE_ARRAY")] + public static VariantType ARRAY; + [CCode (cname = "G_VARIANT_TYPE_TUPLE")] + public static VariantType TUPLE; + [CCode (cname = "G_VARIANT_TYPE_DICT_ENTRY")] + public static VariantType DICT_ENTRY; + [CCode (cname = "G_VARIANT_TYPE_DICTIONARY")] + public static VariantType DICTIONARY; + [CCode (cname = "G_VARIANT_TYPE_STRING_ARRAY")] + public static VariantType STRING_ARRAY; + [CCode (cname = "G_VARIANT_TYPE_OBJECT_PATH_ARRAY")] + public static VariantType OBJECT_PATH_ARRAY; + [CCode (cname = "G_VARIANT_TYPE_BYTESTRING")] + public static VariantType BYTESTRING; + [CCode (cname = "G_VARIANT_TYPE_BYTESTRING_ARRAY")] + public static VariantType BYTESTRING_ARRAY; + [Version (since = "2.30")] + [CCode (cname = "G_VARIANT_TYPE_VARDICT")] + public static VariantType VARDICT; + + public static bool string_is_valid (string type_string); + public static bool string_scan (string type_string, char *limit, out char* endptr); + + public VariantType (string type_string); + public size_t get_string_length (); + public char* peek_string (); + public string dup_string (); + + public bool is_definite (); + public bool is_container (); + public bool is_basic (); + public bool is_maybe (); + public bool is_array (); + public bool is_tuple (); + public bool is_dict_entry (); + public bool is_variant (); + + public uint hash (); + public bool equal (VariantType other); + public bool is_subtype_of (VariantType supertype); + + public unowned VariantType element (); + public unowned VariantType first (); + public unowned VariantType next (); + public size_t n_items (); + public unowned VariantType key (); + public unowned VariantType value (); + + public VariantType.array (VariantType element); + public VariantType.maybe (VariantType element); + public VariantType.tuple (VariantType[] items); + public VariantType.dict_entry (VariantType key, VariantType value); + } + + [Compact] + [Version (since = "2.24")] + [CCode (ref_function = "g_variant_ref", unref_function = "g_variant_unref", ref_sink_function = "g_variant_ref_sink", type_id = "G_TYPE_VARIANT", marshaller_type_name = "VARIANT", param_spec_function = "g_param_spec_variant", get_value_function = "g_value_get_variant", set_value_function = "g_value_set_variant", take_value_function = "g_value_take_variant", type_signature = "v")] + public class Variant { + [CCode (has_type_id = false)] + public enum Class { + BOOLEAN, BYTE, INT16, UINT16, INT32, UINT32, INT64, + UINT64, HANDLE, DOUBLE, STRING, OBJECT_PATH, + SIGNATURE, VARIANT, MAYBE, ARRAY, TUPLE, DICT_ENTRY + } + + public unowned VariantType get_type (); + public unowned string get_type_string (); + public bool is_of_type (VariantType type); + public bool is_container (); + [Version (since = "2.26")] + public bool is_floating (); + public Class classify (); + [Version (since = "2.26")] + public int compare (Variant other); + + public Variant.boolean (bool value); + public Variant.byte (uint8 value); + public Variant.int16 (int16 value); + public Variant.uint16 (uint16 value); + public Variant.int32 (int32 value); + public Variant.uint32 (uint32 value); + public Variant.int64 (int64 value); + public Variant.uint64 (uint64 value); + public Variant.handle (int32 value); + public Variant.double (double value); + public Variant.string (string value); + [Version (since = "2.26")] + public Variant.bytestring (string value); + public Variant.object_path (string object_path); + public static bool is_object_path (string object_path); + public Variant.signature (string signature); + public static bool is_signature (string signature); + + public bool get_boolean (); + public uint8 get_byte (); + public int16 get_int16 (); + public uint16 get_uint16 (); + public int32 get_int32 (); + public uint32 get_uint32 (); + public int64 get_int64 (); + public uint64 get_uint64 (); + public int32 get_handle (); + public double get_double (); + public unowned string get_string (out size_t length = null); + public string dup_string (out size_t length = null); + [Version (since = "2.26")] + public unowned string get_bytestring (); + [Version (since = "2.26")] + public string dup_bytestring (out size_t length); + + public Variant.strv (string[] value); + [CCode (array_length_type = "gsize")] +#if VALA_0_26 + public (unowned string)[] get_strv (); +#else + public string*[] get_strv (); +#endif + [CCode (array_length_type = "gsize")] + public string[] dup_strv (); + + [Version (since = "2.26")] + public Variant.bytestring_array (string[] value); + [Version (since = "2.26")] + [CCode (array_length_type = "gsize")] +#if VALA_0_26 + public (unowned string)[] get_bytestring_array (); +#else + public string*[] get_bytestring_array (); +#endif + [Version (since = "2.26")] + [CCode (array_length_type = "gsize")] + public string[] dup_bytestring_array (); + + [Version (since = "2.30")] + public Variant.objv (string[] value); + [Version (since = "2.30")] + [CCode (array_length_type = "gsize")] +#if VALA_0_26 + public (unowned string)[] get_objv (); +#else + public string*[] get_objv (); +#endif + [Version (since = "2.30")] + [CCode (array_length_type = "gsize")] + public string[] dup_objv (); + + public Variant (string format, ...); + // note: the function changes its behaviour when end_ptr is null, so 'out char *' is wrong + public Variant.va (string format, char **end_ptr, va_list *app); + public void get (string format, ...); + public void get_va (string format, char **end_ptr, va_list *app); + + public Variant.variant (Variant value); + public Variant.maybe (VariantType? child_type, Variant? child); + public Variant.array (VariantType? child_type, Variant[] children); + [Version (since = "2.32")] + [CCode (simple_generics = true)] + public static Variant new_fixed_array (VariantType? element_type, [CCode (array_length_type = "gsize")] T[] elements, size_t element_size); + public Variant.tuple (Variant[] children); + public Variant.dict_entry (Variant key, Variant value); + public Variant get_variant (); + public Variant? get_maybe (); + + public size_t n_children (); + public Variant get_child_value (size_t index); + public void get_child (size_t index, string format_string, ...); + + [Version (since = "2.28")] + public Variant? lookup_value (string key, VariantType? expected_type); + [Version (since = "2.28")] + public bool lookup (string key, string format_string, ...); + + public size_t get_size (); + public void *get_data (); + public void store (void *data); + + public string print (bool type_annotate); + public StringBuilder print_string (StringBuilder? builder, bool type_annotate); + + public uint hash (); + public bool equal (Variant other); + + public Variant byteswap (); + public Variant get_normal_form (); + public bool is_normal_form (); + [CCode (returns_floating_reference = true, simple_generics = true)] + public static Variant new_from_data (VariantType type, uchar[] data, bool trusted, [CCode (destroy_notify_pos = 3.9)] owned T? owner = null); + + [CCode (cname = "g_variant_iter_new")] + public VariantIter iterator (); + + public static Variant parse (VariantType? type, string text, char *limit = null, char **endptr = null) throws GLib.VariantParseError; + public Variant.parsed (string format_string, ...); + + [Version (since = "2.34")] + public bool check_format_string (string format_string, bool copy_only); + + [Version (since = "2.36")] + public Variant.from_bytes (VariantType type, Bytes bytes, bool trusted); + [Version (since = "2.36")] + public Bytes get_data_as_bytes (); + + [Version (since = "2.38")] + public Variant.printf (string format_string, ...); + [Version (since = "2.38")] + public Variant.take_string (owned string str); + + [Version (since = "2.40")] + public static void parse_error_print_context (GLib.VariantParseError error, string source_str); + } + + [CCode (has_type_id = false)] + [Version (since = "2.24")] + public errordomain VariantParseError { + FAILED, + BASIC_TYPE_EXPECTED, + CANNOT_INFER_TYPE, + DEFINITE_TYPE_EXPECTED, + INPUT_NOT_AT_END, + INVALID_CHARACTER, + INVALID_FORMAT_STRING, + INVALID_OBJECT_PATH, + INVALID_SIGNATURE, + INVALID_TYPE_STRING, + NO_COMMON_TYPE, + NUMBER_OUT_OF_RANGE, + NUMBER_TOO_BIG, + TYPE_ERROR, + UNEXPECTED_TOKEN, + UNKNOWN_KEYWORD, + UNTERMINATED_STRING_CONSTANT, + VALUE_EXPECTED, + [Version (since = "2.64")] + RECURSION; + public static GLib.Quark quark (); + } + + [Compact] + [Version (since = "2.24")] + public class VariantIter { + public VariantIter (Variant value); + public size_t n_children (); + public Variant? next_value (); + public bool next (string format_string, ...); + } + + [Compact] + [Version (since = "2.24")] + [CCode (ref_function = "g_variant_builder_ref", unref_function = "g_variant_builder_unref", type_id = "G_TYPE_VARIANT_BUILDER")] + public class VariantBuilder { + public VariantBuilder (VariantType type); + public void open (VariantType type); + public void close (); + public void add_value (Variant value); + public void add (string format_string, ...); + [CCode (returns_floating_reference = true)] + public Variant end (); + } + + [Version (since = "2.40")] + [Compact, CCode (ref_function = "g_variant_dict_ref", unref_function = "g_variant_dict_unref", type_id = "G_TYPE_VARIANT_DICT")] + public class VariantDict { + public VariantDict (GLib.Variant? from_asv = null); + public bool lookup (string key, string format_string, ...); + public GLib.Variant? lookup_value (string key, GLib.VariantType? expected_type); + public bool contains (string key); + public void insert (string key, string format_string, ...); + public void insert_value (string key, GLib.Variant value); + public bool remove (string key); + public void clear (); + [CCode (returns_floating_reference = true)] + public GLib.Variant end (); + } + + [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string", type_signature = "o")] + public class ObjectPath : string { + [CCode (cname = "g_strdup")] + public ObjectPath (string path); + } + + [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string")] + public class BusName : string { + [CCode (cname = "g_strdup")] + public BusName (string bus_name); + } + + [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")] + public static bool likely (bool expression); + [CCode (cname = "G_UNLIKELY", cheader_filename = "glib.h")] + public static bool unlikely (bool expression); + [Version (since = "2.20")] + [CCode (cname = "G_STATIC_ASSERT", cheader_filename = "glib.h")] + public static void static_assert (bool expression); + + [CCode (simple_generics = true, cname = "g_qsort_with_data")] + private static void _qsort_with_data (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc compare_func); + + [CCode (cname = "_vala_g_qsort_with_data")] + public static void qsort_with_data (T[] elems, size_t size, [CCode (type = "GCompareDataFunc")] GLib.CompareDataFunc compare_func) { + _qsort_with_data (elems, size, (a, b) => { + return compare_func (*a, *b); + }); + } + + [CCode (has_type_id = false)] + [Version (since = "2.54")] + public errordomain NumberParserError { + INVALID, + OUT_OF_BOUNDS; + public static GLib.Quark quark (); + } + + /* Unix-specific functions. All of these have to include glib-unix.h. */ + namespace Unix { + [Version (since = "2.30")] + [CCode (cheader_filename = "glib-unix.h", cname = "g_unix_signal_add_full")] + public static uint signal_add (int signum, owned GLib.SourceFunc handler, [CCode (pos = 0.9)] int priority = Priority.DEFAULT); + + [CCode (cheader_filename = "glib-unix.h", cname = "GSource")] + public class SignalSource : GLib.Source { + public SignalSource (int signum); + } + +#if UNIX + [Version (since = "2.64")] + [CCode (cheader_filename = "glib-unix.h")] + public static Posix.Passwd get_passwd_entry (string user_name) throws GLib.Error; +#endif + [Version (since = "2.30")] + [CCode (cheader_filename = "glib-unix.h")] + public static bool open_pipe ([CCode (array_length = false, array_null_terminated = false)] int[] fds, int flags) throws GLib.Error; + [Version (since = "2.30")] + [CCode (cheader_filename = "glib-unix.h")] + public static bool set_fd_nonblocking (int fd, bool nonblock) throws GLib.Error; + } + + [CCode (cname = "GUnicodeScript", cprefix = "G_UNICODE_SCRIPT_", has_type_id = false)] + public enum UnicodeScript { + INVALID_CODE, + COMMON, + INHERITED, + ARABIC, + ARMENIAN, + BENGALI, + BOPOMOFO, + CHEROKEE, + COPTIC, + CYRILLIC, + DESERET, + DEVANAGARI, + ETHIOPIC, + GEORGIAN, + GOTHIC, + GREEK, + GUJARATI, + GURMUKHI, + HAN, + HANGUL, + HEBREW, + HIRAGANA, + KANNADA, + KATAKANA, + KHMER, + LAO, + LATIN, + MALAYALAM, + MONGOLIAN, + MYANMAR, + OGHAM, + OLD_ITALIC, + ORIYA, + RUNIC, + SINHALA, + SYRIAC, + TAMIL, + TELUGU, + THAANA, + THAI, + TIBETAN, + CANADIAN_ABORIGINAL, + YI, + TAGALOG, + HANUNOO, + BUHID, + TAGBANWA, + + BRAILLE, + CYPRIOT, + LIMBU, + OSMANYA, + SHAVIAN, + LINEAR_B, + TAI_LE, + UGARITIC, + + NEW_TAI_LUE, + BUGINESE, + GLAGOLITIC, + TIFINAGH, + SYLOTI_NAGRI, + OLD_PERSIAN, + KHAROSHTHI, + + UNKNOWN, + BALINESE, + CUNEIFORM, + PHOENICIAN, + PHAGS_PA, + NKO, + + KAYAH_LI, + LEPCHA, + REJANG, + SUNDANESE, + SAURASHTRA, + CHAM, + OL_CHIKI, + VAI, + CARIAN, + LYCIAN, + LYDIAN, + + /* Unicode-5.2 additions */ + AVESTAN, /* Avst */ + BAMUM, /* Bamu */ + EGYPTIAN_HIEROGLYPHS, /* Egyp */ + IMPERIAL_ARAMAIC, /* Armi */ + INSCRIPTIONAL_PAHLAVI, /* Phli */ + INSCRIPTIONAL_PARTHIAN, /* Prti */ + JAVANESE, /* Java */ + KAITHI, /* Kthi */ + LISU, /* Lisu */ + MEETEI_MAYEK, /* Mtei */ + OLD_SOUTH_ARABIAN, /* Sarb */ + OLD_TURKIC, /* Orkh */ + SAMARITAN, /* Samr */ + TAI_THAM, /* Lana */ + TAI_VIET, /* Tavt */ + + /* Unicode-6.0 additions */ + BATAK, /* Batk */ + BRAHMI, /* Brah */ + MANDAIC, /* Mand */ + + /* Unicode-6.1 additions */ + CHAKMA, /* Cakm */ + MEROITIC_CURSIVE, /* Merc */ + MEROITIC_HIEROGLYPHS, /* Mero */ + MIAO, /* Plrd */ + SHARADA, /* Shrd */ + SORA_SOMPENG, /* Sora */ + TAKRI, /* Takr */ + + /* Unicode 7.0 additions */ + BASSA_VAH, /* Bass */ + CAUCASIAN_ALBANIAN, /* Aghb */ + DUPLOYAN, /* Dupl */ + ELBASAN, /* Elba */ + GRANTHA, /* Gran */ + KHOJKI, /* Khoj */ + KHUDAWADI, /* Sind */ + LINEAR_A, /* Lina */ + MAHAJANI, /* Mahj */ + MANICHAEAN, /* Manu */ + MENDE_KIKAKUI, /* Mend */ + MODI, /* Modi */ + MRO, /* Mroo */ + NABATAEAN, /* Nbat */ + OLD_NORTH_ARABIAN, /* Narb */ + OLD_PERMIC, /* Perm */ + PAHAWH_HMONG, /* Hmng */ + PALMYRENE, /* Palm */ + PAU_CIN_HAU, /* Pauc */ + PSALTER_PAHLAVI, /* Phlp */ + SIDDHAM, /* Sidd */ + TIRHUTA, /* Tirh */ + WARANG_CITI, /* Wara */ + + /* Unicode 8.0 additions */ + AHOM, /* Ahom */ + ANATOLIAN_HIEROGLYPHS, /* Hluw */ + HATRAN, /* Hatr */ + MULTANI, /* Mult */ + OLD_HUNGARIAN, /* Hung */ + SIGNWRITING, /* Sgnw */ + + /* Unicode 9.0 additions */ + ADLAM, /* Adlm */ + BHAIKSUKI, /* Bhks */ + MARCHEN, /* Marc */ + NEWA, /* Newa */ + OSAGE, /* Osge */ + TANGUT, /* Tang */ + + /* Unicode 10.0 additions */ + MASARAM_GONDI, /* Gonm */ + NUSHU, /* Nshu */ + SOYOMBO, /* Soyo */ + ZANABAZAR_SQUARE, /* Zanb */ + + /* Unicode 11.0 additions */ + DOGRA, /* Dogr */ + GUNJALA_GONDI, /* Gong */ + HANIFI_ROHINGYA, /* Rohg */ + MAKASAR, /* Maka */ + MEDEFAIDRIN, /* Medf */ + OLD_SOGDIAN, /* Sogo */ + SOGDIAN, /* Sogd */ + + /* Unicode 12.0 additions */ + ELYMAIC, /* Elym */ + NANDINAGARI, /* Nand */ + NYIAKENG_PUACHUE_HMONG, /* Rohg */ + WANCHO, /* Wcho */ + + /* Unicode 13.0 additions */ + CHORASMIAN, /* Chrs */ + DIVES_AKURU, /* Diak */ + KHITAN_SMALL_SCRIPT, /* Kits */ + YEZIDI, /* Yezi */ + + /* Unicode 14.0 additions */ + CYPRO_MINOAN, /* Cpmn */ + OLD_UYGHUR, /* Ougr */ + TANGSA, /* Tnsa */ + TOTO, /* Toto */ + VITHKUQI; /* Vith */ + + [CCode (cname = "g_unicode_script_to_iso15924")] + public uint32 to_iso15924 (); + [CCode (cname = "g_unicode_script_from_iso15924")] + public static GLib.UnicodeScript from_iso15924 (uint32 iso15924); + } + + [CCode (cname = "GUnicodeType", cprefix = "G_UNICODE_", has_type_id = false)] + public enum UnicodeType { + CONTROL, + FORMAT, + UNASSIGNED, + PRIVATE_USE, + SURROGATE, + LOWERCASE_LETTER, + MODIFIER_LETTER, + OTHER_LETTER, + TITLECASE_LETTER, + UPPERCASE_LETTER, + SPACING_MARK, + [Version (deprecated_since = "2.30", replacement = "SPACING_MARK")] + 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 (cname = "GUnicodeBreakType", cprefix = "G_UNICODE_BREAK_", has_type_id = false)] + 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, + [Version (deprecated_since = "2.70", replacement = "CLOSE_PARENTHESIS")] + CLOSE_PARANTHESIS, + CLOSE_PARENTHESIS, + CONDITIONAL_JAPANESE_STARTER, + HEBREW_LETTER, + REGIONAL_INDICATOR, + EMOJI_BASE, + EMOJI_MODIFIER, + ZERO_WIDTH_JOINER + } + + [CCode (cname = "GNormalizeMode", cprefix = "G_NORMALIZE_", has_type_id = false)] + public enum NormalizeMode { + DEFAULT, + NFD, + DEFAULT_COMPOSE, + NFC, + ALL, + NFKD, + ALL_COMPOSE, + NFKC + } +} diff --git a/src/util.vala b/src/util.vala new file mode 100644 index 00000000..c766c082 --- /dev/null +++ b/src/util.vala @@ -0,0 +1,36 @@ +/* enchant: miscellaneous public APIs + * Copyright (C) 2003, 2004 Dom Lachowicz + * Copyright (C) 2016-2024 Reuben Thomas + * + * 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.1 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 along with this program; if not, see + * . + * + * In addition, as a special exception, the copyright holders + * give permission to link the code of this program with + * non-LGPL Spelling Provider libraries (eg: a MSFT Office + * spell checker backend) and distribute linked combinations including + * the two. You must obey the GNU Lesser General Public License in all + * respects for all of the code used other than said providers. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to + * do so, delete this exception statement from your version. + */ + + +public string enchant_get_user_language() { + // The returned list always contains "C". + unowned string[] languages = Intl.get_language_names(); + assert(languages != null); + return languages[0]; +} diff --git a/tests/Makefile.am b/tests/Makefile.am index b07ce789..61bc0161 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -137,7 +137,6 @@ main_test_SOURCES = main.test.cpp \ provider/dict_set_error.i \ provider/get_prefix_dir.cpp \ provider/get_user_config_dirs.cpp \ - provider/get_user_language.cpp \ $(NULL) main_test_DEPENDENCIES = $(LIBENCHANT_COPY) main_test_LDADD = $(LIBENCHANT_COPY) $(GLIB_LIBS) $(UNITTESTPP_LIBS) diff --git a/tests/provider/get_user_language.cpp b/tests/provider/get_user_language.cpp deleted file mode 100644 index 38a09945..00000000 --- a/tests/provider/get_user_language.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (c) 2007 Eric Scott Albright - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include -#include -#include - -///////////////////////////////////////////////////////////////////////////// -// Utility functions -std::string origLangEnv; -bool hasLangEnv; - -static void SaveLangEnv() -{ - hasLangEnv = (g_getenv("LANGUAGE") != NULL); - if(hasLangEnv) - { - origLangEnv = std::string(g_getenv("LANGUAGE")); - } -} - -static void RestoreLangEnv() -{ - if(hasLangEnv) - { - g_setenv("LANGUAGE", origLangEnv.c_str(), TRUE); - } - else{ - g_unsetenv("LANGUAGE"); - } -} - -///////////////////////////////////////////////////////////////////////////// -// Test Normal Operation -TEST(EnchantGetUserLanguage) -{ - char* userLanguage = enchant_get_user_language(); - CHECK(userLanguage); - g_free(userLanguage); -} - -TEST(EnchantGetUserLanguage_FromLangEnvironmentVariable) -{ - SaveLangEnv(); - - g_setenv("LANGUAGE", "qaa", TRUE); - char* userLanguage = enchant_get_user_language(); - CHECK(userLanguage); - CHECK_EQUAL("qaa", userLanguage); - - g_free(userLanguage); - - RestoreLangEnv(); -} - -static void SetLocaleAndCheckLanguage(const char *locale, const char *language) -{ - SaveLangEnv(); - g_unsetenv("LANG"); // Ensure LANG does not override locale for enchant_get_user_language - - std::string origLocale(setlocale (LC_ALL, NULL)); - - setlocale (LC_ALL, locale); - char* userLanguage = enchant_get_user_language(); - CHECK(userLanguage); - // Language may be followed by country code and encoding - fprintf(stderr, "language %s, userLanguage %s\n", language, userLanguage); - CHECK(strncmp(language, userLanguage, strlen(language)) == 0); - if (strlen(userLanguage) > 2) - { - CHECK(userLanguage[2] == '_'); - } - - g_free(userLanguage); - - setlocale (LC_ALL, origLocale.c_str()); - - RestoreLangEnv(); -} - -TEST(EnchantGetUserLanguage_LocaleIsC_LocalIsEn) -{ - SetLocaleAndCheckLanguage("C", "en"); -} - -// FIXME: Set and test a particular language. Perhaps use localedef? -// Otherwise, we can't know which languages are available. diff --git a/tests/providers/unittest_enchant_providers.h b/tests/providers/unittest_enchant_providers.h index 62f50ad6..2136cd3d 100644 --- a/tests/providers/unittest_enchant_providers.h +++ b/tests/providers/unittest_enchant_providers.h @@ -67,12 +67,7 @@ struct Provider_TestFixture { EnchantDict* dict=NULL; - // Try getting dictionary for user's default language - char *lang = enchant_get_user_language(); - dict = (*_provider->request_dict) (_provider, lang); - g_free (lang); - - // If not available, get the first dictionary listed as being available + // Get the first dictionary listed as being available if (!dict && _provider->list_dicts) { size_t n_dicts;