summaryrefslogtreecommitdiff
path: root/gen/mapping-rep.h
diff options
context:
space:
mode:
Diffstat (limited to 'gen/mapping-rep.h')
-rw-r--r--gen/mapping-rep.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/gen/mapping-rep.h b/gen/mapping-rep.h
new file mode 100644
index 0000000..59ee393
--- /dev/null
+++ b/gen/mapping-rep.h
@@ -0,0 +1,68 @@
+/*
+ * This file is part of preppie.
+ *
+ * Copyright (C) 2010 Mikhail Zabaluev <mikhail.zabaluev@gmail.com>
+ *
+ * This work 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 work 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 work; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _PREPPIE_GEN_REPERTOIRE_H_
+#define _PREPPIE_GEN_REPERTOIRE_H_
+
+
+#include <glib.h>
+#include <preppie/profile-format.h>
+
+
+G_BEGIN_DECLS
+
+typedef struct _SprepGenMapping SprepGenMapping;
+
+struct _SprepGenMapping {
+ guint length; /* length in bytes */
+ gchar *chars; /* characters of the mapping */
+ gsize offset; /* file offset assigned */
+ const SprepGenMapping *substring_of;
+ /* if non-null, a mapping containing
+ * the characters in a larger string */
+ guint substring_index; /* index of the mapping characters
+ * in the containing mapping */
+ gboolean in_use;
+};
+
+#define SPREP_GEN_REP_PAGE_SIZE_SHIFT 7
+#define SPREP_GEN_REP_PAGE_TABLE_SIZE \
+ ((SPREP_UNICHAR_MAX + 1) >> SPREP_GEN_REP_PAGE_SIZE_SHIFT)
+#define SPREP_GEN_REP_PAGE_SIZE (1 << SPREP_GEN_REP_PAGE_SIZE_SHIFT)
+#define SPREP_GEN_REP_PAGE_INDEX_MASK (SPREP_GEN_REP_PAGE_SIZE - 1)
+
+typedef GTree **SprepGenMappingRepPage;
+
+typedef struct _SprepGenMappingRep {
+ SprepGenMappingRepPage pages[SPREP_GEN_REP_PAGE_TABLE_SIZE];
+} SprepGenMappingRep;
+
+SprepGenMappingRep * sprep_gen_mapping_rep_new ();
+void sprep_gen_mapping_rep_destroy (SprepGenMappingRep *rep);
+const SprepGenMapping * sprep_gen_mapping_rep_add (SprepGenMappingRep *rep,
+ const gunichar *mapping,
+ guint length);
+gsize sprep_gen_mapping_rep_prepare_layout (SprepGenMappingRep *rep);
+
+
+G_END_DECLS
+
+#endif /* _PREPPIE_GEN_REPERTOIRE_H_ */