Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
querymodules.c File Reference
#include "config.h"
#include <glib.h>
#include <gmodule.h>
#include "pango-break.h"
#include "pango-context.h"
#include "pango-utils.h"
#include "pango-engine.h"
#include <errno.h>
#include <string.h>
#include <stdio.h>

Go to the source code of this file.


#define SOEXT   ".so"


void query_module (const char *dir, const char *name)
int main (int argc, char **argv)
 The Xalan testcases app.

Define Documentation

#define SOEXT   ".so"

Definition at line 70 of file querymodules.c.

Function Documentation

int main ( int  argc,
char **  argv 

The Xalan testcases app.

Definition at line 146 of file querymodules.c.

  char cwd[PATH_MAX];
  int i;
  char *path;

  printf ("# Pangolite Modules file\n"
         "# Automatically generated file, do not edit\n"

  if (argc == 1)            /* No arguments given */
      char **dirs;
      int i;
      path = pangolite_config_key_get ("Pangolite/ModulesPath");
      if (!path)
       path = g_strconcat (pangolite_get_lib_subdirectory (),
                         G_DIR_SEPARATOR_S "modules",

      printf ("# ModulesPath = %s\n#\n", path);

      dirs = pangolite_split_file_list (path);

      for (i=0; dirs[i]; i++)
         DIR *dir = opendir (dirs[i]);
         if (dir)
             struct dirent *dent;

             while ((dent = readdir (dir)))
                int len = strlen (dent->d_name);
                if (len > 3 && strcmp (dent->d_name + len - strlen (SOEXT), SOEXT) == 0)
                  query_module (dirs[i], dent->d_name);
             closedir (dir);
      getcwd (cwd, PATH_MAX);
      for (i=1; i<argc; i++)
       query_module (cwd, argv[i]);
  return 0;

Here is the call graph for this function:

void query_module ( const char *  dir,
const char *  name 

Definition at line 74 of file querymodules.c.

  void (*list) (PangoliteEngineInfo **engines, gint *n_engines);
  PangoliteEngine *(*load) (const gchar *id);
  void (*unload) (PangoliteEngine *engine);

  GModule *module;
  gchar *path;

  if (name[0] == G_DIR_SEPARATOR)
    path = g_strdup (name);
    path = g_strconcat (dir, G_DIR_SEPARATOR_S, name, NULL);
  module = g_module_open (path, 0);

  if (!module)
    fprintf(stderr, "Cannot load module %s: %s\n", path, g_module_error());
  if (module &&
      g_module_symbol (module, "script_engine_list", (gpointer)&list) &&
      g_module_symbol (module, "script_engine_load", (gpointer)&load) &&
      g_module_symbol (module, "script_engine_unload", (gpointer)&unload))
      gint i,j;
      PangoliteEngineInfo *engines;
      gint n_engines;

      (*list) (&engines, &n_engines);

      for (i=0; i<n_engines; i++)
         const gchar *quote;
         gchar *quoted_path;

         if (strchr (path, ' ') != NULL)
             quote = "\"";
             quoted_path = g_strescape (path, NULL);
             quote = "";
             quoted_path = g_strdup (path);
         g_print ("%s%s%s %s %s %s ", quote, quoted_path, quote,
                 engines[i].id, engines[i].engine_type, engines[i].render_type);
         g_free (quoted_path);

         for (j=0; j < engines[i].n_ranges; j++)
             if (j != 0)
              g_print (" ");
             g_print ("%d-%d:%s",
         g_print ("\n");
      fprintf (stderr, "%s does not export Pangolite module API\n", path);

  g_free (path);
  if (module)
    g_module_close (module);

Here is the call graph for this function:

Here is the caller graph for this function: