Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clean up to reduce glib dependencies

  • Loading branch information...
commit 51b09234169fb3409994b4f661e7c7b20a09d551 1 parent 692bc1a
@tagoh authored
Showing with 620 additions and 574 deletions.
  1. +1 −0  data/Makefile.am
  2. +1 −0  liblangtag-gobject/Makefile.am
  3. +1 −0  liblangtag/Makefile.am
  4. +5 −5 liblangtag/buildaliastbl.sh
  5. +5 −5 liblangtag/lt-database.c
  6. +5 −5 liblangtag/lt-database.h
  7. +2 −2 liblangtag/lt-ext-module-data.c
  8. +5 −4 liblangtag/lt-ext-module-data.h
  9. +16 −15 liblangtag/lt-ext-module-private.h
  10. +62 −62 liblangtag/lt-ext-module.c
  11. +13 −12 liblangtag/lt-ext-module.h
  12. +10 −9 liblangtag/lt-extension-private.h
  13. +22 −22 liblangtag/lt-extension.c
  14. +7 −7 liblangtag/lt-extension.h
  15. +8 −8 liblangtag/lt-extlang-private.h
  16. +21 −20 liblangtag/lt-extlang.c
  17. +9 −9 liblangtag/lt-extlang.h
  18. +6 −6 liblangtag/lt-grandfathered-private.h
  19. +13 −13 liblangtag/lt-grandfathered.c
  20. +8 −8 liblangtag/lt-grandfathered.h
  21. +15 −15 liblangtag/lt-lang-private.h
  22. +32 −32 liblangtag/lt-lang.c
  23. +16 −16 liblangtag/lt-lang.h
  24. +35 −0 liblangtag/lt-macros.h
  25. +14 −14 liblangtag/lt-mem.c
  26. +22 −21 liblangtag/lt-mem.h
  27. +6 −6 liblangtag/lt-redundant-private.h
  28. +13 −13 liblangtag/lt-redundant.c
  29. +8 −8 liblangtag/lt-redundant.h
  30. +6 −6 liblangtag/lt-region-private.h
  31. +14 −14 liblangtag/lt-region.c
  32. +7 −7 liblangtag/lt-region.h
  33. +5 −5 liblangtag/lt-script-private.h
  34. +12 −12 liblangtag/lt-script.c
  35. +7 −7 liblangtag/lt-script.h
  36. +5 −5 liblangtag/lt-tag-private.h
  37. +123 −122 liblangtag/lt-tag.c
  38. +17 −17 liblangtag/lt-tag.h
  39. +5 −4 liblangtag/lt-utils.c
  40. +4 −4 liblangtag/lt-utils.h
  41. +7 −7 liblangtag/lt-variant-private.h
  42. +16 −16 liblangtag/lt-variant.c
  43. +8 −8 liblangtag/lt-variant.h
  44. +3 −3 liblangtag/lt-xml.h
