[groonga-commit:1559] ranguba/chupatext [master] re-enable tar module.
null+ranguba at clear-code.com
null+ranguba at clear-code.com
Wed Oct 13 04:33:35 EDT 2010
Kouhei Sutou 2010-10-13 08:33:35 +0000 (Wed, 13 Oct 2010)
New Revision: 6d0ddf5c250e31b63a6cb52efca906d499bd571f
Log:
re-enable tar module.
Removed files:
module/tar_factory.c
module/text_factory.c
Modified files:
module/Makefile.am
module/tar.c
module/text.c
Modified: module/Makefile.am (+1 -1)
===================================================================
--- module/Makefile.am 2010-10-13 08:23:38 +0000 (cc401d3)
+++ module/Makefile.am 2010-10-13 08:33:35 +0000 (1464209)
@@ -16,8 +16,8 @@ chupa_libs = \
decomposer_LTLIBRARIES =
decomposer_LTLIBRARIES += text.la
-if FALSE
decomposer_LTLIBRARIES += tar.la
+if FALSE
decomposer_LTLIBRARIES += zip.la
if HAVE_POPPLER_GLIB
decomposer_LTLIBRARIES += pdf.la
Modified: module/tar.c (+146 -26)
===================================================================
--- module/tar.c 2010-10-13 08:23:38 +0000 (f3dee70)
+++ module/tar.c 2010-10-13 08:33:35 +0000 (73ec6c4)
@@ -1,6 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright (C) 2010 Nobuyoshi Nakada <nakada at clear-code.com>
+ * Copyright (C) 2010 Kouhei Sutou <kou at clear-code.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,21 +20,32 @@
*/
#include <chupatext/archive_decomposer.h>
+#include <chupatext/chupa_decomposer_factory.h>
#include <chupatext/chupa_module.h>
#include <glib.h>
#include <gsf/gsf-infile-tar.h>
-#define CHUPA_TYPE_TAR_DECOMPOSER chupa_type_tar_decomposer
-#define CHUPA_TAR_DECOMPOSER(obj) \
- G_TYPE_CHECK_INSTANCE_CAST(obj, CHUPA_TYPE_TAR_DECOMPOSER, ChupaTarDecomposer)
-#define CHUPA_TAR_DECOMPOSER_CLASS(klass) \
- G_TYPE_CHECK_CLASS_CAST(klass, CHUPA_TYPE_TAR_DECOMPOSER, ChupaTarDecomposerClass)
-#define CHUPA_IS_TAR_DECOMPOSER(obj) \
- G_TYPE_CHECK_INSTANCE_TYPE(obj, CHUPA_TYPE_TAR_DECOMPOSER)
-#define CHUPA_IS_TAR_DECOMPOSER_CLASS(klass) \
- G_TYPE_CHECK_CLASS_TYPE(klass, CHUPA_TYPE_TAR_DECOMPOSER)
-#define CHUPA_TAR_DECOMPOSER_GET_CLASS(obj) \
- G_TYPE_INSTANCE_GET_CLASS(obj, CHUPA_TYPE_TAR_DECOMPOSER, ChupaTarDecomposerClass)
+/* ChupaText */
+#define CHUPA_TYPE_TAR_DECOMPOSER \
+ chupa_type_tar_decomposer
+#define CHUPA_TAR_DECOMPOSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ CHUPA_TYPE_TAR_DECOMPOSER, \
+ ChupaTarDecomposer))
+#define CHUPA_TAR_DECOMPOSER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ CHUPA_TYPE_TAR_DECOMPOSER, \
+ ChupaTarDecomposerClass))
+#define CHUPA_IS_TAR_DECOMPOSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ CHUPA_TYPE_TAR_DECOMPOSER))
+#define CHUPA_IS_TAR_DECOMPOSER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ CHUPA_TYPE_TAR_DECOMPOSER))
+#define CHUPA_TAR_DECOMPOSER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ CHUPA_TYPE_TAR_DECOMPOSER, \
+ ChupaTarDecomposerClass)
typedef struct _ChupaTarDecomposer ChupaTarDecomposer;
typedef struct _ChupaTarDecomposerClass ChupaTarDecomposerClass;
@@ -51,43 +63,147 @@ struct _ChupaTarDecomposerClass
static GType chupa_type_tar_decomposer = 0;
static void
-chupa_tar_decomposer_class_init(ChupaTarDecomposerClass *klass)
+decomposer_class_init(ChupaTarDecomposerClass *klass)
{
- ChupaArchiveDecomposerClass *dec_class = CHUPA_ARCHIVE_DECOMPOSER_CLASS(klass);
- dec_class->get_infile = gsf_infile_tar_new;
+ ChupaArchiveDecomposerClass *decomposer_class;
+
+ decomposer_class = CHUPA_ARCHIVE_DECOMPOSER_CLASS(klass);
+ decomposer_class->get_infile = gsf_infile_tar_new;
}
static void
-register_type(GTypeModule *type_module)
+decomposer_register_type(GTypeModule *type_module, GList **registered_types)
{
static const GTypeInfo info = {
sizeof(ChupaTarDecomposerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) chupa_tar_decomposer_class_init,
+ (GBaseInitFunc)NULL,
+ (GBaseFinalizeFunc)NULL,
+ (GClassInitFunc)decomposer_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(ChupaTarDecomposer),
0,
- (GInstanceInitFunc) NULL,
+ (GInstanceInitFunc)NULL,
};
+ const gchar *type_name = "ChupaTarDecomposer";
chupa_type_tar_decomposer =
g_type_module_register_type(type_module,
CHUPA_TYPE_ARCHIVE_DECOMPOSER,
- "ChupaTarDecomposer",
+ type_name,
&info, 0);
+
+ *registered_types = g_list_prepend(*registered_types, g_strdup(type_name));
+}
+
+/* ChupaTarFactory */
+#define CHUPA_TYPE_TAR_DECOMPOSER_FACTORY \
+ (chupa_type_tar_decomposer_factory)
+#define CHUPA_TAR_DECOMPOSER_FACTORY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ CHUPA_TYPE_TAR_DECOMPOSER_FACTORY, \
+ ChupaTarDecomposerFactory))
+#define CHUPA_TAR_DECOMPOSER_FACTORY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ CHUPA_TYPE_TAR_DECOMPOSER_FACTORY, \
+ ChupaTarDecomposerFactoryClass))
+#define CHUPA_IS_TAR_DECOMPOSER_FACTORY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ CHUPA_TYPE_TAR_DECOMPOSER_FACTORY))
+#define CHUPA_IS_TAR_DECOMPOSER_FACTORY_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ CHUPA_TYPE_TAR_DECOMPOSER_FACTORY))
+#define CHUPA_TAR_DECOMPOSER_FACTORY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ CHUPA_TYPE_TAR_DECOMPOSER_FACTORY, \
+ ChupaTarDecomposerFactoryClass))
+
+typedef struct _ChupaTarDecomposerFactory ChupaTarDecomposerFactory;
+typedef struct _ChupaTarDecomposerFactoryClass ChupaTarDecomposerFactoryClass;
+
+struct _ChupaTarDecomposerFactory
+{
+ ChupaDecomposerFactory object;
+};
+
+struct _ChupaTarDecomposerFactoryClass
+{
+ ChupaDecomposerFactoryClass parent_class;
+};
+
+static GType chupa_type_tar_decomposer_factory = 0;
+static ChupaDecomposerFactoryClass *factory_parent_class;
+
+static GList *get_mime_types (ChupaDecomposerFactory *factory);
+static GObject *create (ChupaDecomposerFactory *factory,
+ const gchar *label);
+
+static void
+factory_class_init(ChupaDecomposerFactoryClass *klass)
+{
+ GObjectClass *gobject_class;
+ ChupaDecomposerFactoryClass *factory_class;
+
+ factory_parent_class = g_type_class_peek_parent(klass);
+
+ gobject_class = G_OBJECT_CLASS(klass);
+ factory_class = CHUPA_DECOMPOSER_FACTORY_CLASS(klass);
+
+ factory_class->get_mime_types = get_mime_types;
+ factory_class->create = create;
}
+static void
+factory_register_type(GTypeModule *type_module, GList **registered_types)
+{
+ static const GTypeInfo info =
+ {
+ sizeof (ChupaTarDecomposerFactoryClass),
+ (GBaseInitFunc)NULL,
+ (GBaseFinalizeFunc)NULL,
+ (GClassInitFunc)factory_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof(ChupaTarDecomposerFactory),
+ 0,
+ (GInstanceInitFunc)NULL,
+ };
+ const gchar *type_name = "ChupaTarDecomposerFactory";
+
+ chupa_type_tar_decomposer_factory =
+ g_type_module_register_type(type_module,
+ CHUPA_TYPE_DECOMPOSER_FACTORY,
+ type_name,
+ &info, 0);
+
+ *registered_types = g_list_prepend(*registered_types, g_strdup(type_name));
+}
+
+static GList *
+get_mime_types(ChupaDecomposerFactory *factory)
+{
+ GList *mime_types = NULL;
+
+ mime_types = g_list_prepend(mime_types, g_strdup("application/tar"));
+ mime_types = g_list_prepend(mime_types, g_strdup("application/compressed-tar"));
+
+ return mime_types;
+}
+
+static GObject *
+create(ChupaDecomposerFactory *factory, const gchar *label)
+{
+ return g_object_new(CHUPA_TYPE_TAR_DECOMPOSER, NULL);
+}
+
+/* module entry points */
G_MODULE_EXPORT GList *
CHUPA_MODULE_IMPL_INIT(GTypeModule *type_module)
{
GList *registered_types = NULL;
- register_type(type_module);
- registered_types =
- g_list_prepend(registered_types,
- (gchar *)g_type_name(chupa_type_tar_decomposer));
+ decomposer_register_type(type_module, ®istered_types);
+ factory_register_type(type_module, ®istered_types);
return registered_types;
}
@@ -98,8 +214,12 @@ CHUPA_MODULE_IMPL_EXIT(void)
}
G_MODULE_EXPORT GObject *
-CHUPA_MODULE_IMPL_INSTANTIATE(const gchar *first_property, va_list var_args)
+CHUPA_MODULE_IMPL_CREATE_FACTORY(const gchar *first_property, va_list var_args)
{
- return g_object_new_valist(CHUPA_TYPE_TAR_DECOMPOSER,
+ return g_object_new_valist(CHUPA_TYPE_TAR_DECOMPOSER_FACTORY,
first_property, var_args);
}
+
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
Deleted: module/tar_factory.c (+0 -149) 100644
===================================================================
--- module/tar_factory.c 2010-10-13 08:23:38 +0000 (545d3e4)
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Copyright (C) 2010 Kouhei Sutou <kou at clear-code.com>
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <chupatext/config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gi18n-lib.h>
-#include <gmodule.h>
-
-#include <chupatext/chupa_module_impl.h>
-#include <chupatext/chupa_module_factory.h>
-#include <chupatext/chupa_decomposer.h>
-
-#define CHUPA_TYPE_TAR_FACTORY chupa_type_tar_factory
-#define CHUPA_TAR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHUPA_TYPE_TAR_FACTORY, ChupaTarFactory))
-#define CHUPA_TAR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHUPA_TYPE_TAR_FACTORY, ChupaTarFactoryClass))
-#define CHUPA_IS_TAR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHUPA_TYPE_TAR_FACTORY))
-#define CHUPA_IS_TAR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHUPA_TYPE_TAR_FACTORY))
-#define CHUPA_TAR_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CHUPA_TYPE_TAR_FACTORY, ChupaTarFactoryClass))
-
-typedef struct _ChupaTarFactory ChupaTarFactory;
-typedef struct _ChupaTarFactoryClass ChupaTarFactoryClass;
-
-struct _ChupaTarFactory
-{
- ChupaModuleFactory object;
-};
-
-struct _ChupaTarFactoryClass
-{
- ChupaModuleFactoryClass parent_class;
-};
-
-static GType chupa_type_tar_factory = 0;
-static ChupaModuleFactoryClass *parent_class;
-
-static GList *get_mime_types (ChupaModuleFactory *factory);
-static GObject *create (ChupaModuleFactory *factory, const gchar *label);
-
-static void
-class_init (ChupaModuleFactoryClass *klass)
-{
- GObjectClass *gobject_class;
- ChupaModuleFactoryClass *factory_class;
-
- parent_class = g_type_class_peek_parent(klass);
-
- gobject_class = G_OBJECT_CLASS(klass);
- factory_class = CHUPA_MODULE_FACTORY_CLASS(klass);
-
- factory_class->get_mime_types = get_mime_types;
- factory_class->create = create;
-}
-
-static void
-init (ChupaTarFactory *factory)
-{
-}
-
-static void
-register_type (GTypeModule *type_module)
-{
- static const GTypeInfo info =
- {
- sizeof (ChupaTarFactoryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(ChupaTarFactory),
- 0,
- (GInstanceInitFunc) init,
- };
-
- chupa_type_tar_factory =
- g_type_module_register_type(type_module,
- CHUPA_TYPE_MODULE_FACTORY,
- "ChupaTarFactory",
- &info, 0);
-}
-
-G_MODULE_EXPORT GList *
-CHUPA_MODULE_IMPL_INIT (GTypeModule *type_module)
-{
- GList *registered_types = NULL;
-
- register_type(type_module);
- if (chupa_type_tar_factory) {
- registered_types =
- g_list_prepend(registered_types,
- (gchar *)g_type_name(chupa_type_tar_factory));
- }
-
- return registered_types;
-}
-
-G_MODULE_EXPORT void
-CHUPA_MODULE_IMPL_EXIT (void)
-{
-}
-
-G_MODULE_EXPORT GObject *
-CHUPA_MODULE_IMPL_INSTANTIATE (const gchar *first_property, va_list var_args)
-{
- return g_object_new_valist(CHUPA_TYPE_TAR_FACTORY, first_property, var_args);
-}
-
-static GList *
-get_mime_types (ChupaModuleFactory *factory)
-{
- GList *mime_types = NULL;
-
- mime_types = g_list_prepend(mime_types, g_strdup("application/tar"));
- mime_types = g_list_prepend(mime_types, g_strdup("application/compressed-tar"));
-
- return mime_types;
-}
-
-static GObject *
-create (ChupaModuleFactory *factory, const gchar *label)
-{
- return G_OBJECT(chupa_decomposer_new("tar", NULL));
-}
-
-/*
-vi:ts=4:nowrap:ai:expandtab:sw=4
-*/
Modified: module/text.c (+5 -2)
===================================================================
--- module/text.c 2010-10-13 08:23:38 +0000 (dfa8685)
+++ module/text.c 2010-10-13 08:33:35 +0000 (6a974b8)
@@ -70,8 +70,10 @@ chupa_text_decomposer_feed(ChupaDecomposer *decomposer, ChupaText *chupar,
static void
decomposer_class_init(ChupaTextDecomposerClass *klass)
{
- ChupaDecomposerClass *super = CHUPA_DECOMPOSER_CLASS(klass);
- super->feed = chupa_text_decomposer_feed;
+ ChupaDecomposerClass *decopmoser_class;
+
+ decopmoser_class = CHUPA_DECOMPOSER_CLASS(klass);
+ decopmoser_class->feed = chupa_text_decomposer_feed;
}
static void
@@ -198,6 +200,7 @@ create(ChupaDecomposerFactory *factory, const gchar *label)
return g_object_new(CHUPA_TYPE_TEXT_DECOMPOSER, NULL);
}
+/* module entry points */
G_MODULE_EXPORT GList *
CHUPA_MODULE_IMPL_INIT(GTypeModule *type_module)
{
Deleted: module/text_factory.c (+0 -148) 100644
===================================================================
--- module/text_factory.c 2010-10-13 08:23:38 +0000 (3edc680)
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Copyright (C) 2010 Kouhei Sutou <kou at clear-code.com>
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <chupatext/config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gi18n-lib.h>
-#include <gmodule.h>
-
-#include <chupatext/chupa_module_impl.h>
-#include <chupatext/chupa_module_factory.h>
-#include <chupatext/chupa_decomposer.h>
-
-#define CHUPA_TYPE_TEXT_FACTORY chupa_type_text_factory
-#define CHUPA_TEXT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHUPA_TYPE_TEXT_FACTORY, ChupaTextFactory))
-#define CHUPA_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHUPA_TYPE_TEXT_FACTORY, ChupaTextFactoryClass))
-#define CHUPA_IS_TEXT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHUPA_TYPE_TEXT_FACTORY))
-#define CHUPA_IS_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHUPA_TYPE_TEXT_FACTORY))
-#define CHUPA_TEXT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CHUPA_TYPE_TEXT_FACTORY, ChupaTextFactoryClass))
-
-typedef struct _ChupaTextFactory ChupaTextFactory;
-typedef struct _ChupaTextFactoryClass ChupaTextFactoryClass;
-
-struct _ChupaTextFactory
-{
- ChupaModuleFactory object;
-};
-
-struct _ChupaTextFactoryClass
-{
- ChupaModuleFactoryClass parent_class;
-};
-
-static GType chupa_type_text_factory = 0;
-static ChupaModuleFactoryClass *parent_class;
-
-static GList *get_mime_types (ChupaModuleFactory *factory);
-static GObject *create (ChupaModuleFactory *factory, const gchar *label);
-
-static void
-class_init (ChupaModuleFactoryClass *klass)
-{
- GObjectClass *gobject_class;
- ChupaModuleFactoryClass *factory_class;
-
- parent_class = g_type_class_peek_parent(klass);
-
- gobject_class = G_OBJECT_CLASS(klass);
- factory_class = CHUPA_MODULE_FACTORY_CLASS(klass);
-
- factory_class->get_mime_types = get_mime_types;
- factory_class->create = create;
-}
-
-static void
-init (ChupaTextFactory *factory)
-{
-}
-
-static void
-register_type (GTypeModule *type_module)
-{
- static const GTypeInfo info =
- {
- sizeof (ChupaTextFactoryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(ChupaTextFactory),
- 0,
- (GInstanceInitFunc) init,
- };
-
- chupa_type_text_factory =
- g_type_module_register_type(type_module,
- CHUPA_TYPE_MODULE_FACTORY,
- "ChupaTextFactory",
- &info, 0);
-}
-
-G_MODULE_EXPORT GList *
-CHUPA_MODULE_IMPL_INIT (GTypeModule *type_module)
-{
- GList *registered_types = NULL;
-
- register_type(type_module);
- if (chupa_type_text_factory) {
- registered_types =
- g_list_prepend(registered_types,
- (gchar *)g_type_name(chupa_type_text_factory));
- }
-
- return registered_types;
-}
-
-G_MODULE_EXPORT void
-CHUPA_MODULE_IMPL_EXIT (void)
-{
-}
-
-G_MODULE_EXPORT GObject *
-CHUPA_MODULE_IMPL_INSTANTIATE (const gchar *first_property, va_list var_args)
-{
- return g_object_new_valist(CHUPA_TYPE_TEXT_FACTORY, first_property, var_args);
-}
-
-static GList *
-get_mime_types (ChupaModuleFactory *factory)
-{
- GList *mime_types = NULL;
-
- mime_types = g_list_prepend(mime_types, g_strdup("text/plain"));
-
- return mime_types;
-}
-
-static GObject *
-create (ChupaModuleFactory *factory, const gchar *label)
-{
- return G_OBJECT(chupa_decomposer_new("text", NULL));
-}
-
-/*
-vi:ts=4:nowrap:ai:expandtab:sw=4
-*/
More information about the groonga-commit
mailing list