mathematical 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/mathematical/extconf.rb +14 -0
- data/ext/mathematical/itex2MML.h +63 -0
- data/ext/mathematical/lasemrender.c +257 -0
- data/ext/mathematical/lex.yy.c +6548 -0
- data/ext/mathematical/lsm.c +31 -0
- data/ext/mathematical/lsm.h +39 -0
- data/ext/mathematical/lsmattributes.c +279 -0
- data/ext/mathematical/lsmattributes.h +75 -0
- data/ext/mathematical/lsmcairo.c +598 -0
- data/ext/mathematical/lsmcairo.h +51 -0
- data/ext/mathematical/lsmdebug.c +183 -0
- data/ext/mathematical/lsmdebug.h +73 -0
- data/ext/mathematical/lsmdom.h +43 -0
- data/ext/mathematical/lsmdomcharacterdata.c +114 -0
- data/ext/mathematical/lsmdomcharacterdata.h +59 -0
- data/ext/mathematical/lsmdomdocument.c +255 -0
- data/ext/mathematical/lsmdomdocument.h +75 -0
- data/ext/mathematical/lsmdomdocumentfragment.c +81 -0
- data/ext/mathematical/lsmdomdocumentfragment.h +55 -0
- data/ext/mathematical/lsmdomelement.c +148 -0
- data/ext/mathematical/lsmdomelement.h +62 -0
- data/ext/mathematical/lsmdomentities.c +2166 -0
- data/ext/mathematical/lsmdomentities.h +35 -0
- data/ext/mathematical/lsmdomenumtypes.c +99 -0
- data/ext/mathematical/lsmdomenumtypes.h +26 -0
- data/ext/mathematical/lsmdomimplementation.c +82 -0
- data/ext/mathematical/lsmdomimplementation.h +41 -0
- data/ext/mathematical/lsmdomnamednodemap.c +118 -0
- data/ext/mathematical/lsmdomnamednodemap.h +64 -0
- data/ext/mathematical/lsmdomnode.c +737 -0
- data/ext/mathematical/lsmdomnode.h +122 -0
- data/ext/mathematical/lsmdomnodelist.c +70 -0
- data/ext/mathematical/lsmdomnodelist.h +58 -0
- data/ext/mathematical/lsmdomparser.c +461 -0
- data/ext/mathematical/lsmdomparser.h +54 -0
- data/ext/mathematical/lsmdomtext.c +82 -0
- data/ext/mathematical/lsmdomtext.h +55 -0
- data/ext/mathematical/lsmdomtypes.h +44 -0
- data/ext/mathematical/lsmdomview.c +422 -0
- data/ext/mathematical/lsmdomview.h +94 -0
- data/ext/mathematical/lsmitex.c +76 -0
- data/ext/mathematical/lsmitex.h +36 -0
- data/ext/mathematical/lsmmathml.h +66 -0
- data/ext/mathematical/lsmmathmlactionelement.c +93 -0
- data/ext/mathematical/lsmmathmlactionelement.h +57 -0
- data/ext/mathematical/lsmmathmlaligngroupelement.c +102 -0
- data/ext/mathematical/lsmmathmlaligngroupelement.h +56 -0
- data/ext/mathematical/lsmmathmlalignmarkelement.c +102 -0
- data/ext/mathematical/lsmmathmlalignmarkelement.h +56 -0
- data/ext/mathematical/lsmmathmlattributes.c +197 -0
- data/ext/mathematical/lsmmathmlattributes.h +126 -0
- data/ext/mathematical/lsmmathmldocument.c +304 -0
- data/ext/mathematical/lsmmathmldocument.h +61 -0
- data/ext/mathematical/lsmmathmlelement.c +491 -0
- data/ext/mathematical/lsmmathmlelement.h +107 -0
- data/ext/mathematical/lsmmathmlenums.c +429 -0
- data/ext/mathematical/lsmmathmlenums.h +182 -0
- data/ext/mathematical/lsmmathmlenumtypes.c +666 -0
- data/ext/mathematical/lsmmathmlenumtypes.h +90 -0
- data/ext/mathematical/lsmmathmlerrorelement.c +58 -0
- data/ext/mathematical/lsmmathmlerrorelement.h +56 -0
- data/ext/mathematical/lsmmathmlfencedelement.c +178 -0
- data/ext/mathematical/lsmmathmlfencedelement.h +65 -0
- data/ext/mathematical/lsmmathmlfractionelement.c +253 -0
- data/ext/mathematical/lsmmathmlfractionelement.h +62 -0
- data/ext/mathematical/lsmmathmlglyphtableams.c +597 -0
- data/ext/mathematical/lsmmathmlglyphtableams.h +45 -0
- data/ext/mathematical/lsmmathmlitexelement.c +187 -0
- data/ext/mathematical/lsmmathmlitexelement.h +60 -0
- data/ext/mathematical/lsmmathmllayoututils.c +191 -0
- data/ext/mathematical/lsmmathmllayoututils.h +58 -0
- data/ext/mathematical/lsmmathmlmathelement.c +204 -0
- data/ext/mathematical/lsmmathmlmathelement.h +81 -0
- data/ext/mathematical/lsmmathmloperatordictionary.c +3332 -0
- data/ext/mathematical/lsmmathmloperatordictionary.h +54 -0
- data/ext/mathematical/lsmmathmloperatorelement.c +307 -0
- data/ext/mathematical/lsmmathmloperatorelement.h +73 -0
- data/ext/mathematical/lsmmathmlpaddedelement.c +58 -0
- data/ext/mathematical/lsmmathmlpaddedelement.h +56 -0
- data/ext/mathematical/lsmmathmlphantomelement.c +71 -0
- data/ext/mathematical/lsmmathmlphantomelement.h +56 -0
- data/ext/mathematical/lsmmathmlpresentationcontainer.c +43 -0
- data/ext/mathematical/lsmmathmlpresentationcontainer.h +54 -0
- data/ext/mathematical/lsmmathmlpresentationtoken.c +303 -0
- data/ext/mathematical/lsmmathmlpresentationtoken.h +83 -0
- data/ext/mathematical/lsmmathmlradicalelement.c +266 -0
- data/ext/mathematical/lsmmathmlradicalelement.h +71 -0
- data/ext/mathematical/lsmmathmlrowelement.c +58 -0
- data/ext/mathematical/lsmmathmlrowelement.h +56 -0
- data/ext/mathematical/lsmmathmlscriptelement.c +282 -0
- data/ext/mathematical/lsmmathmlscriptelement.h +78 -0
- data/ext/mathematical/lsmmathmlsemanticselement.c +84 -0
- data/ext/mathematical/lsmmathmlsemanticselement.h +56 -0
- data/ext/mathematical/lsmmathmlspaceelement.c +142 -0
- data/ext/mathematical/lsmmathmlspaceelement.h +60 -0
- data/ext/mathematical/lsmmathmlstringelement.c +123 -0
- data/ext/mathematical/lsmmathmlstringelement.h +58 -0
- data/ext/mathematical/lsmmathmlstyle.c +130 -0
- data/ext/mathematical/lsmmathmlstyle.h +81 -0
- data/ext/mathematical/lsmmathmlstyleelement.c +307 -0
- data/ext/mathematical/lsmmathmlstyleelement.h +87 -0
- data/ext/mathematical/lsmmathmltablecellelement.c +122 -0
- data/ext/mathematical/lsmmathmltablecellelement.h +62 -0
- data/ext/mathematical/lsmmathmltableelement.c +545 -0
- data/ext/mathematical/lsmmathmltableelement.h +78 -0
- data/ext/mathematical/lsmmathmltablerowelement.c +120 -0
- data/ext/mathematical/lsmmathmltablerowelement.h +64 -0
- data/ext/mathematical/lsmmathmltraits.c +819 -0
- data/ext/mathematical/lsmmathmltraits.h +119 -0
- data/ext/mathematical/lsmmathmltypes.h +66 -0
- data/ext/mathematical/lsmmathmlunderoverelement.c +485 -0
- data/ext/mathematical/lsmmathmlunderoverelement.h +82 -0
- data/ext/mathematical/lsmmathmlutils.c +170 -0
- data/ext/mathematical/lsmmathmlutils.h +50 -0
- data/ext/mathematical/lsmmathmlview.c +1048 -0
- data/ext/mathematical/lsmmathmlview.h +164 -0
- data/ext/mathematical/lsmproperties.c +418 -0
- data/ext/mathematical/lsmproperties.h +85 -0
- data/ext/mathematical/lsmstr.c +231 -0
- data/ext/mathematical/lsmstr.h +114 -0
- data/ext/mathematical/lsmsvg.h +67 -0
- data/ext/mathematical/lsmsvgaelement.c +73 -0
- data/ext/mathematical/lsmsvgaelement.h +55 -0
- data/ext/mathematical/lsmsvgattributes.h +118 -0
- data/ext/mathematical/lsmsvgcircleelement.c +153 -0
- data/ext/mathematical/lsmsvgcircleelement.h +59 -0
- data/ext/mathematical/lsmsvgclippathelement.c +134 -0
- data/ext/mathematical/lsmsvgclippathelement.h +59 -0
- data/ext/mathematical/lsmsvgcolors.c +212 -0
- data/ext/mathematical/lsmsvgcolors.h +39 -0
- data/ext/mathematical/lsmsvgdefselement.c +74 -0
- data/ext/mathematical/lsmsvgdefselement.h +55 -0
- data/ext/mathematical/lsmsvgdocument.c +288 -0
- data/ext/mathematical/lsmsvgdocument.h +64 -0
- data/ext/mathematical/lsmsvgelement.c +373 -0
- data/ext/mathematical/lsmsvgelement.h +81 -0
- data/ext/mathematical/lsmsvgellipseelement.c +158 -0
- data/ext/mathematical/lsmsvgellipseelement.h +60 -0
- data/ext/mathematical/lsmsvgenums.c +544 -0
- data/ext/mathematical/lsmsvgenums.h +357 -0
- data/ext/mathematical/lsmsvgenumtypes.c +1083 -0
- data/ext/mathematical/lsmsvgenumtypes.h +111 -0
- data/ext/mathematical/lsmsvgfilterblend.c +105 -0
- data/ext/mathematical/lsmsvgfilterblend.h +58 -0
- data/ext/mathematical/lsmsvgfiltercomposite.c +109 -0
- data/ext/mathematical/lsmsvgfiltercomposite.h +58 -0
- data/ext/mathematical/lsmsvgfilterelement.c +266 -0
- data/ext/mathematical/lsmsvgfilterelement.h +66 -0
- data/ext/mathematical/lsmsvgfilterflood.c +86 -0
- data/ext/mathematical/lsmsvgfilterflood.h +55 -0
- data/ext/mathematical/lsmsvgfiltergaussianblur.c +114 -0
- data/ext/mathematical/lsmsvgfiltergaussianblur.h +57 -0
- data/ext/mathematical/lsmsvgfiltermerge.c +98 -0
- data/ext/mathematical/lsmsvgfiltermerge.h +55 -0
- data/ext/mathematical/lsmsvgfiltermergenode.c +87 -0
- data/ext/mathematical/lsmsvgfiltermergenode.h +57 -0
- data/ext/mathematical/lsmsvgfilteroffset.c +112 -0
- data/ext/mathematical/lsmsvgfilteroffset.h +58 -0
- data/ext/mathematical/lsmsvgfilterprimitive.c +168 -0
- data/ext/mathematical/lsmsvgfilterprimitive.h +66 -0
- data/ext/mathematical/lsmsvgfilterspecularlighting.c +127 -0
- data/ext/mathematical/lsmsvgfilterspecularlighting.h +60 -0
- data/ext/mathematical/lsmsvgfiltersurface.c +455 -0
- data/ext/mathematical/lsmsvgfiltersurface.h +66 -0
- data/ext/mathematical/lsmsvgfiltertile.c +102 -0
- data/ext/mathematical/lsmsvgfiltertile.h +57 -0
- data/ext/mathematical/lsmsvggelement.c +73 -0
- data/ext/mathematical/lsmsvggelement.h +55 -0
- data/ext/mathematical/lsmsvggradientelement.c +151 -0
- data/ext/mathematical/lsmsvggradientelement.h +68 -0
- data/ext/mathematical/lsmsvgimageelement.c +261 -0
- data/ext/mathematical/lsmsvgimageelement.h +67 -0
- data/ext/mathematical/lsmsvglength.c +152 -0
- data/ext/mathematical/lsmsvglength.h +65 -0
- data/ext/mathematical/lsmsvglineargradientelement.c +271 -0
- data/ext/mathematical/lsmsvglineargradientelement.h +60 -0
- data/ext/mathematical/lsmsvglineelement.c +153 -0
- data/ext/mathematical/lsmsvglineelement.h +60 -0
- data/ext/mathematical/lsmsvgmarkerelement.c +266 -0
- data/ext/mathematical/lsmsvgmarkerelement.h +74 -0
- data/ext/mathematical/lsmsvgmaskelement.c +232 -0
- data/ext/mathematical/lsmsvgmaskelement.h +64 -0
- data/ext/mathematical/lsmsvgmatrix.c +205 -0
- data/ext/mathematical/lsmsvgmatrix.h +59 -0
- data/ext/mathematical/lsmsvgpathelement.c +115 -0
- data/ext/mathematical/lsmsvgpathelement.h +59 -0
- data/ext/mathematical/lsmsvgpatternelement.c +398 -0
- data/ext/mathematical/lsmsvgpatternelement.h +69 -0
- data/ext/mathematical/lsmsvgpolygonelement.c +106 -0
- data/ext/mathematical/lsmsvgpolygonelement.h +57 -0
- data/ext/mathematical/lsmsvgpolylineelement.c +106 -0
- data/ext/mathematical/lsmsvgpolylineelement.h +57 -0
- data/ext/mathematical/lsmsvgradialgradientelement.c +323 -0
- data/ext/mathematical/lsmsvgradialgradientelement.h +61 -0
- data/ext/mathematical/lsmsvgrectelement.c +184 -0
- data/ext/mathematical/lsmsvgrectelement.h +62 -0
- data/ext/mathematical/lsmsvgstopelement.c +106 -0
- data/ext/mathematical/lsmsvgstopelement.h +57 -0
- data/ext/mathematical/lsmsvgstyle.c +560 -0
- data/ext/mathematical/lsmsvgstyle.h +217 -0
- data/ext/mathematical/lsmsvgsvgelement.c +260 -0
- data/ext/mathematical/lsmsvgsvgelement.h +71 -0
- data/ext/mathematical/lsmsvgswitchelement.c +103 -0
- data/ext/mathematical/lsmsvgswitchelement.h +55 -0
- data/ext/mathematical/lsmsvgsymbolelement.c +74 -0
- data/ext/mathematical/lsmsvgsymbolelement.h +55 -0
- data/ext/mathematical/lsmsvgtextelement.c +203 -0
- data/ext/mathematical/lsmsvgtextelement.h +60 -0
- data/ext/mathematical/lsmsvgtraits.c +1232 -0
- data/ext/mathematical/lsmsvgtraits.h +104 -0
- data/ext/mathematical/lsmsvgtransformable.c +106 -0
- data/ext/mathematical/lsmsvgtransformable.h +54 -0
- data/ext/mathematical/lsmsvgtspanelement.c +174 -0
- data/ext/mathematical/lsmsvgtspanelement.h +60 -0
- data/ext/mathematical/lsmsvgtypes.h +77 -0
- data/ext/mathematical/lsmsvguseelement.c +237 -0
- data/ext/mathematical/lsmsvguseelement.h +69 -0
- data/ext/mathematical/lsmsvgview.c +2583 -0
- data/ext/mathematical/lsmsvgview.h +179 -0
- data/ext/mathematical/lsmtraits.c +119 -0
- data/ext/mathematical/lsmtraits.h +49 -0
- data/ext/mathematical/lsmtypes.h +36 -0
- data/ext/mathematical/lsmutils.c +54 -0
- data/ext/mathematical/lsmutils.h +56 -0
- data/ext/mathematical/mathematical.c +145 -0
- data/ext/mathematical/y.tab.c +6179 -0
- data/ext/mathematical/y.tab.h +389 -0
- data/lib/mathematical/version.rb +1 -1
- data/mathematical.gemspec +8 -6
- data/test/mathematical/basic_test.rb +9 -0
- data/test/mathematical/fixtures/after/brackets_display.html +1 -0
- data/test/mathematical/fixtures/after/compliance_accents.html +17 -0
- data/test/mathematical/fixtures/after/compliance_arrows.html +71 -0
- data/test/mathematical/fixtures/after/compliance_colors.html +4 -0
- data/test/mathematical/fixtures/after/compliance_greek_letters.html +42 -0
- data/test/mathematical/fixtures/after/compliance_large_math.html +19 -0
- data/test/mathematical/fixtures/after/compliance_log_symbols.html +34 -0
- data/test/mathematical/fixtures/after/compliance_operators.html +262 -0
- data/test/mathematical/fixtures/after/dollar_sign_inline.html +1 -0
- data/test/mathematical/fixtures/after/equation_display.html +1 -0
- data/test/mathematical/fixtures/after/multiple_dollar_inline.html +1 -0
- data/test/mathematical/fixtures/after/parens_inline.html +1 -0
- data/test/mathematical/fixtures/before/brackets_display.text +1 -0
- data/test/mathematical/fixtures/before/compliance_accents.text +17 -0
- data/test/mathematical/fixtures/before/compliance_arrows.text +71 -0
- data/test/mathematical/fixtures/before/compliance_colors.text +4 -0
- data/test/mathematical/fixtures/before/compliance_greek_letters.text +42 -0
- data/test/mathematical/fixtures/before/compliance_large_math.text +19 -0
- data/test/mathematical/fixtures/before/compliance_log_symbols.text +34 -0
- data/test/mathematical/fixtures/before/compliance_operators.text +262 -0
- data/test/mathematical/fixtures/before/dollar_sign_inline.text +1 -0
- data/test/mathematical/fixtures/before/equation_display.text +1 -0
- data/test/mathematical/fixtures/before/multiple_dollar_inline.text +1 -0
- data/test/mathematical/fixtures/before/parens_inline.text +1 -0
- data/test/mathematical/fixtures/performance/big_file.text +1767 -0
- data/test/mathematical/fixtures_test.rb +45 -0
- data/test/mathematical/maliciousness_test.rb +45 -0
- data/test/mathematical/performance_test.rb +15 -0
- data/test/test_helper.rb +5 -0
- metadata +301 -14
- data/lib/mathematical.bundle +0 -0
- data/lib/mathematical/mathematical.bundle +0 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2012 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef LSM_CAIRO_H
|
25
|
+
#define LSM_CAIRO_H
|
26
|
+
|
27
|
+
#include <lsmtypes.h>
|
28
|
+
#include <cairo.h>
|
29
|
+
#include <gdk-pixbuf/gdk-pixbuf.h>
|
30
|
+
|
31
|
+
G_BEGIN_DECLS
|
32
|
+
|
33
|
+
void lsm_cairo_quadratic_curve_to (cairo_t *cr, double x1, double y1, double x, double y);
|
34
|
+
void lsm_cairo_rel_quadratic_curve_to (cairo_t *cr, double dx1, double dy1, double dx, double dy);
|
35
|
+
void lsm_cairo_elliptical_arc (cairo_t *cairo, double rx, double ry, double x_axis_rotation,
|
36
|
+
gboolean large_arc_flag, gboolean sweep_flag, double x, double y);
|
37
|
+
void lsm_cairo_rel_elliptical_arc (cairo_t *cairo, double rx, double ry, double x_axis_rotation,
|
38
|
+
gboolean large_arc_flag, gboolean sweep_flag, double dx, double dy);
|
39
|
+
void lsm_cairo_vertical (cairo_t *cairo, double y);
|
40
|
+
void lsm_cairo_rel_vertical (cairo_t *cairo, double dy);
|
41
|
+
void lsm_cairo_horizontal (cairo_t *cairo, double x);
|
42
|
+
void lsm_cairo_rel_horizontal (cairo_t *cairo, double dx);
|
43
|
+
void lsm_cairo_emit_svg_path (cairo_t *cr, char const *path);
|
44
|
+
void lsm_cairo_box_user_to_device (cairo_t *cairo, LsmBox *to, const LsmBox *from);
|
45
|
+
void lsm_cairo_box_device_to_user (cairo_t *cairo, LsmBox *to, const LsmBox *from);
|
46
|
+
void lsm_cairo_set_source_pixbuf (cairo_t *cairo, const GdkPixbuf *pixbuf,
|
47
|
+
double pixbuf_x, double pixbuf_y);
|
48
|
+
|
49
|
+
G_END_DECLS
|
50
|
+
|
51
|
+
#endif
|
@@ -0,0 +1,183 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2010-2012 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <lsmdebug.h>
|
25
|
+
#include <glib/gprintf.h>
|
26
|
+
#include <stdlib.h>
|
27
|
+
|
28
|
+
struct _LsmDebugCategory {
|
29
|
+
char *name;
|
30
|
+
LsmDebugLevel level;
|
31
|
+
};
|
32
|
+
|
33
|
+
LsmDebugCategory lsm_debug_category_dom =
|
34
|
+
{
|
35
|
+
.name = (char *) "dom",
|
36
|
+
.level = -1
|
37
|
+
};
|
38
|
+
|
39
|
+
LsmDebugCategory lsm_debug_category_measure =
|
40
|
+
{
|
41
|
+
.name = (char *) "measure",
|
42
|
+
.level = -1
|
43
|
+
};
|
44
|
+
|
45
|
+
LsmDebugCategory lsm_debug_category_update =
|
46
|
+
{
|
47
|
+
.name = (char *) "update",
|
48
|
+
.level = -1
|
49
|
+
};
|
50
|
+
|
51
|
+
LsmDebugCategory lsm_debug_category_render =
|
52
|
+
{
|
53
|
+
.name = (char *) "render",
|
54
|
+
.level = -1
|
55
|
+
};
|
56
|
+
|
57
|
+
LsmDebugCategory lsm_debug_category_viewport =
|
58
|
+
{
|
59
|
+
.name = (char *) "viewport",
|
60
|
+
.level = -1
|
61
|
+
};
|
62
|
+
|
63
|
+
static GHashTable *lsm_debug_categories = NULL;
|
64
|
+
|
65
|
+
static void
|
66
|
+
lsm_debug_category_free (LsmDebugCategory *category)
|
67
|
+
{
|
68
|
+
if (category != NULL) {
|
69
|
+
g_free (category->name);
|
70
|
+
g_free (category);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
static void
|
75
|
+
lsm_debug_initialize (const char *debug_var)
|
76
|
+
{
|
77
|
+
if (lsm_debug_categories != NULL)
|
78
|
+
return;
|
79
|
+
|
80
|
+
lsm_debug_categories = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) lsm_debug_category_free);
|
81
|
+
|
82
|
+
if (debug_var != NULL) {
|
83
|
+
char **categories;
|
84
|
+
int i;
|
85
|
+
|
86
|
+
categories = g_strsplit (debug_var, ",", -1);
|
87
|
+
for (i = 0; categories[i] != NULL; i++) {
|
88
|
+
LsmDebugCategory *category;
|
89
|
+
char **infos;
|
90
|
+
|
91
|
+
category = g_new0 (LsmDebugCategory, 1);
|
92
|
+
|
93
|
+
infos = g_strsplit (categories[i], ":", -1);
|
94
|
+
if (infos[0] != NULL) {
|
95
|
+
category->name = g_strdup (infos[0]);
|
96
|
+
if (infos[1] != NULL)
|
97
|
+
category->level = atoi (infos[1]);
|
98
|
+
else
|
99
|
+
category->level = LSM_DEBUG_LEVEL_DEBUG;
|
100
|
+
|
101
|
+
g_hash_table_insert (lsm_debug_categories, category->name, category);
|
102
|
+
} else
|
103
|
+
g_free (category);
|
104
|
+
|
105
|
+
g_strfreev (infos);
|
106
|
+
}
|
107
|
+
g_strfreev (categories);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
gboolean
|
112
|
+
lsm_debug_check (LsmDebugCategory *category, LsmDebugLevel level)
|
113
|
+
{
|
114
|
+
LsmDebugCategory *configured_category;
|
115
|
+
|
116
|
+
if (category == NULL)
|
117
|
+
return FALSE;
|
118
|
+
|
119
|
+
if ((int) level <= (int) category->level)
|
120
|
+
return TRUE;
|
121
|
+
|
122
|
+
if ((int) category->level >= 0)
|
123
|
+
return FALSE;
|
124
|
+
|
125
|
+
lsm_debug_initialize (g_getenv ("LSM_DEBUG"));
|
126
|
+
|
127
|
+
configured_category = g_hash_table_lookup (lsm_debug_categories, category->name);
|
128
|
+
if (configured_category == NULL)
|
129
|
+
configured_category = g_hash_table_lookup (lsm_debug_categories, "all");
|
130
|
+
if (configured_category != NULL)
|
131
|
+
category->level = configured_category->level;
|
132
|
+
else
|
133
|
+
category->level = 0;
|
134
|
+
|
135
|
+
|
136
|
+
return (int) level <= (int) category->level;
|
137
|
+
}
|
138
|
+
|
139
|
+
static void
|
140
|
+
lsm_debug_with_level (LsmDebugCategory *category, LsmDebugLevel level, const char *format, va_list args)
|
141
|
+
{
|
142
|
+
if (!lsm_debug_check (category, level))
|
143
|
+
return;
|
144
|
+
|
145
|
+
g_vprintf (format, args);
|
146
|
+
g_printf ("\n");
|
147
|
+
}
|
148
|
+
|
149
|
+
void
|
150
|
+
lsm_warning (LsmDebugCategory *category, const char *format, ...)
|
151
|
+
{
|
152
|
+
va_list args;
|
153
|
+
|
154
|
+
va_start (args, format);
|
155
|
+
lsm_debug_with_level (category, LSM_DEBUG_LEVEL_WARNING, format, args);
|
156
|
+
va_end (args);
|
157
|
+
}
|
158
|
+
|
159
|
+
void
|
160
|
+
lsm_debug (LsmDebugCategory *category, const char *format, ...)
|
161
|
+
{
|
162
|
+
va_list args;
|
163
|
+
|
164
|
+
va_start (args, format);
|
165
|
+
lsm_debug_with_level (category, LSM_DEBUG_LEVEL_DEBUG, format, args);
|
166
|
+
va_end (args);
|
167
|
+
}
|
168
|
+
|
169
|
+
void
|
170
|
+
lsm_log (LsmDebugCategory *category, const char *format, ...)
|
171
|
+
{
|
172
|
+
va_list args;
|
173
|
+
|
174
|
+
va_start (args, format);
|
175
|
+
lsm_debug_with_level (category, LSM_DEBUG_LEVEL_LOG, format, args);
|
176
|
+
va_end (args);
|
177
|
+
}
|
178
|
+
|
179
|
+
void
|
180
|
+
lsm_debug_enable (const char *categories)
|
181
|
+
{
|
182
|
+
lsm_debug_initialize (categories);
|
183
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2010-2012 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef LSM_DEBUG_H
|
25
|
+
#define LSM_DEBUG_H
|
26
|
+
|
27
|
+
#include <glib.h>
|
28
|
+
|
29
|
+
G_BEGIN_DECLS
|
30
|
+
|
31
|
+
typedef enum {
|
32
|
+
LSM_DEBUG_LEVEL_NONE,
|
33
|
+
LSM_DEBUG_LEVEL_WARNING,
|
34
|
+
LSM_DEBUG_LEVEL_DEBUG,
|
35
|
+
LSM_DEBUG_LEVEL_LOG,
|
36
|
+
LSM_DEBUG_LEVEL_COUNT
|
37
|
+
} LsmDebugLevel;
|
38
|
+
|
39
|
+
typedef struct _LsmDebugCategory LsmDebugCategory;
|
40
|
+
|
41
|
+
extern LsmDebugCategory lsm_debug_category_dom;
|
42
|
+
extern LsmDebugCategory lsm_debug_category_measure;
|
43
|
+
extern LsmDebugCategory lsm_debug_category_update;
|
44
|
+
extern LsmDebugCategory lsm_debug_category_render;
|
45
|
+
extern LsmDebugCategory lsm_debug_category_viewport;
|
46
|
+
|
47
|
+
#define lsm_debug_dom(...) lsm_debug (&lsm_debug_category_dom, __VA_ARGS__)
|
48
|
+
#define lsm_log_dom(...) lsm_log (&lsm_debug_category_dom, __VA_ARGS__)
|
49
|
+
#define lsm_warning_dom(...) lsm_warning (&lsm_debug_category_dom, __VA_ARGS__)
|
50
|
+
|
51
|
+
#define lsm_debug_measure(...) lsm_debug (&lsm_debug_category_measure, __VA_ARGS__)
|
52
|
+
#define lsm_log_measure(...) lsm_log (&lsm_debug_category_measure, __VA_ARGS__)
|
53
|
+
#define lsm_warning_measure(...) lsm_warning (&lsm_debug_category_measure, __VA_ARGS__)
|
54
|
+
|
55
|
+
#define lsm_debug_update(...) lsm_debug (&lsm_debug_category_update, __VA_ARGS__)
|
56
|
+
#define lsm_log_update(...) lsm_log (&lsm_debug_category_update, __VA_ARGS__)
|
57
|
+
#define lsm_warning_update(...) lsm_warning (&lsm_debug_category_update, __VA_ARGS__)
|
58
|
+
|
59
|
+
#define lsm_debug_render(...) lsm_debug (&lsm_debug_category_render, __VA_ARGS__)
|
60
|
+
#define lsm_log_render(...) lsm_log (&lsm_debug_category_render, __VA_ARGS__)
|
61
|
+
#define lsm_warning_render(...) lsm_warning (&lsm_debug_category_render, __VA_ARGS__)
|
62
|
+
|
63
|
+
void lsm_warning (LsmDebugCategory *category, const char *format, ...);
|
64
|
+
void lsm_debug (LsmDebugCategory *category, const char *format, ...);
|
65
|
+
void lsm_log (LsmDebugCategory *category, const char *format, ...);
|
66
|
+
|
67
|
+
gboolean lsm_debug_check (LsmDebugCategory *category, LsmDebugLevel level);
|
68
|
+
|
69
|
+
void lsm_debug_enable (const char *category_selection);
|
70
|
+
|
71
|
+
G_END_DECLS
|
72
|
+
|
73
|
+
#endif
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2007-2008 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
#ifndef LSM_DOM_H
|
25
|
+
#define LSM_DOM_H
|
26
|
+
|
27
|
+
#include <lsm.h>
|
28
|
+
|
29
|
+
#include <lsmdomtypes.h>
|
30
|
+
|
31
|
+
#include <lsmdomentities.h>
|
32
|
+
#include <lsmdomnode.h>
|
33
|
+
#include <lsmdomnodelist.h>
|
34
|
+
#include <lsmdomdocument.h>
|
35
|
+
#include <lsmdomelement.h>
|
36
|
+
#include <lsmdomcharacterdata.h>
|
37
|
+
#include <lsmdomtext.h>
|
38
|
+
#include <lsmdomimplementation.h>
|
39
|
+
|
40
|
+
#include <lsmdomparser.h>
|
41
|
+
#include <lsmdomview.h>
|
42
|
+
|
43
|
+
#endif
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/* Lasem
|
2
|
+
*
|
3
|
+
* Copyright © 2007-2010 Emmanuel Pacaud
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General
|
16
|
+
* Public License along with this library; if not, write to the
|
17
|
+
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
18
|
+
* Boston, MA 02111-1307, USA.
|
19
|
+
*
|
20
|
+
* Author:
|
21
|
+
* Emmanuel Pacaud <emmanuel@gnome.org>
|
22
|
+
*/
|
23
|
+
|
24
|
+
/**
|
25
|
+
* SECTION:lsmdomcharacterdata
|
26
|
+
* @short_description: Base class for DOM character data nodes
|
27
|
+
*/
|
28
|
+
|
29
|
+
#include <lsmdomcharacterdata.h>
|
30
|
+
#include <lsmdebug.h>
|
31
|
+
#include <string.h>
|
32
|
+
|
33
|
+
static GObjectClass *parent_class = NULL;
|
34
|
+
|
35
|
+
/* LsmDomNode implementation */
|
36
|
+
|
37
|
+
static void
|
38
|
+
lsm_dom_character_data_write_to_stream (LsmDomNode *self, GOutputStream *stream, GError **error)
|
39
|
+
{
|
40
|
+
LsmDomCharacterData *character_data = LSM_DOM_CHARACTER_DATA (self);
|
41
|
+
|
42
|
+
if (character_data->data != NULL)
|
43
|
+
g_output_stream_write (stream, character_data->data, strlen (character_data->data), NULL, error);
|
44
|
+
}
|
45
|
+
|
46
|
+
static const char *
|
47
|
+
lsm_dom_character_data_get_node_value (LsmDomNode* self)
|
48
|
+
{
|
49
|
+
return lsm_dom_character_data_get_data (LSM_DOM_CHARACTER_DATA (self));
|
50
|
+
}
|
51
|
+
|
52
|
+
static void
|
53
|
+
lsm_dom_character_data_set_node_value (LsmDomNode* self, const char *value)
|
54
|
+
{
|
55
|
+
lsm_dom_character_data_set_data (LSM_DOM_CHARACTER_DATA (self), value);
|
56
|
+
}
|
57
|
+
|
58
|
+
/* LsmDomCharacterData implementation */
|
59
|
+
|
60
|
+
const char *
|
61
|
+
lsm_dom_character_data_get_data (LsmDomCharacterData* self)
|
62
|
+
{
|
63
|
+
g_return_val_if_fail (LSM_IS_DOM_CHARACTER_DATA (self), NULL);
|
64
|
+
|
65
|
+
return self->data;
|
66
|
+
}
|
67
|
+
|
68
|
+
void
|
69
|
+
lsm_dom_character_data_set_data (LsmDomCharacterData* self, const char * value)
|
70
|
+
{
|
71
|
+
g_return_if_fail (LSM_IS_DOM_CHARACTER_DATA (self));
|
72
|
+
g_return_if_fail (value != NULL);
|
73
|
+
|
74
|
+
g_free (self->data);
|
75
|
+
self->data = g_strdup (value);
|
76
|
+
|
77
|
+
lsm_debug_dom ("[LsmDomCharacterData::set_data] Value = '%s'", value);
|
78
|
+
|
79
|
+
lsm_dom_node_changed (LSM_DOM_NODE (self));
|
80
|
+
}
|
81
|
+
|
82
|
+
static void
|
83
|
+
lsm_dom_character_data_init (LsmDomCharacterData *character_data)
|
84
|
+
{
|
85
|
+
}
|
86
|
+
|
87
|
+
static void
|
88
|
+
lsm_dom_character_data_finalize (GObject *object)
|
89
|
+
{
|
90
|
+
LsmDomCharacterData *self = LSM_DOM_CHARACTER_DATA (object);
|
91
|
+
|
92
|
+
g_free (self->data);
|
93
|
+
|
94
|
+
parent_class->finalize (object);
|
95
|
+
}
|
96
|
+
|
97
|
+
/* LsmDomCharacterData class */
|
98
|
+
|
99
|
+
static void
|
100
|
+
lsm_dom_character_data_class_init (LsmDomCharacterDataClass *character_data_class)
|
101
|
+
{
|
102
|
+
GObjectClass *object_class = G_OBJECT_CLASS (character_data_class);
|
103
|
+
LsmDomNodeClass *node_class = LSM_DOM_NODE_CLASS (character_data_class);
|
104
|
+
|
105
|
+
parent_class = g_type_class_peek_parent (character_data_class);
|
106
|
+
|
107
|
+
object_class->finalize = lsm_dom_character_data_finalize;
|
108
|
+
|
109
|
+
node_class->write_to_stream = lsm_dom_character_data_write_to_stream;
|
110
|
+
node_class->set_node_value = lsm_dom_character_data_set_node_value;
|
111
|
+
node_class->get_node_value = lsm_dom_character_data_get_node_value;
|
112
|
+
}
|
113
|
+
|
114
|
+
G_DEFINE_ABSTRACT_TYPE (LsmDomCharacterData, lsm_dom_character_data, LSM_TYPE_DOM_NODE)
|