summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2000-11-16 18:25:44 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-11-16 18:25:44 +0000
commit5ab5ba7137010fa6fc5be4c7e171fe3081f5f616 (patch)
tree77f25ec8737e17a0c9a37d812afdf0079f663c7f
parent4334318379ac2f111abe99a7fd3d77c816f36071 (diff)
downloadpango-5ab5ba7137010fa6fc5be4c7e171fe3081f5f616.tar.gz
hu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
* docs/pango-sections.txt docs/tmpl/modules.sgml: Add pango_module_register (). * pango/modules.c: Make ordering of module lookup predictable. * pango/modules.c (pango_module_register): Add a useful doc comment. * pango/pango-modules.[ch]: Fix indentation. * .cvsusers: Added
-rw-r--r--.cvsusers1
-rw-r--r--ChangeLog15
-rw-r--r--ChangeLog.pre-1-015
-rw-r--r--ChangeLog.pre-1-1015
-rw-r--r--ChangeLog.pre-1-215
-rw-r--r--ChangeLog.pre-1-415
-rw-r--r--ChangeLog.pre-1-615
-rw-r--r--ChangeLog.pre-1-815
-rw-r--r--docs/pango-sections.txt2
-rw-r--r--docs/tmpl/modules.sgml22
-rw-r--r--pango/modules.c235
-rw-r--r--pango/pango-modules.h16
12 files changed, 271 insertions, 110 deletions
diff --git a/.cvsusers b/.cvsusers
new file mode 100644
index 00000000..c54a36ee
--- /dev/null
+++ b/.cvsusers
@@ -0,0 +1 @@
+-sopwith
diff --git a/ChangeLog b/ChangeLog
index 85a936c3..0e078ec6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index 85a936c3..0e078ec6 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 85a936c3..0e078ec6 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 85a936c3..0e078ec6 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 85a936c3..0e078ec6 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 85a936c3..0e078ec6 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 85a936c3..0e078ec6 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,18 @@
+Thu Nov 16 13:23:43 2000 Owen Taylor <otaylor@redhat.com>
+
+ * docs/pango-sections.txt docs/tmpl/modules.sgml: Add
+ pango_module_register ().
+
+ * pango/modules.c: Make ordering of module lookup
+ predictable.
+
+ * pango/modules.c (pango_module_register): Add a
+ useful doc comment.
+
+ * pango/pango-modules.[ch]: Fix indentation.
+
+ * .cvsusers: Added
+
2000-11-16 Havoc Pennington <hp@redhat.com>
* pango/modules.c (handle_included_module): Declare variable j so
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index bb37a61b..16ea9a91 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -321,11 +321,13 @@ pango_indic_split_out_characters
<SECTION>
<TITLE>Modules</TITLE>
<FILE>modules</FILE>
+PangoIncludedModule
PangoMap
PangoMapEntry
pango_find_map
pango_map_get_entry
pango_map_get_engine
+pango_module_register
</SECTION>
<SECTION>
diff --git a/docs/tmpl/modules.sgml b/docs/tmpl/modules.sgml
index 456de220..90ca7982 100644
--- a/docs/tmpl/modules.sgml
+++ b/docs/tmpl/modules.sgml
@@ -14,6 +14,20 @@ modules
</para>
+<!-- ##### STRUCT PangoIncludedModule ##### -->
+<para>
+The #PangoIncludedModule structure holds information used
+to register a module that is built in to a library instead
+of dynamically loaded. The three functions it holds are
+used instead of the symbols script_engine_load(),
+script_engine_unload() and script_engine_list() in a
+dynamically loaded module.
+</para>
+
+@list: lists the engines this module implements
+@load: does initialization for this module
+@unload: unitializes the module
+
<!-- ##### STRUCT PangoMap ##### -->
<para>
@@ -59,3 +73,11 @@ modules
@Returns:
+<!-- ##### FUNCTION pango_module_register ##### -->
+<para>
+
+</para>
+
+@module:
+
+
diff --git a/pango/modules.c b/pango/modules.c
index e6802b58..6e95027f 100644
--- a/pango/modules.c
+++ b/pango/modules.c
@@ -69,10 +69,13 @@ struct _PangoEnginePair
};
static GList *maps = NULL;
-static GList *engines = NULL;
-static void build_map (PangoMapInfo *info);
-static void init_modules (void);
+static GSList *builtin_engines = NULL;
+static GSList *registered_engines = NULL;
+static GSList *dlloaded_engines = NULL;
+
+static void build_map (PangoMapInfo *info);
+static void init_modules (void);
/**
* pango_find_map:
@@ -179,34 +182,37 @@ pango_engine_pair_get_engine (PangoEnginePair *pair)
}
static void
-handle_included_module (PangoIncludedModule *mod)
+handle_included_module (PangoIncludedModule *module,
+ GSList **engine_list)
{
PangoEngineInfo *engine_info;
int n_engines;
- int j;
-
- mod->list (&engine_info, &n_engines);
+ int i;
+
+ module->list (&engine_info, &n_engines);
- for (j = 0; j < n_engines; j++)
+ for (i = 0; i < n_engines; i++)
{
PangoEnginePair *pair = g_new (PangoEnginePair, 1);
- pair->info = engine_info[j];
+ pair->info = engine_info[i];
pair->included = TRUE;
- pair->load_info = mod;
+ pair->load_info = module;
pair->engine = NULL;
- engines = g_list_prepend (engines, pair);
+ *engine_list = g_slist_prepend (*engine_list, pair);
}
}
static void
-add_included_modules (void)
+add_builtin_modules (void)
{
- int i, j;
+ int i;
for (i = 0; _pango_included_modules[i].list; i++)
- handle_included_module (&_pango_included_modules[i]);
+ handle_included_module (&_pango_included_modules[i], &builtin_engines);
+
+ builtin_engines = g_slist_reverse (builtin_engines);
}
static gboolean /* Returns true if succeeded, false if failed */
@@ -309,7 +315,7 @@ process_module_file (FILE *module_file)
pair->engine = NULL;
- engines = g_list_prepend (engines, pair);
+ dlloaded_engines = g_slist_prepend (dlloaded_engines, pair);
error:
g_list_foreach (ranges, (GFunc)g_free, NULL);
@@ -362,6 +368,8 @@ read_modules (void)
g_strfreev (files);
g_free (file_str);
+
+ dlloaded_engines = g_slist_reverse (dlloaded_engines);
}
static void
@@ -385,23 +393,110 @@ init_modules (void)
else
init = TRUE;
- engines = NULL;
+ add_builtin_modules ();
+ read_modules ();
+}
+
+static void
+map_add_engine (PangoMapInfo *info,
+ PangoEnginePair *pair)
+{
+ int submap;
+ int i, j;
+ PangoMap *map = info->map;
+
+ for (i=0; i<pair->info.n_ranges; i++)
+ {
+ gchar **langs;
+ gboolean is_exact = FALSE;
+
+ if (pair->info.ranges[i].langs)
+ {
+ langs = g_strsplit (pair->info.ranges[i].langs, ";", -1);
+ for (j=0; langs[j]; j++)
+ if (strcmp (langs[j], "*") == 0 ||
+ strcmp (langs[j], info->lang) == 0)
+ {
+ is_exact = TRUE;
+ break;
+ }
+ g_strfreev (langs);
+ }
+
+ for (submap = pair->info.ranges[i].start / 256;
+ submap <= pair->info.ranges[i].end / 256;
+ submap ++)
+ {
+ gunichar start;
+ gunichar end;
+
+ if (submap == pair->info.ranges[i].start / 256)
+ start = pair->info.ranges[i].start % 256;
+ else
+ start = 0;
+
+ if (submap == pair->info.ranges[i].end / 256)
+ end = pair->info.ranges[i].end % 256;
+ else
+ end = 255;
+
+ if (map->submaps[submap].is_leaf &&
+ start == 0 && end == 255)
+ {
+ set_entry (&map->submaps[submap].d.entry,
+ is_exact, &pair->info);
+ }
+ else
+ {
+ if (map->submaps[submap].is_leaf)
+ {
+ map->submaps[submap].is_leaf = FALSE;
+ map->submaps[submap].d.leaves = g_new (PangoMapEntry, 256);
+ for (j=0; j<256; j++)
+ {
+ map->submaps[submap].d.leaves[j].info = NULL;
+ map->submaps[submap].d.leaves[j].is_exact = FALSE;
+ }
+ }
+
+ for (j=start; j<=end; j++)
+ set_entry (&map->submaps[submap].d.leaves[j],
+ is_exact, &pair->info);
+
+ }
+ }
+ }
+}
- add_included_modules();
- read_modules();
+static void
+map_add_engine_list (PangoMapInfo *info,
+ GSList *engines,
+ const char *engine_type,
+ const char *render_type)
+{
+ GSList *tmp_list = engines;
- engines = g_list_reverse (engines);
+ while (tmp_list)
+ {
+ PangoEnginePair *pair = tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ if (strcmp (pair->info.engine_type, engine_type) == 0 &&
+ strcmp (pair->info.render_type, render_type) == 0)
+ {
+ map_add_engine (info, pair);
+ }
+ }
}
static void
build_map (PangoMapInfo *info)
{
- GList *tmp_list;
- int i, j;
+ int i;
PangoMap *map;
- char *engine_type = g_quark_to_string (info->engine_type_id);
- char *render_type = g_quark_to_string (info->render_type_id);
+ const char *engine_type = g_quark_to_string (info->engine_type_id);
+ const char *render_type = g_quark_to_string (info->render_type_id);
init_modules();
@@ -413,81 +508,10 @@ build_map (PangoMapInfo *info)
map->submaps[i].d.entry.info = NULL;
map->submaps[i].d.entry.is_exact = FALSE;
}
-
- tmp_list = engines;
- while (tmp_list)
- {
- PangoEnginePair *pair = tmp_list->data;
- tmp_list = tmp_list->next;
- if (strcmp (pair->info.engine_type, engine_type) == 0 &&
- strcmp (pair->info.render_type, render_type) == 0)
- {
- int submap;
-
- for (i=0; i<pair->info.n_ranges; i++)
- {
- gchar **langs;
- gboolean is_exact = FALSE;
-
- if (pair->info.ranges[i].langs)
- {
- langs = g_strsplit (pair->info.ranges[i].langs, ";", -1);
- for (j=0; langs[j]; j++)
- if (strcmp (langs[j], "*") == 0 ||
- strcmp (langs[j], info->lang) == 0)
- {
- is_exact = TRUE;
- break;
- }
- g_strfreev (langs);
- }
-
- for (submap = pair->info.ranges[i].start / 256;
- submap <= pair->info.ranges[i].end / 256;
- submap ++)
- {
- gunichar start;
- gunichar end;
-
- if (submap == pair->info.ranges[i].start / 256)
- start = pair->info.ranges[i].start % 256;
- else
- start = 0;
-
- if (submap == pair->info.ranges[i].end / 256)
- end = pair->info.ranges[i].end % 256;
- else
- end = 255;
-
- if (map->submaps[submap].is_leaf &&
- start == 0 && end == 255)
- {
- set_entry (&map->submaps[submap].d.entry,
- is_exact, &pair->info);
- }
- else
- {
- if (map->submaps[submap].is_leaf)
- {
- map->submaps[submap].is_leaf = FALSE;
- map->submaps[submap].d.leaves = g_new (PangoMapEntry, 256);
- for (j=0; j<256; j++)
- {
- map->submaps[submap].d.leaves[j].info = NULL;
- map->submaps[submap].d.leaves[j].is_exact = FALSE;
- }
- }
-
- for (j=start; j<=end; j++)
- set_entry (&map->submaps[submap].d.leaves[j],
- is_exact, &pair->info);
-
- }
- }
- }
- }
- }
+ map_add_engine_list (info, dlloaded_engines, engine_type, render_type);
+ map_add_engine_list (info, registered_engines, engine_type, render_type);
+ map_add_engine_list (info, builtin_engines, engine_type, render_type);
}
/**
@@ -537,13 +561,20 @@ pango_map_get_engine (PangoMap *map,
/**
* pango_module_register:
- * @mod: a PangoIncludedModule
- *
- * Registers a PangoIncludedModlue
+ * @module: a #PangoIncludedModule
*
+ * Registers a statically linked module with Pango. The
+ * #PangoIncludedModule structure that is passed in contains the
+ * functions that would otherwise be loaded from a dynamically loaded
+ * module.
**/
void
-pango_module_register (PangoIncludedModule *mod)
+pango_module_register (PangoIncludedModule *module)
{
- handle_included_module (mod);
+ GSList *tmp_list = NULL;
+
+ handle_included_module (module, &tmp_list);
+
+ registered_engines = g_slist_concat (registered_engines,
+ g_slist_reverse (tmp_list));
}
diff --git a/pango/pango-modules.h b/pango/pango-modules.h
index 53b3f697..f76a1246 100644
--- a/pango/pango-modules.h
+++ b/pango/pango-modules.h
@@ -46,14 +46,14 @@ struct _PangoIncludedModule
void (*unload) (PangoEngine *engine);
};
-PangoMap * pango_find_map (const char *lang,
- guint engine_type_id,
- guint render_type_id);
-PangoMapEntry *pango_map_get_entry (PangoMap *map,
- guint32 wc);
-PangoEngine * pango_map_get_engine (PangoMap *map,
- guint32 wc);
-void pango_module_register (PangoIncludedModule *mod);
+PangoMap * pango_find_map (const char *lang,
+ guint engine_type_id,
+ guint render_type_id);
+PangoMapEntry *pango_map_get_entry (PangoMap *map,
+ guint32 wc);
+PangoEngine * pango_map_get_engine (PangoMap *map,
+ guint32 wc);
+void pango_module_register (PangoIncludedModule *module);
#ifdef __cplusplus
}