#define XML_NS "http://www.w3.org/XML/1998/namespace"
#define GT_NS "https://www.gnu.org/s/gettext/ns/its/extensions/1.0"
+
+/* =================== Common API for xgettext and msgfmt =================== */
+
+/* --------------------------------- Values --------------------------------- */
+
struct its_value_ty
{
char *name;
free (pool->items);
}
-struct its_rule_list_ty
-{
- struct its_rule_ty **items;
- size_t nitems;
- size_t nitems_max;
- struct its_pool_ty pool;
-};
+/* ----------------------------- Lists of nodes ----------------------------- */
struct its_node_list_ty
{
nodes->items[nodes->nitems++] = node;
}
+
+/* ---------------------------- Rule base class ---------------------------- */
+
+struct its_rule_ty;
+
/* Base class representing an ITS rule in global definition. */
struct its_rule_class_ty
{
ITS_RULE_TY
};
-static hash_table classes;
-
static void
its_rule_destructor (struct its_rule_ty *rule)
{
node->name, attribute);
}
+
+/* ---------------------------- <translateRule> ---------------------------- */
+
/* Implementation of Translate data category. */
static void
its_translate_rule_constructor (struct its_rule_ty *rule, xmlNode *node)
its_translate_rule_eval,
};
+
+/* ----------------------------- <locNoteRule> ----------------------------- */
+
/* Implementation of Localization Note data category. */
static void
its_localization_note_rule_constructor (struct its_rule_ty *rule, xmlNode *node)
its_localization_note_rule_eval,
};
+
+/* ---------------------------- <withinTextRule> ---------------------------- */
+
/* Implementation of Element Within Text data category. */
static void
its_element_within_text_rule_constructor (struct its_rule_ty *rule,
its_element_within_text_rule_eval,
};
+
+/* -------------------------- <preserveSpaceRule> -------------------------- */
+
/* Implementation of Preserve Space data category. */
static void
its_preserve_space_rule_constructor (struct its_rule_ty *rule,
its_preserve_space_rule_eval,
};
+
+/* ----------------------------- <contextRule> ----------------------------- */
+
/* Implementation of Context data category. */
static void
its_extension_context_rule_constructor (struct its_rule_ty *rule, xmlNode *node)
its_extension_context_rule_eval,
};
+
+/* ------------------------------ <escapeRule> ------------------------------ */
+
/* Implementation of Escape Special Characters data category. */
static void
its_extension_escape_rule_constructor (struct its_rule_ty *rule, xmlNode *node)
its_extension_escape_rule_eval,
};
+
+/* ---------------------------- Rules in general ---------------------------- */
+
+static hash_table classes;
+
static struct its_rule_ty *
its_rule_alloc (struct its_rule_class_ty *method_table, xmlNode *node)
{
#undef ADD_RULE_CLASS
}
+
+/* --------------------------- Loading the rules --------------------------- */
+
+struct its_rule_list_ty
+{
+ struct its_rule_ty **items;
+ size_t nitems;
+ size_t nitems_max;
+
+ struct its_pool_ty pool;
+};
+
struct its_rule_list_ty *
its_rule_list_alloc (void)
{
return result;
}
+
+/* ========================= API only for xgettext ========================= */
+
static void
_its_comment_append (string_list_ty *comments, const char *data)
{
xmlFreeDoc (doc);
}
+
+/* ========================== API only for msgfmt ========================== */
+
struct its_merge_context_ty
{
its_rule_list_ty *rules;
extern "C" {
#endif
-enum its_whitespace_type_ty
-{
- ITS_WHITESPACE_PRESERVE,
- ITS_WHITESPACE_NORMALIZE,
- ITS_WHITESPACE_NORMALIZE_PARAGRAPH,
- ITS_WHITESPACE_TRIM
-};
-typedef struct its_rule_list_ty its_rule_list_ty;
+/* =================== Common API for xgettext and msgfmt =================== */
-typedef message_ty *
- (*its_extract_callback_ty) (message_list_ty *mlp,
- const char *msgctxt,
- const char *msgid,
- lex_pos_ty *pos,
- const char *extracted_comment,
- const char *marker,
- enum its_whitespace_type_ty whitespace);
+typedef struct its_rule_list_ty its_rule_list_ty;
/* Creates a fresh its_rule_list_ty holding global ITS rules. */
extern its_rule_list_ty *its_rule_list_alloc (void);
extern bool its_rule_list_add_from_file (its_rule_list_ty *rules,
const char *filename);
+
+/* ========================= API only for xgettext ========================= */
+
+enum its_whitespace_type_ty
+{
+ ITS_WHITESPACE_PRESERVE,
+ ITS_WHITESPACE_NORMALIZE,
+ ITS_WHITESPACE_NORMALIZE_PARAGRAPH,
+ ITS_WHITESPACE_TRIM
+};
+
+typedef message_ty *
+ (*its_extract_callback_ty) (message_list_ty *mlp,
+ const char *msgctxt,
+ const char *msgid,
+ lex_pos_ty *pos,
+ const char *extracted_comment,
+ const char *marker,
+ enum its_whitespace_type_ty whitespace);
+
/* Extracts messages from FP, accoding to the loaded ITS rules. */
extern void its_rule_list_extract (its_rule_list_ty *rules,
FILE *fp, const char *real_filename,
msgdomain_list_ty *mdlp,
its_extract_callback_ty callback);
+
+/* ========================== API only for msgfmt ========================== */
+
typedef struct its_merge_context_ty its_merge_context_ty;
extern its_merge_context_ty *
extern void its_merge_context_write (its_merge_context_ty *context,
FILE *fp);
+
#ifdef __cplusplus
}
#endif