View
1  data/Makefile.am
@@ -95,6 +95,7 @@ reg2xml_CFLAGS = \
$(LIBXML2_CFLAGS) \
$(GLIB_CFLAGS) \
-I$(top_srcdir)/liblangtag \
+ -D__LANGTAG_COMPILATION \
$(NULL)
reg2xml_LDFLAGS = \
$(LIBXML2_LIBS) \
View
1  liblangtag-gobject/Makefile.am
@@ -67,6 +67,7 @@ liblangtag_gobject_built_private_headers = \
lt-grandfathered.gir.h \
lt-lang-db.gir.h \
lt-lang.gir.h \
+ lt-macros.gir.h \
lt-redundant-db.gir.h \
lt-redundant.gir.h \
lt-region-db.gir.h \
View
1  liblangtag/Makefile.am
@@ -55,6 +55,7 @@ liblangtag_public_headers = \
lt-grandfathered-db.h \
lt-lang.h \
lt-lang-db.h \
+ lt-macros.h \
lt-redundant.h \
lt-redundant-db.h \
lt-region.h \
View
10 liblangtag/buildaliastbl.sh
@@ -37,15 +37,15 @@ cat<<EOF
#ifndef __LT_LOCALEALIAS_H__
#define __LT_LOCALEALIAS_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
typedef struct _lt_localealias_t lt_localealias_t;
struct _lt_localealias_t {
- gchar *alias;
- gchar *locale;
+ char *alias;
+ char *locale;
};
static lt_localealias_t __lt_localealias_tables[] = {
@@ -57,7 +57,7 @@ cat<<EOF
{NULL, NULL}
};
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_LOCALEALIAS_H__ */
EOF
View
10 liblangtag/lt-database.c
@@ -38,7 +38,7 @@ static lt_variant_db_t *__db_variant = NULL;
static lt_grandfathered_db_t *__db_grandfathered = NULL;
static lt_redundant_db_t *__db_redundant = NULL;
-static gchar __lt_db_datadir[LT_PATH_MAX] = { 0 };
+static char __lt_db_datadir[LT_PATH_MAX] = { 0 };
/*< private >*/
@@ -53,7 +53,7 @@ static gchar __lt_db_datadir[LT_PATH_MAX] = { 0 };
* initialization for each databases.
*/
void
-lt_db_set_datadir(const gchar *path)
+lt_db_set_datadir(const char *path)
{
if (path) {
strncpy(__lt_db_datadir, path, LT_PATH_MAX - 1);
@@ -70,10 +70,10 @@ lt_db_set_datadir(const gchar *path)
*
* Returns: the directory name.
*/
-const gchar *
+const char *
lt_db_get_datadir(void)
{
- static const gchar *__builtin_datadir = REGDATADIR;
+ static const char *__builtin_datadir = REGDATADIR;
if (*__lt_db_datadir != 0)
return __lt_db_datadir;
@@ -124,7 +124,7 @@ lt_db_finalize(void)
if (!__db_ ##__type__) { \
__db_ ##__type__ = lt_ ##__type__## _db_new(); \
lt_mem_add_weak_pointer((lt_mem_t *)__db_ ##__type__, \
- (gpointer *)&__db_ ##__type__); \
+ (lt_pointer_t *)&__db_ ##__type__); \
} else { \
lt_ ##__type__## _db_ref(__db_ ##__type__); \
} \
View
10 liblangtag/lt-database.h
@@ -17,7 +17,7 @@
#ifndef __LT_DATABASE_H__
#define __LT_DATABASE_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
#include <liblangtag/lt-extlang-db.h>
#include <liblangtag/lt-grandfathered-db.h>
#include <liblangtag/lt-lang-db.h>
@@ -26,10 +26,10 @@
#include <liblangtag/lt-script-db.h>
#include <liblangtag/lt-variant-db.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
-void lt_db_set_datadir (const gchar *path);
-const gchar *lt_db_get_datadir (void);
+void lt_db_set_datadir (const char *path);
+const char *lt_db_get_datadir (void);
void lt_db_initialize (void);
void lt_db_finalize (void);
lt_lang_db_t *lt_db_get_lang (void);
@@ -40,6 +40,6 @@ lt_variant_db_t *lt_db_get_variant (void);
lt_grandfathered_db_t *lt_db_get_grandfathered(void);
lt_redundant_db_t *lt_db_get_redundant (void);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_DATABASE_H__ */
View
4 liblangtag/lt-ext-module-data.c
@@ -29,7 +29,7 @@
typedef struct _lt_ext_module_data_private_t {
lt_mem_t parent;
lt_destroy_func_t finalizer;
- gpointer dummy[3];
+ lt_pointer_t dummy[3];
} lt_ext_module_data_private_t;
/*< private >*/
@@ -52,7 +52,7 @@ typedef struct _lt_ext_module_data_private_t {
* Returns: (transfer full): a #lt_ext_module_data_t.
*/
lt_ext_module_data_t *
-lt_ext_module_data_new(gsize size,
+lt_ext_module_data_new(size_t size,
lt_destroy_func_t finalizer)
{
lt_ext_module_data_private_t *retval;
View
9 liblangtag/lt-ext-module-data.h
@@ -17,9 +17,10 @@
#ifndef __LT_EXT_MODULE_DATA_H__
#define __LT_EXT_MODULE_DATA_H__
+#include <liblangtag/lt-macros.h>
#include <glib.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* lt_ext_module_data_t:
@@ -29,17 +30,17 @@ G_BEGIN_DECLS
* structure are private to the #lt_ext_module_data_t implementation.
*/
struct _lt_ext_module_data_t {
- gpointer dummy[8];
+ lt_pointer_t dummy[8];
};
typedef struct _lt_ext_module_data_t lt_ext_module_data_t;
-lt_ext_module_data_t *lt_ext_module_data_new (gsize size,
+lt_ext_module_data_t *lt_ext_module_data_new (size_t size,
GDestroyNotify finalizer);
lt_ext_module_data_t *lt_ext_module_data_ref (lt_ext_module_data_t *data);
void lt_ext_module_data_unref(lt_ext_module_data_t *data);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXT_MODULE_DATA_H__ */
View
31 liblangtag/lt-ext-module-private.h
@@ -13,35 +13,36 @@
#ifndef __LT_EXT_MODULE_PRIVATE_H__
#define __LT_EXT_MODULE_PRIVATE_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
#include <liblangtag/lt-ext-module-data.h>
#include <liblangtag/lt-ext-module.h>
+#include <glib.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
#define LT_MAX_EXT_MODULES (('9' - '0' + 1) + ('z' - 'a' + 1) + 2)
-gboolean lt_ext_module_validate_singleton (gchar singleton);
-gint lt_ext_module_singleton_char_to_int(gchar singleton_c);
-gchar lt_ext_module_singleton_int_to_char(gint singleton);
-lt_ext_module_t *lt_ext_module_lookup (gchar singleton_c);
-lt_ext_module_t *lt_ext_module_new (const gchar *name);
-const gchar *lt_ext_module_get_name (lt_ext_module_t *module);
-gchar lt_ext_module_get_singleton (lt_ext_module_t *module);
-gchar *lt_ext_module_get_tag (lt_ext_module_t *module,
+lt_bool_t lt_ext_module_validate_singleton (char singleton);
+int lt_ext_module_singleton_char_to_int(char singleton_c);
+char lt_ext_module_singleton_int_to_char(int singleton);
+lt_ext_module_t *lt_ext_module_lookup (char singleton_c);
+lt_ext_module_t *lt_ext_module_new (const char *name);
+const char *lt_ext_module_get_name (lt_ext_module_t *module);
+char lt_ext_module_get_singleton (lt_ext_module_t *module);
+char *lt_ext_module_get_tag (lt_ext_module_t *module,
lt_ext_module_data_t *data);
lt_ext_module_data_t *lt_ext_module_create_data (lt_ext_module_t *module);
-gboolean lt_ext_module_parse_tag (lt_ext_module_t *module,
+lt_bool_t lt_ext_module_parse_tag (lt_ext_module_t *module,
lt_ext_module_data_t *data,
- const gchar *subtag,
+ const char *subtag,
GError **error);
-gboolean lt_ext_module_validate_tag (lt_ext_module_t *module,
+lt_bool_t lt_ext_module_validate_tag (lt_ext_module_t *module,
lt_ext_module_data_t *data);
-gboolean lt_ext_module_precheck_tag (lt_ext_module_t *module,
+lt_bool_t lt_ext_module_precheck_tag (lt_ext_module_t *module,
lt_ext_module_data_t *data,
const lt_tag_t *tag,
GError **error);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXT_MODULE_PRIVATE_H__ */
View
124 liblangtag/lt-ext-module.c
@@ -34,7 +34,7 @@
*/
struct _lt_ext_module_t {
lt_mem_t parent;
- gchar *name;
+ char *name;
GModule *module;
const lt_ext_module_funcs_t *funcs;
};
@@ -45,28 +45,28 @@ typedef struct _lt_ext_default_data_t {
} lt_ext_default_data_t;
static lt_ext_module_data_t *_lt_ext_default_create_data (void);
-static gboolean _lt_ext_default_precheck_tag(lt_ext_module_data_t *data,
+static lt_bool_t _lt_ext_default_precheck_tag(lt_ext_module_data_t *data,
const lt_tag_t *tag,
GError **error);
-static gboolean _lt_ext_default_parse_tag (lt_ext_module_data_t *data,
- const gchar *subtag,
+static lt_bool_t _lt_ext_default_parse_tag (lt_ext_module_data_t *data,
+ const char *subtag,
GError **error);
-static gchar *_lt_ext_default_get_tag (lt_ext_module_data_t *data);
-static gboolean _lt_ext_default_validate_tag(lt_ext_module_data_t *data);
+static char *_lt_ext_default_get_tag (lt_ext_module_data_t *data);
+static lt_bool_t _lt_ext_default_validate_tag(lt_ext_module_data_t *data);
static lt_ext_module_data_t *_lt_ext_eaw_create_data (void);
-static gboolean _lt_ext_eaw_precheck_tag (lt_ext_module_data_t *data,
+static lt_bool_t _lt_ext_eaw_precheck_tag (lt_ext_module_data_t *data,
const lt_tag_t *tag,
GError **error);
-static gboolean _lt_ext_eaw_parse_tag (lt_ext_module_data_t *data,
- const gchar *subtag,
+static lt_bool_t _lt_ext_eaw_parse_tag (lt_ext_module_data_t *data,
+ const char *subtag,
GError **error);
-static gchar *_lt_ext_eaw_get_tag (lt_ext_module_data_t *data);
-static gboolean _lt_ext_eaw_validate_tag (lt_ext_module_data_t *data);
+static char *_lt_ext_eaw_get_tag (lt_ext_module_data_t *data);
+static lt_bool_t _lt_ext_eaw_validate_tag (lt_ext_module_data_t *data);
static lt_ext_module_t *__lt_ext_modules[LT_MAX_EXT_MODULES + 1];
static lt_ext_module_t *__lt_ext_default_handler;
-static gboolean __lt_ext_module_initialized = FALSE;
+static lt_bool_t __lt_ext_module_initialized = FALSE;
static const lt_ext_module_funcs_t __default_funcs = {
NULL,
_lt_ext_default_create_data,
@@ -108,7 +108,7 @@ _lt_ext_default_create_data(void)
return retval;
}
-static gboolean
+static lt_bool_t
_lt_ext_default_precheck_tag(lt_ext_module_data_t *data,
const lt_tag_t *tag,
GError **error)
@@ -116,9 +116,9 @@ _lt_ext_default_precheck_tag(lt_ext_module_data_t *data,
return TRUE;
}
-static gboolean
+static lt_bool_t
_lt_ext_default_parse_tag(lt_ext_module_data_t *data,
- const gchar *subtag,
+ const char *subtag,
GError **error)
{
lt_ext_default_data_t *d = (lt_ext_default_data_t *)data;
@@ -131,7 +131,7 @@ _lt_ext_default_parse_tag(lt_ext_module_data_t *data,
return TRUE;
}
-static gchar *
+static char *
_lt_ext_default_get_tag(lt_ext_module_data_t *data)
{
lt_ext_default_data_t *d = (lt_ext_default_data_t *)data;
@@ -139,7 +139,7 @@ _lt_ext_default_get_tag(lt_ext_module_data_t *data)
return g_strdup(d->tags->str);
}
-static gboolean
+static lt_bool_t
_lt_ext_default_validate_tag(lt_ext_module_data_t *data)
{
return TRUE;
@@ -159,7 +159,7 @@ _lt_ext_eaw_create_data(void)
return retval;
}
-static gboolean
+static lt_bool_t
_lt_ext_eaw_precheck_tag(lt_ext_module_data_t *data,
const lt_tag_t *tag,
GError **error)
@@ -169,9 +169,9 @@ _lt_ext_eaw_precheck_tag(lt_ext_module_data_t *data,
return FALSE;
}
-static gboolean
+static lt_bool_t
_lt_ext_eaw_parse_tag(lt_ext_module_data_t *data,
- const gchar *subtag,
+ const char *subtag,
GError **error)
{
/* not allowed to add any tags */
@@ -179,28 +179,28 @@ _lt_ext_eaw_parse_tag(lt_ext_module_data_t *data,
return FALSE;
}
-static gchar *
+static char *
_lt_ext_eaw_get_tag(lt_ext_module_data_t *data)
{
return g_strdup("");
}
-static gboolean
+static lt_bool_t
_lt_ext_eaw_validate_tag(lt_ext_module_data_t *data)
{
return TRUE;
}
-static gboolean
+static lt_bool_t
lt_ext_module_load(lt_ext_module_t *module)
{
- gchar *filename = g_strdup_printf("liblangtag-ext-%s." G_MODULE_SUFFIX,
+ char *filename = g_strdup_printf("liblangtag-ext-%s." G_MODULE_SUFFIX,
module->name);
- gchar **path_list, *s, *path = NULL, *fullname = NULL;
- const gchar *env = g_getenv("LANGTAG_EXT_MODULE_PATH");
- gint i;
- gboolean retval = FALSE;
- gsize len;
+ char **path_list, *s, *path = NULL, *fullname = NULL;
+ const char *env = g_getenv("LANGTAG_EXT_MODULE_PATH");
+ int i;
+ lt_bool_t retval = FALSE;
+ size_t len;
if (!env) {
path_list = g_strsplit(
@@ -278,7 +278,7 @@ lt_ext_module_load(lt_ext_module_t *module)
}
static lt_ext_module_t *
-lt_ext_module_new_with_data(const gchar *name,
+lt_ext_module_new_with_data(const char *name,
const lt_ext_module_funcs_t *funcs)
{
lt_ext_module_t *retval;
@@ -302,8 +302,8 @@ lt_ext_module_new_with_data(const gchar *name,
}
/*< protected >*/
-gboolean
-lt_ext_module_validate_singleton(gchar singleton)
+lt_bool_t
+lt_ext_module_validate_singleton(char singleton)
{
return (singleton >= '0' && singleton <= '9') ||
(singleton >= 'A' && singleton <= 'W') ||
@@ -314,10 +314,10 @@ lt_ext_module_validate_singleton(gchar singleton)
singleton == '*';
}
-gint
-lt_ext_module_singleton_char_to_int(gchar singleton_c)
+int
+lt_ext_module_singleton_char_to_int(char singleton_c)
{
- gint retval = -1;
+ int retval = -1;
if (!lt_ext_module_validate_singleton(singleton_c))
g_print("XXXXXXXXx: %c\n", singleton_c);
@@ -337,10 +337,10 @@ lt_ext_module_singleton_char_to_int(gchar singleton_c)
return retval;
}
-gchar
-lt_ext_module_singleton_int_to_char(gint singleton)
+char
+lt_ext_module_singleton_int_to_char(int singleton)
{
- gchar retval;
+ char retval;
g_return_val_if_fail (singleton >= 0, 0);
g_return_val_if_fail (singleton < LT_MAX_EXT_MODULES, 0);
@@ -358,7 +358,7 @@ lt_ext_module_singleton_int_to_char(gint singleton)
}
lt_ext_module_t *
-lt_ext_module_new(const gchar *name)
+lt_ext_module_new(const char *name)
{
lt_ext_module_t *retval;
@@ -367,18 +367,18 @@ lt_ext_module_new(const gchar *name)
retval = lt_mem_alloc_object(sizeof (lt_ext_module_t));
if (retval) {
- gchar *filename = g_path_get_basename(name), *module = NULL;
- static const gchar *prefix = "liblangtag-ext-";
- static gsize prefix_len = 0;
- gchar singleton_c;
- gint singleton;
+ char *filename = g_path_get_basename(name), *module = NULL;
+ static const char *prefix = "liblangtag-ext-";
+ static size_t prefix_len = 0;
+ char singleton_c;
+ int singleton;
if (prefix_len == 0)
prefix_len = strlen(prefix);
if (strncmp(filename, prefix, prefix_len) == 0) {
- gsize len = strlen(&filename[prefix_len]);
- gsize suffix_len = strlen(G_MODULE_SUFFIX) + 1;
+ size_t len = strlen(&filename[prefix_len]);
+ size_t suffix_len = strlen(G_MODULE_SUFFIX) + 1;
if (len > suffix_len &&
g_strcmp0(&filename[prefix_len + len - suffix_len], "." G_MODULE_SUFFIX) == 0) {
@@ -428,9 +428,9 @@ lt_ext_module_new(const gchar *name)
}
lt_ext_module_t *
-lt_ext_module_lookup(gchar singleton_c)
+lt_ext_module_lookup(char singleton_c)
{
- gint singleton = lt_ext_module_singleton_char_to_int(singleton_c);
+ int singleton = lt_ext_module_singleton_char_to_int(singleton_c);
g_return_val_if_fail (singleton >= 0, NULL);
g_return_val_if_fail (__lt_ext_module_initialized, NULL);
@@ -441,7 +441,7 @@ lt_ext_module_lookup(gchar singleton_c)
return lt_ext_module_ref(__lt_ext_modules[singleton]);
}
-const gchar *
+const char *
lt_ext_module_get_name(lt_ext_module_t *module)
{
g_return_val_if_fail (module != NULL, NULL);
@@ -449,7 +449,7 @@ lt_ext_module_get_name(lt_ext_module_t *module)
return module->name;
}
-gchar
+char
lt_ext_module_get_singleton(lt_ext_module_t *module)
{
g_return_val_if_fail (module != NULL, 0);
@@ -469,10 +469,10 @@ lt_ext_module_create_data(lt_ext_module_t *module)
return module->funcs->create_data();
}
-gboolean
+lt_bool_t
lt_ext_module_parse_tag(lt_ext_module_t *module,
lt_ext_module_data_t *data,
- const gchar *subtag,
+ const char *subtag,
GError **error)
{
g_return_val_if_fail (module != NULL, FALSE);
@@ -484,7 +484,7 @@ lt_ext_module_parse_tag(lt_ext_module_t *module,
return module->funcs->parse_tag(data, subtag, error);
}
-gchar *
+char *
lt_ext_module_get_tag(lt_ext_module_t *module,
lt_ext_module_data_t *data)
{
@@ -496,7 +496,7 @@ lt_ext_module_get_tag(lt_ext_module_t *module,
return module->funcs->get_tag(data);
}
-gboolean
+lt_bool_t
lt_ext_module_validate_tag(lt_ext_module_t *module,
lt_ext_module_data_t *data)
{
@@ -508,14 +508,14 @@ lt_ext_module_validate_tag(lt_ext_module_t *module,
return module->funcs->validate_tag(data);
}
-gboolean
+lt_bool_t
lt_ext_module_precheck_tag(lt_ext_module_t *module,
lt_ext_module_data_t *data,
const lt_tag_t *tag,
GError **error)
{
GError *err = NULL;
- gboolean retval;
+ lt_bool_t retval;
g_return_val_if_fail (module != NULL, FALSE);
g_return_val_if_fail (data != NULL, FALSE);
@@ -547,10 +547,10 @@ void
lt_ext_modules_load(void)
{
#ifdef ENABLE_GMODULE
- const gchar *env = g_getenv("LANGTAG_EXT_MODULE_PATH");
- gchar **path_list;
- gint i;
- gsize suffix_len = strlen(G_MODULE_SUFFIX) + 1;
+ const char *env = g_getenv("LANGTAG_EXT_MODULE_PATH");
+ char **path_list;
+ int i;
+ size_t suffix_len = strlen(G_MODULE_SUFFIX) + 1;
if (__lt_ext_module_initialized)
return;
@@ -572,7 +572,7 @@ lt_ext_modules_load(void)
dir = opendir(path_list[i]);
if (dir) {
struct dirent dent, *dresult;
- gsize len;
+ size_t len;
while (1) {
if (readdir_r(dir, &dent, &dresult) || dresult == NULL)
@@ -613,7 +613,7 @@ lt_ext_modules_load(void)
void
lt_ext_modules_unload(void)
{
- gint i;
+ int i;
if (!__lt_ext_module_initialized)
return;
View
25 liblangtag/lt-ext-module.h
@@ -18,10 +18,11 @@
#define __LT_EXT_MODULE_H__
#include <glib.h>
+#include <liblangtag/lt-macros.h>
#include <liblangtag/lt-ext-module-data.h>
#include <liblangtag/lt-tag.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* LT_EXT_MODULE_VERSION:
@@ -49,7 +50,7 @@ typedef struct _lt_ext_module_funcs_t lt_ext_module_funcs_t;
* Returns: a version number. this is the same to #LT_EXT_MODULE_VERSION
* when the module was built.
*/
-typedef gint (* lt_ext_module_version_func_t) (void);
+typedef int (* lt_ext_module_version_func_t) (void);
/**
* lt_ext_module_get_funcs_func_t:
*
@@ -68,7 +69,7 @@ typedef const lt_ext_module_funcs_t * (* lt_ext_module_get_funcs_func_t) (void);
*
* Returns: a singleton character.
*/
-typedef gchar (* lt_ext_module_singleton_func_t) (void);
+typedef char (* lt_ext_module_singleton_func_t) (void);
/**
* lt_ext_module_data_new_func_t:
*
@@ -91,9 +92,9 @@ typedef lt_ext_module_data_t * (* lt_ext_module_data_new_func_t) (void);
* Returns: %TRUE if @tag is valid to process parsing subtags for the extension.
* otherwise %FALSE.
*/
-typedef gboolean (* lt_ext_module_precheck_func_t) (lt_ext_module_data_t *data,
- const lt_tag_t *tag,
- GError **error);
+typedef lt_bool_t (* lt_ext_module_precheck_func_t) (lt_ext_module_data_t *data,
+ const lt_tag_t *tag,
+ GError **error);
/**
* lt_ext_module_parse_func_t:
* @data: a #lt_ext_module_data_t.
@@ -104,9 +105,9 @@ typedef gboolean (* lt_ext_module_precheck_func_t) (lt_ext_module
*
* Returns: %TRUE if the @subtag is valid for Extension. otherwise %FALSE.
*/
-typedef gboolean (* lt_ext_module_parse_func_t) (lt_ext_module_data_t *data,
- const gchar *subtag,
- GError **error);
+typedef lt_bool_t (* lt_ext_module_parse_func_t) (lt_ext_module_data_t *data,
+ const char *subtag,
+ GError **error);
/**
* lt_ext_module_get_tag_func_t:
* @data: a #lt_ext_module_data_t.
@@ -115,7 +116,7 @@ typedef gboolean (* lt_ext_module_parse_func_t) (lt_ext_module
*
* Returns: a tag string.
*/
-typedef gchar * (* lt_ext_module_get_tag_func_t) (lt_ext_module_data_t *data);
+typedef char * (* lt_ext_module_get_tag_func_t) (lt_ext_module_data_t *data);
/**
* lt_ext_module_validate_func_t:
* @data: a #lt_ext_module_data_t.
@@ -124,7 +125,7 @@ typedef gchar * (* lt_ext_module_get_tag_func_t) (lt_ext_module
*
* Returns: %TRUE if it's valid, otherwise %FALSE.
*/
-typedef gboolean (* lt_ext_module_validate_func_t) (lt_ext_module_data_t *data);
+typedef lt_bool_t (* lt_ext_module_validate_func_t) (lt_ext_module_data_t *data);
/**
* lt_ext_module_funcs_t:
@@ -175,6 +176,6 @@ int module_get_version(void);
*/
const lt_ext_module_funcs_t *module_get_funcs (void);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXT_MODULE_H__ */
View
19 liblangtag/lt-extension-private.h
@@ -14,25 +14,26 @@
#define __LT_EXTENSION_PRIVATE_H__
#include <glib.h>
+#include "lt-macros.h"
#include "lt-ext-module.h"
#include "lt-extension.h"
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
lt_extension_t *lt_extension_create (void);
lt_extension_t *lt_extension_copy (lt_extension_t *extension);
-gboolean lt_extension_has_singleton (lt_extension_t *extension,
- gchar singleton_c);
-gboolean lt_extension_add_singleton (lt_extension_t *extension,
- gchar singleton_c,
+lt_bool_t lt_extension_has_singleton (lt_extension_t *extension,
+ char singleton_c);
+lt_bool_t lt_extension_add_singleton (lt_extension_t *extension,
+ char singleton_c,
const lt_tag_t *tag,
GError **error);
-gboolean lt_extension_add_tag (lt_extension_t *extension,
- const gchar *subtag,
+lt_bool_t lt_extension_add_tag (lt_extension_t *extension,
+ const char *subtag,
GError **error);
void lt_extension_cancel_tag (lt_extension_t *extension);
-gboolean lt_extension_validate_state(lt_extension_t *extension);
+lt_bool_t lt_extension_validate_state(lt_extension_t *extension);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXTENSION_PRIVATE_H__ */
View
44 liblangtag/lt-extension.c
@@ -32,7 +32,7 @@ struct _lt_extension_t {
lt_mem_t parent;
GString *cached_tag;
lt_ext_module_t *module;
- gint singleton;
+ int singleton;
lt_ext_module_data_t *extensions[LT_MAX_EXT_MODULES + 1];
};
@@ -53,9 +53,9 @@ lt_extension_create(void)
return retval;
}
-gboolean
+lt_bool_t
lt_extension_has_singleton(lt_extension_t *extension,
- gchar singleton_c)
+ char singleton_c)
{
gint singleton;
@@ -68,9 +68,9 @@ lt_extension_has_singleton(lt_extension_t *extension,
return extension->extensions[singleton] != NULL;
}
-gboolean
+lt_bool_t
lt_extension_add_singleton(lt_extension_t *extension,
- gchar singleton_c,
+ char singleton_c,
const lt_tag_t *tag,
GError **error)
{
@@ -128,12 +128,12 @@ lt_extension_add_singleton(lt_extension_t *extension,
return TRUE;
}
-gboolean
+lt_bool_t
lt_extension_add_tag(lt_extension_t *extension,
- const gchar *subtag,
+ const char *subtag,
GError **error)
{
- gboolean retval;
+ lt_bool_t retval;
GError *err = NULL;
g_return_val_if_fail (extension != NULL, FALSE);
@@ -166,7 +166,7 @@ lt_extension_cancel_tag(lt_extension_t *extension)
g_return_if_fail (extension != NULL);
if (extension->module && extension->extensions[extension->singleton]) {
- gchar **tags, singleton[4];
+ char **tags, singleton[4];
GList *l = NULL, *ll;
gint i;
@@ -193,7 +193,7 @@ lt_extension_cancel_tag(lt_extension_t *extension)
break;
}
if (extension->cached_tag->len > 0)
- g_string_append_printf(extension->cached_tag, "-%s", (gchar *)ll->data);
+ g_string_append_printf(extension->cached_tag, "-%s", (char *)ll->data);
else
g_string_append(extension->cached_tag, ll->data);
}
@@ -232,10 +232,10 @@ lt_extension_copy(lt_extension_t *extension)
return retval;
}
-gboolean
+lt_bool_t
lt_extension_validate_state(lt_extension_t *extension)
{
- gboolean retval = TRUE;
+ lt_bool_t retval = TRUE;
g_return_val_if_fail (extension != NULL, FALSE);
@@ -286,7 +286,7 @@ lt_extension_unref(lt_extension_t *extension)
*
* Returns: the tag string.
*/
-const gchar *
+const char *
lt_extension_get_tag(lt_extension_t *extension)
{
g_return_val_if_fail (extension != NULL, NULL);
@@ -302,12 +302,12 @@ lt_extension_get_tag(lt_extension_t *extension)
*
* Returns: a string. this must be freed.
*/
-gchar *
+char *
lt_extension_get_canonicalized_tag(lt_extension_t *extension)
{
GString *string;
gint i;
- gchar c, *s;
+ char c, *s;
lt_ext_module_t *m;
g_return_val_if_fail (extension != NULL, NULL);
@@ -348,8 +348,8 @@ void
lt_extension_dump(lt_extension_t *extension)
{
gint i;
- gchar c;
- gchar *s;
+ char c;
+ char *s;
lt_ext_module_t *m;
g_return_if_fail (extension != NULL);
@@ -387,14 +387,14 @@ lt_extension_dump(lt_extension_t *extension)
*
* Returns: %TRUE if it's the same, otherwise %FALSE.
*/
-gboolean
+lt_bool_t
lt_extension_compare(const lt_extension_t *v1,
const lt_extension_t *v2)
{
gint i;
- gchar *s1 = NULL, *s2 = NULL;
+ char *s1 = NULL, *s2 = NULL;
lt_ext_module_t *m = NULL;
- gboolean retval = TRUE;
+ lt_bool_t retval = TRUE;
if (v1 == v2)
return TRUE;
@@ -443,11 +443,11 @@ lt_extension_compare(const lt_extension_t *v1,
*
* Returns: %TRUE if a subtag of the extension is truncated. otherwise %FALSE.
*/
-gboolean
+lt_bool_t
lt_extension_truncate(lt_extension_t *extension)
{
gint i;
- gboolean retval = FALSE;
+ lt_bool_t retval = FALSE;
g_return_val_if_fail (extension != NULL, FALSE);
View
14 liblangtag/lt-extension.h
@@ -17,9 +17,9 @@
#ifndef __LT_EXTENSION_H__
#define __LT_EXTENSION_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* lt_extension_t:
@@ -32,13 +32,13 @@ typedef struct _lt_extension_t lt_extension_t;
lt_extension_t *lt_extension_ref (lt_extension_t *extension);
void lt_extension_unref (lt_extension_t *extension);
-const gchar *lt_extension_get_tag (lt_extension_t *extension);
-gchar *lt_extension_get_canonicalized_tag(lt_extension_t *extension);
+const char *lt_extension_get_tag (lt_extension_t *extension);
+char *lt_extension_get_canonicalized_tag(lt_extension_t *extension);
void lt_extension_dump (lt_extension_t *extension);
-gboolean lt_extension_compare (const lt_extension_t *v1,
+lt_bool_t lt_extension_compare (const lt_extension_t *v1,
const lt_extension_t *v2);
-gboolean lt_extension_truncate (lt_extension_t *extension);
+lt_bool_t lt_extension_truncate (lt_extension_t *extension);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXTENSION_H__ */
View
16 liblangtag/lt-extlang-private.h
@@ -13,23 +13,23 @@
#ifndef __LT_EXTLANG_PRIVATE_H__
#define __LT_EXTLANG_PRIVATE_H__
-#include <glib.h>
+#include "lt-macros.h"
#include "lt-extlang.h"
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
lt_extlang_t *lt_extlang_create (void);
void lt_extlang_set_tag (lt_extlang_t *extlang,
- const gchar *subtag);
+ const char *subtag);
void lt_extlang_set_preferred_tag (lt_extlang_t *extlang,
- const gchar *subtag);
+ const char *subtag);
void lt_extlang_set_name (lt_extlang_t *extlang,
- const gchar *description);
+ const char *description);
void lt_extlang_set_macro_language(lt_extlang_t *extlang,
- const gchar *macrolanguage);
+ const char *macrolanguage);
void lt_extlang_add_prefix (lt_extlang_t *extlang,
- const gchar *prefix);
+ const char *prefix);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXTLANG_PRIVATE_H__ */
View
41 liblangtag/lt-extlang.c
@@ -14,6 +14,7 @@
#include "config.h"
#endif
+#include "lt-macros.h"
#include "lt-mem.h"
#include "lt-extlang.h"
#include "lt-extlang-private.h"
@@ -28,11 +29,11 @@
*/
struct _lt_extlang_t {
lt_mem_t parent;
- gchar *tag;
- gchar *description;
- gchar *macrolanguage;
- gchar *preferred_tag;
- gchar *prefix;
+ char *tag;
+ char *description;
+ char *macrolanguage;
+ char *preferred_tag;
+ char *prefix;
};
/*< private >*/
@@ -50,7 +51,7 @@ lt_extlang_create(void)
void
lt_extlang_set_tag(lt_extlang_t *extlang,
- const gchar *subtag)
+ const char *subtag)
{
g_return_if_fail (extlang != NULL);
g_return_if_fail (subtag != NULL);
@@ -64,7 +65,7 @@ lt_extlang_set_tag(lt_extlang_t *extlang,
void
lt_extlang_set_preferred_tag(lt_extlang_t *extlang,
- const gchar *subtag)
+ const char *subtag)
{
g_return_if_fail (extlang != NULL);
g_return_if_fail (subtag != NULL);
@@ -78,7 +79,7 @@ lt_extlang_set_preferred_tag(lt_extlang_t *extlang,
void
lt_extlang_set_name(lt_extlang_t *extlang,
- const gchar *description)
+ const char *description)
{
g_return_if_fail (extlang != NULL);
g_return_if_fail (description != NULL);
@@ -92,7 +93,7 @@ lt_extlang_set_name(lt_extlang_t *extlang,
void
lt_extlang_set_macro_language(lt_extlang_t *extlang,
- const gchar *macrolanguage)
+ const char *macrolanguage)
{
g_return_if_fail (extlang != NULL);
g_return_if_fail (macrolanguage != NULL);
@@ -106,7 +107,7 @@ lt_extlang_set_macro_language(lt_extlang_t *extlang,
void
lt_extlang_add_prefix(lt_extlang_t *extlang,
- const gchar *prefix)
+ const char *prefix)
{
g_return_if_fail (extlang != NULL);
g_return_if_fail (prefix != NULL);
@@ -157,7 +158,7 @@ lt_extlang_unref(lt_extlang_t *extlang)
*
* Returns: a subtag name.
*/
-const gchar *
+const char *
lt_extlang_get_tag(const lt_extlang_t *extlang)
{
g_return_val_if_fail (extlang != NULL, NULL);
@@ -174,7 +175,7 @@ lt_extlang_get_tag(const lt_extlang_t *extlang)
*
* Returns: a preferred-value for the subtag or %NULL.
*/
-const gchar *
+const char *
lt_extlang_get_preferred_tag(const lt_extlang_t *extlang)
{
g_return_val_if_fail (extlang != NULL, NULL);
@@ -190,7 +191,7 @@ lt_extlang_get_preferred_tag(const lt_extlang_t *extlang)
*
* Returns: a description string.
*/
-const gchar *
+const char *
lt_extlang_get_name(const lt_extlang_t *extlang)
{
g_return_val_if_fail (extlang != NULL, NULL);
@@ -208,7 +209,7 @@ lt_extlang_get_name(const lt_extlang_t *extlang)
*
* Returns: a macrolanguage string or %NULL.
*/
-const gchar *
+const char *
lt_extlang_get_macro_language(const lt_extlang_t *extlang)
{
g_return_val_if_fail (extlang != NULL, NULL);
@@ -226,7 +227,7 @@ lt_extlang_get_macro_language(const lt_extlang_t *extlang)
*
* Returns: a prefix string or %NULL.
*/
-const gchar *
+const char *
lt_extlang_get_prefix(const lt_extlang_t *extlang)
{
g_return_val_if_fail (extlang != NULL, NULL);
@@ -243,9 +244,9 @@ lt_extlang_get_prefix(const lt_extlang_t *extlang)
void
lt_extlang_dump(const lt_extlang_t *extlang)
{
- const gchar *macrolang = lt_extlang_get_macro_language(extlang);
- const gchar *preferred = lt_extlang_get_preferred_tag(extlang);
- const gchar *prefix = lt_extlang_get_prefix(extlang);
+ const char *macrolang = lt_extlang_get_macro_language(extlang);
+ const char *preferred = lt_extlang_get_preferred_tag(extlang);
+ const char *prefix = lt_extlang_get_prefix(extlang);
GString *string = g_string_new(NULL);
if (macrolang) {
@@ -288,11 +289,11 @@ lt_extlang_dump(const lt_extlang_t *extlang)
*
* Returns: %TRUE if it's the same, otherwise %FALSE.
*/
-gboolean
+lt_bool_t
lt_extlang_compare(const lt_extlang_t *v1,
const lt_extlang_t *v2)
{
- const gchar *s1, *s2;
+ const char *s1, *s2;
if (v1 == v2)
return TRUE;
View
18 liblangtag/lt-extlang.h
@@ -17,9 +17,9 @@
#ifndef __LT_EXTLANG_H__
#define __LT_EXTLANG_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* lt_extlang_t:
@@ -32,15 +32,15 @@ typedef struct _lt_extlang_t lt_extlang_t;
lt_extlang_t *lt_extlang_ref (lt_extlang_t *extlang);
void lt_extlang_unref (lt_extlang_t *extlang);
-const gchar *lt_extlang_get_tag (const lt_extlang_t *extlang);
-const gchar *lt_extlang_get_preferred_tag (const lt_extlang_t *extlang);
-const gchar *lt_extlang_get_name (const lt_extlang_t *extlang);
-const gchar *lt_extlang_get_macro_language(const lt_extlang_t *extlang);
-const gchar *lt_extlang_get_prefix (const lt_extlang_t *extlang);
+const char *lt_extlang_get_tag (const lt_extlang_t *extlang);
+const char *lt_extlang_get_preferred_tag (const lt_extlang_t *extlang);
+const char *lt_extlang_get_name (const lt_extlang_t *extlang);
+const char *lt_extlang_get_macro_language(const lt_extlang_t *extlang);
+const char *lt_extlang_get_prefix (const lt_extlang_t *extlang);
void lt_extlang_dump (const lt_extlang_t *extlang);
-gboolean lt_extlang_compare (const lt_extlang_t *v1,
+lt_bool_t lt_extlang_compare (const lt_extlang_t *v1,
const lt_extlang_t *v2);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_EXTLANG_H__ */
View
12 liblangtag/lt-grandfathered-private.h
@@ -13,19 +13,19 @@
#ifndef __LT_GRANDFATHERED_PRIVATE_H__
#define __LT_GRANDFATHERED_PRIVATE_H__
-#include <glib.h>
+#include "lt-macros.h"
#include "lt-grandfathered.h"
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
lt_grandfathered_t *lt_grandfathered_create (void);
void lt_grandfathered_set_tag (lt_grandfathered_t *grandfathered,
- const gchar *subtag);
+ const char *subtag);
void lt_grandfathered_set_name (lt_grandfathered_t *grandfathered,
- const gchar *description);
+ const char *description);
void lt_grandfathered_set_preferred_tag(lt_grandfathered_t *grandfathered,
- const gchar *subtag);
+ const char *subtag);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_GRANDFATHERED_PRIVATE_H__ */
View
26 liblangtag/lt-grandfathered.c
@@ -28,9 +28,9 @@
*/
struct _lt_grandfathered_t {
lt_mem_t parent;
- gchar *tag;
- gchar *description;
- gchar *preferred_tag;
+ char *tag;
+ char *description;
+ char *preferred_tag;
};
/*< private >*/
@@ -48,7 +48,7 @@ lt_grandfathered_create(void)
void
lt_grandfathered_set_tag(lt_grandfathered_t *grandfathered,
- const gchar *tag)
+ const char *tag)
{
g_return_if_fail (grandfathered != NULL);
g_return_if_fail (tag != NULL);
@@ -62,7 +62,7 @@ lt_grandfathered_set_tag(lt_grandfathered_t *grandfathered,
void
lt_grandfathered_set_name(lt_grandfathered_t *grandfathered,
- const gchar *description)
+ const char *description)
{
g_return_if_fail (grandfathered != NULL);
g_return_if_fail (description != NULL);
@@ -76,7 +76,7 @@ lt_grandfathered_set_name(lt_grandfathered_t *grandfathered,
void
lt_grandfathered_set_preferred_tag(lt_grandfathered_t *grandfathered,
- const gchar *subtag)
+ const char *subtag)
{
g_return_if_fail (grandfathered != NULL);
g_return_if_fail (subtag != NULL);
@@ -128,10 +128,10 @@ lt_grandfathered_unref(lt_grandfathered_t *grandfathered)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_grandfathered_get_better_tag(const lt_grandfathered_t *grandfathered)
{
- const gchar *retval = lt_grandfathered_get_preferred_tag(grandfathered);
+ const char *retval = lt_grandfathered_get_preferred_tag(grandfathered);
if (!retval)
retval = lt_grandfathered_get_tag(grandfathered);
@@ -147,7 +147,7 @@ lt_grandfathered_get_better_tag(const lt_grandfathered_t *grandfathered)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_grandfathered_get_tag(const lt_grandfathered_t *grandfathered)
{
g_return_val_if_fail (grandfathered != NULL, NULL);
@@ -163,7 +163,7 @@ lt_grandfathered_get_tag(const lt_grandfathered_t *grandfathered)
*
* Returns: a description string.
*/
-const gchar *
+const char *
lt_grandfathered_get_name(const lt_grandfathered_t *grandfathered)
{
g_return_val_if_fail (grandfathered != NULL, NULL);
@@ -180,7 +180,7 @@ lt_grandfathered_get_name(const lt_grandfathered_t *grandfathered)
*
* Returns: a preferred-value for the tag or %NULL.
*/
-const gchar *
+const char *
lt_grandfathered_get_preferred_tag(const lt_grandfathered_t *grandfathered)
{
g_return_val_if_fail (grandfathered != NULL, NULL);
@@ -197,7 +197,7 @@ lt_grandfathered_get_preferred_tag(const lt_grandfathered_t *grandfathered)
void
lt_grandfathered_dump(const lt_grandfathered_t *grandfathered)
{
- const gchar *preferred = lt_grandfathered_get_preferred_tag(grandfathered);
+ const char *preferred = lt_grandfathered_get_preferred_tag(grandfathered);
GString *string = g_string_new(NULL);
if (preferred) {
@@ -225,7 +225,7 @@ lt_grandfathered_dump(const lt_grandfathered_t *grandfathered)
*
* Returns: %TRUE if it's the same. otherwise %FALSE.
*/
-gboolean
+lt_bool_t
lt_grandfathered_compare(const lt_grandfathered_t *v1,
const lt_grandfathered_t *v2)
{
View
16 liblangtag/lt-grandfathered.h
@@ -17,9 +17,9 @@
#ifndef __LT_GRANDFATHERED_H__
#define __LT_GRANDFATHERED_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* lt_grandfathered_t:
@@ -32,14 +32,14 @@ typedef struct _lt_grandfathered_t lt_grandfathered_t;
lt_grandfathered_t *lt_grandfathered_ref (lt_grandfathered_t *grandfathered);
void lt_grandfathered_unref (lt_grandfathered_t *grandfathered);
-const gchar *lt_grandfathered_get_better_tag (const lt_grandfathered_t *grandfathered);
-const gchar *lt_grandfathered_get_tag (const lt_grandfathered_t *grandfathered);
-const gchar *lt_grandfathered_get_preferred_tag(const lt_grandfathered_t *grandfathered);
-const gchar *lt_grandfathered_get_name (const lt_grandfathered_t *grandfathered);
+const char *lt_grandfathered_get_better_tag (const lt_grandfathered_t *grandfathered);
+const char *lt_grandfathered_get_tag (const lt_grandfathered_t *grandfathered);
+const char *lt_grandfathered_get_preferred_tag(const lt_grandfathered_t *grandfathered);
+const char *lt_grandfathered_get_name (const lt_grandfathered_t *grandfathered);
void lt_grandfathered_dump (const lt_grandfathered_t *grandfathered);
-gboolean lt_grandfathered_compare (const lt_grandfathered_t *v1,
+lt_bool_t lt_grandfathered_compare (const lt_grandfathered_t *v1,
const lt_grandfathered_t *v2);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_GRANDFATHERED_H__ */
View
30 liblangtag/lt-lang-private.h
@@ -13,25 +13,25 @@
#ifndef __LT_LANG_PRIVATE_H__
#define __LT_LANG_PRIVATE_H__
-#include <glib.h>
+#include "lt-macros.h"
#include "lt-lang.h"
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
lt_lang_t *lt_lang_create (void);
-void lt_lang_set_name (lt_lang_t *lang,
- const gchar *description);
-void lt_lang_set_tag (lt_lang_t *lang,
- const gchar *subtag);
-void lt_lang_set_preferred_tag (lt_lang_t *lang,
- const gchar *subtag);
-void lt_lang_set_suppress_script(lt_lang_t *lang,
- const gchar *script);
-void lt_lang_set_macro_language (lt_lang_t *lang,
- const gchar *macrolanguage);
-void lt_lang_set_scope (lt_lang_t *lang,
- const gchar *scope);
+void lt_lang_set_name (lt_lang_t *lang,
+ const char *description);
+void lt_lang_set_tag (lt_lang_t *lang,
+ const char *subtag);
+void lt_lang_set_preferred_tag (lt_lang_t *lang,
+ const char *subtag);
+void lt_lang_set_suppress_script(lt_lang_t *lang,
+ const char *script);
+void lt_lang_set_macro_language (lt_lang_t *lang,
+ const char *macrolanguage);
+void lt_lang_set_scope (lt_lang_t *lang,
+ const char *scope);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_LANG_PRIVATE_H__ */
View
64 liblangtag/lt-lang.c
@@ -28,12 +28,12 @@
*/
struct _lt_lang_t {
lt_mem_t parent;
- gchar *tag;
- gchar *description;
- gchar *suppress_script;
- gchar *scope;
- gchar *macrolanguage;
- gchar *preferred_tag;
+ char *tag;
+ char *description;
+ char *suppress_script;
+ char *scope;
+ char *macrolanguage;
+ char *preferred_tag;
};
/*< private >*/
@@ -48,8 +48,8 @@ lt_lang_create(void)
}
void
-lt_lang_set_name(lt_lang_t *lang,
- const gchar *description)
+lt_lang_set_name(lt_lang_t *lang,
+ const char *description)
{
g_return_if_fail (lang != NULL);
g_return_if_fail (description != NULL);
@@ -62,8 +62,8 @@ lt_lang_set_name(lt_lang_t *lang,
}
void
-lt_lang_set_tag(lt_lang_t *lang,
- const gchar *subtag)
+lt_lang_set_tag(lt_lang_t *lang,
+ const char *subtag)
{
g_return_if_fail (lang != NULL);
g_return_if_fail (subtag != NULL);
@@ -76,8 +76,8 @@ lt_lang_set_tag(lt_lang_t *lang,
}
void
-lt_lang_set_preferred_tag(lt_lang_t *lang,
- const gchar *subtag)
+lt_lang_set_preferred_tag(lt_lang_t *lang,
+ const char *subtag)
{
g_return_if_fail (lang != NULL);
g_return_if_fail (subtag != NULL);
@@ -90,8 +90,8 @@ lt_lang_set_preferred_tag(lt_lang_t *lang,
}
void
-lt_lang_set_suppress_script(lt_lang_t *lang,
- const gchar *script)
+lt_lang_set_suppress_script(lt_lang_t *lang,
+ const char *script)
{
g_return_if_fail (lang != NULL);
g_return_if_fail (script != NULL);
@@ -104,8 +104,8 @@ lt_lang_set_suppress_script(lt_lang_t *lang,
}
void
-lt_lang_set_macro_language(lt_lang_t *lang,
- const gchar *macrolanguage)
+lt_lang_set_macro_language(lt_lang_t *lang,
+ const char *macrolanguage)
{
g_return_if_fail (lang != NULL);
g_return_if_fail (macrolanguage != NULL);
@@ -118,8 +118,8 @@ lt_lang_set_macro_language(lt_lang_t *lang,
}
void
-lt_lang_set_scope(lt_lang_t *lang,
- const gchar *scope)
+lt_lang_set_scope(lt_lang_t *lang,
+ const char *scope)
{
g_return_if_fail (lang != NULL);
g_return_if_fail (scope != NULL);
@@ -170,7 +170,7 @@ lt_lang_unref(lt_lang_t *lang)
*
* Returns: a description string.
*/
-const gchar *
+const char *
lt_lang_get_name(const lt_lang_t *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
@@ -187,10 +187,10 @@ lt_lang_get_name(const lt_lang_t *lang)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_lang_get_better_tag(const lt_lang_t *lang)
{
- const gchar *retval = lt_lang_get_preferred_tag(lang);
+ const char *retval = lt_lang_get_preferred_tag(lang);
if (!retval)
retval = lt_lang_get_tag(lang);
@@ -206,7 +206,7 @@ lt_lang_get_better_tag(const lt_lang_t *lang)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_lang_get_tag(const lt_lang_t *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
@@ -223,7 +223,7 @@ lt_lang_get_tag(const lt_lang_t *lang)
*
* Returns: a preferred-value for the tag or %NULL.
*/
-const gchar *
+const char *
lt_lang_get_preferred_tag(const lt_lang_t *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
@@ -240,7 +240,7 @@ lt_lang_get_preferred_tag(const lt_lang_t *lang)
*
* Returns: a suppress-script string or %NULL.
*/
-const gchar *
+const char *
lt_lang_get_suppress_script(const lt_lang_t *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
@@ -258,7 +258,7 @@ lt_lang_get_suppress_script(const lt_lang_t *lang)
*
* Returns: a macrolanguage string or %NULL.
*/
-const gchar *
+const char *
lt_lang_get_macro_language(const lt_lang_t *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
@@ -275,7 +275,7 @@ lt_lang_get_macro_language(const lt_lang_t *lang)
*
* Returns: a scope string or %NULL.
*/
-const gchar *
+const char *
lt_lang_get_scope(const lt_lang_t *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
@@ -292,10 +292,10 @@ lt_lang_get_scope(const lt_lang_t *lang)
void
lt_lang_dump(const lt_lang_t *lang)
{
- const gchar *preferred = lt_lang_get_preferred_tag(lang);
- const gchar *suppress = lt_lang_get_suppress_script(lang);
- const gchar *scope = lt_lang_get_scope(lang);
- const gchar *macrolang = lt_lang_get_macro_language(lang);
+ const char *preferred = lt_lang_get_preferred_tag(lang);
+ const char *suppress = lt_lang_get_suppress_script(lang);
+ const char *scope = lt_lang_get_scope(lang);
+ const char *macrolang = lt_lang_get_macro_language(lang);
GString *string = g_string_new(NULL);
if (preferred) {
@@ -347,11 +347,11 @@ lt_lang_dump(const lt_lang_t *lang)
*
* Returns: %TRUE if it's the same, otherwise %FALSE.
*/
-gboolean
+lt_bool_t
lt_lang_compare(const lt_lang_t *v1,
const lt_lang_t *v2)
{
- const gchar *s1, *s2;
+ const char *s1, *s2;
if (v1 == v2)
return TRUE;
View
32 liblangtag/lt-lang.h
@@ -17,9 +17,9 @@
#ifndef __LT_LANG_H__
#define __LT_LANG_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* lt_lang_t:
@@ -30,19 +30,19 @@ G_BEGIN_DECLS
typedef struct _lt_lang_t lt_lang_t;
-lt_lang_t *lt_lang_ref (lt_lang_t *lang);
-void lt_lang_unref (lt_lang_t *lang);
-const gchar *lt_lang_get_name (const lt_lang_t *lang);
-const gchar *lt_lang_get_better_tag (const lt_lang_t *lang);
-const gchar *lt_lang_get_tag (const lt_lang_t *lang);
-const gchar *lt_lang_get_preferred_tag (const lt_lang_t *lang);
-const gchar *lt_lang_get_suppress_script(const lt_lang_t *lang);
-const gchar *lt_lang_get_macro_language (const lt_lang_t *lang);
-const gchar *lt_lang_get_scope (const lt_lang_t *lang);
-void lt_lang_dump (const lt_lang_t *lang);
-gboolean lt_lang_compare (const lt_lang_t *v1,
- const lt_lang_t *v2);
-
-G_END_DECLS
+lt_lang_t *lt_lang_ref (lt_lang_t *lang);
+void lt_lang_unref (lt_lang_t *lang);
+const char *lt_lang_get_name (const lt_lang_t *lang);
+const char *lt_lang_get_better_tag (const lt_lang_t *lang);
+const char *lt_lang_get_tag (const lt_lang_t *lang);
+const char *lt_lang_get_preferred_tag (const lt_lang_t *lang);
+const char *lt_lang_get_suppress_script(const lt_lang_t *lang);
+const char *lt_lang_get_macro_language (const lt_lang_t *lang);
+const char *lt_lang_get_scope (const lt_lang_t *lang);
+void lt_lang_dump (const lt_lang_t *lang);
+lt_bool_t lt_lang_compare (const lt_lang_t *v1,
+ const lt_lang_t *v2);
+
+LT_END_DECLS
#endif /* __LT_LANG_H__ */
View
35 liblangtag/lt-macros.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * lt-macros.h
+ * Copyright (C) 2011-2012 Akira TAGOH
+ *
+ * Authors:
+ * Akira TAGOH <akira@tagoh.org>
+ *
+ * You may distribute under the terms of either the GNU
+ * Lesser General Public License or the Mozilla Public
+ * License, as specified in the README file.
+ */
+#if !defined (__LANGTAG_H__INSIDE) && !defined (__LANGTAG_COMPILATION)
+#error "Only <liblangtag/langtag.h> can be included directly."
+#endif
+
+#ifndef __LT_MACROS_H__
+#define __LT_MACROS_H__
+
+#ifdef __cplusplus
+#define LT_BEGIN_DECLS extern "C" {
+#define LT_END_DECLS }
+#else
+#define LT_BEGIN_DECLS
+#define LT_END_DECLS
+#endif
+
+LT_BEGIN_DECLS
+
+typedef void * lt_pointer_t;
+typedef int lt_bool_t;
+
+LT_END_DECLS
+
+#endif /* __LT_MACROS_H__ */
View
28 liblangtag/lt-mem.c
@@ -28,8 +28,8 @@ lt_mem_gstring_free(GString *string)
}
/*< public >*/
-gpointer
-lt_mem_alloc_object(gsize size)
+lt_pointer_t
+lt_mem_alloc_object(size_t size)
{
lt_mem_t *retval;
@@ -45,7 +45,7 @@ lt_mem_alloc_object(gsize size)
return retval;
}
-gpointer
+lt_pointer_t
lt_mem_ref(lt_mem_t *object)
{
g_return_val_if_fail (object != NULL, NULL);
@@ -65,7 +65,7 @@ lt_mem_unref(lt_mem_t *object)
if (g_atomic_int_dec_and_test(&object->ref_count)) {
if (object->refs) {
GHashTableIter iter;
- gpointer p, unref;
+ lt_pointer_t p, unref;
g_hash_table_iter_init(&iter, object->refs);
while (g_hash_table_iter_next(&iter, &p, &unref)) {
@@ -76,7 +76,7 @@ lt_mem_unref(lt_mem_t *object)
g_hash_table_destroy(object->refs);
}
for (l = object->weak_pointers; l != NULL; l = g_list_next(l)) {
- gpointer *p = (gpointer *)l->data;
+ lt_pointer_t *p = (lt_pointer_t *)l->data;
*p = NULL;
}
if (object->weak_pointers)
@@ -87,7 +87,7 @@ lt_mem_unref(lt_mem_t *object)
void
lt_mem_add_ref(lt_mem_t *object,
- gpointer p,
+ lt_pointer_t p,
lt_destroy_func_t func)
{
g_return_if_fail (object != NULL);
@@ -103,8 +103,8 @@ lt_mem_add_ref(lt_mem_t *object,
}
void
-lt_mem_remove_ref(lt_mem_t *object,
- gpointer p)
+lt_mem_remove_ref(lt_mem_t *object,
+ lt_pointer_t p)
{
g_return_if_fail (object != NULL);
g_return_if_fail (p != NULL);
@@ -120,8 +120,8 @@ lt_mem_remove_ref(lt_mem_t *object,
}
void
-lt_mem_delete_ref(lt_mem_t *object,
- gpointer p)
+lt_mem_delete_ref(lt_mem_t *object,
+ lt_pointer_t p)
{
g_return_if_fail (object != NULL);
g_return_if_fail (p != NULL);
@@ -132,8 +132,8 @@ lt_mem_delete_ref(lt_mem_t *object,
}
void
-lt_mem_add_weak_pointer(lt_mem_t *object,
- gpointer *p)
+lt_mem_add_weak_pointer(lt_mem_t *object,
+ lt_pointer_t *p)
{
g_return_if_fail (object != NULL);
g_return_if_fail (p != NULL);
@@ -143,8 +143,8 @@ lt_mem_add_weak_pointer(lt_mem_t *object,
}
void
-lt_mem_remove_weak_pointer(lt_mem_t *object,
- gpointer *p)
+lt_mem_remove_weak_pointer(lt_mem_t *object,
+ lt_pointer_t *p)
{
g_return_if_fail (object != NULL);
g_return_if_fail (p != NULL);
View
43 liblangtag/lt-mem.h
@@ -13,39 +13,40 @@
#ifndef __LT_MEM_H__
#define __LT_MEM_H__
+#include <liblangtag/lt-macros.h>
#include <glib.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
typedef struct _lt_mem_t lt_mem_t;
-typedef void (* lt_destroy_func_t) (gpointer data);
+typedef void (* lt_destroy_func_t) (lt_pointer_t data);
struct _lt_mem_t {
- volatile guint ref_count;
- gsize size;
- GHashTable *refs;
- GList *weak_pointers;
+ volatile unsigned int ref_count;
+ size_t size;
+ GHashTable *refs;
+ GList *weak_pointers;
};
-gpointer lt_mem_alloc_object (gsize size);
-gpointer lt_mem_ref (lt_mem_t *object);
-void lt_mem_unref (lt_mem_t *object);
-void lt_mem_add_ref (lt_mem_t *object,
- gpointer p,
- lt_destroy_func_t func);
-void lt_mem_remove_ref (lt_mem_t *object,
- gpointer p);
-void lt_mem_delete_ref (lt_mem_t *object,
- gpointer p);
-void lt_mem_add_weak_pointer (lt_mem_t *object,
- gpointer *p);
-void lt_mem_remove_weak_pointer(lt_mem_t *object,
- gpointer *p);
+lt_pointer_t lt_mem_alloc_object (size_t size);
+lt_pointer_t lt_mem_ref (lt_mem_t *object);
+void lt_mem_unref (lt_mem_t *object);
+void lt_mem_add_ref (lt_mem_t *object,
+ lt_pointer_t p,
+ lt_destroy_func_t func);
+void lt_mem_remove_ref (lt_mem_t *object,
+ lt_pointer_t p);
+void lt_mem_delete_ref (lt_mem_t *object,
+ lt_pointer_t p);
+void lt_mem_add_weak_pointer (lt_mem_t *object,
+ lt_pointer_t *p);
+void lt_mem_remove_weak_pointer(lt_mem_t *object,
+ lt_pointer_t *p);
/* utility functions */
void lt_mem_gstring_free(GString *string);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_MEM_H__ */
View
12 liblangtag/lt-redundant-private.h
@@ -13,19 +13,19 @@
#ifndef __LT_REDUNDANT_PRIVATE_H__
#define __LT_REDUNDANT_PRIVATE_H__
-#include <glib.h>
+#include "lt-macros.h"
#include "lt-redundant.h"
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
lt_redundant_t *lt_redundant_create (void);
void lt_redundant_set_tag (lt_redundant_t *redundant,
- const gchar *subtag);
+ const char *subtag);
void lt_redundant_set_name (lt_redundant_t *redundant,
- const gchar *description);
+ const char *description);
void lt_redundant_set_preferred_tag(lt_redundant_t *redundant,
- const gchar *subtag);
+ const char *subtag);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_REDUNDANT_PRIVATE_H__ */
View
26 liblangtag/lt-redundant.c
@@ -28,9 +28,9 @@
*/
struct _lt_redundant_t {
lt_mem_t parent;
- gchar *tag;
- gchar *description;
- gchar *preferred_tag;
+ char *tag;
+ char *description;
+ char *preferred_tag;
};
/*< private >*/
@@ -48,7 +48,7 @@ lt_redundant_create(void)
void
lt_redundant_set_tag(lt_redundant_t *redundant,
- const gchar *tag)
+ const char *tag)
{
g_return_if_fail (redundant != NULL);
g_return_if_fail (tag != NULL);
@@ -62,7 +62,7 @@ lt_redundant_set_tag(lt_redundant_t *redundant,
void
lt_redundant_set_name(lt_redundant_t *redundant,
- const gchar *description)
+ const char *description)
{
g_return_if_fail (redundant != NULL);
g_return_if_fail (description != NULL);
@@ -76,7 +76,7 @@ lt_redundant_set_name(lt_redundant_t *redundant,
void
lt_redundant_set_preferred_tag(lt_redundant_t *redundant,
- const gchar *subtag)
+ const char *subtag)
{
g_return_if_fail (redundant != NULL);
g_return_if_fail (subtag != NULL);
@@ -128,10 +128,10 @@ lt_redundant_unref(lt_redundant_t *redundant)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_redundant_get_better_tag(const lt_redundant_t *redundant)
{
- const gchar *retval = lt_redundant_get_preferred_tag(redundant);
+ const char *retval = lt_redundant_get_preferred_tag(redundant);
if (!retval)
retval = lt_redundant_get_tag(redundant);
@@ -147,7 +147,7 @@ lt_redundant_get_better_tag(const lt_redundant_t *redundant)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_redundant_get_tag(const lt_redundant_t *redundant)
{
g_return_val_if_fail (redundant != NULL, NULL);
@@ -163,7 +163,7 @@ lt_redundant_get_tag(const lt_redundant_t *redundant)
*
* Returns: a description string.
*/
-const gchar *
+const char *
lt_redundant_get_name(const lt_redundant_t *redundant)
{
g_return_val_if_fail (redundant != NULL, NULL);
@@ -180,7 +180,7 @@ lt_redundant_get_name(const lt_redundant_t *redundant)
*
* Returns: a preferred-value for the tag or %NULL.
*/
-const gchar *
+const char *
lt_redundant_get_preferred_tag(const lt_redundant_t *redundant)
{
g_return_val_if_fail (redundant != NULL, NULL);
@@ -197,7 +197,7 @@ lt_redundant_get_preferred_tag(const lt_redundant_t *redundant)
void
lt_redundant_dump(const lt_redundant_t *redundant)
{
- const gchar *preferred = lt_redundant_get_preferred_tag(redundant);
+ const char *preferred = lt_redundant_get_preferred_tag(redundant);
GString *string = g_string_new(NULL);
if (preferred) {
@@ -225,7 +225,7 @@ lt_redundant_dump(const lt_redundant_t *redundant)
*
* Returns: %TRUE if it's the same. otherwise %FALSE.
*/
-gboolean
+lt_bool_t
lt_redundant_compare(const lt_redundant_t *v1,
const lt_redundant_t *v2)
{
View
16 liblangtag/lt-redundant.h
@@ -17,9 +17,9 @@
#ifndef __LT_REDUNDANT_H__
#define __LT_REDUNDANT_H__
-#include <glib.h>
+#include <liblangtag/lt-macros.h>
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
/**
* lt_redundant_t:
@@ -32,14 +32,14 @@ typedef struct _lt_redundant_t lt_redundant_t;
lt_redundant_t *lt_redundant_ref (lt_redundant_t *redundant);
void lt_redundant_unref (lt_redundant_t *redundant);
-const gchar *lt_redundant_get_better_tag (const lt_redundant_t *redundant);
-const gchar *lt_redundant_get_tag (const lt_redundant_t *redundant);
-const gchar *lt_redundant_get_preferred_tag(const lt_redundant_t *redundant);
-const gchar *lt_redundant_get_name (const lt_redundant_t *redundant);
+const char *lt_redundant_get_better_tag (const lt_redundant_t *redundant);
+const char *lt_redundant_get_tag (const lt_redundant_t *redundant);
+const char *lt_redundant_get_preferred_tag(const lt_redundant_t *redundant);
+const char *lt_redundant_get_name (const lt_redundant_t *redundant);
void lt_redundant_dump (const lt_redundant_t *redundant);
-gboolean lt_redundant_compare (const lt_redundant_t *v1,
+lt_bool_t lt_redundant_compare (const lt_redundant_t *v1,
const lt_redundant_t *v2);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_REDUNDANT_H__ */
View
12 liblangtag/lt-region-private.h
@@ -13,19 +13,19 @@
#ifndef __LT_REGION_PRIVATE_H__
#define __LT_REGION_PRIVATE_H__
-#include <glib.h>
+#include "lt-macros.h"
#include "lt-region.h"
-G_BEGIN_DECLS
+LT_BEGIN_DECLS
lt_region_t *lt_region_create (void);
void lt_region_set_name (lt_region_t *region,
- const gchar *description);
+ const char *description);
void lt_region_set_tag (lt_region_t *region,
- const gchar *subtag);
+ const char *subtag);
void lt_region_set_preferred_tag(lt_region_t *region,
- const gchar *subtag);
+ const char *subtag);
-G_END_DECLS
+LT_END_DECLS
#endif /* __LT_REGION_PRIVATE_H__ */
View
28 liblangtag/lt-region.c
@@ -28,9 +28,9 @@
*/
struct _lt_region_t {
lt_mem_t parent;
- gchar *tag;
- gchar *description;
- gchar *preferred_tag;
+ char *tag;
+ char *description;
+ char *preferred_tag;
};
@@ -47,7 +47,7 @@ lt_region_create(void)
void
lt_region_set_name(lt_region_t *region,
- const gchar *description)
+ const char *description)
{
g_return_if_fail (region != NULL);
g_return_if_fail (description != NULL);
@@ -61,7 +61,7 @@ lt_region_set_name(lt_region_t *region,
void
lt_region_set_tag(lt_region_t *region,
- const gchar *subtag)
+ const char *subtag)
{
g_return_if_fail (region != NULL);
g_return_if_fail (subtag != NULL);
@@ -75,7 +75,7 @@ lt_region_set_tag(lt_region_t *region,
void
lt_region_set_preferred_tag(lt_region_t *region,
- const gchar *subtag)
+ const char *subtag)
{
g_return_if_fail (region != NULL);
g_return_if_fail (subtag != NULL);
@@ -126,7 +126,7 @@ lt_region_unref(lt_region_t *region)
*
* Returns: a description string.
*/
-const gchar *
+const char *
lt_region_get_name(const lt_region_t *region)
{
g_return_val_if_fail (region != NULL, NULL);
@@ -143,10 +143,10 @@ lt_region_get_name(const lt_region_t *region)
*
* Returns: a tag string.
*/
-const gchar *
+const char *
lt_region_get_better_tag(const lt_region_t *region)
{
- const gchar *retval = lt_region_get_preferred_tag(region);
+ const char *retval = lt_region_get_preferred_tag(region);
if (!retval)
retval = lt_region_get_tag(region);
@@ -162,7 +162,7 @@ lt_region_get_better_tag(const lt_region_t *region)