[lasem] [Mathml] Add GTypes for some non-GObject structures.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [lasem] [Mathml] Add GTypes for some non-GObject structures.
- Date: Sun, 4 Oct 2009 08:31:31 +0000 (UTC)
commit bfed0d436594ccfbd4bdab5d5500580746fe036b
Author: Jorn Baayen <jorn baayen gmail com>
Date: Sun Oct 4 10:18:36 2009 +0200
[Mathml] Add GTypes for some non-GObject structures.
Signed-off-by: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
src/lsmmathmlattributes.c | 90 +++++++++++++++++++++++++++++++++++++++++++-
src/lsmmathmlattributes.h | 16 ++++++++
src/lsmmathmlstyle.c | 11 +++++
src/lsmmathmlstyle.h | 5 ++-
4 files changed, 118 insertions(+), 4 deletions(-)
---
diff --git a/src/lsmmathmlattributes.c b/src/lsmmathmlattributes.c
index d2fde2a..49a9b3a 100644
--- a/src/lsmmathmlattributes.c
+++ b/src/lsmmathmlattributes.c
@@ -26,8 +26,93 @@
#include <stdlib.h>
#include <glib/gmem.h>
#include <glib/ghash.h>
+#include <glib-object.h>
#include <math.h>
+static LsmMathmlColor *
+lsm_mathml_color_copy (LsmMathmlColor *color)
+{
+ LsmMathmlColor *copy;
+
+ copy = g_new (LsmMathmlColor, 1);
+ memcpy (copy, color, sizeof (LsmMathmlColor));
+
+ return copy;
+}
+
+GType
+lsm_mathml_color_get_type (void)
+{
+ static GType our_type = 0;
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static
+ ("LsmMathmlColor",
+ (GBoxedCopyFunc) lsm_mathml_color_copy,
+ (GBoxedFreeFunc) g_free);
+ return our_type;
+}
+
+static LsmMathmlLength *
+lsm_mathml_length_copy (LsmMathmlLength *length)
+{
+ LsmMathmlLength *copy;
+
+ copy = g_new (LsmMathmlLength, 1);
+ memcpy (copy, length, sizeof (LsmMathmlLength));
+
+ return copy;
+}
+
+GType
+lsm_mathml_length_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static
+ ("LsmMathmlLength",
+ (GBoxedCopyFunc) lsm_mathml_length_copy,
+ (GBoxedFreeFunc) g_free);
+ return our_type;
+}
+
+static LsmMathmlSpace *
+lsm_mathml_space_copy (LsmMathmlSpace *space)
+{
+ LsmMathmlSpace *copy;
+
+ copy = g_new (LsmMathmlSpace, 1);
+ memcpy (copy, space, sizeof (LsmMathmlSpace));
+
+ return copy;
+}
+
+GType
+lsm_mathml_space_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static
+ ("LsmMathmlSpace",
+ (GBoxedCopyFunc) lsm_mathml_space_copy,
+ (GBoxedFreeFunc) g_free);
+ return our_type;
+}
+
+GType
+lsm_mathml_space_list_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static
+ ("LsmMathmlSpaceList",
+ (GBoxedCopyFunc) lsm_mathml_space_list_duplicate,
+ (GBoxedFreeFunc) lsm_mathml_space_list_free);
+ return our_type;
+}
+
double
lsm_mathml_length_compute (const LsmMathmlLength *length, double default_value, double font_size)
{
@@ -171,8 +256,8 @@ lsm_mathml_line_attribute_parse (LsmDomEnumAttribute *attribute,
void
lsm_mathml_length_attribute_parse (LsmMathmlLengthAttribute *attribute,
- LsmMathmlLength *style_value,
- double font_size)
+ LsmMathmlLength *style_value,
+ double font_size)
{
const char *string;
char *unit_str;
@@ -527,4 +612,3 @@ lsm_dom_attribute_map_add_space_list (LsmDomAttributeMap *map,
{
lsm_dom_attribute_map_add_attribute_full (map, name, offset, &space_list_attribute_class);
}
-
diff --git a/src/lsmmathmlattributes.h b/src/lsmmathmlattributes.h
index 5105f0d..9940f83 100644
--- a/src/lsmmathmlattributes.h
+++ b/src/lsmmathmlattributes.h
@@ -37,6 +37,10 @@ G_BEGIN_DECLS
#define LSM_MATHML_SPACE_EM_VERY_THICK 0.333333
#define LSM_MATHML_SPACE_EM_VERY_VERY_THICK 0.388889
+GType lsm_mathml_color_get_type (void);
+
+#define LSM_TYPE_MATHML_COLOR (lsm_mathml_color_get_type())
+
typedef struct {
double red;
double green;
@@ -44,16 +48,28 @@ typedef struct {
double alpha;
} LsmMathmlColor;
+GType lsm_mathml_length_get_type (void);
+
+#define LSM_TYPE_MATHML_LENGTH (lsm_mathml_length_get_type())
+
typedef struct {
double value;
LsmMathmlUnit unit;
} LsmMathmlLength;
+GType lsm_mathml_space_get_type (void);
+
+#define LSM_TYPE_MATHML_SPACE (lsm_mathml_space_get_type())
+
typedef struct {
LsmMathmlSpaceName name;
LsmMathmlLength length;
} LsmMathmlSpace;
+GType lsm_mathml_space_list_get_type (void);
+
+#define LSM_TYPE_MATHML_SPACE_LIST (lsm_mathml_space_list_get_type())
+
typedef struct {
unsigned int n_spaces;
LsmMathmlSpace *spaces;
diff --git a/src/lsmmathmlstyle.c b/src/lsmmathmlstyle.c
index 24b3f64..980c1e1 100644
--- a/src/lsmmathmlstyle.c
+++ b/src/lsmmathmlstyle.c
@@ -24,6 +24,17 @@
#include <stdio.h>
#include <math.h>
+GType
+lsm_mathml_style_get_type (void)
+{
+ static GType our_type = 0;
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static("LsmMathmlStyle",
+ (GBoxedCopyFunc) lsm_mathml_style_duplicate,
+ (GBoxedFreeFunc) lsm_mathml_style_free);
+ return our_type;
+}
+
LsmMathmlStyle *
lsm_mathml_style_new (void)
{
diff --git a/src/lsmmathmlstyle.h b/src/lsmmathmlstyle.h
index 3e3b9a2..ead019e 100644
--- a/src/lsmmathmlstyle.h
+++ b/src/lsmmathmlstyle.h
@@ -27,6 +27,10 @@
G_BEGIN_DECLS
+GType lsm_mathml_style_get_type (void);
+
+#define LSM_TYPE_MATHML_STYLE (lsm_mathml_style_get_type())
+
struct _LsmMathmlStyle {
double math_size_value;
/* mstyle */
@@ -75,7 +79,6 @@ void lsm_mathml_style_set_math_family (LsmMathmlStyle *style, const char *ma
void lsm_mathml_style_set_math_variant (LsmMathmlStyle *style, LsmMathmlVariant math_variant);
void lsm_mathml_style_set_math_color (LsmMathmlStyle *style,
double red, double green, double blue, double alpha);
-void lsm_mathml_style_dump (const LsmMathmlStyle *style);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]