summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-11-03 23:42:23 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-11-03 23:42:23 +0000
commit48ac54f0234671b23afeaad33af6168037ef552c (patch)
tree3a937530c745c958f8da1e788a8dfe94cff847d4 /src
parentUpdate to trunk (diff)
parentRemove antiquated Perl extensions and modules, which were mostly useless. (diff)
downloadinkscape-48ac54f0234671b23afeaad33af6168037ef552c.tar.gz
inkscape-48ac54f0234671b23afeaad33af6168037ef552c.zip
Update to trunk
(bzr r12588.1.25)
Diffstat (limited to 'src')
-rw-r--r--src/box3d.cpp39
-rw-r--r--src/box3d.h6
-rw-r--r--src/desktop.cpp3
-rw-r--r--src/display/drawing-text.cpp70
-rw-r--r--src/display/drawing-text.h4
-rw-r--r--src/display/nr-filter-gaussian.cpp6
-rw-r--r--src/display/nr-filter-morphology.cpp1
-rw-r--r--src/display/nr-filter-primitive.cpp67
-rw-r--r--src/draw-context.cpp2
-rw-r--r--src/event-context.cpp2
-rw-r--r--src/extension/internal/bitmap/despeckle.cpp2
-rw-r--r--src/extension/internal/bitmap/enhance.cpp2
-rw-r--r--src/extension/internal/bitmap/equalize.cpp2
-rw-r--r--src/extension/internal/bitmap/negate.cpp2
-rw-r--r--src/extension/internal/bitmap/normalize.cpp2
-rw-r--r--src/extension/internal/cdr-input.cpp3
-rw-r--r--src/extension/internal/emf-inout.cpp11
-rw-r--r--src/extension/internal/pdf-input-cairo.cpp2
-rw-r--r--src/extension/internal/wmf-inout.cpp13
-rw-r--r--src/extension/internal/wmf-print.cpp2
-rw-r--r--src/extension/internal/wpg-input.cpp2
-rw-r--r--src/extension/system.cpp16
-rw-r--r--src/libavoid/connector.cpp4
-rw-r--r--src/libcola/cola.h2
-rw-r--r--src/libcroco/cr-additional-sel.c144
-rw-r--r--src/libcroco/cr-additional-sel.h20
-rw-r--r--src/libcroco/cr-attr-sel.c84
-rw-r--r--src/libcroco/cr-attr-sel.h6
-rw-r--r--src/libcroco/cr-cascade.c57
-rw-r--r--src/libcroco/cr-cascade.h2
-rw-r--r--src/libcroco/cr-declaration.c273
-rw-r--r--src/libcroco/cr-declaration.h14
-rw-r--r--src/libcroco/cr-doc-handler.c92
-rw-r--r--src/libcroco/cr-doc-handler.h14
-rw-r--r--src/libcroco/cr-enc-handler.c46
-rw-r--r--src/libcroco/cr-enc-handler.h6
-rw-r--r--src/libcroco/cr-fonts.c275
-rw-r--r--src/libcroco/cr-fonts.h13
-rw-r--r--src/libcroco/cr-input.c412
-rw-r--r--src/libcroco/cr-input.h26
-rw-r--r--src/libcroco/cr-num.c95
-rw-r--r--src/libcroco/cr-num.h8
-rw-r--r--src/libcroco/cr-om-parser.c180
-rw-r--r--src/libcroco/cr-om-parser.h2
-rw-r--r--src/libcroco/cr-parser.c405
-rw-r--r--src/libcroco/cr-parser.h4
-rw-r--r--src/libcroco/cr-parsing-location.c64
-rw-r--r--src/libcroco/cr-parsing-location.h8
-rw-r--r--src/libcroco/cr-prop-list.c126
-rw-r--r--src/libcroco/cr-prop-list.h4
-rw-r--r--src/libcroco/cr-pseudo.c48
-rw-r--r--src/libcroco/cr-pseudo.h4
-rw-r--r--src/libcroco/cr-rgb.c499
-rw-r--r--src/libcroco/cr-rgb.h16
-rw-r--r--src/libcroco/cr-sel-eng.c86
-rw-r--r--src/libcroco/cr-sel-eng.h2
-rw-r--r--src/libcroco/cr-selector.c73
-rw-r--r--src/libcroco/cr-selector.h6
-rw-r--r--src/libcroco/cr-simple-sel.c57
-rw-r--r--src/libcroco/cr-simple-sel.h14
-rw-r--r--src/libcroco/cr-statement.c653
-rw-r--r--src/libcroco/cr-statement.h44
-rw-r--r--src/libcroco/cr-string.c18
-rw-r--r--src/libcroco/cr-string.h10
-rw-r--r--src/libcroco/cr-style.h2
-rw-r--r--src/libcroco/cr-stylesheet.c10
-rw-r--r--src/libcroco/cr-stylesheet.h6
-rw-r--r--src/libcroco/cr-term.c12
-rw-r--r--src/libcroco/cr-term.h8
-rw-r--r--src/libcroco/cr-tknzr.c155
-rw-r--r--src/libcroco/cr-token.c1
-rw-r--r--src/libcroco/cr-utils.c13
-rw-r--r--src/libcroco/cr-utils.h4
-rw-r--r--src/libnrtype/font-lister.cpp2
-rw-r--r--src/livarot/PathConversion.cpp27
-rw-r--r--src/livarot/PathCutting.cpp6
-rw-r--r--src/livarot/PathOutline.cpp4
-rw-r--r--src/livarot/ShapeMisc.cpp4
-rw-r--r--src/marker.cpp4
-rw-r--r--src/marker.h2
-rw-r--r--src/mesh-context.cpp2
-rw-r--r--src/selection-chemistry.cpp20
-rw-r--r--src/selection-describer.cpp15
-rw-r--r--src/selection.cpp14
-rw-r--r--src/sp-anchor.cpp4
-rw-r--r--src/sp-anchor.h4
-rw-r--r--src/sp-ellipse.cpp8
-rw-r--r--src/sp-ellipse.h4
-rw-r--r--src/sp-flowregion.cpp4
-rw-r--r--src/sp-flowregion.h4
-rw-r--r--src/sp-flowtext.cpp10
-rw-r--r--src/sp-flowtext.h8
-rw-r--r--src/sp-image.cpp10
-rw-r--r--src/sp-image.h8
-rw-r--r--src/sp-item-group.cpp15
-rw-r--r--src/sp-item-group.h10
-rw-r--r--src/sp-item.cpp59
-rw-r--r--src/sp-item.h25
-rw-r--r--src/sp-line.cpp4
-rw-r--r--src/sp-line.h4
-rw-r--r--src/sp-linear-gradient.cpp2
-rw-r--r--src/sp-lpe-item.cpp2
-rw-r--r--src/sp-mesh-gradient.cpp2
-rw-r--r--src/sp-mesh-row.cpp2
-rw-r--r--src/sp-metadata.cpp2
-rw-r--r--src/sp-object.cpp6
-rw-r--r--src/sp-offset.cpp6
-rw-r--r--src/sp-offset.h6
-rw-r--r--src/sp-path.cpp6
-rw-r--r--src/sp-path.h6
-rw-r--r--src/sp-polygon.cpp2
-rw-r--r--src/sp-polygon.h2
-rw-r--r--src/sp-polyline.cpp2
-rw-r--r--src/sp-polyline.h2
-rw-r--r--src/sp-rect.cpp6
-rw-r--r--src/sp-rect.h6
-rw-r--r--src/sp-script.cpp6
-rw-r--r--src/sp-shape.cpp9
-rw-r--r--src/sp-shape.h6
-rw-r--r--src/sp-spiral.cpp6
-rw-r--r--src/sp-spiral.h6
-rw-r--r--src/sp-star.cpp6
-rw-r--r--src/sp-star.h6
-rw-r--r--src/sp-switch.cpp6
-rw-r--r--src/sp-switch.h4
-rw-r--r--src/sp-symbol.cpp2
-rw-r--r--src/sp-symbol.h2
-rw-r--r--src/sp-text.cpp10
-rw-r--r--src/sp-text.h8
-rw-r--r--src/sp-tref.cpp23
-rw-r--r--src/sp-tref.h7
-rw-r--r--src/sp-tspan.cpp4
-rw-r--r--src/sp-tspan.h4
-rw-r--r--src/sp-use.cpp14
-rw-r--r--src/sp-use.h9
-rw-r--r--src/svg/svg-length.cpp3
-rw-r--r--src/text-editing.cpp12
-rw-r--r--src/trace/siox.cpp2
-rw-r--r--src/ui/dialog/document-properties.cpp30
-rw-r--r--src/ui/dialog/export.cpp41
-rw-r--r--src/ui/dialog/export.h9
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp2
-rw-r--r--src/util/units.cpp11
-rw-r--r--src/util/units.h4
-rw-r--r--src/winmain.cpp8
145 files changed, 3004 insertions, 1983 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index ff99fccba..32442746d 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -1325,53 +1325,50 @@ SPGroup *box3d_convert_to_group(SPBox3D *box)
return SP_GROUP(doc->getObjectByRepr(grepr));
}
-const char *SPBox3D::displayName() {
+const char *SPBox3D::displayName() const {
return _("3D Box");
}
-gchar *SPBox3D::description() {
+gchar *SPBox3D::description() const {
// We could put more details about the 3d box here
return g_strdup("");
}
static inline void
-box3d_push_back_corner_pair(SPBox3D *box, std::list<std::pair<Geom::Point, Geom::Point> > &pts, int c1, int c2) {
+box3d_push_back_corner_pair(SPBox3D const *box, std::list<std::pair<Geom::Point, Geom::Point> > &pts, int c1, int c2) {
pts.push_back(std::make_pair(box3d_get_corner_screen(box, c1, false),
box3d_get_corner_screen(box, c2, false)));
}
-void SPBox3D::convert_to_guides() {
- SPBox3D* item = this;
- SPBox3D *box = item;
-
+void SPBox3D::convert_to_guides() const {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (!prefs->getBool("/tools/shapes/3dbox/convertguides", true)) {
- box->convert_to_guides();
+ this->convert_to_guides();
return;
}
std::list<std::pair<Geom::Point, Geom::Point> > pts;
/* perspective lines in X direction */
- box3d_push_back_corner_pair(box, pts, 0, 1);
- box3d_push_back_corner_pair(box, pts, 2, 3);
- box3d_push_back_corner_pair(box, pts, 4, 5);
- box3d_push_back_corner_pair(box, pts, 6, 7);
+ box3d_push_back_corner_pair(this, pts, 0, 1);
+ box3d_push_back_corner_pair(this, pts, 2, 3);
+ box3d_push_back_corner_pair(this, pts, 4, 5);
+ box3d_push_back_corner_pair(this, pts, 6, 7);
/* perspective lines in Y direction */
- box3d_push_back_corner_pair(box, pts, 0, 2);
- box3d_push_back_corner_pair(box, pts, 1, 3);
- box3d_push_back_corner_pair(box, pts, 4, 6);
- box3d_push_back_corner_pair(box, pts, 5, 7);
+ box3d_push_back_corner_pair(this, pts, 0, 2);
+ box3d_push_back_corner_pair(this, pts, 1, 3);
+ box3d_push_back_corner_pair(this, pts, 4, 6);
+ box3d_push_back_corner_pair(this, pts, 5, 7);
/* perspective lines in Z direction */
- box3d_push_back_corner_pair(box, pts, 0, 4);
- box3d_push_back_corner_pair(box, pts, 1, 5);
- box3d_push_back_corner_pair(box, pts, 2, 6);
- box3d_push_back_corner_pair(box, pts, 3, 7);
+ box3d_push_back_corner_pair(this, pts, 0, 4);
+ box3d_push_back_corner_pair(this, pts, 1, 5);
+ box3d_push_back_corner_pair(this, pts, 2, 6);
+ box3d_push_back_corner_pair(this, pts, 3, 7);
- sp_guide_pt_pairs_to_guides(item->document, pts);
+ sp_guide_pt_pairs_to_guides(this->document, pts);
}
/*
diff --git a/src/box3d.h b/src/box3d.h
index 1dec1e792..4107d2452 100644
--- a/src/box3d.h
+++ b/src/box3d.h
@@ -60,9 +60,9 @@ public:
virtual const char* display_name();
virtual Geom::Affine set_transform(Geom::Affine const &transform);
- virtual void convert_to_guides();
- virtual const char* displayName();
- virtual gchar *description();
+ virtual void convert_to_guides() const;
+ virtual const char* displayName() const;
+ virtual gchar *description() const;
};
void box3d_position_set (SPBox3D *box);
diff --git a/src/desktop.cpp b/src/desktop.cpp
index f5c35514c..ec446e0f0 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -681,7 +681,6 @@ void SPDesktop::set_event_context2(const std::string& toolName) {
SPEventContext* ec_new = ToolFactory::instance().createObject(toolName);
ec_new->desktop = this;
ec_new->message_context = new Inkscape::MessageContext(this->messageStack());
- ec_new->setup();
event_context = ec_new;
@@ -690,6 +689,8 @@ void SPDesktop::set_event_context2(const std::string& toolName) {
delete ec_old;
}
+ ec_new->setup();
+
sp_event_context_activate(event_context);
_event_context_changed_signal.emit(this, event_context);
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index 55d54b770..f37f4d3c4 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -197,7 +197,7 @@ DrawingText::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, un
return DrawingGroup::_updateItem(area, ctx, flags, reset);
}
-void DrawingText::decorateStyle(DrawingContext &ct, double vextent, double xphase, Geom::Point p1, Geom::Point p2)
+void DrawingText::decorateStyle(DrawingContext &ct, double vextent, double xphase, Geom::Point const &p1, Geom::Point const &p2)
{
double wave[16]={
0.000000, 0.382499, 0.706825, 0.923651, 1.000000, 0.923651, 0.706825, 0.382499,
@@ -311,28 +311,25 @@ pf = Geom::Point(step * round(p2[Geom::X]/step),p2[Geom::Y]);
}
/* returns scaled line thickness */
-double DrawingText::decorateItem(DrawingContext &ct, Geom::Affine aff, double phase_length)
+double DrawingText::decorateItem(DrawingContext &ct, Geom::Affine const &aff, double phase_length)
{
- double tsp_width_adj, tsp_asc_adj, tsp_size_adj;
- double final_underline_thickness, final_line_through_thickness;
- double thickness;
-
- tsp_width_adj = _nrstyle.tspan_width / _nrstyle.font_size;
- tsp_asc_adj = _nrstyle.ascender / _nrstyle.font_size;
- tsp_size_adj = (_nrstyle.ascender + _nrstyle.descender) / _nrstyle.font_size;
-#define VALTRUNC(A,B,C) (A < B ? B : ( A > C ? C : A ))
- final_underline_thickness = VALTRUNC(_nrstyle.underline_thickness, tsp_size_adj/30.0, tsp_size_adj/10.0);
- final_line_through_thickness = VALTRUNC(_nrstyle.line_through_thickness, tsp_size_adj/30.0, tsp_size_adj/10.0);
- Inkscape::DrawingContext::Save save(ct);
+ double tsp_width_adj = _nrstyle.tspan_width / _nrstyle.font_size;
+ double tsp_asc_adj = _nrstyle.ascender / _nrstyle.font_size;
+ double tsp_size_adj = (_nrstyle.ascender + _nrstyle.descender) / _nrstyle.font_size;
+
+ double final_underline_thickness = CLAMP(_nrstyle.underline_thickness, tsp_size_adj/30.0, tsp_size_adj/10.0);
+ double final_line_through_thickness = CLAMP(_nrstyle.line_through_thickness, tsp_size_adj/30.0, tsp_size_adj/10.0);
double scale = aff.descrim();
double xphase = phase_length/ _nrstyle.font_size; // used to figure out phase of patterns
+ Inkscape::DrawingContext::Save save(ct);
ct.transform(aff); // must be leftmost affine in span
+
Geom::Point p1;
Geom::Point p2;
// All lines must be the same thickness, in combinations, line_through trumps underline
- thickness = final_underline_thickness;
+ double thickness = final_underline_thickness;
if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_UNDERLINE){
p1 = Geom::Point(0.0, -_nrstyle.underline_position);
p2 = Geom::Point(tsp_width_adj,-_nrstyle.underline_position);
@@ -393,21 +390,32 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are
bool firsty = true;
bool decorate = true;
double starty = 0.0;
- bool has_stroke, has_fill;
Geom::Affine aff;
using Geom::X;
using Geom::Y;
- has_fill = _nrstyle.prepareFill( ct, _item_bbox);
- has_stroke = _nrstyle.prepareStroke(ct, _item_bbox);
+ // NOTE:
+ // prepareFill / prepareStroke need to be called with _ctm in effect.
+ // However, we might need to apply a different ctm for glyphs.
+ // Therefore, only apply this ctm temporarily.
+ bool has_stroke, has_fill;
+ {
+ Inkscape::DrawingContext::Save save(ct);
+ ct.transform(_ctm);
+
+ has_fill = _nrstyle.prepareFill( ct, _item_bbox);
+ has_stroke = _nrstyle.prepareStroke(ct, _item_bbox);
+ }
if (has_fill || has_stroke) {
Geom::Affine rotinv;
- bool invset=false;
+ bool invset = false;
+
+ // accumulate the path that represents the glyphs
for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) {
DrawingGlyphs *g = dynamic_cast<DrawingGlyphs *>(&*i);
if (!g) throw InvalidItemException();
- if(!invset){
+ if (!invset) {
rotinv = g->_ctm.withoutTranslation().inverse();
invset = true;
}
@@ -415,14 +423,14 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are
Inkscape::DrawingContext::Save save(ct);
if (g->_ctm.isSingular()) continue;
ct.transform(g->_ctm);
- if(g->_drawable){
+ if (g->_drawable) {
ct.path(*g->_font->PathVector(g->_glyph));
}
// get the leftmost affine transform (leftmost defined with respect to the x axis of the first transform).
// That way the decoration will work no matter what mix of L->R, R->L text is in the span.
- if(_nrstyle.text_decoration_line != TEXT_DECORATION_LINE_CLEAR){
- Geom::Point pt =g->_ctm.translation() * rotinv;
- if(pt[X] < leftmost){
+ if (_nrstyle.text_decoration_line != TEXT_DECORATION_LINE_CLEAR) {
+ Geom::Point pt = g->_ctm.translation() * rotinv;
+ if (pt[X] < leftmost) {
leftmost = pt[X];
aff = g->_ctm;
phase_length = g->_pl;
@@ -430,18 +438,20 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are
/* If the text has been mapped onto a path, which causes y to vary, drop the text decorations.
To handle that properly would need a conformal map
*/
- if(firsty){
+ if (firsty) {
firsty = false;
starty = pt[Y];
}
- else {
- if(fabs(pt[Y] - starty) > 1.0e-6)decorate=false;
+ else if (fabs(pt[Y] - starty) > 1.0e-6) {
+ decorate = false;
}
}
}
+ // draw the text itself
+ // we need to apply this object's ctm again
Inkscape::DrawingContext::Save save(ct);
- ct.transform(_ctm); // For one thing, this is needed to scale a fill-pattern when zooming in
+ ct.transform(_ctm);
if (has_fill) {
_nrstyle.applyFill(ct);
ct.fillPreserve();
@@ -451,9 +461,11 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are
ct.strokePreserve();
}
ct.newPath(); // clear path
- if(_nrstyle.text_decoration_line != TEXT_DECORATION_LINE_CLEAR && decorate){
+
+ // draw text decoration
+ if (_nrstyle.text_decoration_line != TEXT_DECORATION_LINE_CLEAR && decorate) {
guint32 ergba;
- if(_nrstyle.text_decoration_useColor){ // color different from the glyph
+ if (_nrstyle.text_decoration_useColor) { // color different from the glyph
ergba = SP_RGBA32_F_COMPOSE(
_nrstyle.text_decoration_color.color.v.c[0],
_nrstyle.text_decoration_color.color.v.c[1],
diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h
index 99b46bc8a..fd122b54b 100644
--- a/src/display/drawing-text.h
+++ b/src/display/drawing-text.h
@@ -68,8 +68,8 @@ protected:
virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags);
virtual bool _canClip();
- double decorateItem(DrawingContext &ct, Geom::Affine aff, double phase_length);
- void decorateStyle(DrawingContext &ct, double vextent, double xphase, Geom::Point p1, Geom::Point p2);
+ double decorateItem(DrawingContext &ct, Geom::Affine const &aff, double phase_length);
+ void decorateStyle(DrawingContext &ct, double vextent, double xphase, Geom::Point const &p1, Geom::Point const &p2);
NRStyle _nrstyle;
friend class DrawingGlyphs;
diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp
index 9d7c32585..b96e24cbc 100644
--- a/src/display/nr-filter-gaussian.cpp
+++ b/src/display/nr-filter-gaussian.cpp
@@ -304,10 +304,9 @@ filter2D_IIR(PT *const dest, int const dstr1, int const dstr2,
#define PREMUL_ALPHA_LOOP for(unsigned int c=1; c<PC; ++c)
#endif
+INK_UNUSED(num_threads); // to suppress unused argument compiler warning
#if HAVE_OPENMP
#pragma omp parallel for num_threads(num_threads)
-#else
- INK_UNUSED(num_threads);
#endif // HAVE_OPENMP
for ( int c2 = 0 ; c2 < n2 ; c2++ ) {
#if HAVE_OPENMP
@@ -375,10 +374,9 @@ filter2D_FIR(PT *const dst, int const dstr1, int const dstr2,
// Past pixels seen (to enable in-place operation)
PT history[scr_len+1][PC];
+INK_UNUSED(num_threads); // suppresses unused argument compiler warning
#if HAVE_OPENMP
#pragma omp parallel for num_threads(num_threads) private(history)
-#else
- INK_UNUSED(num_threads);
#endif // HAVE_OPENMP
for ( int c2 = 0 ; c2 < n2 ; c2++ ) {
diff --git a/src/display/nr-filter-morphology.cpp b/src/display/nr-filter-morphology.cpp
index b058307cf..b6e5052e1 100644
--- a/src/display/nr-filter-morphology.cpp
+++ b/src/display/nr-filter-morphology.cpp
@@ -69,6 +69,7 @@ void morphologicalFilter1D(cairo_surface_t * const input, cairo_surface_t * cons
int limit = w * h;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int numOfThreads = prefs->getIntLimited("/options/threading/numthreads", omp_get_num_procs(), 1, 256);
+ (void) numOfThreads; // suppress unused variable warning
#pragma omp parallel for if(limit > OPENMP_THRESHOLD) num_threads(numOfThreads)
#endif // HAVE_OPENMP
for (int i = 0; i < h; ++i) {
diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp
index fca82c810..95d5d4b09 100644
--- a/src/display/nr-filter-primitive.cpp
+++ b/src/display/nr-filter-primitive.cpp
@@ -110,8 +110,16 @@ void FilterPrimitive::set_subregion(SVGLength const &x, SVGLength const &y,
Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units)
{
- Geom::OptRect bb = units.get_item_bbox();
- Geom::OptRect fa = units.get_filter_area();
+ Geom::OptRect const bb_opt = units.get_item_bbox();
+ Geom::OptRect const fa_opt = units.get_filter_area();
+ Geom::Rect bb;
+ Geom::Rect fa;
+ if (!bb_opt || !fa_opt) {
+ return Geom::Rect (Geom::Point(0.,0.), Geom::Point(0.,0.));
+ } else {
+ bb = *bb_opt;
+ fa = *fa_opt;
+ }
// This is definitely a hack... but what else to do?
// Current viewport might not be document viewport... but how to find?
@@ -127,8 +135,8 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units)
/* Update computed values for ex, em, %. For %, assumes primitive unit is objectBoundingBox. */
/* TODO: fetch somehow the object ex and em lengths; 12, 6 are just dummy values. */
- double len_x = bb->width();
- double len_y = bb->height();
+ double len_x = bb.width();
+ double len_y = bb.height();
_subregion_x.update(12, 6, len_x);
_subregion_y.update(12, 6, len_y);
_subregion_width.update(12, 6, len_x);
@@ -143,44 +151,37 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units)
double height = 0;
// If subregion not set, by special case use filter region.
- if( !_subregion_x._set ) x = fa->min()[X];
- if( !_subregion_y._set ) y = fa->min()[Y];
- if( !_subregion_width._set ) width = fa->width();
- if( !_subregion_height._set ) height = fa->height();
+ if( !_subregion_x._set ) x = fa.min()[X];
+ if( !_subregion_y._set ) y = fa.min()[Y];
+ if( !_subregion_width._set ) width = fa.width();
+ if( !_subregion_height._set ) height = fa.height();
if( units.get_primitive_units() == SP_FILTER_UNITS_OBJECTBOUNDINGBOX ) {
// Values are in terms of fraction of bounding box.
- if( _subregion_x._set && _subregion_x.unit != SVGLength::PERCENT ) x = bb->min()[X] + bb->width() * _subregion_x.value;
- if( _subregion_y._set && _subregion_y.unit != SVGLength::PERCENT ) y = bb->min()[Y] + bb->height() * _subregion_y.value;
- if( _subregion_width._set && _subregion_width.unit != SVGLength::PERCENT ) width = bb->width() * _subregion_width.value;
- if( _subregion_height._set && _subregion_height.unit != SVGLength::PERCENT ) height = bb->height() * _subregion_height.value;
- // Values are in terms of percent
- if( _subregion_x._set && _subregion_x.unit == SVGLength::PERCENT ) x = bb->min()[X] + _subregion_x.computed;
- if( _subregion_y._set && _subregion_y.unit == SVGLength::PERCENT ) y = bb->min()[Y] + _subregion_y.computed;
- if( _subregion_width._set && _subregion_width.unit == SVGLength::PERCENT ) width = _subregion_width.computed;
- if( _subregion_height._set && _subregion_height.unit == SVGLength::PERCENT ) height = _subregion_height.computed;
+ if( _subregion_x._set && (_subregion_x.unit != SVGLength::PERCENT) ) x = bb.min()[X] + bb.width() * _subregion_x.value;
+ if( _subregion_y._set && (_subregion_y.unit != SVGLength::PERCENT) ) y = bb.min()[Y] + bb.height() * _subregion_y.value;
+ if( _subregion_width._set && (_subregion_width.unit != SVGLength::PERCENT) ) width = bb.width() * _subregion_width.value;
+ if( _subregion_height._set && (_subregion_height.unit != SVGLength::PERCENT) ) height = bb.height() * _subregion_height.value;
+ // Values are in terms of percent
+ if( _subregion_x._set && (_subregion_x.unit == SVGLength::PERCENT) ) x = bb.min()[X] + _subregion_x.computed;
+ if( _subregion_y._set && (_subregion_y.unit == SVGLength::PERCENT) ) y = bb.min()[Y] + _subregion_y.computed;
+ if( _subregion_width._set && (_subregion_width.unit == SVGLength::PERCENT) ) width = _subregion_width.computed;
+ if( _subregion_height._set && (_subregion_height.unit == SVGLength::PERCENT) ) height = _subregion_height.computed;
} else {
// Values are in terms of user space coordinates or percent of viewbox (yuck!),
// which is usually the size of SVG drawing. Default.
- if( _subregion_x._set && _subregion_x.unit != SVGLength::PERCENT ) x = _subregion_x.computed;
- if( _subregion_y._set && _subregion_y.unit != SVGLength::PERCENT ) y = _subregion_y.computed;
- if( _subregion_width._set && _subregion_width.unit != SVGLength::PERCENT ) width = _subregion_width.computed;
- if( _subregion_height._set && _subregion_height.unit != SVGLength::PERCENT ) height = _subregion_height.computed;
+ if( _subregion_x._set && (_subregion_x.unit != SVGLength::PERCENT) ) x = _subregion_x.computed;
+ if( _subregion_y._set && (_subregion_y.unit != SVGLength::PERCENT) ) y = _subregion_y.computed;
+ if( _subregion_width._set && (_subregion_width.unit != SVGLength::PERCENT) ) width = _subregion_width.computed;
+ if( _subregion_height._set && (_subregion_height.unit != SVGLength::PERCENT) ) height = _subregion_height.computed;
// Percent of viewport
- if( _subregion_x._set && _subregion_x.unit == SVGLength::PERCENT ) x = _subregion_x.value * viewport.width();
- if( _subregion_y._set && _subregion_y.unit == SVGLength::PERCENT ) y = _subregion_y.value * viewport.height();
- if( _subregion_width._set && _subregion_width.unit == SVGLength::PERCENT ) width = _subregion_width.value * viewport.width();
- if( _subregion_height._set && _subregion_height.unit == SVGLength::PERCENT ) height = _subregion_height.value * viewport.height();
+ if( _subregion_x._set && (_subregion_x.unit == SVGLength::PERCENT) ) x = _subregion_x.value * viewport.width();
+ if( _subregion_y._set && (_subregion_y.unit == SVGLength::PERCENT) ) y = _subregion_y.value * viewport.height();
+ if( _subregion_width._set && (_subregion_width.unit == SVGLength::PERCENT) ) width = _subregion_width.value * viewport.width();
+ if( _subregion_height._set && (_subregion_height.unit == SVGLength::PERCENT) ) height = _subregion_height.value * viewport.height();
}
- Geom::Point minp, maxp;
- minp[X] = x;
- minp[Y] = y;
- maxp[X] = x + width;
- maxp[Y] = y + height;
-
- Geom::Rect area(minp, maxp);
- return area;
+ return Geom::Rect (Geom::Point(x,y), Geom::Point(x + width, y + height));
}
void FilterPrimitive::setStyle(SPStyle *style)
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index dcddd683e..a73d4b715 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -166,7 +166,7 @@ void SPDrawContext::finish() {
spdc_free_colors(this);
}
-void SPDrawContext::set(const Inkscape::Preferences::Entry& value) {
+void SPDrawContext::set(const Inkscape::Preferences::Entry& /*value*/) {
}
bool SPDrawContext::root_handler(GdkEvent* event) {
diff --git a/src/event-context.cpp b/src/event-context.cpp
index e5ea85818..398d3b0e3 100644
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -77,7 +77,7 @@ static guint32 scroll_event_time = 0;
static gdouble scroll_multiply = 1;
static guint scroll_keyval = 0;
-void SPEventContext::set(const Inkscape::Preferences::Entry& val) {
+void SPEventContext::set(const Inkscape::Preferences::Entry& /*val*/) {
}
void SPEventContext::activate() {
diff --git a/src/extension/internal/bitmap/despeckle.cpp b/src/extension/internal/bitmap/despeckle.cpp
index f818ef81a..c40e6e227 100644
--- a/src/extension/internal/bitmap/despeckle.cpp
+++ b/src/extension/internal/bitmap/despeckle.cpp
@@ -23,7 +23,7 @@ Despeckle::applyEffect(Magick::Image *image) {
}
void
-Despeckle::refreshParameters(Inkscape::Extension::Effect *module) {
+Despeckle::refreshParameters(Inkscape::Extension::Effect */*module*/) {
}
#include "../clear-n_.h"
diff --git a/src/extension/internal/bitmap/enhance.cpp b/src/extension/internal/bitmap/enhance.cpp
index 0bd362e8c..5b06a2d27 100644
--- a/src/extension/internal/bitmap/enhance.cpp
+++ b/src/extension/internal/bitmap/enhance.cpp
@@ -23,7 +23,7 @@ Enhance::applyEffect(Magick::Image *image) {
}
void
-Enhance::refreshParameters(Inkscape::Extension::Effect *module) { }
+Enhance::refreshParameters(Inkscape::Extension::Effect */*module*/) { }
#include "../clear-n_.h"
diff --git a/src/extension/internal/bitmap/equalize.cpp b/src/extension/internal/bitmap/equalize.cpp
index b0726b61a..6098f74b1 100644
--- a/src/extension/internal/bitmap/equalize.cpp
+++ b/src/extension/internal/bitmap/equalize.cpp
@@ -23,7 +23,7 @@ Equalize::applyEffect(Magick::Image *image) {
}
void
-Equalize::refreshParameters(Inkscape::Extension::Effect *module) { }
+Equalize::refreshParameters(Inkscape::Extension::Effect */*module*/) { }
#include "../clear-n_.h"
diff --git a/src/extension/internal/bitmap/negate.cpp b/src/extension/internal/bitmap/negate.cpp
index 2e564821e..4737e6443 100644
--- a/src/extension/internal/bitmap/negate.cpp
+++ b/src/extension/internal/bitmap/negate.cpp
@@ -23,7 +23,7 @@ Negate::applyEffect(Magick::Image* image) {
}
void
-Negate::refreshParameters(Inkscape::Extension::Effect* module) {
+Negate::refreshParameters(Inkscape::Extension::Effect* /*module*/) {
}
#include "../clear-n_.h"
diff --git a/src/extension/internal/bitmap/normalize.cpp b/src/extension/internal/bitmap/normalize.cpp
index 591fe1fdd..1444aa654 100644
--- a/src/extension/internal/bitmap/normalize.cpp
+++ b/src/extension/internal/bitmap/normalize.cpp
@@ -23,7 +23,7 @@ Normalize::applyEffect(Magick::Image* image) {
}
void
-Normalize::refreshParameters(Inkscape::Extension::Effect* module) {
+Normalize::refreshParameters(Inkscape::Extension::Effect* /*module*/) {
}
#include "../clear-n_.h"
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp
index 04087e268..0111ed626 100644
--- a/src/extension/internal/cdr-input.cpp
+++ b/src/extension/internal/cdr-input.cpp
@@ -256,8 +256,9 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
}
SPDocument * doc = SPDocument::createNewDocFromMem(tmpSVGOutput[page_num-1].cstr(), strlen(tmpSVGOutput[page_num-1].cstr()), TRUE);
+
// Set viewBox if it doesn't exist
- if (!doc->getRoot()->viewBox_set) {
+ if (doc && !doc->getRoot()->viewBox_set) {
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit())));
}
return doc;
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index 36d7ca145..c8c708051 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -3496,7 +3496,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
d.tri = trinfo_release_except_FC(d.tri);
// Set viewBox if it doesn't exist
- if (!doc->getRoot()->viewBox_set) {
+ if (doc && !doc->getRoot()->viewBox_set) {
bool saved = Inkscape::DocumentUndo::getUndoSensitive(doc);
Inkscape::DocumentUndo::setUndoSensitive(doc, false);
@@ -3511,15 +3511,14 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// Set viewBox
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc_unit), doc->getHeight().value(doc_unit)));
+ doc->ensureUpToDate();
// Scale and translate objects
- double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit);
+ double scale = Inkscape::Util::Quantity::convert(1, "px", doc_unit);
ShapeEditor::blockSetItem(true);
- doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, SP_ACTIVE_DOCUMENT->getHeight().value("px")));
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px")));
ShapeEditor::blockSetItem(false);
-
- doc->ensureUpToDate();
-
+
Inkscape::DocumentUndo::setUndoSensitive(doc, saved);
}
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index f47fbaf87..c45367c08 100644
--- a/src/extension/internal/pdf-input-cairo.cpp
+++ b/src/extension/internal/pdf-input-cairo.cpp
@@ -625,7 +625,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
SPDocument * doc = SPDocument::createNewDocFromMem(output->c_str(), output->length(), TRUE);
// Set viewBox if it doesn't exist
- if (!doc->getRoot()->viewBox_set) {
+ if (doc && !doc->getRoot()->viewBox_set) {
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit())));
}
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index 2e55dcb1e..3f37e4402 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -3181,7 +3181,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
d.tri = trinfo_release_except_FC(d.tri);
// Set viewBox if it doesn't exist
- if (!doc->getRoot()->viewBox_set) {
+ if (doc && !doc->getRoot()->viewBox_set) {
bool saved = Inkscape::DocumentUndo::getUndoSensitive(doc);
Inkscape::DocumentUndo::setUndoSensitive(doc, false);
@@ -3196,15 +3196,14 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
// Set viewBox
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc_unit), doc->getHeight().value(doc_unit)));
-
+ doc->ensureUpToDate();
+
// Scale and translate objects
- double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit);
+ double scale = Inkscape::Util::Quantity::convert(1, "px", doc_unit);
ShapeEditor::blockSetItem(true);
- doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, SP_ACTIVE_DOCUMENT->getHeight().value("px")));
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px")));
ShapeEditor::blockSetItem(false);
-
- doc->ensureUpToDate();
-
+
Inkscape::DocumentUndo::setUndoSensitive(doc, saved);
}
diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp
index 3bb17146c..d60b2adf7 100644
--- a/src/extension/internal/wmf-print.cpp
+++ b/src/extension/internal/wmf-print.cpp
@@ -1101,7 +1101,7 @@ unsigned int PrintWmf::image(
unsigned int w, /** width of bitmap */
unsigned int h, /** height of bitmap */
unsigned int rs, /** row stride (normally w*4) */
- Geom::Affine const &tf_ignore, /** WRONG affine transform, use the one from m_tr_stack */
+ Geom::Affine const & /*tf_ignore*/, /** WRONG affine transform, use the one from m_tr_stack */
SPStyle const *style) /** provides indirect link to image object */
{
double x1, y1, dw, dh;
diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
index b5eb3ce8f..14ff3ec77 100644
--- a/src/extension/internal/wpg-input.cpp
+++ b/src/extension/internal/wpg-input.cpp
@@ -113,7 +113,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
SPDocument * doc = SPDocument::createNewDocFromMem(output.cstr(), strlen(output.cstr()), TRUE);
// Set viewBox if it doesn't exist
- if (!doc->getRoot()->viewBox_set) {
+ if (doc && !doc->getRoot()->viewBox_set) {
doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit())));
}
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
index a4c370f4c..c0211032c 100644
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -592,10 +592,14 @@ get_file_save_extension (Inkscape::Extension::FileSaveMethod method) {
case FILE_SAVE_METHOD_INKSCAPE_SVG:
extension = SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE;
break;
+ case FILE_SAVE_METHOD_EXPORT:
+ /// \todo no default extension set for Export? defaults to SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE is ok?
+ break;
}
- if(extension.empty())
+ if(extension.empty()) {
extension = SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE;
+ }
return extension;
}
@@ -635,13 +639,19 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) {
// leave this as a choice to the user.
path = prefs->getString("/dialogs/save_as/path");
}
+ break;
+ case FILE_SAVE_METHOD_EXPORT:
+ /// \todo no default path set for Export?
+ // defaults to g_get_home_dir()
+ break;
}
- if(path.empty())
+ if(path.empty()) {
path = g_get_home_dir(); // Is this the most sensible solution? Note that we should avoid
// g_get_current_dir because this leads to problems on OS X where
// Inkscape opens the dialog inside application bundle when it is
// invoked for the first teim.
+ }
return path;
}
@@ -658,6 +668,7 @@ store_file_extension_in_prefs (Glib::ustring extension, FileSaveMethod method) {
prefs->setString("/dialogs/save_copy/default", extension);
break;
case FILE_SAVE_METHOD_INKSCAPE_SVG:
+ case FILE_SAVE_METHOD_EXPORT:
// do nothing
break;
}
@@ -675,6 +686,7 @@ store_save_path_in_prefs (Glib::ustring path, FileSaveMethod method) {
prefs->setString("/dialogs/save_copy/path", path);
break;
case FILE_SAVE_METHOD_INKSCAPE_SVG:
+ case FILE_SAVE_METHOD_EXPORT:
// do nothing
break;
}
diff --git a/src/libavoid/connector.cpp b/src/libavoid/connector.cpp
index cf8cfa11a..8dcb66f2d 100644
--- a/src/libavoid/connector.cpp
+++ b/src/libavoid/connector.cpp
@@ -1736,7 +1736,8 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly,
!reversedY);
}
else
- {
+ { /// \todo FIXME: this whole branch was not doing anything
+ /*
int turnDirA = vecDir(a0, a1, a2);
int turnDirB = vecDir(b0, b1, b2);
bool reversed = (side1 != -turnDirA);
@@ -1761,6 +1762,7 @@ CrossingsInfoPair countRealCrossings(Avoid::Polygon& poly,
}
VertID vID(b1.id, true, b1.vn);
//(*pointOrders)[b1].addPoints(&b1, &a1, reversed);
+ */
}
}
}
diff --git a/src/libcola/cola.h b/src/libcola/cola.h
index e1f19994e..a4b05fd92 100644
--- a/src/libcola/cola.h
+++ b/src/libcola/cola.h
@@ -120,7 +120,7 @@ public:
maxiterations(maxiterations) { reset(); }
virtual ~TestConvergence() {}
- virtual bool operator()(double new_stress, double* X, double* Y) {
+ virtual bool operator()(double new_stress, double* /*X*/, double* /*Y*/) {
//std::cout<<"iteration="<<iterations<<", new_stress="<<new_stress<<std::endl;
if (old_stress == DBL_MAX) {
old_stress = new_stress;
diff --git a/src/libcroco/cr-additional-sel.c b/src/libcroco/cr-additional-sel.c
index 80a4767e0..5a37eba6c 100644
--- a/src/libcroco/cr-additional-sel.c
+++ b/src/libcroco/cr-additional-sel.c
@@ -26,15 +26,28 @@
#include "string.h"
/**
- *Default constructor of #CRAdditionalSel.
- *@return the newly build instance of #CRAdditionalSel.
+ * CRAdditionalSel:
+ *
+ * #CRAdditionalSel abstracts an additionnal selector.
+ * An additional selector is the selector part
+ * that comes after the combination of type selectors.
+ * It can be either "a class selector (the .class part),
+ * a pseudo class selector, an attribute selector
+ * or an id selector.
+ */
+
+/**
+ * cr_additional_sel_new:
+ *
+ * Default constructor of #CRAdditionalSel.
+ * Returns the newly build instance of #CRAdditionalSel.
*/
CRAdditionalSel *
cr_additional_sel_new (void)
{
CRAdditionalSel *result = NULL;
- result = (CRAdditionalSel *)g_try_malloc (sizeof (CRAdditionalSel));
+ result = g_try_malloc (sizeof (CRAdditionalSel));
if (result == NULL) {
cr_utils_trace_debug ("Out of memory");
@@ -47,10 +60,12 @@ cr_additional_sel_new (void)
}
/**
- *Constructor of #CRAdditionalSel.
- *@param a_sel_type the type of the newly built instance
- *of #CRAdditionalSel.
- *@return the newly built instance of #CRAdditionalSel.
+ * cr_additional_sel_new_with_type:
+ * @a_sel_type: the type of the newly built instance
+ * of #CRAdditionalSel.
+ *
+ * Constructor of #CRAdditionalSel.
+ * Returns the newly built instance of #CRAdditionalSel.
*/
CRAdditionalSel *
cr_additional_sel_new_with_type (enum AddSelectorType a_sel_type)
@@ -67,12 +82,13 @@ cr_additional_sel_new_with_type (enum AddSelectorType a_sel_type)
}
/**
- *Sets a new class name to a
- *CLASS additional selector.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
- *@param a_class_name the new class name to set.
+ * cr_additional_sel_set_class_name:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ * @a_class_name: the new class name to set.
*
+ * Sets a new class name to a
+ * CLASS additional selector.
*/
void
cr_additional_sel_set_class_name (CRAdditionalSel * a_this,
@@ -88,11 +104,13 @@ cr_additional_sel_set_class_name (CRAdditionalSel * a_this,
}
/**
- *Sets a new id name to an
- *ID additional selector.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
- *@param a_id the new id to set.
+ * cr_additional_sel_set_id_name:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ * @a_id: the new id to set.
+ *
+ * Sets a new id name to an
+ * ID additional selector.
*/
void
cr_additional_sel_set_id_name (CRAdditionalSel * a_this, CRString * a_id)
@@ -107,11 +125,13 @@ cr_additional_sel_set_id_name (CRAdditionalSel * a_this, CRString * a_id)
}
/**
- *Sets a new pseudo to a
- *PSEUDO additional selector.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
- *@param a_pseudo the new pseudo to set.
+ * cr_additional_sel_set_pseudo:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ * @a_pseudo: the new pseudo to set.
+ *
+ * Sets a new pseudo to a
+ * PSEUDO additional selector.
*/
void
cr_additional_sel_set_pseudo (CRAdditionalSel * a_this, CRPseudo * a_pseudo)
@@ -127,11 +147,13 @@ cr_additional_sel_set_pseudo (CRAdditionalSel * a_this, CRPseudo * a_pseudo)
}
/**
- *Sets a new instance of #CRAttrSel to
- *a ATTRIBUTE additional selector.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
- *@param a_sel the new instance of #CRAttrSel to set.
+ * cr_additional_sel_set_attr_sel:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ * @a_sel: the new instance of #CRAttrSel to set.
+ *
+ * Sets a new instance of #CRAttrSel to
+ * a ATTRIBUTE additional selector.
*/
void
cr_additional_sel_set_attr_sel (CRAdditionalSel * a_this, CRAttrSel * a_sel)
@@ -146,12 +168,15 @@ cr_additional_sel_set_attr_sel (CRAdditionalSel * a_this, CRAttrSel * a_sel)
}
/**
- *Appends a new instance of #CRAdditional to the
- *current list of #CRAdditional.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
- *@param a_sel the new instance to #CRAdditional to append.
- *@return the new list of CRAdditionalSel or NULL if an error arises.
+ * cr_additional_sel_append:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ * @a_sel: the new instance to #CRAdditional to append.
+ *
+ * Appends a new instance of #CRAdditional to the
+ * current list of #CRAdditional.
+ *
+ * Returns the new list of CRAdditionalSel or NULL if an error arises.
*/
CRAdditionalSel *
cr_additional_sel_append (CRAdditionalSel * a_this, CRAdditionalSel * a_sel)
@@ -179,12 +204,15 @@ cr_additional_sel_append (CRAdditionalSel * a_this, CRAdditionalSel * a_sel)
}
/**
- *Preppends a new instance of #CRAdditional to the
- *current list of #CRAdditional.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
- *@param a_sel the new instance to #CRAdditional to preappend.
- *@return the new list of CRAdditionalSel or NULL if an error arises.
+ * cr_additional_sel_prepend:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ * @a_sel: the new instance to #CRAdditional to preappend.
+ *
+ * Preppends a new instance of #CRAdditional to the
+ * current list of #CRAdditional.
+ *
+ * Returns the new list of CRAdditionalSel or NULL if an error arises.
*/
CRAdditionalSel *
cr_additional_sel_prepend (CRAdditionalSel * a_this, CRAdditionalSel * a_sel)
@@ -202,11 +230,11 @@ cr_additional_sel_prepend (CRAdditionalSel * a_this, CRAdditionalSel * a_sel)
}
guchar *
-cr_additional_sel_to_string (CRAdditionalSel * a_this)
+cr_additional_sel_to_string (CRAdditionalSel const * a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
- CRAdditionalSel *cur = NULL;
+ CRAdditionalSel const *cur = NULL;
g_return_val_if_fail (a_this, NULL);
@@ -219,7 +247,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this)
guchar *name = NULL;
if (cur->content.class_name) {
- name = (guchar *)g_strndup
+ name = g_strndup
(cur->content.class_name->stryng->str,
cur->content.class_name->stryng->len);
@@ -239,7 +267,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this)
guchar *name = NULL;
if (cur->content.class_name) {
- name = (guchar *)g_strndup
+ name = g_strndup
(cur->content.id_name->stryng->str,
cur->content.id_name->stryng->len);
@@ -295,7 +323,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this)
}
if (str_buf) {
- result = (guchar *)str_buf->str;
+ result = str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
@@ -304,7 +332,7 @@ cr_additional_sel_to_string (CRAdditionalSel * a_this)
}
guchar *
-cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
+cr_additional_sel_one_to_string (CRAdditionalSel const *a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
@@ -319,7 +347,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
guchar *name = NULL;
if (a_this->content.class_name) {
- name = (guchar *)g_strndup
+ name = g_strndup
(a_this->content.class_name->stryng->str,
a_this->content.class_name->stryng->len);
@@ -339,7 +367,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
guchar *name = NULL;
if (a_this->content.class_name) {
- name = (guchar *)g_strndup
+ name = g_strndup
(a_this->content.id_name->stryng->str,
a_this->content.id_name->stryng->len);
@@ -394,7 +422,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
}
if (str_buf) {
- result = (guchar *)str_buf->str;
+ result = str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
@@ -403,13 +431,15 @@ cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
}
/**
- *Dumps the current instance of #CRAdditionalSel to a file
- *@param a_this the "this pointer" of the current instance of
- *#CRAdditionalSel.
- *@param a_fp the destination file.
+ * cr_additional_sel_dump:
+ * @a_this: the "this pointer" of the current instance of
+ * #CRAdditionalSel.
+ * @a_fp: the destination file.
+ *
+ * Dumps the current instance of #CRAdditionalSel to a file
*/
void
-cr_additional_sel_dump (CRAdditionalSel * a_this, FILE * a_fp)
+cr_additional_sel_dump (CRAdditionalSel const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
@@ -426,9 +456,11 @@ cr_additional_sel_dump (CRAdditionalSel * a_this, FILE * a_fp)
}
/**
- *Destroys an instance of #CRAdditional.
- *@param a_this the "this pointer" of the current instance
- *of #CRAdditionalSel .
+ * cr_additional_sel_destroy:
+ * @a_this: the "this pointer" of the current instance
+ * of #CRAdditionalSel .
+ *
+ * Destroys an instance of #CRAdditional.
*/
void
cr_additional_sel_destroy (CRAdditionalSel * a_this)
diff --git a/src/libcroco/cr-additional-sel.h b/src/libcroco/cr-additional-sel.h
index 1ec1aa0ec..7ca3e07d5 100644
--- a/src/libcroco/cr-additional-sel.h
+++ b/src/libcroco/cr-additional-sel.h
@@ -22,11 +22,6 @@
*/
-/**
- *@file
- *This file holds the declaration of the
- *#CRAddSel class.
- */
#ifndef __CR_ADD_SEL_H__
#define __CR_ADD_SEL_H__
@@ -58,15 +53,6 @@ union CRAdditionalSelectorContent
typedef struct _CRAdditionalSel CRAdditionalSel ;
-/**
- *#CRAdditionalSel abstracts
- *an additionnal selector.
- *An additional selector is the selector part
- *that comes after the combination of type selectors.
- *It can be either "a class selector (the .class part),
- *a pseudo class selector, an attribute selector
- *or an id selector.
- */
struct _CRAdditionalSel
{
enum AddSelectorType type ;
@@ -99,11 +85,11 @@ void cr_additional_sel_set_attr_sel (CRAdditionalSel *a_this,
CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this,
CRAdditionalSel *a_sel) ;
-guchar * cr_additional_sel_to_string (CRAdditionalSel *a_this) ;
+guchar * cr_additional_sel_to_string (CRAdditionalSel const *a_this) ;
-guchar * cr_additional_sel_one_to_string (CRAdditionalSel *a_this) ;
+guchar * cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) ;
-void cr_additional_sel_dump (CRAdditionalSel *a_this, FILE *a_fp) ;
+void cr_additional_sel_dump (CRAdditionalSel const *a_this, FILE *a_fp) ;
void cr_additional_sel_destroy (CRAdditionalSel *a_this) ;
diff --git a/src/libcroco/cr-attr-sel.c b/src/libcroco/cr-attr-sel.c
index 0726f0f3e..7976ff1f8 100644
--- a/src/libcroco/cr-attr-sel.c
+++ b/src/libcroco/cr-attr-sel.c
@@ -24,34 +24,38 @@
#include "cr-attr-sel.h"
/**
- *@file
- *The class that abstracts an attribute selector.
- *Attributes selectors are described in the css2 spec [5.8].
- *There are more generally used in the css2 selectors described in
- *css2 spec [5] .
+ * CRAttrSel:
+ *
+ * #CRAdditionalSel abstracts an attribute selector.
+ * Attributes selectors are described in the css2 spec [5.8].
+ * There are more generally used in the css2 selectors described in
+ * css2 spec [5] .
*/
/**
- *The constructor of #CRAttrSel.
- *@return the newly allocated instance
- *of #CRAttrSel.
+ * cr_attr_sel_new:
+ * The constructor of #CRAttrSel.
+ * Returns the newly allocated instance
+ * of #CRAttrSel.
*/
CRAttrSel *
cr_attr_sel_new (void)
{
- CRAttrSel *result = (CRAttrSel *)g_malloc0 (sizeof (CRAttrSel));
+ CRAttrSel *result = NULL;
+
+ result = g_malloc0 (sizeof (CRAttrSel));
return result;
}
/**
- *Appends an attribute selector to the current list of
- *attribute selectors represented by a_this.
+ * cr_attr_sel_append_attr_sel:
+ * @a_this: the this pointer of the current instance of #CRAttrSel.
+ * @a_attr_sel: selector to append.
*
- *@param a_this the this pointer of the current instance of
- *#CRAttrSel.
- *@param a_attr_sel selector to append.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ * Appends an attribute selector to the current list of
+ * attribute selectors represented by a_this.
+ * Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_attr_sel_append_attr_sel (CRAttrSel * a_this, CRAttrSel * a_attr_sel)
@@ -72,13 +76,13 @@ cr_attr_sel_append_attr_sel (CRAttrSel * a_this, CRAttrSel * a_attr_sel)
}
/**
+ * cr_attr_sel_prepend_attr_sel:
+ *@a_this: the "this pointer" of the current instance *of #CRAttrSel.
+ *@a_attr_sel: the attribute selector to append.
+ *
*Prepends an attribute selector to the list of
*attributes selector represented by a_this.
- *
- *@param a_this the "this pointer" of the current instance
- *of #CRAttrSel.
- *@param a_attr_sel the attribute selector to append.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this,
@@ -93,10 +97,17 @@ cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this,
return CR_OK;
}
+/**
+ * cr_attr_sel_to_string:
+ * @a_this: the current instance of #CRAttrSel.
+ *
+ * Serializes an attribute selector into a string
+ * Returns the serialized attribute selector.
+ */
guchar *
-cr_attr_sel_to_string (CRAttrSel * a_this)
+cr_attr_sel_to_string (CRAttrSel const * a_this)
{
- CRAttrSel *cur = NULL;
+ CRAttrSel const *cur = NULL;
guchar *result = NULL;
GString *str_buf = NULL;
@@ -110,7 +121,9 @@ cr_attr_sel_to_string (CRAttrSel * a_this)
}
if (cur->name) {
- gchar *name = g_strndup (cur->name->stryng->str,
+ guchar *name = NULL;
+
+ name = g_strndup (cur->name->stryng->str,
cur->name->stryng->len);
if (name) {
g_string_append (str_buf, name);
@@ -120,7 +133,9 @@ cr_attr_sel_to_string (CRAttrSel * a_this)
}
if (cur->value) {
- gchar *value = g_strndup (cur->value->stryng->str,
+ guchar *value = NULL;
+
+ value = g_strndup (cur->value->stryng->str,
cur->value->stryng->len);
if (value) {
switch (cur->match_way) {
@@ -153,7 +168,7 @@ cr_attr_sel_to_string (CRAttrSel * a_this)
}
if (str_buf) {
- result = (guchar *)str_buf->str;
+ result = str_buf->str;
g_string_free (str_buf, FALSE);
}
@@ -161,13 +176,15 @@ cr_attr_sel_to_string (CRAttrSel * a_this)
}
/**
- *Dumps the current instance of #CRAttrSel to a file.
- *@param a_this the "this pointer" of the current instance of
- *#CRAttrSel.
- *@param a_fp the destination file.
+ * cr_attr_sel_dump:
+ * @a_this: the "this pointer" of the current instance of
+ * #CRAttrSel.
+ * @a_fp: the destination file.
+ *
+ * Dumps the current instance of #CRAttrSel to a file.
*/
void
-cr_attr_sel_dump (CRAttrSel * a_this, FILE * a_fp)
+cr_attr_sel_dump (CRAttrSel const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
@@ -183,10 +200,12 @@ cr_attr_sel_dump (CRAttrSel * a_this, FILE * a_fp)
}
/**
+ *cr_attr_sel_destroy:
+ *@a_this: the "this pointer" of the current
+ *instance of #CRAttrSel.
+ *
*Destroys the current instance of #CRAttrSel.
*Frees all the fields if they are non null.
- *@param a_this the "this pointer" of the current
- *instance of #CRAttrSel.
*/
void
cr_attr_sel_destroy (CRAttrSel * a_this)
@@ -210,3 +229,4 @@ cr_attr_sel_destroy (CRAttrSel * a_this)
g_free (a_this);
}
+
diff --git a/src/libcroco/cr-attr-sel.h b/src/libcroco/cr-attr-sel.h
index 9cc03d358..82d5a87d7 100644
--- a/src/libcroco/cr-attr-sel.h
+++ b/src/libcroco/cr-attr-sel.h
@@ -58,14 +58,14 @@ struct _CRAttrSel
CRAttrSel * cr_attr_sel_new (void) ;
enum CRStatus cr_attr_sel_append_attr_sel (CRAttrSel * a_this,
- CRAttrSel *a_new) ;
+ CRAttrSel *a_attr_sel) ;
enum CRStatus cr_attr_sel_prepend_attr_sel (CRAttrSel *a_this,
CRAttrSel *a_attr_sel) ;
-guchar * cr_attr_sel_to_string (CRAttrSel *a_this) ;
+guchar * cr_attr_sel_to_string (CRAttrSel const *a_this) ;
-void cr_attr_sel_dump (CRAttrSel *a_this, FILE *a_fp) ;
+void cr_attr_sel_dump (CRAttrSel const *a_this, FILE *a_fp) ;
void cr_attr_sel_destroy (CRAttrSel *a_this) ;
diff --git a/src/libcroco/cr-cascade.c b/src/libcroco/cr-cascade.c
index 7fef86c4a..31e938bb7 100644
--- a/src/libcroco/cr-cascade.c
+++ b/src/libcroco/cr-cascade.c
@@ -23,7 +23,7 @@
*/
/*
- *$Id: cr-cascade.c,v 1.6 2004/03/07 13:22:47 dodji Exp $
+ *$Id$
*/
#include <string.h>
@@ -44,6 +44,11 @@ struct _CRCascadePriv {
};
/**
+ * cr_cascade_new:
+ *@a_author_sheet: the author origin style sheet. May be NULL.
+ *@a_user_sheet: the user origin style sheet. May be NULL.
+ *@a_ua_sheet: the user agent origin style sheet. May be NULL.
+ *
*Constructor of the #CRCascade class.
*Note that all three parameters of this
*method are ref counted and their refcount is increased.
@@ -51,24 +56,24 @@ struct _CRCascadePriv {
*the instance of #CRCascade.
*So the caller should not call their destructor. The caller
*should call their ref/unref method instead if it wants
- *@param a_author_sheet the autor origin style sheet
- *@param a_user_sheet the user origin style sheet.
- *@param a_ua_sheet the user agent origin style sheet.
- *@return the newly built instance of CRCascade or NULL if
+ *
+ *Returns the newly built instance of CRCascade or NULL if
*an error arose during constrution.
*/
CRCascade *
cr_cascade_new (CRStyleSheet * a_author_sheet,
CRStyleSheet * a_user_sheet, CRStyleSheet * a_ua_sheet)
{
- CRCascade *result = (CRCascade *)g_try_malloc (sizeof (CRCascade));
+ CRCascade *result = NULL;
+
+ result = g_try_malloc (sizeof (CRCascade));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
}
memset (result, 0, sizeof (CRCascade));
- PRIVATE (result) = (CRCascadePriv *)g_try_malloc (sizeof (CRCascadePriv));
+ PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv));
if (!PRIVATE (result)) {
g_free(result);
cr_utils_trace_info ("Out of memory");
@@ -90,16 +95,19 @@ cr_cascade_new (CRStyleSheet * a_author_sheet,
}
/**
+ * cr_cascade_get_sheet:
+ *@a_this: the current instance of #CRCascade.
+ *@a_origin: the origin of the style sheet as
+ *defined in the css2 spec in chapter 6.4.
*Gets a given origin sheet.
+ *
+ *Gets a sheet, part of the cascade.
*Note that the returned stylesheet
*is refcounted so if the caller wants
*to manage its lifecycle, it must use
*cr_stylesheet_ref()/cr_stylesheet_unref() instead
*of the cr_stylesheet_destroy() method.
- *@param a_this the current instance of #CRCascade.
- *@param a_origin the origin of the style sheet as
- *defined in the css2 spec in chapter 6.4.
- *@return the style sheet, or NULL if it does not
+ *Returns the style sheet, or NULL if it does not
*exist.
*/
CRStyleSheet *
@@ -112,11 +120,14 @@ cr_cascade_get_sheet (CRCascade * a_this, enum CRStyleOrigin a_origin)
}
/**
+ * cr_cascade_set_sheet:
+ *@a_this: the current instance of #CRCascade.
+ *@a_sheet: the stylesheet to set.
+ *@a_origin: the origin of the stylesheet.
+ *
*Sets a stylesheet in the cascade
- *@param a_this the current instance of #CRCascade.
- *@param a_sheet the stylesheet to set.
- *@param a_origin the origin of the stylesheet.
- *@return CR_OK upon successfull completion, an error
+ *
+ *Returns CR_OK upon successfull completion, an error
*code otherwise.
*/
enum CRStatus
@@ -136,10 +147,11 @@ cr_cascade_set_sheet (CRCascade * a_this,
}
/**
+ *cr_cascade_ref:
+ *@a_this: the current instance of #CRCascade
+ *
*Increases the reference counter of the current instance
*of #CRCascade.
- *@param a_this the current instance of #CRCascade
- *
*/
void
cr_cascade_ref (CRCascade * a_this)
@@ -150,12 +162,14 @@ cr_cascade_ref (CRCascade * a_this)
}
/**
+ * cr_cascade_unref:
+ *@a_this: the current instance of
+ *#CRCascade.
+ *
*Decrements the reference counter associated
*to this instance of #CRCascade. If the reference
*counter reaches zero, the instance is destroyed
*using cr_cascade_destroy()
- *@param a_this the current instance of
- *#CRCascade.
*/
void
cr_cascade_unref (CRCascade * a_this)
@@ -170,7 +184,10 @@ cr_cascade_unref (CRCascade * a_this)
}
/**
- *Destructor of #CRCascade.
+ * cr_cascade_destroy:
+ * @a_this: the current instance of #CRCascade
+ *
+ * Destructor of #CRCascade.
*/
void
cr_cascade_destroy (CRCascade * a_this)
diff --git a/src/libcroco/cr-cascade.h b/src/libcroco/cr-cascade.h
index 5e718427d..3119ae85f 100644
--- a/src/libcroco/cr-cascade.h
+++ b/src/libcroco/cr-cascade.h
@@ -22,7 +22,7 @@
*/
/*
- *$Id: cr-cascade.h,v 1.6 2004/01/29 22:05:14 dodji Exp $
+ *$Id$
*/
#ifndef __CR_CASCADE_H__
diff --git a/src/libcroco/cr-declaration.c b/src/libcroco/cr-declaration.c
index 530085b52..ab150a9e4 100644
--- a/src/libcroco/cr-declaration.c
+++ b/src/libcroco/cr-declaration.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -28,22 +28,27 @@
#include "cr-parser.h"
/**
- *@file
+ *@CRDeclaration:
+ *
*The definition of the #CRDeclaration class.
*/
/**
+ * dump:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of indentation white char.
+ *
*Dumps (serializes) one css declaration to a file.
- *@param a_this the current instance of #CRDeclaration.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of indentation white char.
*/
static void
-dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
+dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
{
+ guchar *str = NULL;
+
g_return_if_fail (a_this);
- gchar *str = cr_declaration_to_string (a_this, a_indent);
+ str = cr_declaration_to_string (a_this, a_indent);
if (str) {
fprintf (a_fp, "%s", str);
g_free (str);
@@ -52,16 +57,25 @@ dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
}
/**
+ * cr_declaration_new:
+ * @a_statement: the statement this declaration belongs to. can be NULL.
+ *@a_property: the property string of the declaration
+ *@a_value: the value expression of the declaration.
*Constructor of #CRDeclaration.
- *@param a_property the property string of the declaration
- *@param a_value the value expression of the declaration.
- *@return the newly built instance of #CRDeclaration, or NULL in
+ *
+ *Returns the newly built instance of #CRDeclaration, or NULL in
*case of error.
+ *
+ *The returned CRDeclaration takes ownership of @a_property and @a_value.
+ *(E.g. cr_declaration_destroy on this CRDeclaration will also free
+ *@a_property and @a_value.)
*/
CRDeclaration *
cr_declaration_new (CRStatement * a_statement,
CRString * a_property, CRTerm * a_value)
{
+ CRDeclaration *result = NULL;
+
g_return_val_if_fail (a_property, NULL);
if (a_statement)
@@ -72,7 +86,7 @@ cr_declaration_new (CRStatement * a_statement,
|| (a_statement->type
== AT_PAGE_RULE_STMT)), NULL);
- CRDeclaration * result = (CRDeclaration *)g_try_malloc (sizeof (CRDeclaration));
+ result = g_try_malloc (sizeof (CRDeclaration));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
@@ -89,15 +103,16 @@ cr_declaration_new (CRStatement * a_statement,
}
/**
- *Parses a text buffer that contains
- *a css declaration.
- *
- *@param a_statement the parent css2 statement of this
+ * cr_declaration_parse_from_buf:
+ *@a_statement: the parent css2 statement of this
*this declaration. Must be non NULL and of type
*RULESET_STMT (must be a ruleset).
- *@param a_str the string that contains the statement.
- *@param a_enc the encoding of a_str.
- *@return the parsed declaration, or NULL in case of error.
+ *@a_str: the string that contains the statement.
+ *@a_enc: the encoding of a_str.
+ *
+ *Parses a text buffer that contains
+ *a css declaration.
+ *Returns the parsed declaration, or NULL in case of error.
*/
CRDeclaration *
cr_declaration_parse_from_buf (CRStatement * a_statement,
@@ -107,6 +122,7 @@ cr_declaration_parse_from_buf (CRStatement * a_statement,
CRTerm *value = NULL;
CRString *property = NULL;
CRDeclaration *result = NULL;
+ CRParser *parser = NULL;
gboolean important = FALSE;
g_return_val_if_fail (a_str, NULL);
@@ -114,9 +130,7 @@ cr_declaration_parse_from_buf (CRStatement * a_statement,
g_return_val_if_fail (a_statement->type == RULESET_STMT,
NULL);
- CRParser *parser = (CRParser *)
- cr_parser_new_from_buf ((guchar*)a_str,
- strlen ((char *)a_str), a_enc, FALSE);
+ parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
status = cr_parser_try_to_skip_spaces_and_comments (parser);
@@ -156,11 +170,13 @@ cr_declaration_parse_from_buf (CRStatement * a_statement,
}
/**
- *Parses a ';' separated list of properties declaration.
- *@param a_str the input buffer that contains the list of declaration to
+ * cr_declaration_parse_list_from_buf:
+ *@a_str: the input buffer that contains the list of declaration to
*parse.
- *@param a_enc the encoding of a_str
- *@return the parsed list of declaration, NULL if parsing failed.
+ *@a_enc: the encoding of a_str
+ *
+ *Parses a ';' separated list of properties declaration.
+ *Returns the parsed list of declaration, NULL if parsing failed.
*/
CRDeclaration *
cr_declaration_parse_list_from_buf (const guchar * a_str,
@@ -172,13 +188,13 @@ cr_declaration_parse_list_from_buf (const guchar * a_str,
CRString *property = NULL;
CRDeclaration *result = NULL,
*cur_decl = NULL;
+ CRParser *parser = NULL;
CRTknzr *tokenizer = NULL;
gboolean important = FALSE;
g_return_val_if_fail (a_str, NULL);
- CRParser *parser = (CRParser *)cr_parser_new_from_buf
- ((guchar*)a_str, strlen ((char *)a_str), a_enc, FALSE);
+ parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
status = cr_parser_get_tknzr (parser, &tokenizer);
if (status != CR_OK || !tokenizer) {
@@ -210,7 +226,7 @@ cr_declaration_parse_list_from_buf (const guchar * a_str,
cr_parser_try_to_skip_spaces_and_comments (parser);
status = cr_tknzr_peek_char (tokenizer, &c);
if (status != CR_OK) {
- if (status == CR_END_OF_INPUT_ERROR)
+ if (status == CR_END_OF_INPUT_ERROR)
status = CR_OK;
goto cleanup;
}
@@ -269,10 +285,12 @@ cr_declaration_parse_list_from_buf (const guchar * a_str,
}
/**
+ * cr_declaration_append:
+ *@a_this: the current declaration list.
+ *@a_new: the declaration to append.
+ *
*Appends a new declaration to the current declarations list.
- *@param a_this the current declaration list.
- *@param a_new the declaration to append.
- *@return the declaration list with a_new appended to it, or NULL
+ *Returns the declaration list with a_new appended to it, or NULL
*in case of error.
*/
CRDeclaration *
@@ -294,10 +312,13 @@ cr_declaration_append (CRDeclaration * a_this, CRDeclaration * a_new)
}
/**
+ * cr_declaration_unlink:
+ *@a_decls: the declaration to unlink.
+ *
*Unlinks the declaration from the declaration list.
- *@param a_decl the declaration to unlink.
- *@return a pointer to the unlinked declaration in
*case of a successfull completion, NULL otherwise.
+ *
+ *Returns a pointer to the unlinked declaration in
*/
CRDeclaration *
cr_declaration_unlink (CRDeclaration * a_decl)
@@ -369,10 +390,13 @@ cr_declaration_unlink (CRDeclaration * a_decl)
}
/**
- *prepends a declaration to the current declaration list.
- *@param a_this the current declaration list.
- *@param a_new the declaration to prepend.
- *@return the list with a_new prepended or NULL in case of error.
+ * cr_declaration_prepend:
+ * @a_this: the current declaration list.
+ * @a_new: the declaration to prepend.
+ *
+ * prepends a declaration to the current declaration list.
+ *
+ * Returns the list with a_new prepended or NULL in case of error.
*/
CRDeclaration *
cr_declaration_prepend (CRDeclaration * a_this, CRDeclaration * a_new)
@@ -393,11 +417,13 @@ cr_declaration_prepend (CRDeclaration * a_this, CRDeclaration * a_new)
}
/**
+ * cr_declaration_append2:
+ *@a_this: the current declaration list.
+ *@a_prop: the property string of the declaration to append.
+ *@a_value: the value of the declaration to append.
+ *
*Appends a declaration to the current declaration list.
- *@param a_this the current declaration list.
- *@param a_prop the property string of the declaration to append.
- *@param a_value the value of the declaration to append.
- *@return the list with the new property appended to it, or NULL in
+ *Returns the list with the new property appended to it, or NULL in
*case of an error.
*/
CRDeclaration *
@@ -419,16 +445,20 @@ cr_declaration_append2 (CRDeclaration * a_this,
}
/**
+ * cr_declaration_dump:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_fp: the destination file.
+ *@a_indent: the number of indentation white char.
+ *@a_one_per_line: whether to put one declaration per line of not .
+ *
+ *
*Dumps a declaration list to a file.
- *@param a_this the current instance of #CRDeclaration.
- *@param a_fp the destination file.
- *@param a_indent the number of indentation white char.
*/
void
-cr_declaration_dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent,
+cr_declaration_dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent,
gboolean a_one_per_line)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
g_return_if_fail (a_this);
@@ -444,13 +474,15 @@ cr_declaration_dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent,
}
/**
+ * cr_declaration_dump_one:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_fp: the destination file.
+ *@a_indent: the number of indentation white char.
+ *
*Dumps the first declaration of the declaration list to a file.
- *@param a_this the current instance of #CRDeclaration.
- *@param a_fp the destination file.
- *@param a_indent the number of indentation white char.
*/
void
-cr_declaration_dump_one (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
+cr_declaration_dump_one (CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
{
g_return_if_fail (a_this);
@@ -458,17 +490,21 @@ cr_declaration_dump_one (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
}
/**
- *Serializes the declaration into a string
- *@param a_this the current instance of #CRDeclaration.
- *@param a_indent the number of indentation white char
+ * cr_declaration_to_string:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_indent: the number of indentation white char
*to put before the actual serialisation.
+ *
+ *Serializes the declaration into a string
+ *Returns the serialized form the declaration. The caller must
+ *free the string using g_free().
*/
gchar *
-cr_declaration_to_string (CRDeclaration * a_this, gulong a_indent)
+cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent)
{
GString *stringue = NULL;
- gchar *str = NULL,
+ guchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
@@ -525,17 +561,19 @@ cr_declaration_to_string (CRDeclaration * a_this, gulong a_indent)
}
/**
- *Serializes the declaration list into a string
- *@param a_this the current instance of #CRDeclaration.
- *@param a_indent the number of indentation white char
+ * cr_declaration_list_to_string:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_indent: the number of indentation white char
*to put before the actual serialisation.
+ *
+ *Serializes the declaration list into a string
*/
guchar *
-cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent)
+cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
GString *stringue = NULL;
- gchar *str = NULL,
+ guchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
@@ -555,22 +593,26 @@ cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent)
g_string_free (stringue, FALSE);
}
- return (guchar *)result;
+ return result;
}
/**
- *Serializes the declaration list into a string
- *@param a_this the current instance of #CRDeclaration.
- *@param a_indent the number of indentation white char
+ * cr_declaration_list_to_string2:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_indent: the number of indentation white char
+ *@a_one_decl_per_line: whether to output one doc per line or not.
*to put before the actual serialisation.
+ *
+ *Serializes the declaration list into a string
+ *Returns the serialized form the declararation.
*/
guchar *
-cr_declaration_list_to_string2 (CRDeclaration * a_this,
+cr_declaration_list_to_string2 (CRDeclaration const * a_this,
gulong a_indent, gboolean a_one_decl_per_line)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
GString *stringue = NULL;
- gchar *str = NULL,
+ guchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
@@ -604,18 +646,18 @@ cr_declaration_list_to_string2 (CRDeclaration * a_this,
g_string_free (stringue, FALSE);
}
- return (guchar *)result;
+ return result;
}
/**
- *Return the number of properties in the declaration;
- *@param a_this the current instance of #CRDeclaration.
- *@return number of properties in the declaration list.
+ * cr_declaration_nr_props:
+ *@a_this: the current instance of #CRDeclaration.
+ *Return the number of properties in the declaration
*/
gint
-cr_declaration_nr_props (CRDeclaration * a_this)
+cr_declaration_nr_props (CRDeclaration const * a_this)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
int nr = 0;
g_return_val_if_fail (a_this, -1);
@@ -626,10 +668,14 @@ cr_declaration_nr_props (CRDeclaration * a_this)
}
/**
+ * cr_declaration_get_from_list:
+ *@a_this: the current instance of #CRDeclaration.
+ *@itemnr: the index into the declaration list.
+ *
*Use an index to get a CRDeclaration from the declaration list.
- *@param a_this the current instance of #CRDeclaration.
- *@param itemnr the index into the declaration list.
- *@return CRDeclaration at position itemnr, if itemnr > number of declarations - 1,
+ *
+ *Returns #CRDeclaration at position itemnr,
+ *if itemnr > number of declarations - 1,
*it will return NULL.
*/
CRDeclaration *
@@ -647,10 +693,12 @@ cr_declaration_get_from_list (CRDeclaration * a_this, int itemnr)
}
/**
+ * cr_declaration_get_by_prop_name:
+ *@a_this: the current instance of #CRDeclaration.
+ *@a_prop: the property name to search for.
+ *
*Use property name to get a CRDeclaration from the declaration list.
- *@param a_this the current instance of #CRDeclaration.
- *@param a_prop the property name to search for.
- *@return CRDeclaration with property name a_prop, or NULL if not found.
+ *Returns #CRDeclaration with property name a_prop, or NULL if not found.
*/
CRDeclaration *
cr_declaration_get_by_prop_name (CRDeclaration * a_this,
@@ -666,7 +714,7 @@ cr_declaration_get_by_prop_name (CRDeclaration * a_this,
&& cur->property->stryng
&& cur->property->stryng->str) {
if (!strcmp (cur->property->stryng->str,
- (char *)a_prop)) {
+ a_prop)) {
return cur;
}
}
@@ -675,8 +723,10 @@ cr_declaration_get_by_prop_name (CRDeclaration * a_this,
}
/**
+ * cr_declaration_ref:
+ *@a_this: the current instance of #CRDeclaration.
+ *
*Increases the ref count of the current instance of #CRDeclaration.
- *@param a_this the current instance of #CRDeclaration.
*/
void
cr_declaration_ref (CRDeclaration * a_this)
@@ -687,12 +737,14 @@ cr_declaration_ref (CRDeclaration * a_this)
}
/**
+ * cr_declaration_unref:
+ *@a_this: the current instance of #CRDeclaration.
+ *
*Decrements the ref count of the current instance of #CRDeclaration.
*If the ref count reaches zero, the current instance of #CRDeclaration
*if destroyed.
- *@param a_this the current instance of #CRDeclaration.
- *@return TRUE if the current instance of #CRDeclaration has been destroyed
- *(ref count reached zero), FALSE otherwise.
+ *Returns TRUE if @a_this was destroyed (ref count reached zero),
+ *FALSE otherwise.
*/
gboolean
cr_declaration_unref (CRDeclaration * a_this)
@@ -711,8 +763,10 @@ cr_declaration_unref (CRDeclaration * a_this)
}
/**
+ * cr_declaration_destroy:
+ *@a_this: the current instance of #CRDeclaration.
+ *
*Destructor of the declaration list.
- *@param a_this the current instance of #CRDeclaration.
*/
void
cr_declaration_destroy (CRDeclaration * a_this)
@@ -722,22 +776,19 @@ cr_declaration_destroy (CRDeclaration * a_this)
g_return_if_fail (a_this);
/*
- *Go get the tail of the list.
- *Meanwhile, free each property/value pair contained in the list.
+ * Go to the last element of the list.
*/
- for (cur = a_this; cur && cur->next; cur = cur->next) {
- if (cur->property) {
- cr_string_destroy (cur->property);
- cur->property = NULL;
- }
+ for (cur = a_this; cur->next; cur = cur->next)
+ g_assert (cur->next->prev == cur);
- if (cur->value) {
- cr_term_destroy (cur->value);
- cur->value = NULL;
- }
- }
+ /*
+ * Walk backward the list and free each "next" element.
+ * Meanwhile, free each property/value pair contained in the list.
+ */
+ for (; cur; cur = cur->prev) {
+ g_free (cur->next);
+ cur->next = NULL;
- if (cur) {
if (cur->property) {
cr_string_destroy (cur->property);
cur->property = NULL;
@@ -749,27 +800,5 @@ cr_declaration_destroy (CRDeclaration * a_this)
}
}
- /*in case the list contains only one element */
- if (cur && !cur->prev) {
- g_free (cur);
- return;
- }
-
- /*walk backward the list and free each "next" element */
- for (cur = cur->prev; cur && cur->prev; cur = cur->prev) {
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
- }
-
- if (!cur)
- return;
-
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
-
- g_free (cur);
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-declaration.h b/src/libcroco/cr-declaration.h
index 00523956c..eee8be321 100644
--- a/src/libcroco/cr-declaration.h
+++ b/src/libcroco/cr-declaration.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -100,14 +100,14 @@ CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this,
CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ;
void
-cr_declaration_dump (CRDeclaration *a_this,
+cr_declaration_dump (CRDeclaration const *a_this,
FILE *a_fp, glong a_indent,
gboolean a_one_per_line) ;
-void cr_declaration_dump_one (CRDeclaration *a_this,
+void cr_declaration_dump_one (CRDeclaration const *a_this,
FILE *a_fp, glong a_indent) ;
-gint cr_declaration_nr_props (CRDeclaration *a_this) ;
+gint cr_declaration_nr_props (CRDeclaration const *a_this) ;
CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this,
int itemnr) ;
@@ -115,13 +115,13 @@ CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this,
CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this,
const guchar *a_str) ;
-gchar * cr_declaration_to_string (CRDeclaration *a_this,
+gchar * cr_declaration_to_string (CRDeclaration const *a_this,
gulong a_indent) ;
-guchar * cr_declaration_list_to_string (CRDeclaration *a_this,
+guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,
gulong a_indent) ;
-guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this,
+guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this,
gulong a_indent,
gboolean a_one_decl_per_line) ;
diff --git a/src/libcroco/cr-doc-handler.c b/src/libcroco/cr-doc-handler.c
index 00357c0f0..bbb158298 100644
--- a/src/libcroco/cr-doc-handler.c
+++ b/src/libcroco/cr-doc-handler.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -25,7 +25,8 @@
#include "cr-parser.h"
/**
- *@file
+ *@CRDocHandler:
+ *
*The definition of the CRDocHandler class.
*Contains methods to instantiate, destroy,
*and initialyze instances of #CRDocHandler
@@ -58,20 +59,26 @@ struct _CRDocHandlerPriv {
};
/**
+ * cr_doc_handler_new:
*Constructor of #CRDocHandler.
- *@return the newly built instance of
+ *
+ *Returns the newly built instance of
*#CRDocHandler
+ *
*/
CRDocHandler *
cr_doc_handler_new (void)
{
- CRDocHandler *result = ( CRDocHandler *)g_try_malloc (sizeof (CRDocHandler));
+ CRDocHandler *result = NULL;
+
+ result = g_try_malloc (sizeof (CRDocHandler));
g_return_val_if_fail (result, NULL);
memset (result, 0, sizeof (CRDocHandler));
+ result->ref_count++;
- result->priv = (CRDocHandlerPriv *)g_try_malloc (sizeof (CRDocHandlerPriv));
+ result->priv = g_try_malloc (sizeof (CRDocHandlerPriv));
if (!result->priv) {
cr_utils_trace_info ("Out of memory exception");
g_free (result);
@@ -84,15 +91,17 @@ cr_doc_handler_new (void)
}
/**
- *Returns the private parsing context.
+ * cr_doc_handler_get_ctxt:
+ *@a_this: the current instance of #CRDocHandler.
+ *@a_ctxt: out parameter. The new parsing context.
+ *
+ *Gets the private parsing context associated to the document handler
*The private parsing context is used by libcroco only.
- *@param a_this the current instance of #CRDocHandler.
- *@param a_ctxt out parameter. The new parsing context.
- *@return CR_OK upon successfull completion, an error code otherwise.
- *@return the parsing context, or NULL if an error occured.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
-cr_doc_handler_get_ctxt (CRDocHandler * a_this, gpointer * a_ctxt)
+cr_doc_handler_get_ctxt (CRDocHandler const * a_this, gpointer * a_ctxt)
{
g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR);
@@ -102,11 +111,13 @@ cr_doc_handler_get_ctxt (CRDocHandler * a_this, gpointer * a_ctxt)
}
/**
+ * cr_doc_handler_set_ctxt:
+ *@a_this: the current instance of #CRDocHandler
+ *@a_ctxt: a pointer to the parsing context.
+ *
*Sets the private parsing context.
*This is used by libcroco only.
- *@param a_this the current instance of #CRDocHandler
- *@param a_ctxt a pointer to the parsing context.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_doc_handler_set_ctxt (CRDocHandler * a_this, gpointer a_ctxt)
@@ -117,14 +128,17 @@ cr_doc_handler_set_ctxt (CRDocHandler * a_this, gpointer a_ctxt)
}
/**
- *Returns the private parsing result.
+ * cr_doc_handler_get_result:
+ *@a_this: the current instance of #CRDocHandler
+ *@a_result: out parameter. The returned result.
+ *
+ *Gets the private parsing result.
*The private parsing result is used by libcroco only.
- *@param a_this the current instance of #CRDocHandler
- *@param a_result out parameter. The returned result.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
-cr_doc_handler_get_result (CRDocHandler * a_this, gpointer * a_result)
+cr_doc_handler_get_result (CRDocHandler const * a_this, gpointer * a_result)
{
g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR);
@@ -134,11 +148,14 @@ cr_doc_handler_get_result (CRDocHandler * a_this, gpointer * a_result)
}
/**
+ * cr_doc_handler_set_result:
+ *@a_this: the current instance of #CRDocHandler
+ *@a_result: the new result.
+ *
*Sets the private parsing context.
*This is used by libcroco only.
- *@param a_this the current instance of #CRDocHandler
- *@param a_result the new result.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_doc_handler_set_result (CRDocHandler * a_this, gpointer a_result)
@@ -149,14 +166,16 @@ cr_doc_handler_set_result (CRDocHandler * a_this, gpointer a_result)
}
/**
+ *cr_doc_handler_set_default_sac_handler:
+ *@a_this: a pointer to the current instance of #CRDocHandler.
+ *
*Sets the sac handlers contained in the current
*instance of DocHandler to the default handlers.
*For the time being the default handlers are
*test handlers. This is expected to change in a
*near future, when the libcroco gets a bit debugged.
*
- *@param a_this a pointer to the current instance of #CRDocHandler.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_doc_handler_set_default_sac_handler (CRDocHandler * a_this)
@@ -184,8 +203,8 @@ cr_doc_handler_set_default_sac_handler (CRDocHandler * a_this)
}
/**
- *Increases the reference count of the doc handler
- *@param a_this the current instance of #CRDocHandler.
+ * cr_doc_handler_ref:
+ *@a_this: the current instance of #CRDocHandler.
*/
void
cr_doc_handler_ref (CRDocHandler * a_this)
@@ -196,10 +215,13 @@ cr_doc_handler_ref (CRDocHandler * a_this)
}
/**
+ * cr_doc_handler_unref:
+ *@a_this: the currrent instance of #CRDocHandler.
+ *
*Decreases the ref count of the current instance of #CRDocHandler.
*If the ref count reaches '0' then, destroys the instance.
- *@param a_this the currrent instance of #CRDocHandler.
- *@return TRUE if the instance as been destroyed, FALSE otherwise.
+ *
+ *Returns TRUE if the instance as been destroyed, FALSE otherwise.
*/
gboolean
cr_doc_handler_unref (CRDocHandler * a_this)
@@ -218,9 +240,11 @@ cr_doc_handler_unref (CRDocHandler * a_this)
}
/**
- *The destructor of the #CRDocHandler class.
- *@param a_this the instance of #CRDocHandler to
+ * cr_doc_handler_destroy:
+ *@a_this: the instance of #CRDocHandler to
*destroy.
+ *
+ *The destructor of the #CRDocHandler class.
*/
void
cr_doc_handler_destroy (CRDocHandler * a_this)
@@ -235,9 +259,11 @@ cr_doc_handler_destroy (CRDocHandler * a_this)
}
/**
+ * cr_doc_handler_associate_a_parser:
*Associates a parser to the current document handler
- *@param a_this the current instance of document handler.
- *@param a_parser the parser to associate.
+ *
+ *@a_this: the current instance of document handler.
+ *@a_parser: the parser to associate.
*/
void
cr_doc_handler_associate_a_parser (CRDocHandler *a_this,
@@ -246,5 +272,5 @@ cr_doc_handler_associate_a_parser (CRDocHandler *a_this,
g_return_if_fail (a_this && PRIVATE (a_this)
&& a_parser) ;
- PRIVATE (a_this)->parser = (CRParser *)a_parser ;
+ PRIVATE (a_this)->parser = a_parser ;
}
diff --git a/src/libcroco/cr-doc-handler.h b/src/libcroco/cr-doc-handler.h
index 704f186f5..d12673f31 100644
--- a/src/libcroco/cr-doc-handler.h
+++ b/src/libcroco/cr-doc-handler.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -92,7 +92,7 @@ struct _CRDocHandler
*destination media for style information.
*@param a_uri the uri of the imported style sheet.
*@param a_uri_default_ns the default namespace of URI
- *@param a_location the parsing location of the '@import'
+ *@param a_location the parsing location of the '\@import'
*keyword.
*of the imported style sheet.
*/
@@ -175,7 +175,7 @@ struct _CRDocHandler
*
*@param a_this a pointer to the current instance of
*#CRDocHandler.
- *@param a_location the parsing location of the "@font-face"
+ *@param a_location the parsing location of the "\@font-face"
*keyword.
*/
void (*start_font_face) (CRDocHandler *a_this,
@@ -227,7 +227,7 @@ struct _CRDocHandler
*#CRDocHandler.
*@param a_name the name of the page (if any, null otherwise).
*@param a_pseudo_page the pseudo page (if any, null otherwise).
- *@param a_location the parsing location of the "@page" keyword.
+ *@param a_location the parsing location of the "\@page" keyword.
*/
void (*start_page) (CRDocHandler *a_this,
CRString *a_name,
@@ -239,7 +239,7 @@ struct _CRDocHandler
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*@param a_name the name of the page (if any, null otherwise).
- *@parap a_pseudo_page the pseudo page (if any, null otherwise).
+ *@param a_pseudo_page the pseudo page (if any, null otherwise).
*/
void (*end_page) (CRDocHandler *a_this,
CRString *a_name,
@@ -276,11 +276,11 @@ CRDocHandler * cr_doc_handler_new (void) ;
enum CRStatus cr_doc_handler_set_result (CRDocHandler *a_this, gpointer a_result) ;
-enum CRStatus cr_doc_handler_get_result (CRDocHandler *a_this, gpointer * a_result) ;
+enum CRStatus cr_doc_handler_get_result (CRDocHandler const *a_this, gpointer * a_result) ;
enum CRStatus cr_doc_handler_set_ctxt (CRDocHandler *a_this, gpointer a_ctxt) ;
-enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler *a_this, gpointer * a_ctxt) ;
+enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler const *a_this, gpointer * a_ctxt) ;
enum CRStatus cr_doc_handler_set_default_sac_handler (CRDocHandler *a_this) ;
diff --git a/src/libcroco/cr-enc-handler.c b/src/libcroco/cr-enc-handler.c
index 973a5f373..b3e5b7eba 100644
--- a/src/libcroco/cr-enc-handler.c
+++ b/src/libcroco/cr-enc-handler.c
@@ -21,7 +21,7 @@
*/
/*
- *$Id: cr-enc-handler.c,v 1.7 2004/03/07 13:22:47 dodji Exp $
+ *$Id$
*/
/**
@@ -57,7 +57,7 @@ static struct CREncAlias gv_default_aliases[] = {
{"UCS-4", CR_UCS_4},
{"UCS_4", CR_UCS_4},
{"ASCII", CR_ASCII},
- {(char *)0, (enum CREncoding)0}
+ {0, 0}
};
static CREncHandler gv_default_enc_handlers[] = {
@@ -70,14 +70,17 @@ static CREncHandler gv_default_enc_handlers[] = {
{CR_ASCII, cr_utils_ucs1_to_utf8, cr_utils_utf8_to_ucs1,
cr_utils_ucs1_str_len_as_utf8, cr_utils_utf8_str_len_as_ucs1},
- {(enum CREncoding)0, NULL, NULL, NULL, NULL}
+ {0, NULL, NULL, NULL, NULL}
};
/**
+ * cr_enc_handler_get_instance:
+ *@a_enc: the encoding of the Handler.
+ *
*Gets the instance of encoding handler.
*This function implements a singleton pattern.
- *@param a_enc the encoding of the Handler.
- *@return the instance of #CREncHandler.
+ *
+ *Returns the instance of #CREncHandler.
*/
CREncHandler *
cr_enc_handler_get_instance (enum CREncoding a_enc)
@@ -95,23 +98,27 @@ cr_enc_handler_get_instance (enum CREncoding a_enc)
}
/**
+ * cr_enc_handler_resolve_enc_alias:
+ *@a_alias_name: the encoding name.
+ *@a_enc: output param. The returned encoding type
+ *or 0 if the alias is not supported.
+ *
*Given an encoding name (called an alias name)
*the function returns the matching encoding type.
- *@param a_alias_name the encoding name
- *@param a_enc output param. The returned encoding type
- *or 0 if the alias is not supported.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_enc_handler_resolve_enc_alias (const guchar * a_alias_name,
enum CREncoding *a_enc)
{
gulong i = 0;
+ guchar *alias_name_up = NULL;
enum CRStatus status = CR_ENCODING_NOT_FOUND_ERROR;
g_return_val_if_fail (a_alias_name != NULL, CR_BAD_PARAM_ERROR);
- gchar *alias_name_up = g_strdup ((gchar *)a_alias_name);
+ alias_name_up = g_strdup (a_alias_name);
g_ascii_strup (alias_name_up, -1);
for (i = 0; gv_default_aliases[i].name; i++) {
@@ -126,16 +133,19 @@ cr_enc_handler_resolve_enc_alias (const guchar * a_alias_name,
}
/**
- *Converts a raw input buffer into an utf8 buffer.
- *@param a_this the current instance of #CREncHandler.
- *@param a_in the input buffer to convert.
- *@param a_in_len in/out parameter. The len of the input
+ * cr_enc_handler_convert_input:
+ *@a_this: the current instance of #CREncHandler.
+ *@a_in: the input buffer to convert.
+ *@a_in_len: in/out parameter. The len of the input
*buffer to convert. After return, contains the number of
*bytes actually consumed.
- *@param @a_out output parameter. The converted output buffer.
+ *@a_out: output parameter. The converted output buffer.
*Must be freed by the buffer.
- *@param a_out_len output parameter. The length of the output buffer.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *@a_out_len: output parameter. The length of the output buffer.
+ *
+ *Converts a raw input buffer into an utf8 buffer.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_enc_handler_convert_input (CREncHandler * a_this,
@@ -161,7 +171,7 @@ cr_enc_handler_convert_input (CREncHandler * a_this,
*a_out_len = *a_in_len;
}
- *a_out = (guchar *)g_malloc0 (*a_out_len);
+ *a_out = g_malloc0 (*a_out_len);
status = a_this->decode_input (a_in, a_in_len, *a_out, a_out_len);
diff --git a/src/libcroco/cr-enc-handler.h b/src/libcroco/cr-enc-handler.h
index 2f5da69f9..0727764c0 100644
--- a/src/libcroco/cr-enc-handler.h
+++ b/src/libcroco/cr-enc-handler.h
@@ -21,7 +21,7 @@
*/
/*
- *$Id: cr-enc-handler.h,v 1.5 2004/01/24 19:24:01 dodji Exp $
+ *$Id$
*/
/**
@@ -79,10 +79,8 @@ CREncHandler *
cr_enc_handler_get_instance (enum CREncoding a_enc) ;
enum CRStatus
-cr_enc_handler_resolve_enc_alias (const guchar *a_en_alias,
+cr_enc_handler_resolve_enc_alias (const guchar *a_alias_name,
enum CREncoding *a_enc) ;
-void
-cr_enc_handler_destroy (CREncHandler * a_enc_hdlr) ;
enum CRStatus
cr_enc_handler_convert_input (CREncHandler *a_this,
diff --git a/src/libcroco/cr-fonts.c b/src/libcroco/cr-fonts.c
index 14438c344..3c6896ffd 100644
--- a/src/libcroco/cr-fonts.c
+++ b/src/libcroco/cr-fonts.c
@@ -27,10 +27,10 @@
#include <string.h>
static enum CRStatus
-cr_font_family_to_string_real (CRFontFamily * a_this,
+cr_font_family_to_string_real (CRFontFamily const * a_this,
gboolean a_walk_list, GString ** a_string)
{
- gchar *name = NULL;
+ guchar const *name = NULL;
enum CRStatus result = CR_OK;
if (!*a_string) {
@@ -46,31 +46,31 @@ cr_font_family_to_string_real (CRFontFamily * a_this,
switch (a_this->type) {
case FONT_FAMILY_SANS_SERIF:
- name = (gchar *) "sans-serif";
+ name = (guchar const *) "sans-serif";
break;
case FONT_FAMILY_SERIF:
- name = (gchar *) "sans-serif";
+ name = (guchar const *) "sans-serif";
break;
case FONT_FAMILY_CURSIVE:
- name = (gchar *) "cursive";
+ name = (guchar const *) "cursive";
break;
case FONT_FAMILY_FANTASY:
- name = (gchar *) "fantasy";
+ name = (guchar const *) "fantasy";
break;
case FONT_FAMILY_MONOSPACE:
- name = (gchar *) "monospace";
+ name = (guchar const *) "monospace";
break;
case FONT_FAMILY_NON_GENERIC:
- name = (gchar *) a_this->name;
+ name = (guchar const *) a_this->name;
break;
default:
- name = (gchar *) NULL;
+ name = NULL;
break;
}
@@ -92,32 +92,32 @@ static const gchar *
cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize
a_code)
{
- gchar *str = NULL;
+ gchar const *str = NULL;
switch (a_code) {
case FONT_SIZE_XX_SMALL:
- str = (gchar *) "xx-small";
+ str = "xx-small";
break;
case FONT_SIZE_X_SMALL:
- str = (gchar *) "x-small";
+ str = "x-small";
break;
case FONT_SIZE_SMALL:
- str = (gchar *) "small";
+ str = "small";
break;
case FONT_SIZE_MEDIUM:
- str = (gchar *) "medium";
+ str = "medium";
break;
case FONT_SIZE_LARGE:
- str = (gchar *) "large";
+ str = "large";
break;
case FONT_SIZE_X_LARGE:
- str = (gchar *) "x-large";
+ str = "x-large";
break;
case FONT_SIZE_XX_LARGE:
- str = (gchar *) "xx-large";
+ str = "xx-large";
break;
default:
- str = (gchar *) "unknown absolute font size value";
+ str = "unknown absolute font size value";
}
return str;
}
@@ -125,26 +125,37 @@ cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize
static const gchar *
cr_relative_font_size_to_string (enum CRRelativeFontSize a_code)
{
- gchar *str = NULL;
+ gchar const *str = NULL;
switch (a_code) {
case FONT_SIZE_LARGER:
- str = (gchar *) "larger";
+ str = "larger";
break;
case FONT_SIZE_SMALLER:
- str = (gchar *) "smaller";
+ str = "smaller";
break;
default:
- str = (gchar *) "unknown relative font size value";
+ str = "unknown relative font size value";
break;
}
return str;
}
+/**
+ * cr_font_family_new:
+ * @a_type: the type of font family to create.
+ * @a_name: the name of the font family.
+ *
+ * create a font family.
+ *
+ * Returns the newly built font family.
+ */
CRFontFamily *
cr_font_family_new (enum CRFontFamilyType a_type, guchar * a_name)
{
- CRFontFamily *result = (CRFontFamily *)g_try_malloc (sizeof (CRFontFamily));
+ CRFontFamily *result = NULL;
+
+ result = g_try_malloc (sizeof (CRFontFamily));
if (!result) {
cr_utils_trace_info ("Out of memory");
@@ -159,18 +170,26 @@ cr_font_family_new (enum CRFontFamilyType a_type, guchar * a_name)
return result;
}
+/**
+ * cr_font_family_to_string:
+ * @a_this: the current instance of #CRFontFamily.
+ * @a_walk_font_family_list: wether the serialize the entire list.
+ *
+ * Returns the seriliazed font family. The caller has to free it using
+ * g_free().
+ */
guchar *
-cr_font_family_to_string (CRFontFamily * a_this,
+cr_font_family_to_string (CRFontFamily const * a_this,
gboolean a_walk_font_family_list)
{
enum CRStatus status = CR_OK;
- gchar *result = NULL;
+ guchar *result = NULL;
GString *stringue = NULL;
if (!a_this) {
result = g_strdup ("NULL");
g_return_val_if_fail (result, NULL);
- return (guchar *)result;
+ return result;
}
status = cr_font_family_to_string_real (a_this,
a_walk_font_family_list,
@@ -188,8 +207,16 @@ cr_font_family_to_string (CRFontFamily * a_this,
}
}
- return (guchar *)result;
+ return result;
}
+
+/**
+ * cr_font_family_set_name:
+ * @a_this: the current instance of #CRFontFamily.
+ * @a_name: the new name
+ *
+ * Returns CR_OK upon sucessful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_family_set_name (CRFontFamily * a_this, guchar * a_name)
{
@@ -212,6 +239,13 @@ cr_font_family_set_name (CRFontFamily * a_this, guchar * a_name)
return CR_OK;
}
+/**
+ * cr_font_family_append:
+ * @a_this: the current instance of #CRFontFamily.
+ * @a_family_to_append: the font family to append to the list
+ *
+ * Returns the new font family list.
+ */
CRFontFamily *
cr_font_family_append (CRFontFamily * a_this,
CRFontFamily * a_family_to_append)
@@ -232,6 +266,13 @@ cr_font_family_append (CRFontFamily * a_this,
}
+/**
+ * cr_font_family_prepend:
+ * @a_this: the current instance #CRFontFamily.
+ * @a_family_to_prepend: the font family to prepend to the list.
+ *
+ * Returns the font family list.
+ */
CRFontFamily *
cr_font_family_prepend (CRFontFamily * a_this,
CRFontFamily * a_family_to_prepend)
@@ -247,6 +288,12 @@ cr_font_family_prepend (CRFontFamily * a_this,
return a_family_to_prepend;
}
+/**
+ * cr_font_family_destroy:
+ * @a_this: the current instance of #CRFontFamily.
+ *
+ * Returns CR_OK upon sucessful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_family_destroy (CRFontFamily * a_this)
{
@@ -279,10 +326,17 @@ cr_font_family_destroy (CRFontFamily * a_this)
*'font-size' manipulation functions definitions
***************************************************/
+/**
+ * cr_font_size_new:
+ *
+ * Returns the newly created font size.
+ */
CRFontSize *
cr_font_size_new (void)
{
- CRFontSize *result = (CRFontSize *)g_try_malloc (sizeof (CRFontSize));
+ CRFontSize *result = NULL;
+
+ result = g_try_malloc (sizeof (CRFontSize));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
@@ -292,6 +346,12 @@ cr_font_size_new (void)
return result;
}
+/**
+ * cr_font_size_clear:
+ * @a_this: the current instance of #CRFontSize
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_size_clear (CRFontSize * a_this)
{
@@ -315,8 +375,15 @@ cr_font_size_clear (CRFontSize * a_this)
return CR_OK;
}
+/**
+ * cr_font_size_copy:
+ * @a_dst: the destination #CRFontSize (where to copy to).
+ * @a_src: the source #CRFontSize (where to copy from).
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ */
enum CRStatus
-cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src)
+cr_font_size_copy (CRFontSize * a_dst, CRFontSize const * a_src)
{
g_return_val_if_fail (a_dst && a_src, CR_BAD_PARAM_ERROR);
@@ -341,6 +408,13 @@ cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src)
return CR_OK;
}
+/**
+ * cr_font_size_set_predefined_absolute_font_size:
+ * @a_this: the current instance of #CRFontSize.
+ * @a_predefined: what to set.
+ *
+ * Returns CR_OK upon sucessful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this,
enum CRPredefinedAbsoluteFontSize a_predefined)
@@ -355,6 +429,13 @@ cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this,
return CR_OK ;
}
+/**
+ * cr_font_size_set_relative_font_size:
+ * @a_this: the current instance of #CRFontSize
+ * @a_relative: the new relative font size
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_size_set_relative_font_size (CRFontSize *a_this,
enum CRRelativeFontSize a_relative)
@@ -368,6 +449,14 @@ cr_font_size_set_relative_font_size (CRFontSize *a_this,
return CR_OK ;
}
+/**
+ * cr_font_size_set_absolute_font_size:
+ * @a_this: the current instance of #CRFontSize
+ * @a_num_type: the type of number to set.
+ * @a_value: the actual value to set.
+ *
+ * Returns CR_OK upon succesful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_size_set_absolute_font_size (CRFontSize *a_this,
enum CRNumType a_num_type,
@@ -383,6 +472,12 @@ cr_font_size_set_absolute_font_size (CRFontSize *a_this,
return CR_OK ;
}
+/**
+ * cr_font_size_set_to_inherit:
+ * @a_this: the current instance of #CRFontSize
+ *
+ * Returns CR_OK upon succesful completion, an error code otherwise.
+ */
enum CRStatus
cr_font_size_set_to_inherit (CRFontSize *a_this)
{
@@ -394,16 +489,29 @@ cr_font_size_set_to_inherit (CRFontSize *a_this)
return CR_OK ;
}
+/**
+ * cr_font_size_is_set_to_inherit:
+ * @a_this: the current instance of #CRFontSize.
+ *
+ * Returns TRUE if the current instance is set to 'inherit'.
+ */
gboolean
-cr_font_size_is_set_to_inherit (CRFontSize *a_this)
+cr_font_size_is_set_to_inherit (CRFontSize const *a_this)
{
g_return_val_if_fail (a_this, FALSE) ;
return a_this->type == INHERITED_FONT_SIZE ;
}
+/**
+ * cr_font_size_to_string:
+ * @a_this: the current instance of #CRFontSize
+ *
+ * Returns the serialized form of #CRFontSize. The returned string
+ * has to bee freed using g_free().
+ */
gchar *
-cr_font_size_to_string (CRFontSize * a_this)
+cr_font_size_to_string (CRFontSize const * a_this)
{
gchar *str = NULL;
@@ -418,7 +526,7 @@ cr_font_size_to_string (CRFontSize * a_this)
(a_this->value.predefined));
break;
case ABSOLUTE_FONT_SIZE:
- str = (gchar *)cr_num_to_string (&a_this->value.absolute);
+ str = cr_num_to_string (&a_this->value.absolute);
break;
case RELATIVE_FONT_SIZE:
str = g_strdup (cr_relative_font_size_to_string
@@ -433,9 +541,15 @@ cr_font_size_to_string (CRFontSize * a_this)
return str;
}
+/**
+ * cr_font_size_get_smaller_predefined:
+ * @a_font_size: the font size to consider.
+ * @a_smaller_size: out parameter. The a smaller value than @a_font_size.
+ */
void
-cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
- enum CRPredefinedAbsoluteFontSize *a_smaller_size)
+cr_font_size_get_smaller_predefined_font_size
+ (enum CRPredefinedAbsoluteFontSize a_font_size,
+ enum CRPredefinedAbsoluteFontSize *a_smaller_size)
{
enum CRPredefinedAbsoluteFontSize result = FONT_SIZE_MEDIUM ;
@@ -477,9 +591,17 @@ cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize
}
+/**
+ * cr_font_size_get_larger_predefined_font_size:
+ * @a_font_size: the font size to consider.
+ * @a_larger_size: out parameter. the font size considered larger than
+ * @a_font_size.
+ *
+ */
void
-cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
- enum CRPredefinedAbsoluteFontSize *a_larger_size)
+cr_font_size_get_larger_predefined_font_size
+ (enum CRPredefinedAbsoluteFontSize a_font_size,
+ enum CRPredefinedAbsoluteFontSize *a_larger_size)
{
enum CRPredefinedAbsoluteFontSize result = FONT_SIZE_MEDIUM ;
@@ -520,8 +642,16 @@ cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize
*a_larger_size = result ;
}
+/**
+ * cr_font_size_is_predefined_absolute_font_size:
+ * @a_font_size: the font size to consider.
+ *
+ * Returns TRUE if the instance is an predefined absolute font size, FALSE
+ * otherwise.
+ */
gboolean
-cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size)
+cr_font_size_is_predefined_absolute_font_size
+ (enum CRPredefinedAbsoluteFontSize a_font_size)
{
if ((unsigned)a_font_size < NB_PREDEFINED_ABSOLUTE_FONT_SIZES) {
return TRUE ;
@@ -530,8 +660,14 @@ cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize
}
}
+/**
+ * cr_font_size_adjust_to_string:
+ * @a_this: the instance of #CRFontSizeAdjust.
+ *
+ * Returns the serialized form of #CRFontSizeAdjust
+ */
gchar *
-cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this)
+cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this)
{
gchar *str = NULL;
@@ -547,9 +683,9 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this)
break;
case FONT_SIZE_ADJUST_NUMBER:
if (a_this->num)
- str = (gchar *)cr_num_to_string (a_this->num);
+ str = cr_num_to_string (a_this->num);
else
- str = g_strdup ("unknow font-size-adjust property value"); // Should raise an error no?
+ str = g_strdup ("unknow font-size-adjust property value"); /* Should raise an error no?*/
break;
case FONT_SIZE_ADJUST_INHERIT:
str = g_strdup ("inherit");
@@ -557,6 +693,13 @@ cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this)
return str;
}
+/**
+ * cr_font_style_to_string:
+ * @a_code: the current instance of #CRFontStyle .
+ *
+ * Returns the serialized #CRFontStyle. The caller must free the returned
+ * string using g_free().
+ */
const gchar *
cr_font_style_to_string (enum CRFontStyle a_code)
{
@@ -582,6 +725,13 @@ cr_font_style_to_string (enum CRFontStyle a_code)
return str;
}
+/**
+ * cr_font_variant_to_string:
+ * @a_code: the current instance of #CRFontVariant.
+ *
+ * Returns the serialized form of #CRFontVariant. The caller has
+ * to free the returned string using g_free().
+ */
const gchar *
cr_font_variant_to_string (enum CRFontVariant a_code)
{
@@ -601,10 +751,19 @@ cr_font_variant_to_string (enum CRFontVariant a_code)
return str;
}
+/**
+ * cr_font_weight_get_bolder:
+ * @a_weight: the #CRFontWeight to consider.
+ *
+ * Returns a font weight bolder than @a_weight
+ */
enum CRFontWeight
cr_font_weight_get_bolder (enum CRFontWeight a_weight)
{
- if (a_weight >= NB_FONT_WEIGHTS) {
+ if (a_weight == FONT_WEIGHT_INHERIT) {
+ cr_utils_trace_info ("can't return a bolder weight for FONT_WEIGHT_INHERIT") ;
+ return a_weight;
+ } else if (a_weight >= FONT_WEIGHT_900) {
return FONT_WEIGHT_900 ;
} else if (a_weight < FONT_WEIGHT_NORMAL) {
return FONT_WEIGHT_NORMAL ;
@@ -613,10 +772,16 @@ cr_font_weight_get_bolder (enum CRFontWeight a_weight)
cr_utils_trace_info ("FONT_WEIGHT_BOLDER or FONT_WEIGHT_LIGHTER should not appear here") ;
return FONT_WEIGHT_NORMAL ;
} else {
- return (enum CRFontWeight)(a_weight << 1) ;
+ return a_weight << 1 ;
}
}
+/**
+ * cr_font_weight_to_string:
+ * @a_code: the font weight to consider.
+ *
+ * Returns the serialized form of #CRFontWeight.
+ */
const gchar *
cr_font_weight_to_string (enum CRFontWeight a_code)
{
@@ -672,6 +837,12 @@ cr_font_weight_to_string (enum CRFontWeight a_code)
return str;
}
+/**
+ * cr_font_stretch_to_string:
+ * @a_code: the instance of #CRFontStretch to consider.
+ *
+ * Returns the serialized form of #CRFontStretch.
+ */
const gchar *
cr_font_stretch_to_string (enum CRFontStretch a_code)
{
@@ -718,6 +889,11 @@ cr_font_stretch_to_string (enum CRFontStretch a_code)
return str;
}
+/**
+ * cr_font_size_destroy:
+ * @a_font_size: the font size to destroy
+ *
+ */
void
cr_font_size_destroy (CRFontSize * a_font_size)
{
@@ -730,11 +906,17 @@ cr_font_size_destroy (CRFontSize * a_font_size)
*'font-size-adjust' manipulation function definition
*******************************************************/
+/**
+ * cr_font_size_adjust_new:
+ *
+ * Returns a newly built instance of #CRFontSizeAdjust
+ */
CRFontSizeAdjust *
cr_font_size_adjust_new (void)
{
- CRFontSizeAdjust *result =
- (CRFontSizeAdjust *)g_try_malloc (sizeof (CRFontSizeAdjust));
+ CRFontSizeAdjust *result = NULL;
+
+ result = g_try_malloc (sizeof (CRFontSizeAdjust));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
@@ -744,6 +926,11 @@ cr_font_size_adjust_new (void)
return result;
}
+/**
+ * cr_font_size_adjust_destroy:
+ * @a_this: the current instance of #CRFontSizeAdjust.
+ *
+ */
void
cr_font_size_adjust_destroy (CRFontSizeAdjust * a_this)
{
diff --git a/src/libcroco/cr-fonts.h b/src/libcroco/cr-fonts.h
index 45446180b..9eaeeeb98 100644
--- a/src/libcroco/cr-fonts.h
+++ b/src/libcroco/cr-fonts.h
@@ -25,7 +25,6 @@
#ifndef __CR_FONTS_H__
#define __CR_FONTS_H__
-#endif
#include "cr-utils.h"
#include "cr-num.h"
@@ -236,7 +235,7 @@ cr_font_family_append (CRFontFamily *a_this,
CRFontFamily *a_family_to_append) ;
guchar *
-cr_font_family_to_string (CRFontFamily *a_this,
+cr_font_family_to_string (CRFontFamily const *a_this,
gboolean a_walk_font_family_list) ;
CRFontFamily *
@@ -259,7 +258,7 @@ CRFontSize * cr_font_size_new (void) ;
enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
enum CRStatus cr_font_size_copy (CRFontSize *a_dst,
- CRFontSize *a_src) ;
+ CRFontSize const *a_src) ;
enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this,
enum CRPredefinedAbsoluteFontSize a_predefined) ;
enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this,
@@ -271,9 +270,9 @@ enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this,
enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
-gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
+gboolean cr_font_size_is_set_to_inherit (CRFontSize const *a_this) ;
-gchar* cr_font_size_to_string (CRFontSize *a_this) ;
+gchar* cr_font_size_to_string (CRFontSize const *a_this) ;
void cr_font_size_destroy (CRFontSize *a_font_size) ;
@@ -283,7 +282,7 @@ void cr_font_size_destroy (CRFontSize *a_font_size) ;
CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
-gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
+gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this) ;
void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
@@ -312,3 +311,5 @@ const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ;
const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
G_END_DECLS
+
+#endif
diff --git a/src/libcroco/cr-input.c b/src/libcroco/cr-input.c
index 861329227..3cc283e01 100644
--- a/src/libcroco/cr-input.c
+++ b/src/libcroco/cr-input.c
@@ -27,7 +27,8 @@
#include "cr-enc-handler.h"
/**
- *@file
+ *@CRInput:
+ *
*The definition of the #CRInput class.
*/
@@ -87,14 +88,16 @@ static CRInput *cr_input_new_real (void);
static CRInput *
cr_input_new_real (void)
{
- CRInput *result = (CRInput *)g_try_malloc (sizeof (CRInput));
+ CRInput *result = NULL;
+
+ result = g_try_malloc (sizeof (CRInput));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
}
memset (result, 0, sizeof (CRInput));
- PRIVATE (result) = (CRInputPriv *)g_try_malloc (sizeof (CRInputPriv));
+ PRIVATE (result) = g_try_malloc (sizeof (CRInputPriv));
if (!PRIVATE (result)) {
cr_utils_trace_info ("Out of memory");
g_free (result);
@@ -110,15 +113,17 @@ cr_input_new_real (void)
***************/
/**
- *Creates a new input stream from a memory buffer.
- *@param a_buf the memory buffer to create the input stream from.
+ * cr_input_new_from_buf:
+ *@a_buf: the memory buffer to create the input stream from.
*The #CRInput keeps this pointer so user should not free it !.
- *@param a_len the size of the input buffer.
- *@param a_enc the buffer's encoding.
- *@param a_free_buf if set to TRUE, this a_buf will be freed
+ *@a_len: the size of the input buffer.
+ *@a_enc: the buffer's encoding.
+ *@a_free_buf: if set to TRUE, this a_buf will be freed
*at the destruction of this instance. If set to false, it is up
*to the caller to free it.
- *@return the newly built instance of #CRInput.
+ *
+ *Creates a new input stream from a memory buffer.
+ *Returns the newly built instance of #CRInput.
*/
CRInput *
cr_input_new_from_buf (guchar * a_buf,
@@ -175,13 +180,14 @@ cr_input_new_from_buf (guchar * a_buf,
}
/**
+ * cr_input_new_from_uri:
+ *@a_file_uri: the file to create *the input stream from.
+ *@a_enc: the encoding of the file *to create the input from.
+ *
*Creates a new input stream from
*a file.
- *@param a_file_uri the file to create
- *the input stream from.
- *@param a_enc the encoding of the file
- *to create the input from
- *@return the newly created input stream if
+ *
+ *Returns the newly created input stream if
*this method could read the file and create it,
*NULL otherwise.
*/
@@ -234,7 +240,7 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc)
if (status == CR_OK) {
/*read went well */
- buf = (guchar *)g_realloc (buf, len + CR_INPUT_MEM_CHUNK_SIZE);
+ buf = g_realloc (buf, len + CR_INPUT_MEM_CHUNK_SIZE);
memcpy (buf + len, tmp_buf, nb_read);
len += nb_read;
buf_size += CR_INPUT_MEM_CHUNK_SIZE;
@@ -268,8 +274,10 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc)
}
/**
+ * cr_input_destroy:
+ *@a_this: the current instance of #CRInput.
+ *
*The destructor of the #CRInput class.
- *@param a_this the current instance of #CRInput.
*/
void
cr_input_destroy (CRInput * a_this)
@@ -291,9 +299,11 @@ cr_input_destroy (CRInput * a_this)
}
/**
+ * cr_input_ref:
+ *@a_this: the current instance of #CRInput.
+ *
*Increments the reference count of the current
*instance of #CRInput.
- *@param a_this the current instance of #CRInput.
*/
void
cr_input_ref (CRInput * a_this)
@@ -304,11 +314,14 @@ cr_input_ref (CRInput * a_this)
}
/**
+ * cr_input_unref:
+ *@a_this: the current instance of #CRInput.
+ *
*Decrements the reference count of this instance
*of #CRInput. If the reference count goes down to
*zero, this instance is destroyed.
- *@param a_this the current instance of #CRInput.
*
+ * Returns TRUE if the instance of #CRInput got destroyed, false otherwise.
*/
gboolean
cr_input_unref (CRInput * a_this)
@@ -327,18 +340,21 @@ cr_input_unref (CRInput * a_this)
}
/**
- *Tests wether the current instance of
- *#CRInput has reached its input buffer.
- *@param a_this the current instance of #CRInput.
- *@param a_end_of_input out parameter. Is set to TRUE if
+ * cr_input_end_of_input:
+ *@a_this: the current instance of #CRInput.
+ *@a_end_of_input: out parameter. Is set to TRUE if
*the current instance has reached the end of its input buffer,
*FALSE otherwise.
- *@param CR_OK upon successful completion, an error code otherwise.
- *Note that all the out parameters of this method are valid if
- *and only if this method returns CR_OK.
+ *
+ *Tests wether the current instance of
+ *#CRInput has reached its input buffer.
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ * Note that all the out parameters of this method are valid if
+ * and only if this method returns CR_OK.
*/
enum CRStatus
-cr_input_end_of_input (CRInput * a_this, gboolean * a_end_of_input)
+cr_input_end_of_input (CRInput const * a_this, gboolean * a_end_of_input)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_end_of_input, CR_BAD_PARAM_ERROR);
@@ -350,13 +366,14 @@ cr_input_end_of_input (CRInput * a_this, gboolean * a_end_of_input)
}
/**
+ * cr_input_get_nb_bytes_left:
+ *@a_this: the current instance of #CRInput.
+ *
*Returns the number of bytes left in the input stream
- *before the end.
- *@param a_this the current instance of #CRInput.
- *@return the number of characters left or -1 in case of error.
+ *before the end, -1 in case of error.
*/
glong
-cr_input_get_nb_bytes_left (CRInput * a_this)
+cr_input_get_nb_bytes_left (CRInput const * a_this)
{
g_return_val_if_fail (a_this && PRIVATE (a_this), -1);
g_return_val_if_fail (PRIVATE (a_this)->nb_bytes
@@ -371,14 +388,16 @@ cr_input_get_nb_bytes_left (CRInput * a_this)
}
/**
- *Returns the next byte of the input.
- *Update the state of the input so that
+ * cr_input_read_byte:
+ *@a_this: the current instance of #CRInput.
+ *@a_byte: out parameter the returned byte.
+ *
+ *Gets the next byte of the input.
+ *Updates the state of the input so that
*the next invocation of this method returns
*the next coming byte.
*
- *@param a_this the current instance of #CRInput.
- *@param a_byte out parameter the returned byte.
- *@return CR_OK upon successful completion, an error code
+ *Returns CR_OK upon successful completion, an error code
*otherwise. All the out parameters of this method are valid if
*and only if this method returns CR_OK.
*/
@@ -407,11 +426,14 @@ cr_input_read_byte (CRInput * a_this, guchar * a_byte)
}
/**
+ * cr_input_read_char:
+ *@a_this: the current instance of CRInput.
+ *@a_char: out parameter. The read character.
+ *
*Reads an unicode character from the current instance of
*#CRInput.
- *@param a_this the current instance of CRInput.
- *@param a_char out parameter. The read character.
- *@return CR_OK upon successful completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
@@ -462,11 +484,13 @@ cr_input_read_char (CRInput * a_this, guint32 * a_char)
}
/**
+ * cr_input_set_line_num:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_line_num: the new line number.
+ *
*Setter of the current line number.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@param a_line_num the new line number.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Return CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_set_line_num (CRInput * a_this, glong a_line_num)
@@ -479,14 +503,16 @@ cr_input_set_line_num (CRInput * a_this, glong a_line_num)
}
/**
+ * cr_input_get_line_num:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_line_num: the returned line number.
+ *
*Getter of the current line number.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@param a_line_num the returned line number.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_get_line_num (CRInput * a_this, glong * a_line_num)
+cr_input_get_line_num (CRInput const * a_this, glong * a_line_num)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_line_num, CR_BAD_PARAM_ERROR);
@@ -497,11 +523,13 @@ cr_input_get_line_num (CRInput * a_this, glong * a_line_num)
}
/**
+ * cr_input_set_column_num:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_col: the new column number.
+ *
*Setter of the current column number.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@param a_col the new column number.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_set_column_num (CRInput * a_this, glong a_col)
@@ -514,14 +542,16 @@ cr_input_set_column_num (CRInput * a_this, glong a_col)
}
/**
+ * cr_input_get_column_num:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_col: out parameter
+ *
*Getter of the current column number.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@param a_col out parameter
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_get_column_num (CRInput * a_this, glong * a_col)
+cr_input_get_column_num (CRInput const * a_this, glong * a_col)
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_col,
CR_BAD_PARAM_ERROR);
@@ -532,10 +562,13 @@ cr_input_get_column_num (CRInput * a_this, glong * a_col)
}
/**
+ * cr_input_increment_line_num:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_increment: the increment to add to the line number.
+ *
*Increments the current line number.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_increment_line_num (CRInput * a_this, glong a_increment)
@@ -548,10 +581,13 @@ cr_input_increment_line_num (CRInput * a_this, glong a_increment)
}
/**
+ * cr_input_increment_col_num:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_increment: the increment to add to the column number.
+ *
*Increments the current column number.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_increment_col_num (CRInput * a_this, glong a_increment)
@@ -564,13 +600,15 @@ cr_input_increment_col_num (CRInput * a_this, glong a_increment)
}
/**
+ * cr_input_consume_char:
+ *@a_this: the this pointer.
+ *@a_char: the character to consume. If set to zero,
+ *consumes any character.
+ *
*Consumes the next character of the input stream if
*and only if that character equals a_char.
*
- *@param a_this the this pointer.
- *@param a_char the character to consume. If set to zero,
- *consumes any character.
- *@return CR_OK upon successful completion, CR_PARSING_ERROR if
+ *Returns CR_OK upon successful completion, CR_PARSING_ERROR if
*next char is different from a_char, an other error code otherwise
*/
enum CRStatus
@@ -595,21 +633,23 @@ cr_input_consume_char (CRInput * a_this, guint32 a_char)
}
/**
+ * cr_input_consume_chars:
+ *@a_this: the this pointer of the current instance of #CRInput.
+ *@a_char: the character to consume.
+ *@a_nb_char: in/out parameter. The number of characters to consume.
+ *If set to a negative value, the function will consume all the occurences
+ *of a_char found.
+ *After return, if the return value equals CR_OK, this variable contains
+ *the number of characters actually consumed.
+ *
*Consumes up to a_nb_char occurences of the next contiguous characters
*which equal a_char. Note that the next character of the input stream
**MUST* equal a_char to trigger the consumption, or else, the error
*code CR_PARSING_ERROR is returned.
*If the number of contiguous characters that equals a_char is less than
*a_nb_char, then this function consumes all the characters it can consume.
- *
- *@param a_this the this pointer of the current instance of #CRInput.
- *@param a_char the character to consume.
- *@param a_nb_char in/out parameter. The number of characters to consume.
- *If set to a negative value, the function will consume all the occurences
- *of a_char found.
- *After return, if the return value equals CR_OK, this variable contains
- *the number of characters actually consumed.
- *@return CR_OK if at least one character has been consumed, an error code
+ *
+ *Returns CR_OK if at least one character has been consumed, an error code
*otherwise.
*/
enum CRStatus
@@ -643,13 +683,15 @@ cr_input_consume_chars (CRInput * a_this, guint32 a_char, gulong * a_nb_char)
}
/**
+ * cr_input_consume_white_spaces:
+ *@a_this: the "this pointer" of the current instance of #CRInput.
+ *@a_nb_chars: in/out parameter. The number of white spaces to
+ *consume. After return, holds the number of white spaces actually consumed.
+ *
*Same as cr_input_consume_chars() but this one consumes white
*spaces.
*
- *@param a_this the "this pointer" of the current instance of #CRInput.
- *@param a_nb_chars in/out parameter. The number of white spaces to
- *consume. After return, holds the number of white spaces actually consumed.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_consume_white_spaces (CRInput * a_this, gulong * a_nb_chars)
@@ -688,17 +730,20 @@ cr_input_consume_white_spaces (CRInput * a_this, gulong * a_nb_chars)
}
/**
+ * cr_input_peek_char:
+ *@a_this: the current instance of #CRInput.
+ *@a_char: out parameter. The returned character.
+ *
*Same as cr_input_read_char() but does not update the
*internal state of the input stream. The next call
*to cr_input_peek_char() or cr_input_read_char() will thus
*return the same character as the current one.
- *@param a_this the current instance of #CRInput.
- *@param a_char out parameter. The returned character.
- *@return CR_OK upon successful completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
-cr_input_peek_char (CRInput * a_this, guint32 * a_char)
+cr_input_peek_char (CRInput const * a_this, guint32 * a_char)
{
enum CRStatus status = CR_OK;
glong consumed = 0,
@@ -721,12 +766,20 @@ cr_input_peek_char (CRInput * a_this, guint32 * a_char)
status = cr_utils_read_char_from_utf8_buf
(PRIVATE (a_this)->in_buf +
PRIVATE (a_this)->next_byte_index,
- nb_bytes_left, a_char, (gulong *)&consumed);
+ nb_bytes_left, a_char, &consumed);
return status;
}
/**
+ * cr_input_peek_byte:
+ *@a_this: the current instance of #CRInput.
+ *@a_origin: the origin to consider in the calculation
+ *of the position of the byte to peek.
+ *@a_offset: the offset of the byte to peek, starting from
+ *the origin specified by a_origin.
+ *@a_byte: out parameter the peeked byte.
+ *
*Gets a byte from the input stream,
*starting from the current position in the input stream.
*Unlike cr_input_peek_next_byte() this method
@@ -734,21 +787,12 @@ cr_input_peek_char (CRInput * a_this, guint32 * a_char)
*Subsequent calls to cr_input_peek_byte with the same arguments
*will return the same byte.
*
- *@param a_this the current instance of #CRInput.
- *@param a_origin the origin to consider in the calculation
- *of the position of the byte to peek.
- *@param a_offset the offset of the byte to peek, starting from
- *the origin specified by a_origin.
- *@param a_byte out parameter the peeked byte.
- *@return CR_OK upon successful completion or,
- *
- *<ul>
- *<li>CR_BAD_PARAM_ERROR if at least one of the parameters is invalid</li>
- *<li>CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds</li>
- *</ul>
+ *Returns CR_OK upon successful completion or,
+ *CR_BAD_PARAM_ERROR if at least one of the parameters is invalid;
+ *CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds.
*/
enum CRStatus
-cr_input_peek_byte (CRInput * a_this, enum CRSeekPos a_origin,
+cr_input_peek_byte (CRInput const * a_this, enum CRSeekPos a_origin,
gulong a_offset, guchar * a_byte)
{
gulong abs_offset = 0;
@@ -786,18 +830,21 @@ cr_input_peek_byte (CRInput * a_this, enum CRSeekPos a_origin,
}
/**
- *Same as cr_input_peek_byte() but with a simplified
- *interface.
- *@param a_this the current byte input stream.
- *@param a_offset the offset of the byte to peek, starting
+ * cr_input_peek_byte2:
+ *@a_this: the current byte input stream.
+ *@a_offset: the offset of the byte to peek, starting
*from the current input position pointer.
- *@param a_eof out parameter. Is set to true is we reach end of
+ *@a_eof: out parameter. Is set to true is we reach end of
*stream. If set to NULL by the caller, this parameter is not taken
*in account.
- *@return the read byte or 0 if something bad happened.
+ *
+ *Same as cr_input_peek_byte() but with a simplified
+ *interface.
+ *
+ *Returns the read byte or 0 if something bad happened.
*/
guchar
-cr_input_peek_byte2 (CRInput * a_this, gulong a_offset, gboolean * a_eof)
+cr_input_peek_byte2 (CRInput const * a_this, gulong a_offset, gboolean * a_eof)
{
guchar result = 0;
enum CRStatus status = CR_ERROR;
@@ -817,12 +864,15 @@ cr_input_peek_byte2 (CRInput * a_this, gulong a_offset, gboolean * a_eof)
}
/**
- *Returns the memory address of the byte located at a given offset
- *in the input stream.
- *@param a_this the current instance of #CRInput.
- *@param a_offset the offset of the byte in the input stream starting
+ * cr_input_get_byte_addr:
+ *@a_this: the current instance of #CRInput.
+ *@a_offset: the offset of the byte in the input stream starting
*from the beginning of the stream.
- *@return the address, otherwise NULL if an error occured.
+ *
+ *Gets the memory address of the byte located at a given offset
+ *in the input stream.
+ *
+ *Returns the address, otherwise NULL if an error occured.
*/
guchar *
cr_input_get_byte_addr (CRInput * a_this, gulong a_offset)
@@ -837,10 +887,13 @@ cr_input_get_byte_addr (CRInput * a_this, gulong a_offset)
}
/**
- *Returns the address of the current character pointer.
- *@param a_this the current input stream
- *@param a_offset out parameter. The returned address.
- *@return CR_OK upon successful completion, an error code otherwise.
+ * cr_input_get_cur_byte_addr:
+ *@a_this: the current input stream
+ *@a_offset: out parameter. The returned address.
+ *
+ *Gets the address of the current character pointer.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_get_cur_byte_addr (CRInput * a_this, guchar ** a_offset)
@@ -859,23 +912,20 @@ cr_input_get_cur_byte_addr (CRInput * a_this, guchar ** a_offset)
}
/**
+ * cr_input_seek_index:
+ *@a_this: the current instance of #CRInput.
+ *@a_origin: the origin to consider during the calculation
+ *of the absolute position of the new "current byte index".
+ *@a_pos: the relative offset of the new "current byte index."
+ *This offset is relative to the origin a_origin.
+ *
*Sets the "current byte index" of the current instance
*of #CRInput. Next call to cr_input_get_byte() will return
*the byte next after the new "current byte index".
*
- *@param a_this the current instance of #CRInput.
- *
- *@param a_origin the origin to consider during the calculation
- *of the absolute position of the new "current byte index".
- *
- *@param a_pos the relative offset of the new "current byte index."
- *This offset is relative to the origin a_origin.
- *
- *@return CR_OK upon successful completion otherwise returns
- *<ul>
- *<li>CR_BAD_PARAM_ERROR if at least one of the parameters is not valid</li>
- *<li>CR_OUT_BOUNDS_ERROR</li>
- *</ul>
+ *Returns CR_OK upon successful completion otherwise returns
+ *CR_BAD_PARAM_ERROR if at least one of the parameters is not valid
+ *or CR_OUT_BOUNDS_ERROR in case of error.
*/
enum CRStatus
cr_input_seek_index (CRInput * a_this, enum CRSeekPos a_origin, gint a_pos)
@@ -916,26 +966,24 @@ cr_input_seek_index (CRInput * a_this, enum CRSeekPos a_origin, gint a_pos)
}
/**
+ * cr_input_get_cur_pos:
+ *@a_this: the current instance of #CRInput.
+ *@a_pos: out parameter. The returned position.
+ *
*Gets the position of the "current byte index" which
*is basically the position of the last returned byte in the
*input stream.
*
- *@param a_this the current instance of #CRInput.
- *
- *@param a_pos out parameter. The returned position.
- *
- *@return CR_OK upon successful completion. Otherwise,
- *<ul>
- *<li>CR_BAD_PARAMETER_ERROR if at least one of the arguments is invalid.</li>
- *<li>CR_START_OF_INPUT if no call to either cr_input_read_byte()
+ *Returns CR_OK upon successful completion. Otherwise,
+ *CR_BAD_PARAMETER_ERROR if at least one of the arguments is invalid.
+ *CR_START_OF_INPUT if no call to either cr_input_read_byte()
*or cr_input_seek_index() have been issued before calling
- *cr_input_get_cur_pos()</li>
- *</ul>
+ *cr_input_get_cur_pos()
*Note that the out parameters of this function are valid if and only if this
*function returns CR_OK.
*/
enum CRStatus
-cr_input_get_cur_pos (CRInput * a_this, CRInputPos * a_pos)
+cr_input_get_cur_pos (CRInput const * a_this, CRInputPos * a_pos)
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos,
CR_BAD_PARAM_ERROR);
@@ -950,17 +998,20 @@ cr_input_get_cur_pos (CRInput * a_this, CRInputPos * a_pos)
}
/**
+ * cr_input_get_parsing_location:
+ *@a_this: the current instance of #CRInput
+ *@a_loc: the set parsing location.
+ *
*Gets the current parsing location.
*The Parsing location is a public datastructure that
*represents the current line/column/byte offset/ in the input
*stream.
- *@param a_this the current instance of #CRInput
- *@param a_loc the set parsing location.
- *@return CR_OK upon successful completion, an error
+ *
+ *Returns CR_OK upon successful completion, an error
*code otherwise.
*/
enum CRStatus
-cr_input_get_parsing_location (CRInput *a_this,
+cr_input_get_parsing_location (CRInput const *a_this,
CRParsingLocation *a_loc)
{
g_return_val_if_fail (a_this
@@ -979,17 +1030,20 @@ cr_input_get_parsing_location (CRInput *a_this,
}
/**
+ * cr_input_get_cur_index:
+ *@a_this: the "this pointer" of the current instance of
+ *#CRInput
+ *@a_index: out parameter. The returned index.
+ *
*Getter of the next byte index.
*It actually returns the index of the
*next byte to be read.
- *@param a_this the "this pointer" of the current instance of
- *#CRInput
- *@param a_index out parameter. The returned index.
- *@return CR_OK upon successful completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
-cr_input_get_cur_index (CRInput * a_this, glong * a_index)
+cr_input_get_cur_index (CRInput const * a_this, glong * a_index)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_index, CR_BAD_PARAM_ERROR);
@@ -1000,12 +1054,15 @@ cr_input_get_cur_index (CRInput * a_this, glong * a_index)
}
/**
+ * cr_input_set_cur_index:
+ *@a_this: the "this pointer" of the current instance
+ *of #CRInput .
+ *@a_index: the new index to set.
+ *
*Setter of the next byte index.
*It sets the index of the next byte to be read.
- *@param a_this the "this pointer" of the current instance
- *of #CRInput .
- *@param a_index the new index to set.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_set_cur_index (CRInput * a_this, glong a_index)
@@ -1018,10 +1075,13 @@ cr_input_set_cur_index (CRInput * a_this, glong a_index)
}
/**
+ * cr_input_set_end_of_file:
+ *@a_this: the current instance of #CRInput.
+ *@a_eof: the new end of file flag.
+ *
*Sets the end of file flag.
- *@param a_this the current instance of #CRInput.
- *@param a_eof the new end of file flag.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_input_set_end_of_file (CRInput * a_this, gboolean a_eof)
@@ -1034,14 +1094,17 @@ cr_input_set_end_of_file (CRInput * a_this, gboolean a_eof)
}
/**
- *Gets the end of file flag.
- *@param a_this the current instance of #CRInput.
- *@param a_eof out parameter the place to put the end of
+ * cr_input_get_end_of_file:
+ *@a_this: the current instance of #CRInput.
+ *@a_eof: out parameter the place to put the end of
*file flag.
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Gets the end of file flag.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_get_end_of_file (CRInput * a_this, gboolean * a_eof)
+cr_input_get_end_of_file (CRInput const * a_this, gboolean * a_eof)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_eof, CR_BAD_PARAM_ERROR);
@@ -1052,10 +1115,13 @@ cr_input_get_end_of_file (CRInput * a_this, gboolean * a_eof)
}
/**
+ * cr_input_set_end_of_line:
+ *@a_this: the current instance of #CRInput.
+ *@a_eol: the new end of line flag.
+ *
*Sets the end of line flag.
- *@param a_this the current instance of #CRInput.
- *@param a_eol the new end of line flag.
- *@return CR_OK upon successful completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
@@ -1069,15 +1135,18 @@ cr_input_set_end_of_line (CRInput * a_this, gboolean a_eol)
}
/**
- *Gets the end of line flag of the current input.
- *@param a_this the current instance of #CRInput
- *@param a_eol out parameter. The place to put
+ * cr_input_get_end_of_line:
+ *@a_this: the current instance of #CRInput
+ *@a_eol: out parameter. The place to put
*the returned flag
- *@return CR_OK upon successful completion, an error code
+ *
+ *Gets the end of line flag of the current input.
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
-cr_input_get_end_of_line (CRInput * a_this, gboolean * a_eol)
+cr_input_get_end_of_line (CRInput const * a_this, gboolean * a_eol)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_eol, CR_BAD_PARAM_ERROR);
@@ -1088,14 +1157,17 @@ cr_input_get_end_of_line (CRInput * a_this, gboolean * a_eol)
}
/**
+ * cr_input_set_cur_pos:
+ *@a_this: the "this pointer" of the current instance of
+ *#CRInput.
+ *@a_pos: the new position.
+ *
*Sets the current position in the input stream.
*
- *@param a_this the "this pointer" of the current instance of
- *#CRInput.
- *@param a_pos the new position.
+ * Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_set_cur_pos (CRInput * a_this, CRInputPos * a_pos)
+cr_input_set_cur_pos (CRInput * a_this, CRInputPos const * a_pos)
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos,
CR_BAD_PARAM_ERROR);
diff --git a/src/libcroco/cr-input.h b/src/libcroco/cr-input.h
index 976b73fb0..9eb402a87 100644
--- a/src/libcroco/cr-input.h
+++ b/src/libcroco/cr-input.h
@@ -93,15 +93,15 @@ enum CRStatus
cr_input_consume_white_spaces (CRInput *a_this, gulong *a_nb_chars) ;
enum CRStatus
-cr_input_peek_byte (CRInput *a_this, enum CRSeekPos a_origin,
+cr_input_peek_byte (CRInput const *a_this, enum CRSeekPos a_origin,
gulong a_offset, guchar *a_byte) ;
guchar
-cr_input_peek_byte2 (CRInput *a_this, gulong a_offset,
+cr_input_peek_byte2 (CRInput const *a_this, gulong a_offset,
gboolean *a_eof) ;
enum CRStatus
-cr_input_peek_char (CRInput *a_this, guint32 *a_char) ;
+cr_input_peek_char (CRInput const *a_this, guint32 *a_char) ;
guchar *
cr_input_get_byte_addr (CRInput *a_this,
@@ -115,29 +115,29 @@ cr_input_seek_index (CRInput *a_this,
enum CRSeekPos a_origin, gint a_pos) ;
enum CRStatus
-cr_input_get_cur_index (CRInput *a_this, glong *a_index) ;
+cr_input_get_cur_index (CRInput const *a_this, glong *a_index) ;
enum CRStatus
cr_input_set_cur_index (CRInput *a_this, glong a_index) ;
enum CRStatus
-cr_input_get_cur_pos (CRInput *a_this, CRInputPos * a_pos) ;
+cr_input_get_cur_pos (CRInput const *a_this, CRInputPos * a_pos) ;
enum CRStatus
-cr_input_set_cur_pos (CRInput *a_this, CRInputPos *a_pos) ;
+cr_input_set_cur_pos (CRInput *a_this, CRInputPos const *a_pos) ;
enum CRStatus
-cr_input_get_parsing_location (CRInput *a_this,
+cr_input_get_parsing_location (CRInput const *a_this,
CRParsingLocation *a_loc) ;
enum CRStatus
-cr_input_get_end_of_line (CRInput *a_this, gboolean *a_eol) ;
+cr_input_get_end_of_line (CRInput const *a_this, gboolean *a_eol) ;
enum CRStatus
cr_input_set_end_of_line (CRInput *a_this, gboolean a_eol) ;
enum CRStatus
-cr_input_get_end_of_file (CRInput *a_this, gboolean *a_eof) ;
+cr_input_get_end_of_file (CRInput const *a_this, gboolean *a_eof) ;
enum CRStatus
cr_input_set_end_of_file (CRInput *a_this, gboolean a_eof) ;
@@ -146,13 +146,13 @@ enum CRStatus
cr_input_set_line_num (CRInput *a_this, glong a_line_num) ;
enum CRStatus
-cr_input_get_line_num (CRInput *a_this, glong *a_line_num) ;
+cr_input_get_line_num (CRInput const *a_this, glong *a_line_num) ;
enum CRStatus
cr_input_set_column_num (CRInput *a_this, glong a_col) ;
enum CRStatus
-cr_input_get_column_num (CRInput *a_this, glong *a_col) ;
+cr_input_get_column_num (CRInput const *a_this, glong *a_col) ;
enum CRStatus
cr_input_increment_line_num (CRInput *a_this,
@@ -163,10 +163,10 @@ cr_input_increment_col_num (CRInput *a_this,
glong a_increment) ;
glong
-cr_input_get_nb_bytes_left (CRInput *a_this) ;
+cr_input_get_nb_bytes_left (CRInput const *a_this) ;
enum CRStatus
-cr_input_end_of_input (CRInput *a_this, gboolean *a_end_of_input) ;
+cr_input_end_of_input (CRInput const *a_this, gboolean *a_end_of_input) ;
G_END_DECLS
diff --git a/src/libcroco/cr-num.c b/src/libcroco/cr-num.c
index 062784c84..a5c320bf2 100644
--- a/src/libcroco/cr-num.c
+++ b/src/libcroco/cr-num.c
@@ -23,7 +23,8 @@
*/
/**
- *@file
+ *@CRNum:
+ *
*The definition
*of the #CRNum class.
*/
@@ -32,15 +33,19 @@
#include "string.h"
/**
- *The default constructor of
+ * cr_num_new:
+ *
*#CRNum.
- *@return the newly built instance of
+ *
+ *Returns the newly built instance of
*#CRNum.
*/
CRNum *
cr_num_new (void)
{
- CRNum *result = (CRNum *)g_try_malloc (sizeof (CRNum));
+ CRNum *result = NULL;
+
+ result = g_try_malloc (sizeof (CRNum));
if (result == NULL) {
cr_utils_trace_info ("Out of memory");
@@ -53,16 +58,14 @@ cr_num_new (void)
}
/**
- *A constructor of #CRNum.
- *@param a_is_natural indicates whether the intance of #CRNum is
- *a natural number or not.
- *@param a_integer_part the integer part of the instance
- *of #CRNum
- *@param a_decimal_part in case the instance of #CRNum
- *natural number (but a decimal one) this parameter
- *is the decimal part of the instance of #CRNum.
- *@return the newly built instance of #CRNum or
- *NULL if an error arises.
+ * cr_num_new_with_val:
+ * @a_val: the numerical value of the number.
+ * @a_type: the type of number.
+ *
+ * A constructor of #CRNum.
+ *
+ * Returns the newly built instance of #CRNum or
+ * NULL if an error arises.
*/
CRNum *
cr_num_new_with_val (gdouble a_val, enum CRNumType a_type)
@@ -80,27 +83,29 @@ cr_num_new_with_val (gdouble a_val, enum CRNumType a_type)
}
/**
- *Returns the string representation of the
- *current instance of #CRNum.
- *@param a_this the current instance of #CRNum.
- *@return the newly built string representation
+ * cr_num_to_string:
+ *@a_this: the current instance of #CRNum.
+ *
+ *Returns the newly built string representation
*of the current instance of #CRNum. The returned
*string is NULL terminated. The caller *must*
*free the returned string.
*/
guchar *
-cr_num_to_string (CRNum * a_this)
+cr_num_to_string (CRNum const * a_this)
{
+ gdouble test_val = 0.0;
+
guchar *tmp_char1 = NULL,
*tmp_char2 = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
- gdouble test_val = a_this->val - (glong) a_this->val;
+ test_val = a_this->val - (glong) a_this->val;
if (!test_val) {
- tmp_char1 = (guchar *)g_strdup_printf ("%ld", (glong) a_this->val);
+ tmp_char1 = g_strdup_printf ("%ld", (glong) a_this->val);
} else {
/* We can't use g_ascii_dtostr, because that sometimes uses
e notation (which wouldn't be a valid number in CSS). */
@@ -190,8 +195,7 @@ cr_num_to_string (CRNum * a_this)
}
if (tmp_char2) {
- result = (guchar *)g_strconcat (
- (gchar *)tmp_char1, (gchar *)tmp_char2, NULL);
+ result = g_strconcat (tmp_char1, tmp_char2, NULL);
g_free (tmp_char1);
} else {
result = tmp_char1;
@@ -201,16 +205,19 @@ cr_num_to_string (CRNum * a_this)
}
/**
- *Copies an instance of #CRNum.
- *@param a_src the instance of #CRNum to copy.
+ * cr_num_copy:
+ *@a_src: the instance of #CRNum to copy.
*Must be non NULL.
- *@param a_dst the destination of the copy.
+ *@a_dest: the destination of the copy.
*Must be non NULL
- *@return CR_OK upon successful completion, an
+ *
+ *Copies an instance of #CRNum.
+ *
+ *Returns CR_OK upon successful completion, an
*error code otherwise.
*/
enum CRStatus
-cr_num_copy (CRNum * a_dest, CRNum * a_src)
+cr_num_copy (CRNum * a_dest, CRNum const * a_src)
{
g_return_val_if_fail (a_dest && a_src, CR_BAD_PARAM_ERROR);
@@ -220,13 +227,16 @@ cr_num_copy (CRNum * a_dest, CRNum * a_src)
}
/**
+ * cr_num_dup:
+ *@a_this: the instance of #CRNum to duplicate.
+ *
*Duplicates an instance of #CRNum
- *@param a_this the instance of #CRNum to duplicate.
- *@return the newly created (duplicated) instance of #CRNum.
+ *
+ *Returns the newly created (duplicated) instance of #CRNum.
*Must be freed by cr_num_destroy().
*/
CRNum *
-cr_num_dup (CRNum * a_this)
+cr_num_dup (CRNum const * a_this)
{
CRNum *result = NULL;
enum CRStatus status = CR_OK;
@@ -243,11 +253,14 @@ cr_num_dup (CRNum * a_this)
}
/**
+ * cr_num_set:
*Sets an instance of #CRNum.
- *@param a_this the current instance of #CRNum to be set.
- *@param a_val the new numerical value to be hold by the current
+ *@a_this: the current instance of #CRNum to be set.
+ *@a_val: the new numerical value to be hold by the current
*instance of #CRNum
- *@param a_type the new type of #CRNum.
+ *@a_type: the new type of #CRNum.
+ *
+ * Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
cr_num_set (CRNum * a_this, gdouble a_val, enum CRNumType a_type)
@@ -261,15 +274,19 @@ cr_num_set (CRNum * a_this, gdouble a_val, enum CRNumType a_type)
}
/**
+ * cr_num_is_fixed_length:
+ * @a_this: the current instance of #CRNum .
+ *
*Tests if the current instance of #CRNum is a fixed
*length value or not. Typically a fixed length value
*is anything from NUM_LENGTH_EM to NUM_LENGTH_PC.
*See the definition of #CRNumType to see what we mean.
- *@return TRUE if the instance of #CRNum is a fixed length number,
+ *
+ *Returns TRUE if the instance of #CRNum is a fixed length number,
*FALSE otherwise.
*/
gboolean
-cr_num_is_fixed_length (CRNum * a_this)
+cr_num_is_fixed_length (CRNum const * a_this)
{
gboolean result = FALSE;
@@ -283,9 +300,11 @@ cr_num_is_fixed_length (CRNum * a_this)
}
/**
- *The destructor of #CRNum.
- *@param a_this the this pointer of
+ * cr_num_destroy:
+ *@a_this: the this pointer of
*the current instance of #CRNum.
+ *
+ *The destructor of #CRNum.
*/
void
cr_num_destroy (CRNum * a_this)
diff --git a/src/libcroco/cr-num.h b/src/libcroco/cr-num.h
index 83e9dc7c6..2b73aaf79 100644
--- a/src/libcroco/cr-num.h
+++ b/src/libcroco/cr-num.h
@@ -102,20 +102,20 @@ cr_num_new_with_val (gdouble a_val,
enum CRNumType a_type) ;
CRNum *
-cr_num_dup (CRNum *a_this) ;
+cr_num_dup (CRNum const *a_this) ;
guchar *
-cr_num_to_string (CRNum *a_this) ;
+cr_num_to_string (CRNum const *a_this) ;
enum CRStatus
-cr_num_copy (CRNum *a_dest, CRNum *a_src) ;
+cr_num_copy (CRNum *a_dest, CRNum const *a_src) ;
enum CRStatus
cr_num_set (CRNum *a_this, gdouble a_val,
enum CRNumType a_type) ;
gboolean
-cr_num_is_fixed_length (CRNum *a_this) ;
+cr_num_is_fixed_length (CRNum const *a_this) ;
void
cr_num_destroy (CRNum *a_this) ;
diff --git a/src/libcroco/cr-om-parser.c b/src/libcroco/cr-om-parser.c
index c9ce032af..ea622e35c 100644
--- a/src/libcroco/cr-om-parser.c
+++ b/src/libcroco/cr-om-parser.c
@@ -25,10 +25,9 @@
#include "cr-utils.h"
#include "cr-om-parser.h"
-#define UNUSED(_param) ((void)(_param))
-
/**
- *@file
+ *@CROMParser:
+ *
*The definition of the CSS Object Model Parser.
*This parser uses (and sits) the SAC api of libcroco defined
*in cr-parser.h and cr-doc-handler.h
@@ -112,8 +111,9 @@ struct _ParsingContext {
static ParsingContext *
new_parsing_context (void)
{
- ParsingContext *result =
- (ParsingContext *)g_try_malloc (sizeof (ParsingContext));
+ ParsingContext *result = NULL;
+
+ result = g_try_malloc (sizeof (ParsingContext));
if (!result) {
cr_utils_trace_info ("Out of Memory");
return NULL;
@@ -142,7 +142,7 @@ static enum CRStatus
cr_om_parser_init_default_sac_handler (CROMParser * a_this)
{
CRDocHandler *sac_handler = NULL;
- gboolean free_hdlr_if_error = FALSE;
+ gboolean created_handler = FALSE;
enum CRStatus status = CR_OK;
g_return_val_if_fail (a_this && PRIVATE (a_this)
@@ -155,7 +155,7 @@ cr_om_parser_init_default_sac_handler (CROMParser * a_this)
if (!sac_handler) {
sac_handler = cr_doc_handler_new ();
- free_hdlr_if_error = TRUE;
+ created_handler = TRUE;
}
/*
@@ -177,15 +177,10 @@ cr_om_parser_init_default_sac_handler (CROMParser * a_this)
sac_handler->end_media = end_media;
sac_handler->import_style = import_style;
- status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
- sac_handler);
- if (status == CR_OK) {
- return CR_OK;
- }
-
- if (sac_handler && free_hdlr_if_error == TRUE) {
- cr_doc_handler_destroy (sac_handler);
- sac_handler = NULL;
+ if (created_handler) {
+ status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
+ sac_handler);
+ cr_doc_handler_unref (sac_handler);
}
return status;
@@ -216,10 +211,10 @@ start_font_face (CRDocHandler * a_this,
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
- UNUSED(a_location);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+ g_return_if_fail (a_this);
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt == NULL);
@@ -315,10 +310,8 @@ charset (CRDocHandler * a_this, CRString * a_charset,
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
- UNUSED(a_location);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
@@ -351,10 +344,8 @@ start_page (CRDocHandler * a_this,
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
- UNUSED(a_location);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt == NULL);
@@ -395,11 +386,8 @@ end_page (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
CRStatement *stmt = NULL;
- UNUSED(a_page);
- UNUSED(a_pseudo_page);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt
@@ -419,6 +407,8 @@ end_page (CRDocHandler * a_this,
cr_statement_destroy (ctxt->cur_stmt);
ctxt->cur_stmt = NULL;
}
+ a_page = NULL; /*keep compiler happy */
+ a_pseudo_page = NULL; /*keep compiler happy */
}
static void
@@ -431,10 +421,8 @@ start_media (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
GList *media_list = NULL;
- UNUSED(a_location);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
@@ -444,10 +432,12 @@ start_media (CRDocHandler * a_this,
&& ctxt->stylesheet);
if (a_media_list) {
/*duplicate the media_list */
- media_list = cr_utils_dup_glist_of_cr_string(a_media_list);
+ media_list = cr_utils_dup_glist_of_cr_string
+ (a_media_list);
}
ctxt->cur_media_stmt =
- cr_statement_new_at_media_rule(ctxt->stylesheet, NULL, media_list);
+ cr_statement_new_at_media_rule
+ (ctxt->stylesheet, NULL, media_list);
}
@@ -459,10 +449,8 @@ end_media (CRDocHandler * a_this, GList * a_media_list)
ParsingContext **ctxtptr = NULL;
CRStatement *stmts = NULL;
- UNUSED(a_media_list);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt
@@ -482,6 +470,7 @@ end_media (CRDocHandler * a_this, GList * a_media_list)
ctxt->cur_stmt = NULL ;
ctxt->cur_media_stmt = NULL ;
+ a_media_list = NULL;
}
static void
@@ -499,11 +488,8 @@ import_style (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
GList *media_list = NULL ;
- UNUSED(a_uri_default_ns);
- UNUSED(a_location);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
@@ -575,10 +561,8 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list)
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
- UNUSED(a_selector_list);
g_return_if_fail (a_this);
-
- ctxtptr = &ctxt;
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet);
@@ -773,16 +757,19 @@ unrecoverable_error (CRDocHandler * a_this)
********************************************/
/**
+ * cr_om_parser_new:
+ *@a_input: the input stream.
+ *
*Constructor of the CROMParser.
- *@param a_input the input stream.
- *@return the newly built instance of #CROMParser.
+ *Returns the newly built instance of #CROMParser.
*/
CROMParser *
cr_om_parser_new (CRInput * a_input)
{
+ CROMParser *result = NULL;
enum CRStatus status = CR_OK;
- CROMParser *result = (CROMParser *)g_try_malloc (sizeof (CROMParser));
+ result = g_try_malloc (sizeof (CROMParser));
if (!result) {
cr_utils_trace_info ("Out of memory");
@@ -790,7 +777,7 @@ cr_om_parser_new (CRInput * a_input)
}
memset (result, 0, sizeof (CROMParser));
- PRIVATE (result) = (CROMParserPriv *)g_try_malloc (sizeof (CROMParserPriv));
+ PRIVATE (result) = g_try_malloc (sizeof (CROMParserPriv));
if (!PRIVATE (result)) {
cr_utils_trace_info ("Out of memory");
@@ -824,13 +811,16 @@ cr_om_parser_new (CRInput * a_input)
}
/**
+ * cr_om_parser_parse_buf:
+ *@a_this: the current instance of #CROMParser.
+ *@a_buf: the in memory buffer to parse.
+ *@a_len: the length of the in memory buffer in number of bytes.
+ *@a_enc: the encoding of the in memory buffer.
+ *@a_result: out parameter the resulting style sheet
+ *
*Parses the content of an in memory buffer.
- *@param a_this the current instance of #CROMParser.
- *@param a_buf the in memory buffer to parse.
- *@param a_len the length of the in memory buffer in number of bytes.
- *@param a_enc the encoding of the in memory buffer.
- *@param a_result out parameter the resulting style sheet
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_om_parser_parse_buf (CROMParser * a_this,
@@ -871,12 +861,15 @@ cr_om_parser_parse_buf (CROMParser * a_this,
}
/**
+ * cr_om_parser_simply_parse_buf:
+ *@a_buf: the css2 in memory buffer.
+ *@a_len: the length of the in memory buffer.
+ *@a_enc: the encoding of the in memory buffer.
+ *@a_result: out parameter. The resulting css2 style sheet.
+ *
*The simpler way to parse an in memory css2 buffer.
- *@param a_buf the css2 in memory buffer.
- *@param a_len the length of the in memory buffer.
- *@param a_enc the encoding of the in memory buffer.
- *@param a_result out parameter. The resulting css2 style sheet.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_om_parser_simply_parse_buf (const guchar * a_buf,
@@ -906,16 +899,18 @@ cr_om_parser_simply_parse_buf (const guchar * a_buf,
}
/**
- *Parses a css2 stylesheet contained
- *in a file.
- *@param a_this the current instance of the cssom parser.
- *@param a_file_uri the uri of the file.
+ * cr_om_parser_parse_file:
+ *@a_this: the current instance of the cssom parser.
+ *@a_file_uri: the uri of the file.
*(only local file paths are suppported so far)
- *@param a_enc the encoding of the file.
- *@param a_result out parameter. A pointer
+ *@a_enc: the encoding of the file.
+ *@a_result: out parameter. A pointer
*the build css object model.
- *@param CR_OK upon successfull completion, an error code
- *otherwise.
+ *
+ *Parses a css2 stylesheet contained
+ *in a file.
+ *
+ * Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
cr_om_parser_parse_file (CROMParser * a_this,
@@ -955,12 +950,15 @@ cr_om_parser_parse_file (CROMParser * a_this,
}
/**
- *The simpler method to parse a css2 file.
- *@param a_file_path the css2 local file path.
- *@param a_enc the file encoding.
- *@param a_result out parameter. The returned css stylesheet.
+ * cr_om_parser_simply_parse_file:
+ *@a_file_path: the css2 local file path.
+ *@a_enc: the file encoding.
+ *@a_result: out parameter. The returned css stylesheet.
*Must be freed by the caller using cr_stylesheet_destroy.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *The simpler method to parse a css2 file.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*Note that this method uses cr_om_parser_parse_file() so both methods
*have the same return values.
*/
@@ -990,14 +988,18 @@ cr_om_parser_simply_parse_file (const guchar * a_file_path,
}
/**
- *Parses three sheets located by their paths and build a cascade
- *@param a_this the current instance of #CROMParser
- *@param a_author_path the path to the author stylesheet
- *@param a_user_path the path to the user stylesheet
- *@param a_ua_path the path to the User Agent stylesheet
- *@param a_result out parameter. The resulting cascade if the parsing
+ * cr_om_parser_parse_paths_to_cascade:
+ *@a_this: the current instance of #CROMParser
+ *@a_author_path: the path to the author stylesheet
+ *@a_user_path: the path to the user stylesheet
+ *@a_ua_path: the path to the User Agent stylesheet
+ *@a_encoding: the encoding of the sheets.
+ *@a_result: out parameter. The resulting cascade if the parsing
*was okay
- *@return CR_OK upon successful completion, an error code otherwise
+ *
+ *Parses three sheets located by their paths and build a cascade
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise
*/
enum CRStatus
cr_om_parser_parse_paths_to_cascade (CROMParser * a_this,
@@ -1017,7 +1019,7 @@ cr_om_parser_parse_paths_to_cascade (CROMParser * a_this,
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
- memset (sheets, 0, sizeof (sheets));
+ memset (sheets, 0, sizeof (CRStyleSheet*) * 3);
paths[0] = (guchar *) a_author_path;
paths[1] = (guchar *) a_user_path;
paths[2] = (guchar *) a_ua_path;
@@ -1046,13 +1048,17 @@ cr_om_parser_parse_paths_to_cascade (CROMParser * a_this,
}
/**
- *Parses three sheets located by their paths and build a cascade
- *@param a_author_path the path to the author stylesheet
- *@param a_user_path the path to the user stylesheet
- *@param a_ua_path the path to the User Agent stylesheet
- *@param a_result out parameter. The resulting cascade if the parsing
+ * cr_om_parser_simply_parse_paths_to_cascade:
+ *@a_author_path: the path to the author stylesheet
+ *@a_user_path: the path to the user stylesheet
+ *@a_ua_path: the path to the User Agent stylesheet
+ *@a_encoding: the encoding of the sheets.
+ *@a_result: out parameter. The resulting cascade if the parsing
*was okay
- *@return CR_OK upon successful completion, an error code otherwise
+ *
+ *Parses three sheets located by their paths and build a cascade
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise
*/
enum CRStatus
cr_om_parser_simply_parse_paths_to_cascade (const guchar * a_author_path,
@@ -1083,8 +1089,10 @@ cr_om_parser_simply_parse_paths_to_cascade (const guchar * a_author_path,
}
/**
+ * cr_om_parser_destroy:
+ *@a_this: the current instance of #CROMParser.
+ *
*Destructor of the #CROMParser.
- *@param a_this the current instance of #CROMParser.
*/
void
cr_om_parser_destroy (CROMParser * a_this)
diff --git a/src/libcroco/cr-om-parser.h b/src/libcroco/cr-om-parser.h
index 4fc63011a..13d35b1cd 100644
--- a/src/libcroco/cr-om-parser.h
+++ b/src/libcroco/cr-om-parser.h
@@ -22,7 +22,7 @@
*/
/*
- *$Id: cr-om-parser.h,v 1.9 2004/01/29 22:05:14 dodji Exp $
+ *$Id$
*/
#ifndef __CR_OM_PARSER_H__
diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c
index 410f8f80f..41d3eab5a 100644
--- a/src/libcroco/cr-parser.c
+++ b/src/libcroco/cr-parser.c
@@ -24,7 +24,8 @@
*/
/**
- *@file
+ *@CRParser:
+ *
*The definition of the #CRParser class.
*/
@@ -41,7 +42,7 @@
*=====================================
*
*One must keep in mind
- *that css UA must comply with two syntax.
+ *that css UA must comply with two syntaxes.
*
*1/the specific syntax that defines the css language
*for a given level of specificatin (e.g css2 syntax
@@ -136,8 +137,9 @@ struct _CRParserPriv {
#define CHARS_TAB_SIZE 12
/**
+ * IS_NUM:
+ *@a_char: the char to test.
*return TRUE if the character is a number ([0-9]), FALSE otherwise
- *@param a_char the char to test.
*/
#define IS_NUM(a_char) (((a_char) >= '0' && (a_char) <= '9')?TRUE:FALSE)
@@ -161,16 +163,18 @@ if ((status) != CR_OK) \
}
/**
- *same as CHECK_PARSING_STATUS() but this one pushes an error
- *on the parser error stack when an error arises.
- *@param a_this the current instance of #CRParser .
- *@param a_status the status to check. Is of type enum #CRStatus.
- *@param a_is_exception in case of error, if is TRUE, the status
+ * CHECK_PARSING_STATUS_ERR:
+ *@a_this: the current instance of #CRParser .
+ *@a_status: the status to check. Is of type enum #CRStatus.
+ *@a_is_exception: in case of error, if is TRUE, the status
*is set to CR_PARSING_ERROR before goto error. If is false, the
*real low level status is kept and will be returned by the
*upper level function that called this macro. Usally,this must
*be set to FALSE.
*
+ *same as CHECK_PARSING_STATUS() but this one pushes an error
+ *on the parser error stack when an error arises.
+ *
*/
#define CHECK_PARSING_STATUS_ERR(a_this, a_status, a_is_exception,\
a_err_msg, a_err_status) \
@@ -409,7 +413,9 @@ static enum CRStatus
static CRParserError *
cr_parser_error_new (const guchar * a_msg, enum CRStatus a_status)
{
- CRParserError *result = (CRParserError *)g_try_malloc (sizeof (CRParserError));
+ CRParserError *result = NULL;
+
+ result = g_try_malloc (sizeof (CRParserError));
if (result == NULL) {
cr_utils_trace_info ("Out of memory");
@@ -438,7 +444,7 @@ cr_parser_error_set_msg (CRParserError * a_this, const guchar * a_msg)
g_free (a_this->msg);
}
- a_this->msg = (guchar *)g_strdup ((gchar *)a_msg);
+ a_this->msg = g_strdup (a_msg);
}
/**
@@ -603,11 +609,13 @@ cr_parser_clear_errors (CRParser * a_this)
}
/**
+ * cr_parser_try_to_skip_spaces_and_comments:
+ *@a_this: the current instance of #CRParser.
+ *
*Same as cr_parser_try_to_skip_spaces() but this one skips
*spaces and comments.
*
- *@param a_this the current instance of #CRParser.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_try_to_skip_spaces_and_comments (CRParser * a_this)
@@ -725,7 +733,7 @@ cr_parser_parse_stylesheet_core (CRParser * a_this)
error:
cr_parser_push_error
- (a_this, (guchar *)"could not recognize next production", CR_ERROR);
+ (a_this, "could not recognize next production", CR_ERROR);
cr_parser_dump_err_stack (a_this, TRUE);
@@ -1483,6 +1491,9 @@ cr_parser_parse_property (CRParser * a_this,
}
/**
+ * cr_parser_parse_term:
+ *@a_term: out parameter. The successfully parsed term.
+ *
*Parses a "term" as defined in the css2 spec, appendix D.1:
*term ::= unary_operator? [NUMBER S* | PERCENTAGE S* | LENGTH S* |
*EMS S* | EXS S* | ANGLE S* | TIME S* | FREQ S* | function ] |
@@ -1490,8 +1501,7 @@ cr_parser_parse_property (CRParser * a_this,
*
*TODO: handle parsing of 'RGB'
*
- *@param a_term out parameter. The successfully parsed term.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term)
@@ -1636,15 +1646,17 @@ cr_parser_parse_term (CRParser * a_this, CRTerm ** a_term)
}
/**
+ * cr_parser_parse_simple_selector:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *@a_sel: out parameter. Is set to the successfully parsed simple
+ *selector.
+ *
*Parses a "simple_selector" as defined by the css2 spec in appendix D.1 :
*element_name? [ HASH | class | attrib | pseudo ]* S*
*and where pseudo is:
*pseudo ::= ':' [ IDENT | FUNCTION S* IDENT S* ')' ]
*
- *@Param a_this the "this pointer" of the current instance of #CRParser.
- *@param a_sel out parameter. Is set to the successfully parsed simple
- *selector.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel)
@@ -1904,16 +1916,18 @@ cr_parser_parse_simple_selector (CRParser * a_this, CRSimpleSel ** a_sel)
}
/**
- *Parses a "selector" as defined by the css2 spec in appendix D.1:
- *selector ::= simple_selector [ combinator simple_selector ]*
- *
- *@param a_this the this pointer of the current instance of #CRParser.
- *@param a_start a pointer to the
+ * cr_parser_parse_simple_sels:
+ *@a_this: the this pointer of the current instance of #CRParser.
+ *@a_start: a pointer to the
*first chararcter of the successfully parsed
*string.
- *@param a_end a pointer to the last character of the successfully parsed
+ *@a_end: a pointer to the last character of the successfully parsed
*string.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Parses a "selector" as defined by the css2 spec in appendix D.1:
+ *selector ::= simple_selector [ combinator simple_selector ]*
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_simple_sels (CRParser * a_this,
@@ -1980,11 +1994,14 @@ cr_parser_parse_simple_sels (CRParser * a_this,
}
/**
- *Parses a comma separated list of selectors.
- *@param a_this the current instance of #CRParser.
- *@param a_selector the parsed list of comma separated
+ * cr_parser_parse_selector:
+ *@a_this: the current instance of #CRParser.
+ *@a_selector: the parsed list of comma separated
*selectors.
- *@return CR_OK upon successful completion, an error
+ *
+ *Parses a comma separated list of selectors.
+ *
+ *Returns CR_OK upon successful completion, an error
*code otherwise.
*/
static enum CRStatus
@@ -2098,16 +2115,17 @@ cr_parser_parse_selector (CRParser * a_this,
}
/**
+ * cr_parser_parse_function:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *
+ *@a_func_name: out parameter. The parsed function name
+ *@a_expr: out parameter. The successfully parsed term.
+ *
*Parses a "function" as defined in css spec at appendix D.1:
*function ::= FUNCTION S* expr ')' S*
*FUNCTION ::= ident'('
*
- *@param a_this the "this pointer" of the current instance of
- *#CRParser.
- *
- *@param a_func_name out parameter. The parsed function name
- *@param a_expr out parameter. The successfully parsed term.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_function (CRParser * a_this,
@@ -2185,13 +2203,15 @@ cr_parser_parse_function (CRParser * a_this,
}
/**
+ * cr_parser_parse_uri:
+ *@a_this: the current instance of #CRParser.
+ *@a_str: the successfully parsed url.
+ *
*Parses an uri as defined by the css spec [4.1.1]:
* URI ::= url\({w}{string}{w}\)
* |url\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}\)
*
- *@param a_this the current instance of #CRParser.
- *@param a_str the successfully parsed url.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_uri (CRParser * a_this, CRString ** a_str)
@@ -2208,19 +2228,21 @@ cr_parser_parse_uri (CRParser * a_this, CRString ** a_str)
}
/**
+ * cr_parser_parse_string:
+ *@a_this: the current instance of #CRParser.
+ *@a_start: out parameter. Upon successfull completion,
+ *points to the beginning of the string, points to an undefined value
+ *otherwise.
+ *@a_end: out parameter. Upon successfull completion, points to
+ *the beginning of the string, points to an undefined value otherwise.
+ *
*Parses a string type as defined in css spec [4.1.1]:
*
*string ::= {string1}|{string2}
*string1 ::= \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
*string2 ::= \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
*
- *@param a_this the current instance of #CRParser.
- *@param a_start out parameter. Upon successfull completion,
- *points to the beginning of the string, points to an undefined value
- *otherwise.
- *@param a_end out parameter. Upon successfull completion, points to
- *the beginning of the string, points to an undefined value otherwise.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
static enum CRStatus
cr_parser_parse_string (CRParser * a_this, CRString ** a_str)
@@ -2408,7 +2430,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
import_string,
NULL, &location) ;
- if (PRIVATE (a_this)->sac_handler->resolve_import == TRUE) {
+ if ((PRIVATE (a_this)->sac_handler->resolve_import == TRUE)) {
/*
*TODO: resolve the
*import rule.
@@ -2445,7 +2467,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
/*free the medium list */
for (cur = media_list; cur; cur = cur->next) {
if (cur->data) {
- cr_string_destroy ((CRString *)cur->data);
+ cr_string_destroy (cur->data);
}
}
@@ -2685,7 +2707,7 @@ cr_parser_parse_stylesheet (CRParser * a_this)
}
cr_parser_push_error
- (a_this, (guchar *)"could not recognize next production", CR_ERROR);
+ (a_this, "could not recognize next production", CR_ERROR);
if (PRIVATE (a_this)->sac_handler
&& PRIVATE (a_this)->sac_handler->unrecoverable_error) {
@@ -2720,23 +2742,24 @@ cr_parser_parse_stylesheet (CRParser * a_this)
****************************************/
/**
+ * cr_parser_new:
+ * @a_tknzr: the tokenizer to use for the parsing.
+ *
*Creates a new parser to parse data
*coming the input stream given in parameter.
- *@param a_input the input stream of the parser.
- *Note that the newly created parser will ref
- *a_input and unref it when parsing reaches the
- *end of the input stream.
- *@return the newly created instance of #CRParser,
+ *
+ *Returns the newly created instance of #CRParser,
*or NULL if an error occured.
*/
CRParser *
cr_parser_new (CRTknzr * a_tknzr)
{
+ CRParser *result = NULL;
enum CRStatus status = CR_OK;
- CRParser *result = (CRParser *)g_malloc0 (sizeof (CRParser));
+ result = g_malloc0 (sizeof (CRParser));
- PRIVATE (result) = (CRParserPriv *)g_malloc0 (sizeof (CRParserPriv));
+ PRIVATE (result) = g_malloc0 (sizeof (CRParserPriv));
if (a_tknzr) {
status = cr_parser_set_tknzr (result, a_tknzr);
@@ -2748,15 +2771,18 @@ cr_parser_new (CRTknzr * a_tknzr)
}
/**
- *Instanciates a new parser from a memory buffer.
- *@param a_buf the buffer to parse.
- *@param a_len the length of the data in the buffer.
- *@param a_enc the encoding of the input buffer a_buf.
- *@param a_free_buf if set to TRUE, a_buf will be freed
+ * cr_parser_new_from_buf:
+ *@a_buf: the buffer to parse.
+ *@a_len: the length of the data in the buffer.
+ *@a_enc: the encoding of the input buffer a_buf.
+ *@a_free_buf: if set to TRUE, a_buf will be freed
*during the destruction of the newly built instance
*of #CRParser. If set to FALSE, it is up to the caller to
*eventually free it.
- *@return the newly built parser, or NULL if an error arises.
+ *
+ *Instanciates a new parser from a memory buffer.
+ *
+ *Returns the newly built parser, or NULL if an error arises.
*/
CRParser *
cr_parser_new_from_buf (guchar * a_buf,
@@ -2781,6 +2807,12 @@ cr_parser_new_from_buf (guchar * a_buf,
return result;
}
+/**
+ * cr_parser_new_from_input:
+ * @a_input: the parser input stream to use.
+ *
+ * Returns a newly built parser input.
+ */
CRParser *
cr_parser_new_from_input (CRInput * a_input)
{
@@ -2798,6 +2830,13 @@ cr_parser_new_from_input (CRInput * a_input)
return result;
}
+/**
+ * cr_parser_new_from_file:
+ * @a_file_uri: the uri of the file to parse.
+ * @a_enc: the file encoding to use.
+ *
+ * Returns the newly built parser.
+ */
CRParser *
cr_parser_new_from_file (const guchar * a_file_uri, enum CREncoding a_enc)
{
@@ -2816,10 +2855,13 @@ cr_parser_new_from_file (const guchar * a_file_uri, enum CREncoding a_enc)
}
/**
+ * cr_parser_set_sac_handler:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *@a_handler: the handler to set.
+ *
*Sets a SAC document handler to the parser.
- *@param a_this the "this pointer" of the current instance of #CRParser.
- *@param a_handler the handler to set.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_set_sac_handler (CRParser * a_this, CRDocHandler * a_handler)
@@ -2837,11 +2879,14 @@ cr_parser_set_sac_handler (CRParser * a_this, CRDocHandler * a_handler)
}
/**
- *Gets the SAC document handler.
- *@param a_this the "this pointer" of the current instance of
+ * cr_parser_get_sac_handler:
+ *@a_this: the "this pointer" of the current instance of
*#CRParser.
- *@param a_handler out parameter. The returned handler.
- *@return CR_OK upon successfull completion, an error code
+ *@a_handler: out parameter. The returned handler.
+ *
+ *Gets the SAC document handler.
+ *
+ *Returns CR_OK upon successfull completion, an error code
*otherwise.
*/
enum CRStatus
@@ -2855,10 +2900,13 @@ cr_parser_get_sac_handler (CRParser * a_this, CRDocHandler ** a_handler)
}
/**
+ * cr_parser_set_default_sac_handler:
+ *@a_this: a pointer to the current instance of #CRParser.
+ *
*Sets the SAC handler associated to the current instance
*of #CRParser to the default SAC handler.
- *@param a_this a pointer to the current instance of #CRParser.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_set_default_sac_handler (CRParser * a_this)
@@ -2882,6 +2930,13 @@ cr_parser_set_default_sac_handler (CRParser * a_this)
return status;
}
+/**
+ * cr_parser_set_use_core_grammar:
+ * @a_this: the current instance of #CRParser.
+ * @a_use_core_grammar: where to parse against the css core grammar.
+ *
+ * Returns CR_OK upon succesful completion, an error code otherwise.
+ */
enum CRStatus
cr_parser_set_use_core_grammar (CRParser * a_this,
gboolean a_use_core_grammar)
@@ -2893,8 +2948,15 @@ cr_parser_set_use_core_grammar (CRParser * a_this,
return CR_OK;
}
+/**
+ * cr_parser_get_use_core_grammar:
+ * @a_this: the current instance of #CRParser.
+ * @a_use_core_grammar: wether to use the core grammar or not.
+ *
+ * Returns CR_OK upon succesful completion, an error code otherwise.
+ */
enum CRStatus
-cr_parser_get_use_core_grammar (CRParser * a_this,
+cr_parser_get_use_core_grammar (CRParser const * a_this,
gboolean * a_use_core_grammar)
{
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
@@ -2905,11 +2967,15 @@ cr_parser_get_use_core_grammar (CRParser * a_this,
}
/**
- *Parses a the given in parameter.
- *@param a_this a pointer to the current instance of #CRParser.
- *@param a_file_uri the uri to the file to load. For the time being,
+ * cr_parser_parse_file:
+ *@a_this: a pointer to the current instance of #CRParser.
+ *@a_file_uri: the uri to the file to load. For the time being,
+ *@a_enc: the encoding of the file to parse.
*only local files are supported.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Parses a the given in parameter.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_file (CRParser * a_this,
@@ -2934,9 +3000,16 @@ cr_parser_parse_file (CRParser * a_this,
}
/**
+ * cr_parser_parse_expr:
+ * @a_this: the current instance of #CRParser.
+ * @a_expr: out parameter. the parsed expression.
+ *
*Parses an expression as defined by the css2 spec in appendix
*D.1:
*expr: term [ operator term ]*
+ *
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
@@ -3033,13 +3106,17 @@ cr_parser_parse_expr (CRParser * a_this, CRTerm ** a_expr)
}
/**
+ * cr_parser_parse_prio:
+ *@a_this: the current instance of #CRParser.
+ *@a_prio: a string representing the priority.
+ *Today, only "!important" is returned as only this
+ *priority is defined by css2.
+ *
*Parses a declaration priority as defined by
*the css2 grammar in appendix C:
*prio: IMPORTANT_SYM S*
- *@param a_this the current instance of #CRParser.
- *@param a_prio a string representing the priority.
- *Today, only "!important" is returned as only this
- *priority is defined by css2.
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_prio (CRParser * a_this, CRString ** a_prio)
@@ -3078,17 +3155,19 @@ cr_parser_parse_prio (CRParser * a_this, CRString ** a_prio)
}
/**
+ * cr_parser_parse_declaration:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *@a_property: the successfully parsed property. The caller
+ * *must* free the returned pointer.
+ *@a_expr: the expression that represents the attribute value.
+ *The caller *must* free the returned pointer.
+ *
*TODO: return the parsed priority, so that
*upper layers can take benefit from it.
*Parses a "declaration" as defined by the css2 spec in appendix D.1:
*declaration ::= [property ':' S* expr prio?]?
*
- *@param a_this the "this pointer" of the current instance of #CRParser.
- *@param a_property the successfully parsed property. The caller
- * *must* free the returned pointer.
- *@param a_expr the expression that represents the attribute value.
- *The caller *must* free the returned pointer.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_declaration (CRParser * a_this,
@@ -3114,7 +3193,7 @@ cr_parser_parse_declaration (CRParser * a_this,
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- (guchar *)"while parsing declaration: next property is malformed",
+ "while parsing declaration: next property is malformed",
CR_SYNTAX_ERROR);
READ_NEXT_CHAR (a_this, &cur_char);
@@ -3123,7 +3202,7 @@ cr_parser_parse_declaration (CRParser * a_this,
status = CR_PARSING_ERROR;
cr_parser_push_error
(a_this,
- (guchar *)"while parsing declaration: this char must be ':'",
+ "while parsing declaration: this char must be ':'",
CR_SYNTAX_ERROR);
goto error;
}
@@ -3134,7 +3213,7 @@ cr_parser_parse_declaration (CRParser * a_this,
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- (guchar *)"while parsing declaration: next expression is malformed",
+ "while parsing declaration: next expression is malformed",
CR_SYNTAX_ERROR);
cr_parser_try_to_skip_spaces_and_comments (a_this);
@@ -3175,11 +3254,14 @@ cr_parser_parse_declaration (CRParser * a_this,
}
/**
+ * cr_parser_parse_statement_core:
+ *@a_this: the current instance of #CRParser.
+ *
*Parses a statement as defined by the css core grammar in
*chapter 4.1 of the css2 spec.
*statement : ruleset | at-rule;
- *@param a_this the current instance of #CRParser.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_statement_core (CRParser * a_this)
@@ -3231,6 +3313,9 @@ cr_parser_parse_statement_core (CRParser * a_this)
}
/**
+ * cr_parser_parse_ruleset:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *
*Parses a "ruleset" as defined in the css2 spec at appendix D.1.
*ruleset ::= selector [ ',' S* selector ]*
*'{' S* declaration? [ ';' S* declaration? ]* '}' S*;
@@ -3239,8 +3324,8 @@ cr_parser_parse_statement_core (CRParser * a_this)
*callbacks whenever it encounters some specific constructions.
*See the documentation of #CRDocHandler (the SAC handler) to know
*when which SAC handler is called.
- *@param a_this the "this pointer" of the current instance of #CRParser.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_ruleset (CRParser * a_this)
@@ -3255,6 +3340,7 @@ cr_parser_parse_ruleset (CRParser * a_this)
CRSelector *selector = NULL;
gboolean start_selector = FALSE,
is_important = FALSE;
+ CRParsingLocation end_parsing_location;
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
@@ -3267,7 +3353,7 @@ cr_parser_parse_ruleset (CRParser * a_this)
ENSURE_PARSING_COND_ERR
(a_this, cur_char == '{',
- (guchar *)"while parsing rulset: current char should be '{'",
+ "while parsing rulset: current char should be '{'",
CR_SYNTAX_ERROR);
if (PRIVATE (a_this)->sac_handler
@@ -3331,7 +3417,7 @@ cr_parser_parse_ruleset (CRParser * a_this)
}
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- (guchar *)"while parsing ruleset: next construction should be a declaration",
+ "while parsing ruleset: next construction should be a declaration",
CR_SYNTAX_ERROR);
for (;;) {
@@ -3369,12 +3455,14 @@ cr_parser_parse_ruleset (CRParser * a_this)
end_of_ruleset:
cr_parser_try_to_skip_spaces_and_comments (a_this);
+ cr_parser_get_parsing_location (a_this, &end_parsing_location);
READ_NEXT_CHAR (a_this, &cur_char);
ENSURE_PARSING_COND_ERR
(a_this, cur_char == '}',
- (guchar *)"while parsing rulset: current char must be a '}'",
+ "while parsing rulset: current char must be a '}'",
CR_SYNTAX_ERROR);
+ selector->location = end_parsing_location;
if (PRIVATE (a_this)->sac_handler
&& PRIVATE (a_this)->sac_handler->end_selector) {
PRIVATE (a_this)->sac_handler->end_selector
@@ -3431,29 +3519,29 @@ cr_parser_parse_ruleset (CRParser * a_this)
}
/**
- *Parses an 'import' declaration as defined in the css2 spec
- *in appendix D.1:
- *
- *import ::=
- *@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
- *
- *@param a_this the "this pointer" of the current instance
+ * cr_parser_parse_import:
+ *@a_this: the "this pointer" of the current instance
*of #CRParser.
- *
- *@param a_medium_list out parameter. A linked list of
+ *@a_media_list: out parameter. A linked list of
*#CRString
*Each CRString is a string that contains
*a 'medium' declaration part of the successfully
*parsed 'import' declaration.
- *
- *@param a_import_string out parameter.
+ *@a_import_string: out parameter.
*A string that contains the 'import
*string". The import string can be either an uri (if it starts with
*the substring "uri(") or a any other css2 string. Note that
* *a_import_string must be initially set to NULL or else, this function
*will return CR_BAD_PARAM_ERROR.
+ *@a_location: the location (line, column) where the import has been parsed
*
- *@return CR_OK upon sucessfull completion, an error code otherwise.
+ *Parses an 'import' declaration as defined in the css2 spec
+ *in appendix D.1:
+ *
+ *import ::=
+ *\@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
+ *
+ *Returns CR_OK upon sucessfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_import (CRParser * a_this,
@@ -3578,7 +3666,7 @@ cr_parser_parse_import (CRParser * a_this,
*/
for (cur = *a_media_list; cur; cur = cur->next) {
if (cur->data) {
- cr_string_destroy ((CRString *)cur->data);
+ cr_string_destroy (cur->data);
}
}
@@ -3602,16 +3690,19 @@ cr_parser_parse_import (CRParser * a_this,
}
/**
+ * cr_parser_parse_media:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *
*Parses a 'media' declaration as specified in the css2 spec at
*appendix D.1:
*
- *media ::= @media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
+ *media ::= \@media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
*
*Note that this function calls the required sac handlers during the parsing
*to notify media productions. See #CRDocHandler to know the callback called
- *during @media parsing.
- *@param a_this the "this pointer" of the current instance of #CRParser.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *during \@media parsing.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_media (CRParser * a_this)
@@ -3729,7 +3820,7 @@ cr_parser_parse_media (CRParser * a_this)
GList *cur = NULL;
for (cur = media_list; cur; cur = cur->next) {
- cr_string_destroy ((CRString *)cur->data);
+ cr_string_destroy (cur->data);
}
g_list_free (media_list);
@@ -3757,7 +3848,7 @@ cr_parser_parse_media (CRParser * a_this)
GList *cur = NULL;
for (cur = media_list; cur; cur = cur->next) {
- cr_string_destroy ((CRString *)cur->data);
+ cr_string_destroy (cur->data);
}
g_list_free (media_list);
@@ -3770,15 +3861,18 @@ cr_parser_parse_media (CRParser * a_this)
}
/**
- *Parses '@page' rule as specified in the css2 spec in appendix D.1:
+ * cr_parser_parse_page:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *
+ *Parses '\@page' rule as specified in the css2 spec in appendix D.1:
*page ::= PAGE_SYM S* IDENT? pseudo_page? S*
*'{' S* declaration [ ';' S* declaration ]* '}' S*
*
*This function also calls the relevant SAC handlers whenever it
*encounters a construction that must
*be reported to the calling application.
- *@param a_this the "this pointer" of the current instance of #CRParser.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_page (CRParser * a_this)
@@ -4018,16 +4112,18 @@ cr_parser_parse_page (CRParser * a_this)
}
/**
+ * cr_parser_parse_charset:
+ *@a_this: the "this pointer" of the current instance of #CRParser.
+ *@a_value: out parameter. The actual parsed value of the charset
+ *declararation. Note that for safety check reasons, *a_value must be
+ *set to NULL.
+ *@a_charset_sym_location: the parsing location of the charset rule
+ *
*Parses a charset declaration as defined implictly by the css2 spec in
*appendix D.1:
*charset ::= CHARSET_SYM S* STRING S* ';'
*
- *@param a_this the "this pointer" of the current instance of #CRParser.
- *@param a_value out parameter. The actual parsed value of the charset
- *declararation. Note that for safety check reasons, *a_value must be
- *set to NULL.
- *@param a_charset_sym_location the parsing location of
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_charset (CRParser * a_this, CRString ** a_value,
@@ -4107,14 +4203,18 @@ cr_parser_parse_charset (CRParser * a_this, CRString ** a_value,
}
/**
- *Parses the "@font-face" rule specified in the css1 spec in
+ * cr_parser_parse_font_face:
+ *@a_this: the current instance of #CRParser.
+ *
+ *Parses the "\@font-face" rule specified in the css1 spec in
*appendix D.1:
*
*font_face ::= FONT_FACE_SYM S*
*'{' S* declaration [ ';' S* declaration ]* '}' S*
*
*This function will call SAC handlers whenever it is necessary.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_font_face (CRParser * a_this)
@@ -4264,11 +4364,14 @@ cr_parser_parse_font_face (CRParser * a_this)
}
/**
+ * cr_parser_parse:
+ *@a_this: the current instance of #CRParser.
+ *
*Parses the data that comes from the
*input previously associated to the current instance of
*#CRParser.
- *@param a_this the current instance of #CRParser.
- *@return CR_OK ;
+ *
+ *Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse (CRParser * a_this)
@@ -4287,6 +4390,13 @@ cr_parser_parse (CRParser * a_this)
return status;
}
+/**
+ * cr_parser_set_tknzr:
+ * @a_this: the current instance of #CRParser;
+ * @a_tknzr: the new tokenizer.
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ */
enum CRStatus
cr_parser_set_tknzr (CRParser * a_this, CRTknzr * a_tknzr)
{
@@ -4305,10 +4415,13 @@ cr_parser_set_tknzr (CRParser * a_this, CRTknzr * a_tknzr)
}
/**
+ * cr_parser_get_tknzr:
+ *@a_this: the current instance of #CRParser
+ *@a_tknzr: out parameter. The returned tokenizer
+ *
*Getter of the parser's underlying tokenizer
- *@param a_this the current instance of #CRParser
- *@param a_tknzr out parameter. The returned tokenizer
- *@return CR_OK upon succesful completion, an error code
+ *
+ *Returns CR_OK upon succesful completion, an error code
*otherwise
*/
enum CRStatus
@@ -4322,14 +4435,17 @@ cr_parser_get_tknzr (CRParser * a_this, CRTknzr ** a_tknzr)
}
/**
+ * cr_parser_get_parsing_location:
+ *@a_this: the current instance of #CRParser
+ *@a_loc: the parsing location to get.
+ *
*Gets the current parsing location.
- *@param a_this the current instance of #CRParser
- *@param a_loc the parsing location to get.
- *@return CR_OK upon succesful completion, an error code
+ *
+ *Returns CR_OK upon succesful completion, an error code
*otherwise.
*/
enum CRStatus
-cr_parser_get_parsing_location (CRParser *a_this,
+cr_parser_get_parsing_location (CRParser const *a_this,
CRParsingLocation *a_loc)
{
g_return_val_if_fail (a_this
@@ -4341,12 +4457,15 @@ cr_parser_get_parsing_location (CRParser *a_this,
}
/**
+ * cr_parser_parse_buf:
+ *@a_this: the current instance of #CRparser
+ *@a_buf: the input buffer
+ *@a_len: the length of the input buffer
+ *@a_enc: the encoding of the buffer
+ *
*Parses a stylesheet from a buffer
- *@param a_this the current instance of #CRparser
- *@param a_buf the input buffer
- *@param a_len the length of the input buffer
- *@param a_enc the encoding of the buffer
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_parser_parse_buf (CRParser * a_this,
@@ -4372,10 +4491,12 @@ cr_parser_parse_buf (CRParser * a_this,
}
/**
+ * cr_parser_destroy:
+ *@a_this: the current instance of #CRParser to
+ *destroy.
+ *
*Destroys the current instance
*of #CRParser.
- *@param a_this the current instance of #CRParser to
- *destroy.
*/
void
cr_parser_destroy (CRParser * a_this)
diff --git a/src/libcroco/cr-parser.h b/src/libcroco/cr-parser.h
index 1534afb86..6dce9439e 100644
--- a/src/libcroco/cr-parser.h
+++ b/src/libcroco/cr-parser.h
@@ -68,7 +68,7 @@ enum CRStatus cr_parser_set_tknzr (CRParser *a_this, CRTknzr *a_tknzr) ;
enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ;
-enum CRStatus cr_parser_get_parsing_location (CRParser *a_this, CRParsingLocation *a_loc) ;
+enum CRStatus cr_parser_get_parsing_location (CRParser const *a_this, CRParsingLocation *a_loc) ;
enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser *a_this) ;
@@ -81,7 +81,7 @@ enum CRStatus cr_parser_get_sac_handler (CRParser *a_this,
enum CRStatus cr_parser_set_use_core_grammar (CRParser *a_this,
gboolean a_use_core_grammar) ;
-enum CRStatus cr_parser_get_use_core_grammar (CRParser *a_this,
+enum CRStatus cr_parser_get_use_core_grammar (CRParser const *a_this,
gboolean *a_use_core_grammar) ;
enum CRStatus cr_parser_parse (CRParser *a_this) ;
diff --git a/src/libcroco/cr-parsing-location.c b/src/libcroco/cr-parsing-location.c
index 38a75a6e6..4fe4acc30 100644
--- a/src/libcroco/cr-parsing-location.c
+++ b/src/libcroco/cr-parsing-location.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -25,21 +25,25 @@
#include "cr-parsing-location.h"
/**
- *@file
+ *@CRParsingLocation:
+ *
*Definition of the #CRparsingLocation class.
*/
/**
+ * cr_parsing_location_new:
*Instanciates a new parsing location.
- *@return the newly instanciated #CRParsingLocation.
+ *
+ *Returns the newly instanciated #CRParsingLocation.
*Must be freed by cr_parsing_location_destroy()
*/
CRParsingLocation *
cr_parsing_location_new (void)
{
- CRParsingLocation *result =
- (CRParsingLocation *)g_try_malloc (sizeof (CRParsingLocation)) ;
+ CRParsingLocation * result = NULL ;
+
+ result = g_try_malloc (sizeof (CRParsingLocation)) ;
if (!result) {
cr_utils_trace_info ("Out of memory error") ;
return NULL ;
@@ -49,9 +53,12 @@ cr_parsing_location_new (void)
}
/**
+ * cr_parsing_location_init:
+ *@a_this: the current instance of #CRParsingLocation.
+ *
*Initializes the an instance of #CRparsingLocation.
- *@param a_this the current instance of #CRParsingLocation.
- *@return CR_OK upon
+ *
+ *Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
cr_parsing_location_init (CRParsingLocation *a_this)
@@ -63,16 +70,19 @@ cr_parsing_location_init (CRParsingLocation *a_this)
}
/**
- *Copies an instance of CRParsingLocation into another one.
- *@param a_to the destination of the copy.
+ * cr_parsing_location_copy:
+ *@a_to: the destination of the copy.
*Must be allocated by the caller.
- *@param a_from the source of the copy.
- *@return CR_OK upon succesful completion, an error code
+ *@a_from: the source of the copy.
+ *
+ *Copies an instance of CRParsingLocation into another one.
+ *
+ *Returns CR_OK upon succesful completion, an error code
*otherwise.
*/
enum CRStatus
cr_parsing_location_copy (CRParsingLocation *a_to,
- CRParsingLocation *a_from)
+ CRParsingLocation const *a_from)
{
g_return_val_if_fail (a_to && a_from, CR_BAD_PARAM_ERROR) ;
@@ -81,24 +91,26 @@ cr_parsing_location_copy (CRParsingLocation *a_to,
}
/**
- *@param a_this the current instance of #CRParsingLocation.
- *@param a_mask a bitmap that defines which parts of the
+ * cr_parsing_location_to_string:
+ *@a_this: the current instance of #CRParsingLocation.
+ *@a_mask: a bitmap that defines which parts of the
*parsing location are to be serialized (line, column or byte offset)
- *@return the serialized string or NULL in case of an error.
+ *
+ *Returns the serialized string or NULL in case of an error.
*/
gchar *
-cr_parsing_location_to_string (CRParsingLocation *a_this,
+cr_parsing_location_to_string (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask)
{
+ GString *result = NULL ;
gchar *str = NULL ;
g_return_val_if_fail (a_this, NULL) ;
if (!a_mask) {
- a_mask = (enum CRParsingLocationSerialisationMask)
- ((int)DUMP_LINE | (int)DUMP_COLUMN | (int)DUMP_BYTE_OFFSET) ;
+ a_mask = DUMP_LINE | DUMP_COLUMN | DUMP_BYTE_OFFSET ;
}
- GString *result = (GString *)g_string_new (NULL) ;
+ result =g_string_new (NULL) ;
if (!result)
return NULL ;
if (a_mask & DUMP_LINE) {
@@ -122,8 +134,14 @@ cr_parsing_location_to_string (CRParsingLocation *a_this,
return str ;
}
+/**
+ * cr_parsing_location_dump:
+ * @a_this: current instance of #CRParsingLocation
+ * @a_mask: the serialization mask.
+ * @a_fp: the file pointer to dump the parsing location to.
+ */
void
-cr_parsing_location_dump (CRParsingLocation *a_this,
+cr_parsing_location_dump (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask,
FILE *a_fp)
{
@@ -139,9 +157,11 @@ cr_parsing_location_dump (CRParsingLocation *a_this,
}
/**
- *Destroys the current instance of #CRParsingLocation
- *@param a_this the current instance of #CRParsingLocation. Must
+ * cr_parsing_location_destroy:
+ *@a_this: the current instance of #CRParsingLocation. Must
*have been allocated with cr_parsing_location_new().
+ *
+ *Destroys the current instance of #CRParsingLocation
*/
void
cr_parsing_location_destroy (CRParsingLocation *a_this)
diff --git a/src/libcroco/cr-parsing-location.h b/src/libcroco/cr-parsing-location.h
index 877c0507f..b8064a560 100644
--- a/src/libcroco/cr-parsing-location.h
+++ b/src/libcroco/cr-parsing-location.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -54,11 +54,11 @@ CRParsingLocation * cr_parsing_location_new (void) ;
enum CRStatus cr_parsing_location_init (CRParsingLocation *a_this) ;
enum CRStatus cr_parsing_location_copy (CRParsingLocation *a_to,
- CRParsingLocation *a_from) ;
+ CRParsingLocation const *a_from) ;
-gchar * cr_parsing_location_to_string (CRParsingLocation *a_this,
+gchar * cr_parsing_location_to_string (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask) ;
-void cr_parsing_location_dump (CRParsingLocation *a_this,
+void cr_parsing_location_dump (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask,
FILE *a_fp) ;
diff --git a/src/libcroco/cr-prop-list.c b/src/libcroco/cr-prop-list.c
index 551f0b8ee..dc575d6ff 100644
--- a/src/libcroco/cr-prop-list.c
+++ b/src/libcroco/cr-prop-list.c
@@ -41,13 +41,15 @@ static CRPropList *cr_prop_list_allocate (void);
static CRPropList *
cr_prop_list_allocate (void)
{
- CRPropList *result = (CRPropList *)g_try_malloc (sizeof (CRPropList));
+ CRPropList *result = NULL;
+
+ result = g_try_malloc (sizeof (CRPropList));
if (!result) {
cr_utils_trace_info ("could not allocate CRPropList");
return NULL;
}
memset (result, 0, sizeof (CRPropList));
- PRIVATE (result) = (CRPropListPriv *)g_try_malloc (sizeof (CRPropListPriv));
+ PRIVATE (result) = g_try_malloc (sizeof (CRPropListPriv));
if (!PRIVATE (result)) {
cr_utils_trace_info ("could not allocate CRPropListPriv");
g_free (result);
@@ -62,10 +64,13 @@ cr_prop_list_allocate (void)
***************/
/**
+ * cr_prop_list_append:
+ *@a_this: the current instance of #CRPropList
+ *@a_to_append: the property list to append
+ *
*Appends a property list to the current one.
- *@param a_this the current instance of #CRPropList
- *@param a_to_append the property list to append
- *@return the resulting prop list, or NULL if an error
+ *
+ *Returns the resulting prop list, or NULL if an error
*occured
*/
CRPropList *
@@ -89,12 +94,14 @@ cr_prop_list_append (CRPropList * a_this, CRPropList * a_to_append)
}
/**
+ * cr_prop_list_append2:
*Appends a pair of prop/declaration to
*the current prop list.
- *@param a_this the current instance of #CRPropList
- *@param a_prop the property to consider
- *@param a_decl the declaration to consider
- *@return the resulting property list, or NULL in case
+ *@a_this: the current instance of #CRPropList
+ *@a_prop: the property to consider
+ *@a_decl: the declaration to consider
+ *
+ *Returns the resulting property list, or NULL in case
*of an error.
*/
CRPropList *
@@ -118,9 +125,12 @@ cr_prop_list_append2 (CRPropList * a_this,
}
/**
+ * cr_prop_list_prepend:
+ *@a_this: the current instance of #CRPropList
+ *@a_to_prepend: the new list to prepend.
+ *
*Prepends a list to the current list
- *@param a_this the current instance of #CRPropList
- *@param the new list to prepend.
+ *Returns the new properties list.
*/
CRPropList *
cr_prop_list_prepend (CRPropList * a_this, CRPropList * a_to_prepend)
@@ -141,32 +151,39 @@ cr_prop_list_prepend (CRPropList * a_this, CRPropList * a_to_prepend)
}
/**
- *Prepends a list to the current list
- *@param a_this the current instance of #CRPropList
- *@param the new list to prepend.
+ * cr_prop_list_prepend2:
+ *@a_this: the current instance of #CRPropList
+ *@a_prop_name: property name to append
+ *@a_decl: the property value to append.
+ *
+ *Prepends a propertie to a list of properties
+ *
+ *Returns the new property list.
*/
CRPropList *
cr_prop_list_prepend2 (CRPropList * a_this,
- CRString * a_prop, CRDeclaration * a_decl)
+ CRString * a_prop_name, CRDeclaration * a_decl)
{
CRPropList *list = NULL,
*result = NULL;
g_return_val_if_fail (a_this && PRIVATE (a_this)
- && a_prop && a_decl, NULL);
+ && a_prop_name && a_decl, NULL);
list = cr_prop_list_allocate ();
g_return_val_if_fail (list, NULL);
- PRIVATE (list)->prop = a_prop;
+ PRIVATE (list)->prop = a_prop_name;
PRIVATE (list)->decl = a_decl;
result = cr_prop_list_prepend (a_this, list);
return result;
}
/**
+ * cr_prop_list_set_prop:
+ *@a_this: the current instance of #CRPropList
+ *@a_prop: the property to set
+ *
*Sets the property of a CRPropList
- *@param a_this the current instance of #CRPropList
- *@param a_prop the property to set
*/
enum CRStatus
cr_prop_list_set_prop (CRPropList * a_this, CRString * a_prop)
@@ -179,15 +196,18 @@ cr_prop_list_set_prop (CRPropList * a_this, CRString * a_prop)
}
/**
+ * cr_prop_list_get_prop:
+ *@a_this: the current instance of #CRPropList
+ *@a_prop: out parameter. The returned property
+ *
*Getter of the property associated to the current instance
*of #CRPropList
- *@param a_this the current instance of #CRPropList
- *@param a_prop out parameter. The returned property
- *@return CR_OK upon successful completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
-cr_prop_list_get_prop (CRPropList * a_this, CRString ** a_prop)
+cr_prop_list_get_prop (CRPropList const * a_this, CRString ** a_prop)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_prop, CR_BAD_PARAM_ERROR);
@@ -196,6 +216,13 @@ cr_prop_list_get_prop (CRPropList * a_this, CRString ** a_prop)
return CR_OK;
}
+/**
+ * cr_prop_list_set_decl:
+ * @a_this: the current instance of #CRPropList
+ * @a_decl: the new property value.
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ */
enum CRStatus
cr_prop_list_set_decl (CRPropList * a_this, CRDeclaration * a_decl)
{
@@ -206,8 +233,15 @@ cr_prop_list_set_decl (CRPropList * a_this, CRDeclaration * a_decl)
return CR_OK;
}
+/**
+ * cr_prop_list_get_decl:
+ * @a_this: the current instance of #CRPropList
+ * @a_decl: out parameter. The property value
+ *
+ * Returns CR_OK upon successful completion.
+ */
enum CRStatus
-cr_prop_list_get_decl (CRPropList * a_this, CRDeclaration ** a_decl)
+cr_prop_list_get_decl (CRPropList const * a_this, CRDeclaration ** a_decl)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_decl, CR_BAD_PARAM_ERROR);
@@ -217,12 +251,15 @@ cr_prop_list_get_decl (CRPropList * a_this, CRDeclaration ** a_decl)
}
/**
- *Lookup a given property/declaration pair
- *@param a_this the current instance of #CRPropList
- *@param a_prop the property to lookup
- *@param a_prop_list out parameter. The property/declaration
+ * cr_prop_list_lookup_prop:
+ *@a_this: the current instance of #CRPropList
+ *@a_prop: the property to lookup
+ *@a_prop_list: out parameter. The property/declaration
*pair found (if and only if the function returned code if CR_OK)
- *@return CR_OK if a prop/decl pair has been found,
+ *
+ *Lookup a given property/declaration pair
+ *
+ *Returns CR_OK if a prop/decl pair has been found,
*CR_VALUE_NOT_FOUND_ERROR if not, or an error code if something
*bad happens.
*/
@@ -259,11 +296,12 @@ cr_prop_list_lookup_prop (CRPropList * a_this,
}
/**
+ * cr_prop_list_get_next:
+ *@a_this: the current instance of CRPropList
+ *
*Gets the next prop/decl pair in the list
- *@param a_this the current instance of CRPropList
- *@param the next prop/decl pair, or NULL if we
- *reached the end of the list.
- *@return the next prop/declaration pair of the list,
+ *
+ *Returns the next prop/declaration pair of the list,
*or NULL if we reached end of list (or if an error occurs)
*/
CRPropList *
@@ -275,11 +313,12 @@ cr_prop_list_get_next (CRPropList * a_this)
}
/**
+ * cr_prop_list_get_prev:
+ *@a_this: the current instance of CRPropList
+ *
*Gets the previous prop/decl pair in the list
- *@param a_this the current instance of CRPropList
- *@param the previous prop/decl pair, or NULL if we
- *reached the end of the list.
- *@return the previous prop/declaration pair of the list,
+ *
+ *Returns the previous prop/declaration pair of the list,
*or NULL if we reached end of list (or if an error occurs)
*/
CRPropList *
@@ -291,10 +330,13 @@ cr_prop_list_get_prev (CRPropList * a_this)
}
/**
+ * cr_prop_list_unlink:
+ *@a_this: the current list of prop/decl pairs
+ *@a_pair: the prop/decl pair to unlink.
+ *
*Unlinks a prop/decl pair from the list
- *@param a_this the current list of prop/decl pairs
- *@param a_pair the prop/decl pair to unlink.
- *@return the new list or NULL in case of an error.
+ *
+ *Returns the new list or NULL in case of an error.
*/
CRPropList *
cr_prop_list_unlink (CRPropList * a_this, CRPropList * a_pair)
@@ -330,6 +372,10 @@ cr_prop_list_unlink (CRPropList * a_this, CRPropList * a_pair)
return a_this;
}
+/**
+ * cr_prop_list_destroy:
+ * @a_this: the current instance of #CRPropList
+ */
void
cr_prop_list_destroy (CRPropList * a_this)
{
diff --git a/src/libcroco/cr-prop-list.h b/src/libcroco/cr-prop-list.h
index a003be260..797ba43ea 100644
--- a/src/libcroco/cr-prop-list.h
+++ b/src/libcroco/cr-prop-list.h
@@ -53,7 +53,7 @@ CRPropList * cr_prop_list_prepend2 (CRPropList *a_this,
enum CRStatus cr_prop_list_set_prop (CRPropList *a_this,
CRString *a_prop) ;
-enum CRStatus cr_prop_list_get_prop (CRPropList *a_this,
+enum CRStatus cr_prop_list_get_prop (CRPropList const *a_this,
CRString **a_prop) ;
enum CRStatus cr_prop_list_lookup_prop (CRPropList *a_this,
@@ -67,7 +67,7 @@ CRPropList * cr_prop_list_get_prev (CRPropList *a_this) ;
enum CRStatus cr_prop_list_set_decl (CRPropList *a_this,
CRDeclaration *a_decl);
-enum CRStatus cr_prop_list_get_decl (CRPropList *a_this,
+enum CRStatus cr_prop_list_get_decl (CRPropList const *a_this,
CRDeclaration **a_decl) ;
CRPropList * cr_prop_list_unlink (CRPropList *a_this,
diff --git a/src/libcroco/cr-pseudo.c b/src/libcroco/cr-pseudo.c
index abb4f9bd4..a46e69ed0 100644
--- a/src/libcroco/cr-pseudo.c
+++ b/src/libcroco/cr-pseudo.c
@@ -24,37 +24,51 @@
#include "cr-pseudo.h"
/**
- *@file
+ *@CRPseudo:
*The definition of the #CRPseudo class.
*/
/**
+ * cr_pseudo_new:
*Constructor of the #CRPseudo class.
- *@return the newly build instance.
+ *
+ *Returns the newly build instance.
*/
CRPseudo *
cr_pseudo_new (void)
{
- CRPseudo *result = (CRPseudo *)g_malloc0 (sizeof (CRPseudo));
+ CRPseudo *result = NULL;
+
+ result = g_malloc0 (sizeof (CRPseudo));
return result;
}
+/**
+ * cr_pseudo_to_string:
+ * @a_this: the current instance of #CRPseud.
+ *
+ * Returns the serialized pseudo. Caller must free the returned
+ * string using g_free().
+ */
guchar *
-cr_pseudo_to_string (CRPseudo * a_this)
+cr_pseudo_to_string (CRPseudo const * a_this)
{
guchar *result = NULL;
+ GString *str_buf = NULL;
g_return_val_if_fail (a_this, NULL);
- GString *str_buf = (GString *)g_string_new (NULL);
+ str_buf = g_string_new (NULL);
if (a_this->type == IDENT_PSEUDO) {
+ guchar *name = NULL;
- if (a_this->name == NULL)
+ if (a_this->name == NULL) {
goto error;
+ }
- gchar *name = g_strndup (a_this->name->stryng->str,
+ name = g_strndup (a_this->name->stryng->str,
a_this->name->stryng->len);
if (name) {
@@ -63,12 +77,13 @@ cr_pseudo_to_string (CRPseudo * a_this)
name = NULL;
}
} else if (a_this->type == FUNCTION_PSEUDO) {
- gchar *arg = NULL;
+ guchar *name = NULL,
+ *arg = NULL;
if (a_this->name == NULL)
goto error;
- gchar *name = g_strndup (a_this->name->stryng->str,
+ name = g_strndup (a_this->name->stryng->str,
a_this->name->stryng->len);
if (a_this->extra) {
@@ -92,7 +107,7 @@ cr_pseudo_to_string (CRPseudo * a_this)
}
if (str_buf) {
- result = (guchar *)str_buf->str;
+ result = str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
@@ -105,12 +120,15 @@ cr_pseudo_to_string (CRPseudo * a_this)
}
/**
+ * cr_pseudo_dump:
+ *@a_this: the current instance of pseudo
+ *@a_fp: the destination file pointer.
+ *
*Dumps the pseudo to a file.
- *@param a_this the current instance of pseudo
- *@param a_fp the destination file pointer.
+ *
*/
void
-cr_pseudo_dump (CRPseudo * a_this, FILE * a_fp)
+cr_pseudo_dump (CRPseudo const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
@@ -125,8 +143,10 @@ cr_pseudo_dump (CRPseudo * a_this, FILE * a_fp)
}
/**
+ * cr_pseudo_destroy:
+ *@a_this: the current instance to destroy.
+ *
*destructor of the #CRPseudo class.
- *@param a_this the current instance to destroy.
*/
void
cr_pseudo_destroy (CRPseudo * a_this)
diff --git a/src/libcroco/cr-pseudo.h b/src/libcroco/cr-pseudo.h
index 6de6c9e21..8917da45e 100644
--- a/src/libcroco/cr-pseudo.h
+++ b/src/libcroco/cr-pseudo.h
@@ -53,9 +53,9 @@ struct _CRPseudo
CRPseudo * cr_pseudo_new (void) ;
-guchar * cr_pseudo_to_string (CRPseudo *a_this) ;
+guchar * cr_pseudo_to_string (CRPseudo const *a_this) ;
-void cr_pseudo_dump (CRPseudo *a_this, FILE *a_fp) ;
+void cr_pseudo_dump (CRPseudo const *a_this, FILE *a_fp) ;
void cr_pseudo_destroy (CRPseudo *a_this) ;
diff --git a/src/libcroco/cr-rgb.c b/src/libcroco/cr-rgb.c
index e0c28701a..06e61ba41 100644
--- a/src/libcroco/cr-rgb.c
+++ b/src/libcroco/cr-rgb.c
@@ -21,172 +21,179 @@
* See COPYRIGHTS file for copyrights information.
*/
+#include "config.h"
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "cr-rgb.h"
#include "cr-term.h"
#include "cr-parser.h"
-static CRRgb gv_standard_colors[] = {
- {"aliceblue", 240, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"antiquewhite", 250, 235, 215, FALSE, FALSE, FALSE, {0,0,0}},
- {"aqua", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"aquamarine", 127, 255, 212, FALSE, FALSE, FALSE, {0,0,0}},
- {"azure", 240, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"beige", 245, 245, 220, FALSE, FALSE, FALSE, {0,0,0}},
- {"bisque", 255, 228, 196, FALSE, FALSE, FALSE, {0,0,0}},
- {"black", 0, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"blanchedalmond", 255, 235, 205, FALSE, FALSE, FALSE, {0,0,0}},
- {"blue", 0, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"blueviolet", 138, 43, 226, FALSE, FALSE, FALSE, {0,0,0}},
- {"brown", 165, 42, 42, FALSE, FALSE, FALSE, {0,0,0}},
- {"burlywood", 222, 184, 135, FALSE, FALSE, FALSE, {0,0,0}},
- {"cadetblue", 95, 158, 160, FALSE, FALSE, FALSE, {0,0,0}},
- {"chartreuse", 127, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"chocolate", 210, 105, 30, FALSE, FALSE, FALSE, {0,0,0}},
- {"coral", 255, 127, 80, FALSE, FALSE, FALSE, {0,0,0}},
- {"cornflowerblue", 100, 149, 237, FALSE, FALSE, FALSE, {0,0,0}},
- {"cornsilk", 255, 248, 220, FALSE, FALSE, FALSE, {0,0,0}},
- {"crimson", 220, 20, 60, FALSE, FALSE, FALSE, {0,0,0}},
- {"cyan", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkblue", 0, 0, 139, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkcyan", 0, 139, 139, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkgoldenrod", 184, 134, 11, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkgray", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkgreen", 0, 100, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkgrey", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkkhaki", 189, 183, 107, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkmagenta", 139, 0, 139, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkolivegreen", 85, 107, 47, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkorange", 255, 140, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkorchid", 153, 50, 204, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkred", 139, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"darksalmon", 233, 150, 122, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkseagreen", 143, 188, 143, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkslateblue", 72, 61, 139, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkslategray", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkslategrey", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkturquoise", 0, 206, 209, FALSE, FALSE, FALSE, {0,0,0}},
- {"darkviolet", 148, 0, 211, FALSE, FALSE, FALSE, {0,0,0}},
- {"deeppink", 255, 20, 147, FALSE, FALSE, FALSE, {0,0,0}},
- {"deepskyblue", 0, 191, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"dimgray", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
- {"dimgrey", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
- {"dodgerblue", 30, 144, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"firebrick", 178, 34, 34, FALSE, FALSE, FALSE, {0,0,0}},
- {"floralwhite", 255, 250, 240, FALSE, FALSE, FALSE, {0,0,0}},
- {"forestgreen", 34, 139, 34, FALSE, FALSE, FALSE, {0,0,0}},
- {"fuchsia", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"gainsboro", 220, 220, 220, FALSE, FALSE, FALSE, {0,0,0}},
- {"ghostwhite", 248, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"gold", 255, 215, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"goldenrod", 218, 165, 32, FALSE, FALSE, FALSE, {0,0,0}},
- {"gray", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
- {"grey", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
- {"green", 0, 128, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"greenyellow", 173, 255, 47, FALSE, FALSE, FALSE, {0,0,0}},
- {"honeydew", 240, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
- {"hotpink", 255, 105, 180, FALSE, FALSE, FALSE, {0,0,0}},
- {"indianred", 205, 92, 92, FALSE, FALSE, FALSE, {0,0,0}},
- {"indigo", 75, 0, 130, FALSE, FALSE, FALSE, {0,0,0}},
- {"ivory", 255, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
- {"khaki", 240, 230, 140, FALSE, FALSE, FALSE, {0,0,0}},
- {"lavender", 230, 230, 250, FALSE, FALSE, FALSE, {0,0,0}},
- {"lavenderblush", 255, 240, 245, FALSE, FALSE, FALSE, {0,0,0}},
- {"lawngreen", 124, 252, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"lemonchiffon", 255, 250, 205, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightblue", 173, 216, 230, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightcoral", 240, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightcyan", 224, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightgoldenrodyellow", 250, 250, 210, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightgray", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightgreen", 144, 238, 144, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightgrey", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightpink", 255, 182, 193, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightsalmon", 255, 160, 122, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightseagreen", 32, 178, 170, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightskyblue", 135, 206, 250, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightslategray", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightslategrey", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightsteelblue", 176, 196, 222, FALSE, FALSE, FALSE, {0,0,0}},
- {"lightyellow", 255, 255, 224, FALSE, FALSE, FALSE, {0,0,0}},
- {"lime", 0, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"limegreen", 50, 205, 50, FALSE, FALSE, FALSE, {0,0,0}},
- {"linen", 250, 240, 230, FALSE, FALSE, FALSE, {0,0,0}},
- {"magenta", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"maroon", 128, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumaquamarine", 102, 205, 170, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumblue", 0, 0, 205, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumorchid", 186, 85, 211, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumpurple", 147, 112, 219, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumseagreen", 60, 179, 113, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumslateblue", 123, 104, 238, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumspringgreen", 0, 250, 154, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumturquoise", 72, 209, 204, FALSE, FALSE, FALSE, {0,0,0}},
- {"mediumvioletred", 199, 21, 133, FALSE, FALSE, FALSE, {0,0,0}},
- {"midnightblue", 25, 25, 112, FALSE, FALSE, FALSE, {0,0,0}},
- {"mintcream", 245, 255, 250, FALSE, FALSE, FALSE, {0,0,0}},
- {"mistyrose", 255, 228, 225, FALSE, FALSE, FALSE, {0,0,0}},
- {"moccasin", 255, 228, 181, FALSE, FALSE, FALSE, {0,0,0}},
- {"navajowhite", 255, 222, 173, FALSE, FALSE, FALSE, {0,0,0}},
- {"navy", 0, 0, 128, FALSE, FALSE, FALSE, {0,0,0}},
- {"oldlace", 253, 245, 230, FALSE, FALSE, FALSE, {0,0,0}},
- {"olive", 128, 128, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"olivedrab", 107, 142, 35, FALSE, FALSE, FALSE, {0,0,0}},
- {"orange", 255, 165, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"orangered", 255, 69, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"orchid", 218, 112, 214, FALSE, FALSE, FALSE, {0,0,0}},
- {"palegoldenrod", 238, 232, 170, FALSE, FALSE, FALSE, {0,0,0}},
- {"palegreen", 152, 251, 152, FALSE, FALSE, FALSE, {0,0,0}},
- {"paleturquoise", 175, 238, 238, FALSE, FALSE, FALSE, {0,0,0}},
- {"palevioletred", 219, 112, 147, FALSE, FALSE, FALSE, {0,0,0}},
- {"papayawhip", 255, 239, 213, FALSE, FALSE, FALSE, {0,0,0}},
- {"peachpuff", 255, 218, 185, FALSE, FALSE, FALSE, {0,0,0}},
- {"peru", 205, 133, 63, FALSE, FALSE, FALSE, {0,0,0}},
- {"pink", 255, 192, 203, FALSE, FALSE, FALSE, {0,0,0}},
- {"plum", 221, 160, 221, FALSE, FALSE, FALSE, {0,0,0}},
- {"powderblue", 176, 224, 230, FALSE, FALSE, FALSE, {0,0,0}},
- {"purple", 128, 0, 128, FALSE, FALSE, FALSE, {0,0,0}},
- {"red", 255, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"rosybrown", 188, 143, 143, FALSE, FALSE, FALSE, {0,0,0}},
- {"royalblue", 65, 105, 225, FALSE, FALSE, FALSE, {0,0,0}},
- {"saddlebrown", 139, 69, 19, FALSE, FALSE, FALSE, {0,0,0}},
- {"salmon", 250, 128, 114, FALSE, FALSE, FALSE, {0,0,0}},
- {"sandybrown", 244, 164, 96, FALSE, FALSE, FALSE, {0,0,0}},
- {"seagreen", 46, 139, 87, FALSE, FALSE, FALSE, {0,0,0}},
- {"seashell", 255, 245, 238, FALSE, FALSE, FALSE, {0,0,0}},
- {"sienna", 160, 82, 45, FALSE, FALSE, FALSE, {0,0,0}},
- {"silver", 192, 192, 192, FALSE, FALSE, FALSE, {0,0,0}},
- {"skyblue", 135, 206, 235, FALSE, FALSE, FALSE, {0,0,0}},
- {"slateblue", 106, 90, 205, FALSE, FALSE, FALSE, {0,0,0}},
- {"slategray", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
- {"slategrey", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
- {"snow", 255, 250, 250, FALSE, FALSE, FALSE, {0,0,0}},
- {"springgreen", 0, 255, 127, FALSE, FALSE, FALSE, {0,0,0}},
- {"steelblue", 70, 130, 180, FALSE, FALSE, FALSE, {0,0,0}},
- {"tan", 210, 180, 140, FALSE, FALSE, FALSE, {0,0,0}},
- {"teal", 0, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
- {"thistle", 216, 191, 216, FALSE, FALSE, FALSE, {0,0,0}},
- {"tomato", 255, 99, 71, FALSE, FALSE, FALSE, {0,0,0}},
- {"turquoise", 64, 224, 208, FALSE, FALSE, FALSE, {0,0,0}},
- {"violet", 238, 130, 238, FALSE, FALSE, FALSE, {0,0,0}},
- {"wheat", 245, 222, 179, FALSE, FALSE, FALSE, {0,0,0}},
- {"white", 255, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
- {"whitesmoke", 245, 245, 245, FALSE, FALSE, FALSE, {0,0,0}},
- {"yellow", 255, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
- {"yellowgreen", 154, 205, 50, FALSE, FALSE, FALSE, {0,0,0}},
- {"transparent", 255, 255, 255, FALSE, FALSE, TRUE, {0,0,0}}
+static const CRRgb gv_standard_colors[] = {
+ {(const guchar*)"aliceblue", 240, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"antiquewhite", 250, 235, 215, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"aqua", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"aquamarine", 127, 255, 212, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"azure", 240, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"beige", 245, 245, 220, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"bisque", 255, 228, 196, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"black", 0, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"blanchedalmond", 255, 235, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"blue", 0, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"blueviolet", 138, 43, 226, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"brown", 165, 42, 42, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"burlywood", 222, 184, 135, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cadetblue", 95, 158, 160, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"chartreuse", 127, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"chocolate", 210, 105, 30, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"coral", 255, 127, 80, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cornflowerblue", 100, 149, 237, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cornsilk", 255, 248, 220, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"crimson", 220, 20, 60, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cyan", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkblue", 0, 0, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkcyan", 0, 139, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgoldenrod", 184, 134, 11, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgray", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgreen", 0, 100, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgrey", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkkhaki", 189, 183, 107, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkmagenta", 139, 0, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkolivegreen", 85, 107, 47, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkorange", 255, 140, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkorchid", 153, 50, 204, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkred", 139, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darksalmon", 233, 150, 122, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkseagreen", 143, 188, 143, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkslateblue", 72, 61, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkslategray", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkslategrey", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkturquoise", 0, 206, 209, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkviolet", 148, 0, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"deeppink", 255, 20, 147, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"deepskyblue", 0, 191, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"dimgray", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"dimgrey", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"dodgerblue", 30, 144, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"firebrick", 178, 34, 34, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"floralwhite", 255, 250, 240, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"forestgreen", 34, 139, 34, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"fuchsia", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"gainsboro", 220, 220, 220, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"ghostwhite", 248, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"gold", 255, 215, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"goldenrod", 218, 165, 32, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"gray", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"green", 0, 128, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"greenyellow", 173, 255, 47, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"grey", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"honeydew", 240, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"hotpink", 255, 105, 180, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"indianred", 205, 92, 92, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"indigo", 75, 0, 130, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"ivory", 255, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"khaki", 240, 230, 140, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lavender", 230, 230, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lavenderblush", 255, 240, 245, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lawngreen", 124, 252, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lemonchiffon", 255, 250, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightblue", 173, 216, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightcoral", 240, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightcyan", 224, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgoldenrodyellow", 250, 250, 210, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgray", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgreen", 144, 238, 144, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgrey", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightpink", 255, 182, 193, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightsalmon", 255, 160, 122, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightseagreen", 32, 178, 170, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightskyblue", 135, 206, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightslategray", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightslategrey", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightsteelblue", 176, 196, 222, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightyellow", 255, 255, 224, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lime", 0, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"limegreen", 50, 205, 50, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"linen", 250, 240, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"magenta", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"maroon", 128, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumaquamarine", 102, 205, 170, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumblue", 0, 0, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumorchid", 186, 85, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumpurple", 147, 112, 219, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumseagreen", 60, 179, 113, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumslateblue", 123, 104, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumspringgreen", 0, 250, 154, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumturquoise", 72, 209, 204, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumvioletred", 199, 21, 133, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"midnightblue", 25, 25, 112, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mintcream", 245, 255, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mistyrose", 255, 228, 225, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"moccasin", 255, 228, 181, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"navajowhite", 255, 222, 173, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"navy", 0, 0, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"oldlace", 253, 245, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"olive", 128, 128, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"olivedrab", 107, 142, 35, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"orange", 255, 165, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"orangered", 255, 69, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"orchid", 218, 112, 214, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"palegoldenrod", 238, 232, 170, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"palegreen", 152, 251, 152, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"paleturquoise", 175, 238, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"palevioletred", 219, 112, 147, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"papayawhip", 255, 239, 213, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"peachpuff", 255, 218, 185, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"peru", 205, 133, 63, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"pink", 255, 192, 203, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"plum", 221, 160, 221, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"powderblue", 176, 224, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"purple", 128, 0, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"red", 255, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"rosybrown", 188, 143, 143, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"royalblue", 65, 105, 225, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"saddlebrown", 139, 69, 19, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"salmon", 250, 128, 114, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"sandybrown", 244, 164, 96, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"seagreen", 46, 139, 87, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"seashell", 255, 245, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"sienna", 160, 82, 45, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"silver", 192, 192, 192, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"skyblue", 135, 206, 235, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"slateblue", 106, 90, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"slategray", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"slategrey", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"snow", 255, 250, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"springgreen", 0, 255, 127, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"steelblue", 70, 130, 180, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"tan", 210, 180, 140, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"teal", 0, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"thistle", 216, 191, 216, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"tomato", 255, 99, 71, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"transparent", 255, 255, 255, FALSE, FALSE, TRUE, {0,0,0}},
+ {(const guchar*)"turquoise", 64, 224, 208, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"violet", 238, 130, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"wheat", 245, 222, 179, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"white", 255, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"whitesmoke", 245, 245, 245, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"yellow", 255, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"yellowgreen", 154, 205, 50, FALSE, FALSE, FALSE, {0,0,0}}
};
/**
+ * cr_rgb_new:
+ *
*The default constructor of #CRRgb.
- *@return the newly built instance of #CRRgb
+ *
+ *Returns the newly built instance of #CRRgb
*/
CRRgb *
cr_rgb_new (void)
{
- CRRgb *result = (CRRgb *)g_try_malloc (sizeof (CRRgb));
+ CRRgb *result = NULL;
+
+ result = g_try_malloc (sizeof (CRRgb));
if (result == NULL) {
cr_utils_trace_info ("No more memory");
@@ -199,13 +206,16 @@ cr_rgb_new (void)
}
/**
- *A constructor of #CRRgb.
- *@param a_red the red component of the color.
- *@param a_green the green component of the color.
- *@param a_blue the blue component of the color.
- *@param a_unit the unit of the rgb values.
+ * cr_rgb_new_with_vals:
+ *@a_red: the red component of the color.
+ *@a_green: the green component of the color.
+ *@a_blue: the blue component of the color.
+ *@a_unit: the unit of the rgb values.
*(either percentage or integer values)
- *@return the newly built instance of #CRRgb.
+ *
+ *A constructor of #CRRgb.
+ *
+ *Returns the newly built instance of #CRRgb.
*/
CRRgb *
cr_rgb_new_with_vals (gulong a_red, gulong a_green,
@@ -226,16 +236,21 @@ cr_rgb_new_with_vals (gulong a_red, gulong a_green,
}
/**
+ * cr_rgb_to_string:
+ *@a_this: the instance of #CRRgb to serialize.
+ *
*Serializes the rgb into a zero terminated string.
- *@param a_this the instance of #CRRgb to serialize.
- *@return the zero terminated string containing the serialized
+ *
+ *Returns the zero terminated string containing the serialized
*rgb. MUST BE FREED by the caller using g_free().
*/
guchar *
-cr_rgb_to_string (CRRgb * a_this)
+cr_rgb_to_string (CRRgb const * a_this)
{
- gchar *result = NULL;
- GString *str_buf = (GString *)g_string_new (NULL);
+ guchar *result = NULL;
+ GString *str_buf = NULL;
+
+ str_buf = g_string_new (NULL);
g_return_val_if_fail (str_buf, NULL);
if (a_this->is_percentage == 1) {
@@ -263,18 +278,20 @@ cr_rgb_to_string (CRRgb * a_this)
g_string_free (str_buf, FALSE);
}
- return (guchar *)result;
+ return result;
}
/**
+ * cr_rgb_dump:
+ *@a_this: the "this pointer" of
+ *the current instance of #CRRgb.
+ *@a_fp: the destination file pointer.
+ *
*Dumps the current instance of #CRRgb
*to a file.
- *@param a_this the "this pointer" of
- *the current instance of #CRRgb.
- *@param a_fp the destination file pointer.
*/
void
-cr_rgb_dump (CRRgb * a_this, FILE * a_fp)
+cr_rgb_dump (CRRgb const * a_this, FILE * a_fp)
{
guchar *str = NULL;
@@ -290,10 +307,13 @@ cr_rgb_dump (CRRgb * a_this, FILE * a_fp)
}
/**
+ * cr_rgb_compute_from_percentage:
+ *@a_this: the current instance of #CRRgb
+ *
*If the rgb values are expressed in percentage,
*compute their real value.
- *@param a_this the current instance of #CRRgb
- *@return
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_rgb_compute_from_percentage (CRRgb * a_this)
@@ -310,12 +330,15 @@ cr_rgb_compute_from_percentage (CRRgb * a_this)
}
/**
+ * cr_rgb_set:
+ *@a_this: the current instance of #CRRgb.
+ *@a_red: the red value.
+ *@a_green: the green value.
+ *@a_blue: the blue value.
+ *
*Sets rgb values to the RGB.
- *@param a_this the current instance of #CRRgb.
- *@param a_red the red value.
- *@param a_green the green value.
- *@param a_blue the blue value.
- *@return CR_OK upon successful completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
@@ -340,11 +363,14 @@ cr_rgb_set (CRRgb * a_this, gulong a_red,
}
/**
+ * cr_rgb_set_to_inherit:
+ *@a_this: the current instance of #CRRgb
+ *
*sets the value of the rgb to inherit.
*Look at the css spec from chapter 6.1 to 6.2 to understand
*the meaning of "inherit".
- *@param a_this the current instance of #CRRgb
*
+ * Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit)
@@ -356,8 +382,15 @@ cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit)
return CR_OK ;
}
+/**
+ * cr_rgb_is_set_to_inherit:
+ *
+ * @a_this: the current instance of #CRRgb.
+ *
+ * Returns TRUE if the rgb is set to the value "inherit", FALSE otherwise.
+ */
gboolean
-cr_rgb_is_set_to_inherit (CRRgb *a_this)
+cr_rgb_is_set_to_inherit (CRRgb const *a_this)
{
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
@@ -365,15 +398,18 @@ cr_rgb_is_set_to_inherit (CRRgb *a_this)
}
/**
+ * cr_rgb_is_set_to_transparent:
+ *@a_this: the current instance of
+ *#CRRgb
+ *
*Tests if the rgb is set to the
*value "transparent" or not.
- *@param a_this the current instance of
- *#CRRgb
- *@return TRUE if the rgb has been set to
+ *
+ *Returns TRUE if the rgb has been set to
*transparent, FALSE otherwise.
*/
gboolean
-cr_rgb_is_set_to_transparent (CRRgb *a_this)
+cr_rgb_is_set_to_transparent (CRRgb const *a_this)
{
g_return_val_if_fail (a_this, FALSE) ;
return a_this->is_transparent ;
@@ -381,9 +417,12 @@ cr_rgb_is_set_to_transparent (CRRgb *a_this)
/**
+ * cr_rgb_set_to_transparent:
+ *@a_this: the current instance of #CRRgb
+ *@a_is_transparent: set to transparent or not.
+ *
*Sets the rgb to the "transparent" value (or not)
- *@param a_this the current instance of #CRRgb
- *@param a_is_transparent set to transparent or not.
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_rgb_set_to_transparent (CRRgb *a_this,
@@ -395,13 +434,16 @@ cr_rgb_set_to_transparent (CRRgb *a_this,
}
/**
+ * cr_rgb_set_from_rgb:
+ *@a_this: the current instance of #CRRgb.
+ *@a_rgb: the rgb to "copy"
+ *
*Sets the rgb from an other one.
- *@param a_this the current instance of #CRRgb.
- *@param a_rgb the rgb to "copy"
- *@return CR_OK upon successful completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb)
+cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb const * a_rgb)
{
g_return_val_if_fail (a_this && a_rgb, CR_BAD_PARAM_ERROR);
@@ -410,29 +452,51 @@ cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb)
return CR_OK;
}
+static int
+cr_rgb_color_name_compare (const void *a,
+ const void *b)
+{
+ const char *a_color_name = a;
+ const CRRgb *rgb = b;
+
+ return g_ascii_strcasecmp (a_color_name, (const char *) rgb->name);
+}
+
+/**
+ * cr_rgb_set_from_name:
+ * @a_this: the current instance of #CRRgb
+ * @a_color_name: the color name
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
+ */
enum CRStatus
cr_rgb_set_from_name (CRRgb * a_this, const guchar * a_color_name)
{
- gulong i = 0;
enum CRStatus status = CR_OK;
+ CRRgb *result;
g_return_val_if_fail (a_this && a_color_name, CR_BAD_PARAM_ERROR);
- for (i = 0; i < sizeof (gv_standard_colors); i++) {
- if (!strcmp ((char *)a_color_name, gv_standard_colors[i].name)) {
- cr_rgb_set_from_rgb (a_this, &gv_standard_colors[i]);
- break;
- }
- }
-
- if (i < sizeof (gv_standard_colors))
- status = CR_OK;
+ result = bsearch (a_color_name,
+ gv_standard_colors,
+ G_N_ELEMENTS (gv_standard_colors),
+ sizeof (gv_standard_colors[0]),
+ cr_rgb_color_name_compare);
+ if (result != NULL)
+ cr_rgb_set_from_rgb (a_this, result);
else
status = CR_UNKNOWN_TYPE_ERROR;
return status;
}
+/**
+ * cr_rgb_set_from_hex_str:
+ * @a_this: the current instance of #CRRgb
+ * @a_hex: the hexadecimal value to set.
+ *
+ * Returns CR_OK upon successful completion.
+ */
enum CRStatus
cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex)
{
@@ -442,7 +506,7 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex)
g_return_val_if_fail (a_this && a_hex, CR_BAD_PARAM_ERROR);
- if (strlen ((char *)a_hex) == 3) {
+ if (strlen (a_hex) == 3) {
for (i = 0; i < 3; i++) {
if (a_hex[i] >= '0' && a_hex[i] <= '9') {
colors[i] = a_hex[i] - '0';
@@ -457,7 +521,7 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex)
status = CR_UNKNOWN_TYPE_ERROR;
}
}
- } else if (strlen ((char *)a_hex) == 6) {
+ } else if (strlen (a_hex) == 6) {
for (i = 0; i < 6; i++) {
if (a_hex[i] >= '0' && a_hex[i] <= '9') {
colors[i / 2] <<= 4;
@@ -488,15 +552,19 @@ cr_rgb_set_from_hex_str (CRRgb * a_this, const guchar * a_hex)
}
/**
+ * cr_rgb_set_from_term:
+ *@a_this: the instance of #CRRgb to set
+ *@a_value: the terminal from which to set
+ *
*Set the rgb from a terminal symbol
- *@param a_this the instance of #CRRgb to set
- *@param a_value the terminal from which to set
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value)
{
- enum CRStatus status = CR_OK ;
- g_return_val_if_fail (a_this && a_value,
+ enum CRStatus status = CR_OK ;
+ g_return_val_if_fail (a_this && a_value,
CR_BAD_PARAM_ERROR) ;
switch(a_value->type) {
@@ -518,7 +586,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value)
} else {
status = cr_rgb_set_from_name
(a_this,
- (guchar *)a_value->content.str->stryng->str) ;
+ a_value->content.str->stryng->str) ;
}
} else {
cr_utils_trace_info
@@ -531,7 +599,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value)
&& a_value->content.str->stryng->str) {
status = cr_rgb_set_from_hex_str
(a_this,
- (guchar *)a_value->content.str->stryng->str) ;
+ a_value->content.str->stryng->str) ;
} else {
cr_utils_trace_info
("a_value has NULL string value") ;
@@ -544,7 +612,7 @@ cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value)
}
enum CRStatus
-cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src)
+cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src)
{
g_return_val_if_fail (a_dest && a_src,
CR_BAD_PARAM_ERROR) ;
@@ -554,9 +622,11 @@ cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src)
}
/**
- *Destructor of #CRRgb.
- *@param a_this the "this pointer" of the
+ * cr_rgb_destroy:
+ *@a_this: the "this pointer" of the
*current instance of #CRRgb.
+ *
+ *Destructor of #CRRgb.
*/
void
cr_rgb_destroy (CRRgb * a_this)
@@ -566,13 +636,16 @@ cr_rgb_destroy (CRRgb * a_this)
}
/**
+ * cr_rgb_parse_from_buf:
+ *@a_str: a string that contains a color description
+ *@a_enc: the encoding of a_str
+ *
*Parses a text buffer that contains a rgb color
*
- *@param a_str a string that contains a color description
- *@param a_enc the encoding of a_str
- *@return the parsed color, or NULL in case of error
+ *Returns the parsed color, or NULL in case of error
*/
-CRRgb *cr_rgb_parse_from_buf (const guchar *a_str,
+CRRgb *
+cr_rgb_parse_from_buf (const guchar *a_str,
enum CREncoding a_enc)
{
enum CRStatus status = CR_OK ;
@@ -582,7 +655,7 @@ CRRgb *cr_rgb_parse_from_buf (const guchar *a_str,
g_return_val_if_fail (a_str, NULL);
- parser = cr_parser_new_from_buf ((guchar *)a_str, strlen ((char *)a_str),
+ parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str),
a_enc, FALSE) ;
g_return_val_if_fail (parser, NULL);
@@ -612,6 +685,4 @@ cleanup:
}
return result ;
}
-
-
diff --git a/src/libcroco/cr-rgb.h b/src/libcroco/cr-rgb.h
index 50cec94ec..a127a440e 100644
--- a/src/libcroco/cr-rgb.h
+++ b/src/libcroco/cr-rgb.h
@@ -39,12 +39,12 @@ struct _CRRgb
*Either NO_UNIT (integer) or
*UNIT_PERCENTAGE (percentage).
*/
- const gchar *name ;
+ const guchar *name ;
glong red ;
glong green ;
glong blue ;
gboolean is_percentage ;
- gboolean inherit ;
+ gboolean inherit ;
gboolean is_transparent ;
CRParsingLocation location ;
} ;
@@ -63,17 +63,17 @@ enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red,
gulong a_green, gulong a_blue,
gboolean a_is_percentage) ;
-enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) ;
+enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) ;
enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ;
-gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this) ;
+gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this) ;
-gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this) ;
+gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ;
enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this,
gboolean a_is_transparent) ;
-enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ;
+enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *a_rgb) ;
enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
@@ -83,9 +83,9 @@ struct _CRTerm;
enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
-guchar * cr_rgb_to_string (CRRgb *a_this) ;
+guchar * cr_rgb_to_string (CRRgb const *a_this) ;
-void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ;
+void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
void cr_rgb_destroy (CRRgb *a_this) ;
diff --git a/src/libcroco/cr-sel-eng.c b/src/libcroco/cr-sel-eng.c
index 266191e82..5bc58a96c 100644
--- a/src/libcroco/cr-sel-eng.c
+++ b/src/libcroco/cr-sel-eng.c
@@ -26,7 +26,8 @@
#include "cr-node-iface.h"
/**
- *@file:
+ *@CRSelEng:
+ *
*The definition of the #CRSelEng class.
*The #CRSelEng is actually the "Selection Engine"
*class. This is highly experimental for at the moment and
@@ -114,6 +115,10 @@ cr_sel_eng_set_node_iface (CRSelEng *const a_this, CRNodeIface const *const a_no
PRIVATE(a_this)->node_iface = a_node_iface;
}
+/* Quick strcmp. Test only for == 0 or != 0, not < 0 or > 0. */
+#define strqcmp(str,lit,lit_len) \
+ (strlen (str) != (lit_len) || memcmp (str, lit, lit_len))
+
static gboolean
lang_pseudo_class_handler (CRSelEng *const a_this,
CRAdditionalSel * a_sel, CRXMLNodePtr a_node)
@@ -131,7 +136,7 @@ lang_pseudo_class_handler (CRSelEng *const a_this,
node_iface = PRIVATE(a_this)->node_iface;
- if (strncmp (a_sel->content.pseudo->name->stryng->str,
+ if (strqcmp (a_sel->content.pseudo->name->stryng->str,
"lang", 4)
|| !a_sel->content.pseudo->type == FUNCTION_PSEUDO) {
cr_utils_trace_info ("This handler is for :lang only");
@@ -145,7 +150,7 @@ lang_pseudo_class_handler (CRSelEng *const a_this,
for (; node; node = get_next_parent_element_node (node_iface, node)) {
char *val = node_iface->getProp (node, "lang");
if (val) {
- if (!strncmp (val,
+ if (!strqcmp (val,
a_sel->content.pseudo->extra->stryng->str,
a_sel->content.pseudo->extra->stryng->len)) {
result = TRUE;
@@ -248,6 +253,10 @@ class_add_sel_matches_node (CRAdditionalSel * a_add_sel,
if ((cur && !*cur)
|| cr_utils_is_white_space (*cur) == TRUE)
result = TRUE;
+ } else { /* if it doesn't match, */
+ /* then skip to next whitespace character to try again */
+ while (cur && *cur && !(cr_utils_is_white_space(*cur) == TRUE))
+ cur++;
}
if (cur && !*cur)
break ;
@@ -284,7 +293,7 @@ id_add_sel_matches_node (CRAdditionalSel * a_add_sel,
id = a_node_iface->getProp (a_node, "id");
if (id) {
- if (!strncmp (id, a_add_sel->content.id_name->stryng->str,
+ if (!strqcmp (id, a_add_sel->content.id_name->stryng->str,
a_add_sel->content.id_name->stryng->len)) {
result = TRUE;
}
@@ -1086,8 +1095,10 @@ set_style_from_props (CRStyle * a_style, CRPropList * a_props)
****************************************/
/**
+ * cr_sel_eng_new:
*Creates a new instance of #CRSelEng.
- *@return the newly built instance of #CRSelEng of
+ *
+ *Returns the newly built instance of #CRSelEng of
*NULL if an error occurs.
*/
CRSelEng *
@@ -1122,13 +1133,16 @@ cr_sel_eng_new (void)
}
/**
- *Adds a new handler entry in the handlers entry table.
- *@param a_this the current instance of #CRSelEng
- *@param a_pseudo_class_sel_name the name of the pseudo class selector.
- *@param a_pseudo_class_type the type of the pseudo class selector.
- *@param a_handler the actual handler or callback to be called during
+ * cr_sel_eng_register_pseudo_class_sel_handler:
+ *@a_this: the current instance of #CRSelEng
+ *@a_pseudo_class_sel_name: the name of the pseudo class selector.
+ *@a_pseudo_class_type: the type of the pseudo class selector.
+ *@a_handler: the actual handler or callback to be called during
*the selector evaluation process.
- *@return CR_OK, upon successful completion, an error code otherwise.
+ *
+ *Adds a new handler entry in the handlers entry table.
+ *
+ *Returns CR_OK, upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng * a_this,
@@ -1198,10 +1212,13 @@ cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng * a_this,
}
/**
+ * cr_sel_eng_unregister_all_pseudo_class_sel_handlers:
+ *@a_this: the current instance of #CRSelEng .
+ *
*Unregisters all the pseudo class sel handlers
*and frees all the associated allocated datastructures.
- *@param a_this the current instance of #CRSelEng .
- *@return CR_OK upon succesful completion, an error code
+ *
+ *Returns CR_OK upon succesful completion, an error code
*otherwise.
*/
enum CRStatus
@@ -1262,17 +1279,20 @@ cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng * a_this,
}
/**
- *Evaluates a chained list of simple selectors (known as a css2 selector).
- *Says wheter if this selector matches the xml node given in parameter or
- *not.
- *@param a_this the selection engine.
- *@param a_sel the simple selector against which the xml node
+ * cr_sel_eng_matches_node:
+ *@a_this: the selection engine.
+ *@a_sel: the simple selector against which the xml node
*is going to be matched.
- *@param a_node the node against which the selector is going to be matched.
- *@param a_result out parameter. The result of the match. Is set to
+ *@a_node: the node against which the selector is going to be matched.
+ *@a_result: out parameter. The result of the match. Is set to
*TRUE if the selector matches the node, FALSE otherwise. This value
*is considered if and only if this functions returns CR_OK.
- *@return the CR_OK if the selection ran correctly, an error code otherwise.
+ *
+ *Evaluates a chained list of simple selectors (known as a css2 selector).
+ *Says wheter if this selector matches the xml node given in parameter or
+ *not.
+ *
+ *Returns the CR_OK if the selection ran correctly, an error code otherwise.
*/
enum CRStatus
cr_sel_eng_matches_node (CRSelEng * a_this, CRSimpleSel * a_sel,
@@ -1293,20 +1313,22 @@ cr_sel_eng_matches_node (CRSelEng * a_this, CRSimpleSel * a_sel,
}
/**
- *Returns an array of pointers to selectors that matches
- *the xml node given in parameter.
- *
- *@param a_this the current instance of the selection engine.
- *@param a_sheet the stylesheet that holds the selectors.
- *@param a_node the xml node to consider during the walk thru
+ * cr_sel_eng_get_matched_rulesets:
+ *@a_this: the current instance of the selection engine.
+ *@a_sheet: the stylesheet that holds the selectors.
+ *@a_node: the xml node to consider during the walk thru
*the stylesheet.
- *@param a_rulesets out parameter. A pointer to an array of
+ *@a_rulesets: out parameter. A pointer to an array of
*rulesets statement pointers. *a_rulesets is allocated by
*this function and must be freed by the caller. However, the caller
*must not alter the rulesets statements pointer because they
*point to statements that are still in the css stylesheet.
- *@param a_len the length of *a_ruleset.
- *@return CR_OK upon sucessfull completion, an error code otherwise.
+ *@a_len: the length of *a_ruleset.
+ *
+ *Returns an array of pointers to selectors that matches
+ *the xml node given in parameter.
+ *
+ *Returns CR_OK upon sucessfull completion, an error code otherwise.
*/
enum CRStatus
cr_sel_eng_get_matched_rulesets (CRSelEng * a_this,
@@ -1517,8 +1539,10 @@ cr_sel_eng_get_matched_style (CRSelEng * a_this,
}
/**
+ * cr_sel_eng_destroy:
+ *@a_this: the current instance of the selection engine.
+ *
*The destructor of #CRSelEng
- *@param a_this the current instance of the selection engine.
*/
void
cr_sel_eng_destroy (CRSelEng * a_this)
diff --git a/src/libcroco/cr-sel-eng.h b/src/libcroco/cr-sel-eng.h
index af6c84398..4d09f9c95 100644
--- a/src/libcroco/cr-sel-eng.h
+++ b/src/libcroco/cr-sel-eng.h
@@ -31,7 +31,7 @@
#include "cr-prop-list.h"
#include "cr-node-iface.h"
-
+#include <libxml/tree.h>
/**
*@file:
diff --git a/src/libcroco/cr-selector.c b/src/libcroco/cr-selector.c
index d85b3effc..43a3bd914 100644
--- a/src/libcroco/cr-selector.c
+++ b/src/libcroco/cr-selector.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -25,10 +25,14 @@
#include "cr-parser.h"
/**
- *Creates a new instance of #CRSelector.
- *@param a_simple_sel the initial simple selector list
+ * cr_selector_new:
+ *
+ *@a_simple_sel: the initial simple selector list
*of the current instance of #CRSelector.
- *@return the newly built instance of #CRSelector, or
+ *
+ *Creates a new instance of #CRSelector.
+ *
+ *Returns the newly built instance of #CRSelector, or
*NULL in case of failure.
*/
CRSelector *
@@ -60,10 +64,14 @@ cr_selector_parse_from_buf (const guchar * a_char_buf, enum CREncoding a_enc)
}
/**
+ * cr_selector_append:
+ *
+ *@a_this: the current instance of #CRSelector.
+ *@a_new: the instance of #CRSelector to be appended.
+ *
*Appends a new instance of #CRSelector to the current selector list.
- *@param a_this the current instance of #CRSelector.
- *@param a_new the instance of #CRSelector to be appended.
- *@return the new list.
+ *
+ *Returns the new list.
*/
CRSelector *
cr_selector_append (CRSelector * a_this, CRSelector * a_new)
@@ -84,10 +92,14 @@ cr_selector_append (CRSelector * a_this, CRSelector * a_new)
}
/**
+ * cr_selector_prepend:
+ *
+ *@a_this: the current instance of #CRSelector list.
+ *@a_new: the instance of #CRSelector.
+ *
*Prepends an element to the #CRSelector list.
- *@param a_this the current instance of #CRSelector list.
- *@param a_new the instance of #CRSelector.
- *@return the new list.
+ *
+ *Returns the new list.
*/
CRSelector *
cr_selector_prepend (CRSelector * a_this, CRSelector * a_new)
@@ -103,10 +115,14 @@ cr_selector_prepend (CRSelector * a_this, CRSelector * a_new)
}
/**
+ * cr_selector_append_simple_sel:
+ *
+ *@a_this: the current instance of #CRSelector.
+ *@a_simple_sel: the simple selector to append.
+ *
*append a simple selector to the current #CRSelector list.
- *@param a_this the current instance of #CRSelector.
- *@param a_simple_sel the simple selector to append.
- *@return the new list or NULL in case of failure.
+ *
+ *Returns the new list or NULL in case of failure.
*/
CRSelector *
cr_selector_append_simple_sel (CRSelector * a_this,
@@ -121,7 +137,7 @@ cr_selector_append_simple_sel (CRSelector * a_this,
}
guchar *
-cr_selector_to_string (CRSelector * a_this)
+cr_selector_to_string (CRSelector const * a_this)
{
guchar *result = NULL;
@@ -129,7 +145,7 @@ cr_selector_to_string (CRSelector * a_this)
g_return_val_if_fail (str_buf, NULL);
if (a_this) {
- CRSelector *cur = NULL;
+ CRSelector const *cur = NULL;
for (cur = a_this; cur; cur = cur->next) {
if (cur->simple_sel) {
@@ -162,12 +178,15 @@ cr_selector_to_string (CRSelector * a_this)
}
/**
+ * cr_selector_dump:
+ *
+ *@a_this: the current instance of #CRSelector.
+ *@a_fp: the destination file.
+ *
*Serializes the current instance of #CRSelector to a file.
- *@param a_this the current instance of #CRSelector.
- *@param a_fp the destination file.
*/
void
-cr_selector_dump (CRSelector * a_this, FILE * a_fp)
+cr_selector_dump (CRSelector const * a_this, FILE * a_fp)
{
guchar *tmp_buf = NULL;
@@ -182,9 +201,12 @@ cr_selector_dump (CRSelector * a_this, FILE * a_fp)
}
/**
+ * cr_selector_ref:
+ *
+ *@a_this: the current instance of #CRSelector.
+ *
*Increments the ref count of the current instance
*of #CRSelector.
- *@param a_this the current instance of #CRSelector.
*/
void
cr_selector_ref (CRSelector * a_this)
@@ -195,12 +217,16 @@ cr_selector_ref (CRSelector * a_this)
}
/**
+ * cr_selector_unref:
+ *
+ *@a_this: the current instance of #CRSelector.
+ *
*Decrements the ref count of the current instance of
*#CRSelector.
*If the ref count reaches zero, the current instance of
*#CRSelector is destroyed.
- *@param a_this the current instance of #CRSelector.
- *@return TRUE if this function destroyed the current instance
+ *
+ *Returns TRUE if this function destroyed the current instance
*of #CRSelector, FALSE otherwise.
*/
gboolean
@@ -221,8 +247,11 @@ cr_selector_unref (CRSelector * a_this)
}
/**
+ * cr_selector_destroy:
+ *
+ *@a_this: the current instance of #CRSelector.
+ *
*Destroys the selector list.
- *@param a_this the current instance of #CRSelector.
*/
void
cr_selector_destroy (CRSelector * a_this)
diff --git a/src/libcroco/cr-selector.h b/src/libcroco/cr-selector.h
index a22e81fdb..a7e029597 100644
--- a/src/libcroco/cr-selector.h
+++ b/src/libcroco/cr-selector.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -80,9 +80,9 @@ CRSelector* cr_selector_append_simple_sel (CRSelector *a_this,
CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ;
-guchar * cr_selector_to_string (CRSelector *a_this) ;
+guchar * cr_selector_to_string (CRSelector const *a_this) ;
-void cr_selector_dump (CRSelector *a_this, FILE *a_fp) ;
+void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ;
void cr_selector_ref (CRSelector *a_this) ;
diff --git a/src/libcroco/cr-simple-sel.c b/src/libcroco/cr-simple-sel.c
index 6a51a9526..4f5ac965a 100644
--- a/src/libcroco/cr-simple-sel.c
+++ b/src/libcroco/cr-simple-sel.c
@@ -26,9 +26,11 @@
#include "cr-simple-sel.h"
/**
+ * cr_simple_sel_new:
+ *
*The constructor of #CRSimpleSel.
*
- *@return the new instance of #CRSimpleSel.
+ *Returns the new instance of #CRSimpleSel.
*/
CRSimpleSel *
cr_simple_sel_new (void)
@@ -44,11 +46,14 @@ cr_simple_sel_new (void)
}
/**
+ * cr_simple_sel_append_simple_sel:
+ *
*Appends a simpe selector to the current list of simple selector.
*
- *@param a_this the this pointer of the current instance of #CRSimpleSel.
- *@param a_sel the simple selector to append.
- *@return the new list upon successfull completion, an error code otherwise.
+ *@a_this: the this pointer of the current instance of #CRSimpleSel.
+ *@a_sel: the simple selector to append.
+ *
+ *Returns: the new list upon successfull completion, an error code otherwise.
*/
CRSimpleSel *
cr_simple_sel_append_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel)
@@ -69,10 +74,14 @@ cr_simple_sel_append_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel)
}
/**
+ * cr_simple_sel_prepend_simple_sel:
+ *
+ *@a_this: the this pointer of the current instance of #CRSimpleSel.
+ *@a_sel: the simple selector to prepend.
+ *
*Prepends a simple selector to the current list of simple selectors.
- *@param a_this the this pointer of the current instance of #CRSimpleSel.
- *@param a_sel the simple selector to prepend.
- *@return the new list upon successfull completion, an error code otherwise.
+ *
+ *Returns the new list upon successfull completion, an error code otherwise.
*/
CRSimpleSel *
cr_simple_sel_prepend_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel)
@@ -89,12 +98,12 @@ cr_simple_sel_prepend_simple_sel (CRSimpleSel * a_this, CRSimpleSel * a_sel)
}
guchar *
-cr_simple_sel_to_string (CRSimpleSel * a_this)
+cr_simple_sel_to_string (CRSimpleSel const * a_this)
{
GString *str_buf = NULL;
guchar *result = NULL;
- CRSimpleSel *cur = NULL;
+ CRSimpleSel const *cur = NULL;
g_return_val_if_fail (a_this, NULL);
@@ -150,7 +159,7 @@ cr_simple_sel_to_string (CRSimpleSel * a_this)
guchar *
-cr_simple_sel_one_to_string (CRSimpleSel * a_this)
+cr_simple_sel_one_to_string (CRSimpleSel const * a_this)
{
GString *str_buf = NULL;
guchar *result = NULL;
@@ -190,16 +199,18 @@ cr_simple_sel_one_to_string (CRSimpleSel * a_this)
}
/**
+ * cr_simple_sel_dump:
+ *@a_this: the current instance of #CRSimpleSel.
+ *@a_fp: the destination file pointer.
+ *
*Dumps the selector to a file.
*TODO: add the support of unicode in the dump.
*
- *@param a_this the current instance of #CRSimpleSel.
- *@param a_fp the destination file pointer.
- *@return CR_OK upon successfull completion, an error code
+ *Returns CR_OK upon successfull completion, an error code
*otherwise.
*/
enum CRStatus
-cr_simple_sel_dump (CRSimpleSel * a_this, FILE * a_fp)
+cr_simple_sel_dump (CRSimpleSel const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
@@ -218,16 +229,20 @@ cr_simple_sel_dump (CRSimpleSel * a_this, FILE * a_fp)
}
/**
+ * cr_simple_sel_compute_specificity:
+ *
+ *@a_this: the current instance of #CRSimpleSel
+ *
*Computes the selector (combinator separated list of simple selectors)
*as defined in the css2 spec in chapter 6.4.3
- *@param a_this the current instance of #CRSimpleSel
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
cr_simple_sel_compute_specificity (CRSimpleSel * a_this)
{
- CRAdditionalSel *cur_add_sel = NULL;
- CRSimpleSel *cur_sel = NULL;
+ CRAdditionalSel const *cur_add_sel = NULL;
+ CRSimpleSel const *cur_sel = NULL;
gulong a = 0,
b = 0,
c = 0;
@@ -274,10 +289,12 @@ cr_simple_sel_compute_specificity (CRSimpleSel * a_this)
}
/**
+ * cr_simple_sel_destroy:
+ *
+ *@a_this: the this pointer of the current instance of #CRSimpleSel.
+ *
*The destructor of the current instance of
*#CRSimpleSel. Recursively calls the destructor of #CRSimpleSel->next
- *@param a_this the this pointer of the current instance of #CRSimpleSel.
- *
*/
void
cr_simple_sel_destroy (CRSimpleSel * const a_this)
diff --git a/src/libcroco/cr-simple-sel.h b/src/libcroco/cr-simple-sel.h
index 29033aff5..d8edc0025 100644
--- a/src/libcroco/cr-simple-sel.h
+++ b/src/libcroco/cr-simple-sel.h
@@ -40,9 +40,9 @@ G_BEGIN_DECLS
enum Combinator
{
NO_COMBINATOR,
- COMB_WS,/*whitesape*/
- COMB_PLUS,
- COMB_GT/*greater than*/
+ COMB_WS,/*whitespace: descendent*/
+ COMB_PLUS,/*'+': preceded by*/
+ COMB_GT/*greater than ('>'): child*/
} ;
enum SimpleSelectorType
@@ -112,13 +112,13 @@ CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this,
CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this,
CRSimpleSel *a_sel) ;
-guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ;
+guchar * cr_simple_sel_to_string (CRSimpleSel const *a_this) ;
-guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ;
+guchar * cr_simple_sel_one_to_string (CRSimpleSel const * a_this) ;
-enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ;
+enum CRStatus cr_simple_sel_dump (CRSimpleSel const *a_this, FILE *a_fp) ;
-enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ;
+enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel const *a_this) ;
enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
diff --git a/src/libcroco/cr-statement.c b/src/libcroco/cr-statement.c
index 147cc8347..fb8df867f 100644
--- a/src/libcroco/cr-statement.c
+++ b/src/libcroco/cr-statement.c
@@ -590,14 +590,18 @@ cr_statement_clear (CRStatement * a_this)
}
/**
+ * cr_statement_ruleset_to_string:
+ *
+ *@a_this: the current instance of #CRStatement
+ *@a_indent: the number of whitespace to use for indentation
+ *
*Serializes the ruleset statement into a string
- *@param a_this the current instance of #CRStatement
- *@param a_indent the number of whitespace to use for indentation
- *@return the newly allocated serialised string. Must be freed
+ *
+ *Returns the newly allocated serialised string. Must be freed
*by the caller, using g_free().
*/
static gchar *
-cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
+cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent)
{
gchar *tmp_str = NULL,
*result = NULL;
@@ -650,15 +654,19 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
/**
- *Serializes a font face rule statement into a string.
- *@param a_this the current instance of #CRStatement to consider
+ * cr_statement_font_face_rule_to_string:
+ *
+ *@a_this: the current instance of #CRStatement to consider
*It must be a font face rule statement.
- *@param a_indent the number of white spaces of indentation.
- *@return the serialized string. Must be deallocated by the caller
+ *@a_indent: the number of white spaces of indentation.
+ *
+ *Serializes a font face rule statement into a string.
+ *
+ *Returns the serialized string. Must be deallocated by the caller
*using g_free().
*/
static gchar *
-cr_statement_font_face_rule_to_string (CRStatement * a_this,
+cr_statement_font_face_rule_to_string (CRStatement const * a_this,
glong a_indent)
{
gchar *result = NULL, *tmp_str = NULL ;
@@ -696,13 +704,17 @@ cr_statement_font_face_rule_to_string (CRStatement * a_this,
/**
- *Serialises an @charset statement into a string.
- *@param a_this the statement to serialize.
- *@return the serialized charset statement. Must be
+ * cr_statement_charset_to_string:
+ *
+ *Serialises an \@charset statement into a string.
+ *@a_this: the statement to serialize.
+ *@a_indent: the number of indentation spaces
+ *
+ *Returns the serialized charset statement. Must be
*freed by the caller using g_free().
*/
static gchar *
-cr_statement_charset_to_string (CRStatement *a_this,
+cr_statement_charset_to_string (CRStatement const *a_this,
gulong a_indent)
{
gchar *str = NULL ;
@@ -738,13 +750,16 @@ cr_statement_charset_to_string (CRStatement *a_this,
/**
+ * cr_statement_at_page_rule_to_string:
+ *
*Serialises the at page rule statement into a string
- *@param a_this the current instance of #CRStatement. Must
- *be an "@page" rule statement.
- *@return the serialized string. Must be freed by the caller
+ *@a_this: the current instance of #CRStatement. Must
+ *be an "\@page" rule statement.
+ *
+ *Returns the serialized string. Must be freed by the caller
*/
static gchar *
-cr_statement_at_page_rule_to_string (CRStatement *a_this,
+cr_statement_at_page_rule_to_string (CRStatement const *a_this,
gulong a_indent)
{
gchar *result = NULL ;
@@ -788,19 +803,19 @@ cr_statement_at_page_rule_to_string (CRStatement *a_this,
/**
- *Serializes an @media statement.
+ *Serializes an \@media statement.
*@param a_this the current instance of #CRStatement
*@param a_indent the number of spaces of indentation.
- *@return the serialized @media statement. Must be freed
+ *@return the serialized \@media statement. Must be freed
*by the caller using g_free().
*/
static gchar *
-cr_statement_media_rule_to_string (CRStatement *a_this,
+cr_statement_media_rule_to_string (CRStatement const *a_this,
gulong a_indent)
{
gchar *str = NULL ;
GString *stringue = NULL ;
- GList *cur = NULL;
+ GList const *cur = NULL;
g_return_val_if_fail (a_this->type == AT_MEDIA_RULE_STMT,
NULL);
@@ -814,7 +829,7 @@ cr_statement_media_rule_to_string (CRStatement *a_this,
cur = cur->next) {
if (cur->data) {
gchar *str = cr_string_dup2
- ((CRString *) cur->data);
+ ((CRString const *) cur->data);
if (str) {
if (cur->prev) {
@@ -850,7 +865,7 @@ cr_statement_media_rule_to_string (CRStatement *a_this,
static gchar *
-cr_statement_import_rule_to_string (CRStatement *a_this,
+cr_statement_import_rule_to_string (CRStatement const *a_this,
gulong a_indent)
{
GString *stringue = NULL ;
@@ -878,12 +893,12 @@ cr_statement_import_rule_to_string (CRStatement *a_this,
return NULL;
if (a_this->kind.import_rule->media_list) {
- GList *cur = NULL;
+ GList const *cur = NULL;
for (cur = a_this->kind.import_rule->media_list;
cur; cur = cur->next) {
if (cur->data) {
- CRString *crstr = (CRString *)cur->data;
+ CRString const *crstr = cur->data;
if (cur->prev) {
g_string_append
@@ -916,12 +931,16 @@ cr_statement_import_rule_to_string (CRStatement *a_this,
******************/
/**
+ * cr_statement_does_buf_parses_against_core:
+ *
+ *@a_buf: the buffer to parse.
+ *@a_encoding: the character encoding of a_buf.
+ *
*Tries to parse a buffer and says whether if the content of the buffer
*is a css statement as defined by the "Core CSS Grammar" (chapter 4 of the
*css spec) or not.
- *@param a_buf the buffer to parse.
- *@param a_encoding the character encoding of a_buf.
- *@return TRUE if the buffer parses against the core grammar, false otherwise.
+ *
+ *Returns TRUE if the buffer parses against the core grammar, false otherwise.
*/
gboolean
cr_statement_does_buf_parses_against_core (const guchar * a_buf,
@@ -955,13 +974,17 @@ cr_statement_does_buf_parses_against_core (const guchar * a_buf,
}
/**
+ * cr_statement_parse_from_buf:
+ *
+ *@a_buf: the buffer to parse.
+ *@a_encoding: the character encoding of a_buf.
+ *
*Parses a buffer that contains a css statement and returns
- *an instance of #CRStatement in case of successfull parsing.
- *TODO: at support of "@import" rules.
- *@param a_buf the buffer to parse.
- *@param a_encoding the character encoding of a_buf.
- *@return the newly built instance of #CRStatement in case
- *of successfull parsing, NULL otherwise.
+ *an instance of #CRStatement in case of successful parsing.
+ *TODO: at support of "\@import" rules.
+ *
+ *Returns the newly built instance of #CRStatement in case
+ *of successful parsing, NULL otherwise.
*/
CRStatement *
cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding)
@@ -970,7 +993,7 @@ cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding)
/*
*The strategy of this function is "brute force".
- *It tries to parse all the types of #CRStatement it knows about.
+ *It tries to parse all the types of CRStatement it knows about.
*I could do this a smarter way but I don't have the time now.
*I think I will revisit this when time of performances and
*pull based incremental parsing comes.
@@ -1025,11 +1048,15 @@ cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding)
}
/**
+ * cr_statement_ruleset_parse_from_buf:
+ *
+ *@a_buf: the buffer to parse.
+ *@a_enc: the character encoding of a_buf.
+ *
*Parses a buffer that contains a ruleset statement and instanciates
*a #CRStatement of type RULESET_STMT.
- *@param a_buf the buffer to parse.
- *@param a_enc the character encoding of a_buf.
- *@param the newly built instance of #CRStatement in case of successful parsing,
+ *
+ *Returns the newly built instance of #CRStatement in case of successful parsing,
*NULL otherwise.
*/
CRStatement *
@@ -1090,15 +1117,19 @@ cr_statement_ruleset_parse_from_buf (const guchar * a_buf,
}
/**
- *Creates a new instance of #CRStatement of type
- *#CRRulSet.
- *@param a_sel_list the list of #CRSimpleSel (selectors)
+ * cr_statement_new_ruleset:
+ *
+ *@a_sel_list: the list of #CRSimpleSel (selectors)
*the rule applies to.
- *@param a_decl_list the list of instances of #CRDeclaration
+ *@a_decl_list: the list of instances of #CRDeclaration
*that composes the ruleset.
- *@param a_media_types a list of instances of GString that
+ *@a_media_types: a list of instances of GString that
*describe the media list this ruleset applies to.
- *@return the new instance of #CRStatement or NULL if something
+ *
+ *Creates a new instance of #CRStatement of type
+ *#CRRulSet.
+ *
+ *Returns the new instance of #CRStatement or NULL if something
*went wrong.
*/
CRStatement *
@@ -1155,11 +1186,15 @@ cr_statement_new_ruleset (CRStyleSheet * a_sheet,
}
/**
- *Parses a buffer that contains an "@media" declaration
- *and builds an @media css statement.
- *@param a_buf the input to parse.
- *@param a_enc the encoding of the buffer.
- *@return the @media statement, or NULL if the buffer could not
+ * cr_statement_at_media_rule_parse_from_buf:
+ *
+ *@a_buf: the input to parse.
+ *@a_enc: the encoding of the buffer.
+ *
+ *Parses a buffer that contains an "\@media" declaration
+ *and builds an \@media css statement.
+ *
+ *Returns the \@media statement, or NULL if the buffer could not
*be successfully parsed.
*/
CRStatement *
@@ -1229,11 +1264,15 @@ cr_statement_at_media_rule_parse_from_buf (const guchar * a_buf,
}
/**
+ * cr_statement_new_at_media_rule:
+ *
+ *@a_ruleset: the ruleset statements contained
+ *in the \@media rule.
+ *@a_media: the media string list. A list of GString pointers.
+ *
*Instanciates an instance of #CRStatement of type
- *AT_MEDIA_RULE_STMT (@media ruleset).
- *@param a_ruleset the ruleset statements contained
- *in the @media rule.
- *@param a_media, the media string list. A list of GString pointers.
+ *AT_MEDIA_RULE_STMT (\@media ruleset).
+ *
*/
CRStatement *
cr_statement_new_at_media_rule (CRStyleSheet * a_sheet,
@@ -1284,12 +1323,16 @@ cr_statement_new_at_media_rule (CRStyleSheet * a_sheet,
}
/**
+ * cr_statement_new_at_import_rule:
+ *
+ *@a_url: the url to connect to the get the file
+ *to be imported.
+ *@a_sheet: the imported parsed stylesheet.
+ *
*Creates a new instance of #CRStatment of type
*#CRAtImportRule.
- *@param a_url the url to connect to the get the file
- *to be imported.
- *@param a_sheet the imported parsed stylesheet.
- *@return the newly built instance of #CRStatement.
+ *
+ *Returns the newly built instance of #CRStatement.
*/
CRStatement *
cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet,
@@ -1326,12 +1369,16 @@ cr_statement_new_at_import_rule (CRStyleSheet * a_container_sheet,
}
/**
- *Parses a buffer that contains an "@import" rule and
+ * cr_statement_at_import_rule_parse_from_buf:
+ *
+ *@a_buf: the buffer to parse.
+ *@a_encoding: the encoding of a_buf.
+ *
+ *Parses a buffer that contains an "\@import" rule and
*instanciate a #CRStatement of type AT_IMPORT_RULE_STMT
- *@param a_buf the buffer to parse.
- *@param a_encoding the encoding of a_buf.
- *@return the newly built instance of #CRStatement in case of
- *a successfull parsing, NULL otherwise.
+ *
+ *Returns the newly built instance of #CRStatement in case of
+ *a successful parsing, NULL otherwise.
*/
CRStatement *
cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
@@ -1398,13 +1445,17 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
}
/**
- *Creates a new instance of #CRStatement of type
- *#CRAtPageRule.
- *@param a_decl_list a list of instances of #CRDeclarations
+ * cr_statement_new_at_page_rule:
+ *
+ *@a_decl_list: a list of instances of #CRDeclarations
*which is actually the list of declarations that applies to
*this page rule.
- *@param a_selector the page rule selector.
- *@return the newly built instance of #CRStatement or NULL
+ *@a_selector: the page rule selector.
+ *
+ *Creates a new instance of #CRStatement of type
+ *#CRAtPageRule.
+ *
+ *Returns the newly built instance of #CRStatement or NULL
*in case of error.
*/
CRStatement *
@@ -1444,11 +1495,15 @@ cr_statement_new_at_page_rule (CRStyleSheet * a_sheet,
}
/**
- *Parses a buffer that contains an "@page" production and,
+ * cr_statement_at_page_rule_parse_from_buf:
+ *
+ *@a_buf: the character buffer to parse.
+ *@a_encoding: the character encoding of a_buf.
+ *
+ *Parses a buffer that contains an "\@page" production and,
*if the parsing succeeds, builds the page statement.
- *@param a_buf the character buffer to parse.
- *@param a_encoding the character encoding of a_buf.
- *@return the newly built at page statement in case of successfull parsing,
+ *
+ *Returns the newly built at page statement in case of successful parsing,
*NULL otherwise.
*/
CRStatement *
@@ -1513,12 +1568,16 @@ cr_statement_at_page_rule_parse_from_buf (const guchar * a_buf,
}
/**
- *Creates a new instance of #CRStatement of type
- *#CRAtCharsetRule.
- *@param a_charset the string representing the charset.
+ * cr_statement_new_at_charset_rule:
+ *
+ *@a_charset: the string representing the charset.
*Note that the newly built instance of #CRStatement becomes
*the owner of a_charset. The caller must not free a_charset !!!.
- *@return the newly built instance of #CRStatement or NULL
+ *
+ *Creates a new instance of #CRStatement of type
+ *#CRAtCharsetRule.
+ *
+ *Returns the newly built instance of #CRStatement or NULL
*if an error arises.
*/
CRStatement *
@@ -1552,11 +1611,15 @@ cr_statement_new_at_charset_rule (CRStyleSheet * a_sheet,
}
/**
- *Parses a buffer that contains an '@charset' rule and
+ * cr_statement_at_charset_rule_parse_from_buf:
+ *
+ *@a_buf: the buffer to parse.
+ *@a_encoding: the character encoding of the buffer.
+ *
+ *Parses a buffer that contains an '\@charset' rule and
*creates an instance of #CRStatement of type AT_CHARSET_RULE_STMT.
- *@param a_buf the buffer to parse.
- *@param the character encoding of the buffer.
- *@return the newly built instance of #CRStatement.
+ *
+ *Returns the newly built instance of #CRStatement.
*/
CRStatement *
cr_statement_at_charset_rule_parse_from_buf (const guchar * a_buf,
@@ -1602,10 +1665,14 @@ cr_statement_at_charset_rule_parse_from_buf (const guchar * a_buf,
}
/**
- *Creates an instance of #CRStatement of type #CRAtFontFaceRule.
- *@param a_font_decls a list of instances of #CRDeclaration. Each declaration
+ * cr_statement_new_at_font_face_rule:
+ *
+ *@a_font_decls: a list of instances of #CRDeclaration. Each declaration
*is actually a font declaration.
- *@return the newly built instance of #CRStatement.
+ *
+ *Creates an instance of #CRStatement of type #CRAtFontFaceRule.
+ *
+ *Returns the newly built instance of #CRStatement.
*/
CRStatement *
cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet,
@@ -1638,11 +1705,16 @@ cr_statement_new_at_font_face_rule (CRStyleSheet * a_sheet,
}
/**
- *Parses a buffer that contains an "@font-face" rule and builds
+ * cr_statement_font_face_rule_parse_from_buf:
+ *
+ *
+ *@a_buf: the buffer to parse.
+ *@a_encoding: the character encoding of a_buf.
+ *
+ *Parses a buffer that contains an "\@font-face" rule and builds
*an instance of #CRStatement of type AT_FONT_FACE_RULE_STMT out of it.
- *@param a_buf the buffer to parse.
- *@param a_encoding the character encoding of a_buf.
- *@return the newly built instance of #CRStatement in case of successufull
+ *
+ *Returns the newly built instance of #CRStatement in case of successufull
*parsing, NULL otherwise.
*/
CRStatement *
@@ -1710,10 +1782,14 @@ cr_statement_font_face_rule_parse_from_buf (const guchar * a_buf,
}
/**
+ * cr_statement_set_parent_sheet:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *@a_sheet: the sheet that contains the current statement.
+ *
*Sets the container stylesheet.
- *@param a_this the current instance of #CRStatement.
- *@param a_sheet the sheet that contains the current statement.
- *@return CR_OK upon successfull completion, an errror code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet)
@@ -1724,10 +1800,14 @@ cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet)
}
/**
+ * cr_statement_get_parent_sheet:
+ *
+ *@a_this: the current #CRStatement.
+ *@a_sheet: out parameter. A pointer to the sheets that
+ *
*Gets the sheets that contains the current statement.
- *@param a_this the current #CRStatement.
- *@param a_sheet out parameter. A pointer to the sheets that
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_get_parent_sheet (CRStatement * a_this, CRStyleSheet ** a_sheet)
@@ -1738,10 +1818,14 @@ cr_statement_get_parent_sheet (CRStatement * a_this, CRStyleSheet ** a_sheet)
}
/**
+ * cr_statement_append:
+ *
+ *@a_this: the current instance of the statement list.
+ *@a_new: a_new the new instance of #CRStatement to append.
+ *
*Appends a new statement to the statement list.
- *@param a_this the current instance of the statement list.
- *@param a_this a_new the new instance of #CRStatement to append.
- *@return the new list statement list, or NULL in cas of failure.
+ *
+ *Returns the new list statement list, or NULL in cas of failure.
*/
CRStatement *
cr_statement_append (CRStatement * a_this, CRStatement * a_new)
@@ -1764,11 +1848,15 @@ cr_statement_append (CRStatement * a_this, CRStatement * a_new)
}
/**
+ * cr_statement_prepend:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *@a_new: the new statement to prepend.
+ *
*Prepends the an instance of #CRStatement to
*the current statement list.
- *@param a_this the current instance of #CRStatement.
- *@param a_new the new statement to prepend.
- *@return the new list with the new statement prepended,
+ *
+ *Returns the new list with the new statement prepended,
*or NULL in case of an error.
*/
CRStatement *
@@ -1791,10 +1879,14 @@ cr_statement_prepend (CRStatement * a_this, CRStatement * a_new)
}
/**
+ * cr_statement_unlink:
+ *
+ *@a_this: the current statements list.
+ *@a_to_unlink: the statement to unlink from the list.
+ *
*Unlinks a statement from the statements list.
- *@param a_this the current statements list.
- *@param a_to_unlink the statement to unlink from the list.
- *@return the new list where a_to_unlink has been unlinked
+ *
+ *Returns the new list where a_to_unlink has been unlinked
*from, or NULL in case of error.
*/
CRStatement *
@@ -1838,14 +1930,18 @@ cr_statement_unlink (CRStatement * a_stmt)
}
/**
- *Return the number of rules in the statement list;
- *@param a_this the current instance of #CRStatement.
- *@return number of rules in the statement list.
+ * cr_statement_nr_rules:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *
+ *Gets the number of rules in the statement list;
+ *
+ *Returns number of rules in the statement list.
*/
gint
-cr_statement_nr_rules (CRStatement * a_this)
+cr_statement_nr_rules (CRStatement const * a_this)
{
- CRStatement *cur = NULL;
+ CRStatement const *cur = NULL;
int nr = 0;
g_return_val_if_fail (a_this, -1);
@@ -1856,10 +1952,14 @@ cr_statement_nr_rules (CRStatement * a_this)
}
/**
+ * cr_statement_get_from_list:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *@itemnr: the index into the statement list.
+ *
*Use an index to get a CRStatement from the statement list.
- *@param a_this the current instance of #CRStatement.
- *@param itemnr the index into the statement list.
- *@return CRStatement at position itemnr, if itemnr > number of statements - 1,
+ *
+ *Returns CRStatement at position itemnr, if itemnr > number of statements - 1,
*it will return NULL.
*/
CRStatement *
@@ -1877,13 +1977,17 @@ cr_statement_get_from_list (CRStatement * a_this, int itemnr)
}
/**
- *Sets a selector list to a ruleset statement.
- *@param a_this the current ruleset statement.
- *@param a_sel_list the selector list to set. Note
+ * cr_statement_ruleset_set_sel_list:
+ *
+ *@a_this: the current ruleset statement.
+ *@a_sel_list: the selector list to set. Note
*that this function increments the ref count of a_sel_list.
*The sel list will be destroyed at the destruction of the
*current instance of #CRStatement.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Sets a selector list to a ruleset statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_ruleset_set_sel_list (CRStatement * a_this,
@@ -1904,12 +2008,16 @@ cr_statement_ruleset_set_sel_list (CRStatement * a_this,
}
/**
+ * cr_statement_ruleset_get_declarations:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *@a_decl_list: out parameter. A pointer to the the returned
+ *list of declaration. Must not be NULL.
+ *
*Gets a pointer to the list of declaration contained
*in the ruleset statement.
- *@param a_this the current instance of #CRStatement.
- *@a_decl_list out parameter. A pointer to the returned
- *list of declaration. Must not be NULL.
- *@return CR_OK upon successfull completion, an error code if something
+ *
+ *Returns CR_OK upon successful completion, an error code if something
*bad happened.
*/
enum CRStatus
@@ -1927,15 +2035,19 @@ cr_statement_ruleset_get_declarations (CRStatement * a_this,
}
/**
+ * cr_statement_ruleset_get_sel_list:
+ *
+ *@a_this: the current ruleset statement.
+ *@a_list: out parameter. The returned selector list,
+ *if and only if the function returned CR_OK.
+ *
*Gets a pointer to the selector list contained in
*the current ruleset statement.
- *@param a_this the current ruleset statement.
- *@param a_list out parameter. The returned selector list,
- *if and only if the function returned CR_OK.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list)
+cr_statement_ruleset_get_sel_list (CRStatement const * a_this, CRSelector ** a_list)
{
g_return_val_if_fail (a_this && a_this->type == RULESET_STMT
&& a_this->kind.ruleset, CR_BAD_PARAM_ERROR);
@@ -1946,11 +2058,15 @@ cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list)
}
/**
- *Sets a declaration list to the current ruleset statement.
- *@param a_this the current ruleset statement.
- *@param a_list the declaration list to be added to the current
+ * cr_statement_ruleset_set_decl_list:
+ *
+ *@a_this: the current ruleset statement.
+ *@a_list: the declaration list to be added to the current
*ruleset statement.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Sets a declaration list to the current ruleset statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_ruleset_set_decl_list (CRStatement * a_this,
@@ -1972,11 +2088,15 @@ cr_statement_ruleset_set_decl_list (CRStatement * a_this,
}
/**
+ * cr_statement_ruleset_append_decl2:
+ *
+ *@a_this: the current statement.
+ *@a_prop: the property of the declaration.
+ *@a_value: the value of the declaration.
+ *
*Appends a declaration to the current ruleset statement.
- *@param a_this the current statement.
- *@param a_prop the property of the declaration.
- *@param a_value the value of the declaration.
- *@return CR_OK uppon successfull completion, an error code
+ *
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
@@ -1999,10 +2119,14 @@ cr_statement_ruleset_append_decl2 (CRStatement * a_this,
}
/**
+ * cr_statement_ruleset_append_decl:
+ *
*Appends a declaration to the current statement.
- *@param a_this the current statement.
- *@param a_declaration the declaration to append.
- *@return CR_OK upon sucessfull completion, an error code
+ *
+ *@a_this: the current statement.
+ *@a_declaration: the declaration to append.
+ *
+ *Returns CR_OK upon sucessful completion, an error code
*otherwise.
*/
enum CRStatus
@@ -2023,13 +2147,16 @@ cr_statement_ruleset_append_decl (CRStatement * a_this,
}
/**
- *Sets a stylesheet to the current @import rule.
- *@param a_this the current @import rule.
- *@param a_sheet the stylesheet. The stylesheet is owned
+ * cr_statement_at_import_rule_set_imported_sheet:
+ *
+ *Sets a stylesheet to the current \@import rule.
+ *@a_this: the current \@import rule.
+ *@a_sheet: the stylesheet. The stylesheet is owned
*by the current instance of #CRStatement, that is, the
*stylesheet will be destroyed when the current instance
- *of #CRStatement will be destroyed.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *of #CRStatement is destroyed.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this,
@@ -2046,11 +2173,14 @@ cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this,
}
/**
- *Gets the stylesheet contained by the @import rule statement.
- *@param a_this the current @import rule statement.
- *@param a_sheet out parameter. The returned stylesheet if and
+ * cr_statement_at_import_rule_get_imported_sheet:
+ *
+ *@a_this: the current \@import rule statement.
+ *@a_sheet: out parameter. The returned stylesheet if and
*only if the function returns CR_OK.
- *@return CR_OK upon sucessfull completion, an error code otherwise.
+ *
+ *Gets the stylesheet contained by the \@import rule statement.
+ *Returns CR_OK upon sucessful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this,
@@ -2066,10 +2196,14 @@ cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this,
}
/**
- *Sets an url to the current @import rule statement.
- *@param a_this the current @import rule statement.
- *@param a_url the url to set.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ * cr_statement_at_import_rule_set_url:
+ *
+ *@a_this: the current \@import rule statement.
+ *@a_url: the url to set.
+ *
+ *Sets an url to the current \@import rule statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_import_rule_set_url (CRStatement * a_this,
@@ -2090,13 +2224,17 @@ cr_statement_at_import_rule_set_url (CRStatement * a_this,
}
/**
- *Gets the url of the @import rule statement.
- *@param the current @import rule statement.
- *@param a_url out parameter. The returned url if
+ * cr_statement_at_import_rule_get_url:
+ *
+ *@a_this: the current \@import rule statement.
+ *@a_url: out parameter. The returned url if
*and only if the function returned CR_OK.
+ *
+ *Gets the url of the \@import rule statement.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_statement_at_import_rule_get_url (CRStatement * a_this,
+cr_statement_at_import_rule_get_url (CRStatement const * a_this,
CRString ** a_url)
{
g_return_val_if_fail (a_this
@@ -2110,12 +2248,14 @@ cr_statement_at_import_rule_get_url (CRStatement * a_this,
}
/**
- *Return the number of rules in the media rule;
- *@param a_this the current instance of #CRStatement.
- *@return number of rules in the media rule.
+ * cr_statement_at_media_nr_rules:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *
+ *Returns the number of rules in the media rule;
*/
int
-cr_statement_at_media_nr_rules (CRStatement * a_this)
+cr_statement_at_media_nr_rules (CRStatement const * a_this)
{
g_return_val_if_fail (a_this
&& a_this->type == AT_MEDIA_RULE_STMT
@@ -2125,10 +2265,14 @@ cr_statement_at_media_nr_rules (CRStatement * a_this)
}
/**
+ * cr_statement_at_media_get_from_list:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *@itemnr: the index into the media rule list of rules.
+ *
*Use an index to get a CRStatement from the media rule list of rules.
- *@param a_this the current instance of #CRStatement.
- *@param itemnr the index into the media rule list of rules.
- *@return CRStatement at position itemnr, if itemnr > number of rules - 1,
+ *
+ *Returns CRStatement at position itemnr, if itemnr > number of rules - 1,
*it will return NULL.
*/
CRStatement *
@@ -2143,11 +2287,15 @@ cr_statement_at_media_get_from_list (CRStatement * a_this, int itemnr)
}
/**
- *Sets a declaration list to the current @page rule statement.
- *@param a_this the current @page rule statement.
- *@param a_decl_list the declaration list to add. Will be freed
+ * cr_statement_at_page_rule_set_declarations:
+ *
+ *@a_this: the current \@page rule statement.
+ *@a_decl_list: the declaration list to add. Will be freed
*by the current instance of #CRStatement when it is destroyed.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Sets a declaration list to the current \@page rule statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_page_rule_set_declarations (CRStatement * a_this,
@@ -2171,11 +2319,15 @@ cr_statement_at_page_rule_set_declarations (CRStatement * a_this,
}
/**
- *Gets the declaration list associated to the current @page rule
+ * cr_statement_at_page_rule_get_declarations:
+ *
+ *@a_this: the current \@page rule statement.
+ *@a_decl_list: out parameter. The returned declaration list.
+ *
+ *Gets the declaration list associated to the current \@page rule
*statement.
- *@param a_this the current @page rule statement.
- *@param a_decl_list out parameter. The returned declaration list.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_page_rule_get_declarations (CRStatement * a_this,
@@ -2191,10 +2343,15 @@ cr_statement_at_page_rule_get_declarations (CRStatement * a_this,
}
/**
- *Sets the charset of the current @charset rule statement.
- *@param a_this the current @charset rule statement.
- *@param a_charset the charset to set.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ * cr_statement_at_charset_rule_set_charset:
+ *
+ *
+ *@a_this: the current \@charset rule statement.
+ *@a_charset: the charset to set.
+ *
+ *Sets the charset of the current \@charset rule statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_charset_rule_set_charset (CRStatement * a_this,
@@ -2213,14 +2370,18 @@ cr_statement_at_charset_rule_set_charset (CRStatement * a_this,
}
/**
- *Gets the charset string associated to the current
- *@charset rule statement.
- *@param a_this the current @charset rule statement.
- *@param a_charset out parameter. The returned charset string if
+ * cr_statement_at_charset_rule_get_charset:
+ *@a_this: the current \@charset rule statement.
+ *@a_charset: out parameter. The returned charset string if
*and only if the function returned CR_OK.
+ *
+ *Gets the charset string associated to the current
+ *\@charset rule statement.
+ *
+ * Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_statement_at_charset_rule_get_charset (CRStatement * a_this,
+cr_statement_at_charset_rule_get_charset (CRStatement const * a_this,
CRString ** a_charset)
{
g_return_val_if_fail (a_this
@@ -2234,10 +2395,14 @@ cr_statement_at_charset_rule_get_charset (CRStatement * a_this,
}
/**
- *Sets a declaration list to the current @font-face rule statement.
- *@param a_this the current @font-face rule statement.
- *@param a_decls the declarations list to set.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ * cr_statement_at_font_face_rule_set_decls:
+ *
+ *@a_this: the current \@font-face rule statement.
+ *@a_decls: the declarations list to set.
+ *
+ *Sets a declaration list to the current \@font-face rule statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_font_face_rule_set_decls (CRStatement * a_this,
@@ -2259,12 +2424,16 @@ cr_statement_at_font_face_rule_set_decls (CRStatement * a_this,
}
/**
- *Gets the declaration list associated to the current instance
- *of @font-face rule statement.
- *@param a_this the current @font-face rule statement.
- *@param a_decls out parameter. The returned declaration list if
+ * cr_statement_at_font_face_rule_get_decls:
+ *
+ *@a_this: the current \@font-face rule statement.
+ *@a_decls: out parameter. The returned declaration list if
*and only if this function returns CR_OK.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Gets the declaration list associated to the current instance
+ *of \@font-face rule statement.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_font_face_rule_get_decls (CRStatement * a_this,
@@ -2281,12 +2450,16 @@ cr_statement_at_font_face_rule_get_decls (CRStatement * a_this,
}
/**
- *Adds a declaration to the current @font-face rule
+ * cr_statement_at_font_face_rule_add_decl:
+ *
+ *@a_this: the current \@font-face rule statement.
+ *@a_prop: the property of the declaration.
+ *@a_value: the value of the declaration.
+ *
+ *Adds a declaration to the current \@font-face rule
*statement.
- *@param a_this the current @font-face rule statement.
- *@param a_prop the property of the declaration.
- *@param a_value the value of the declaration.
- *@return CR_OK upon successfull completion, an error code otherwise.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_font_face_rule_add_decl (CRStatement * a_this,
@@ -2313,15 +2486,20 @@ cr_statement_at_font_face_rule_add_decl (CRStatement * a_this,
return CR_OK;
}
+
/**
+ * cr_statement_to_string:
+ *
+ *@a_this: the current statement to serialize
+ *@a_indent: the number of white space of indentation.
+ *
*Serializes a css statement into a string
- *@param a_this the current statement to serialize
- *@param a_indent the number of white space of indentation.
- *@return the serialized statement. Must be freed by the caller
+ *
+ *Returns the serialized statement. Must be freed by the caller
*using g_free().
*/
gchar *
-cr_statement_to_string (CRStatement * a_this, gulong a_indent)
+cr_statement_to_string (CRStatement const * a_this, gulong a_indent)
{
gchar *str = NULL ;
@@ -2367,9 +2545,9 @@ cr_statement_to_string (CRStatement * a_this, gulong a_indent)
}
gchar*
-cr_statement_list_to_string (CRStatement *a_this, gulong a_indent)
+cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent)
{
- CRStatement *cur_stmt = NULL ;
+ CRStatement const *cur_stmt = NULL ;
GString *stringue = NULL ;
gchar *str = NULL ;
@@ -2400,13 +2578,16 @@ cr_statement_list_to_string (CRStatement *a_this, gulong a_indent)
}
/**
+ * cr_statement_dump:
+ *
+ *@a_this: the current css2 statement.
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of white space indentation characters.
+ *
*Dumps the css2 statement to a file.
- *@param a_this the current css2 statement.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of white space indentation characters.
*/
void
-cr_statement_dump (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
{
gchar *str = NULL ;
@@ -2422,13 +2603,16 @@ cr_statement_dump (CRStatement * a_this, FILE * a_fp, gulong a_indent)
}
/**
+ * cr_statement_dump_ruleset:
+ *
+ *@a_this: the current instance of #CRStatement.
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of indentation white spaces to add.
+ *
*Dumps a ruleset statement to a file.
- *@param a_this the current instance of #CRStatement.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of indentation white spaces to add.
*/
void
-cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent)
+cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp, glong a_indent)
{
g_return_if_fail (a_fp && a_this);
gchar *str = cr_statement_ruleset_to_string (a_this, a_indent);
@@ -2440,13 +2624,16 @@ cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent)
}
/**
+ * cr_statement_dump_font_face_rule:
+ *
+ *@a_this: the current instance of font face rule statement.
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of white space indentation.
+ *
*Dumps a font face rule statement to a file.
- *@param a_this the current instance of font face rule statement.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of white space indentation.
*/
void
-cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_font_face_rule (CRStatement const * a_this, FILE * a_fp,
glong a_indent)
{
gchar *str = NULL ;
@@ -2463,13 +2650,16 @@ cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp,
}
/**
- *Dumps an @charset rule statement to a file.
- *@param a_this the current instance of the @charset rule statement.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of indentation white spaces.
+ * cr_statement_dump_charset:
+ *
+ *@a_this: the current instance of the \@charset rule statement.
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of indentation white spaces.
+ *
+ *Dumps an \@charset rule statement to a file.
*/
void
-cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
{
g_return_if_fail (a_this && a_this->type == AT_CHARSET_RULE_STMT);
@@ -2484,13 +2674,16 @@ cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent)
/**
- *Dumps an @page rule statement on stdout.
- *@param a_this the statement to dump on stdout.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of indentation white spaces.
+ * cr_statement_dump_page:
+ *
+ *@a_this: the statement to dump on stdout.
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of indentation white spaces.
+ *
+ *Dumps an \@page rule statement on stdout.
*/
void
-cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
{
g_return_if_fail (a_this
&& a_this->type == AT_PAGE_RULE_STMT
@@ -2506,13 +2699,16 @@ cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent)
/**
- *Dumps an @media rule statement to a file.
- *@param a_this the statement to dump.
- *@param a_fp the destination file pointer
- *@param a_indent the number of white spaces indentation.
+ * cr_statement_dump_media_rule:
+ *
+ *@a_this: the statement to dump.
+ *@a_fp: the destination file pointer
+ *@a_indent: the number of white spaces indentation.
+ *
+ *Dumps an \@media rule statement to a file.
*/
void
-cr_statement_dump_media_rule (CRStatement * a_this,
+cr_statement_dump_media_rule (CRStatement const * a_this,
FILE * a_fp,
gulong a_indent)
{
@@ -2528,12 +2724,15 @@ cr_statement_dump_media_rule (CRStatement * a_this,
}
/**
- *Dumps an @import rule statement to a file.
- *@param a_fp the destination file pointer.
- *@param a_indent the number of white space indentations.
+ * cr_statement_dump_import_rule:
+ *
+ *@a_fp: the destination file pointer.
+ *@a_indent: the number of white space indentations.
+ *
+ *Dumps an \@import rule statement to a file.
*/
void
-cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
gulong a_indent)
{
gchar *str = NULL ;
@@ -2551,6 +2750,10 @@ cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
}
/**
+ * cr_statement_destroy:
+ *
+ * @a_this: the current instance of #CRStatement.
+ *
*Destructor of #CRStatement.
*/
void
diff --git a/src/libcroco/cr-statement.h b/src/libcroco/cr-statement.h
index 5639ab730..74a233055 100644
--- a/src/libcroco/cr-statement.h
+++ b/src/libcroco/cr-statement.h
@@ -84,7 +84,7 @@ struct _CRStyleSheet ;
typedef struct _CRStyleSheet CRStyleSheet;
-/**The @import rule abstraction.*/
+/**The \@import rule abstraction.*/
typedef struct _CRAtImportRule CRAtImportRule ;
struct _CRAtImportRule
{
@@ -102,7 +102,7 @@ struct _CRAtImportRule
};
-/**abstraction of an @media rule*/
+/**abstraction of an \@media rule*/
struct _CRAtMediaRule
{
GList *media_list ;
@@ -111,7 +111,7 @@ struct _CRAtMediaRule
typedef struct _CRAtPageRule CRAtPageRule ;
-/**The @page rule abstraction*/
+/**The \@page rule abstraction*/
struct _CRAtPageRule
{
/**a list of instances of #CRDeclaration*/
@@ -122,14 +122,14 @@ struct _CRAtPageRule
CRString *pseudo ;
} ;
-/**The @charset rule abstraction*/
+/**The \@charset rule abstraction*/
typedef struct _CRAtCharsetRule CRAtCharsetRule ;
struct _CRAtCharsetRule
{
CRString * charset ;
};
-/**The abstaction of the @font-face rule.*/
+/**The abstaction of the \@font-face rule.*/
typedef struct _CRAtFontFaceRule CRAtFontFaceRule ;
struct _CRAtFontFaceRule
{
@@ -176,8 +176,8 @@ enum CRStatementType
*The abstraction of css statement as defined
*in the chapter 4 and appendix D.1 of the css2 spec.
*A statement is actually a double chained list of
- *statements.A statement can be a ruleset, an @import
- *rule, an @page rule etc ...
+ *statements.A statement can be a ruleset, an \@import
+ *rule, an \@page rule etc ...
*/
struct _CRStatement
{
@@ -314,7 +314,7 @@ cr_statement_ruleset_set_sel_list (CRStatement *a_this,
CRSelector *a_sel_list) ;
enum CRStatus
-cr_statement_ruleset_get_sel_list (CRStatement *a_this,
+cr_statement_ruleset_get_sel_list (CRStatement const *a_this,
CRSelector **a_list) ;
enum CRStatus
@@ -346,11 +346,11 @@ cr_statement_at_import_rule_set_url (CRStatement *a_this,
CRString *a_url) ;
enum CRStatus
-cr_statement_at_import_rule_get_url (CRStatement *a_this,
+cr_statement_at_import_rule_get_url (CRStatement const *a_this,
CRString **a_url) ;
gint
-cr_statement_at_media_nr_rules (CRStatement *a_this) ;
+cr_statement_at_media_nr_rules (CRStatement const *a_this) ;
CRStatement *
cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ;
@@ -360,7 +360,7 @@ cr_statement_at_page_rule_set_sel (CRStatement *a_this,
CRSelector *a_sel) ;
enum CRStatus
-cr_statement_at_page_rule_get_sel (CRStatement *a_this,
+cr_statement_at_page_rule_get_sel (CRStatement const *a_this,
CRSelector **a_sel) ;
enum CRStatus
@@ -376,7 +376,7 @@ cr_statement_at_charset_rule_set_charset (CRStatement *a_this,
CRString *a_charset) ;
enum CRStatus
-cr_statement_at_charset_rule_get_charset (CRStatement *a_this,
+cr_statement_at_charset_rule_get_charset (CRStatement const *a_this,
CRString **a_charset) ;
enum CRStatus
@@ -393,41 +393,41 @@ cr_statement_at_font_face_rule_add_decl (CRStatement *a_this,
CRTerm *a_value) ;
gchar *
-cr_statement_to_string (CRStatement * a_this, gulong a_indent) ;
+cr_statement_to_string (CRStatement const * a_this, gulong a_indent) ;
gchar*
-cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) ;
+cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) ;
void
-cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) ;
+cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent) ;
void
-cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp,
glong a_indent) ;
void
-cr_statement_dump_font_face_rule (CRStatement * a_this,
+cr_statement_dump_font_face_rule (CRStatement const * a_this,
FILE * a_fp,
glong a_indent) ;
void
-cr_statement_dump_page (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
void
-cr_statement_dump_media_rule (CRStatement * a_this,
+cr_statement_dump_media_rule (CRStatement const * a_this,
FILE * a_fp,
gulong a_indent) ;
void
-cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
void
-cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
gint
-cr_statement_nr_rules (CRStatement *a_this) ;
+cr_statement_nr_rules (CRStatement const *a_this) ;
CRStatement *
cr_statement_get_from_list (CRStatement *a_this, int itemnr) ;
diff --git a/src/libcroco/cr-string.c b/src/libcroco/cr-string.c
index 7c656f54d..47d557d5b 100644
--- a/src/libcroco/cr-string.c
+++ b/src/libcroco/cr-string.c
@@ -68,7 +68,7 @@ cr_string_new_from_string (const gchar * a_string)
*@return the newly instanciated #CRString.
*/
CRString *
-cr_string_new_from_gstring (GString *a_string)
+cr_string_new_from_gstring (GString const *a_string)
{
CRString *result = cr_string_new () ;
if (!result) {
@@ -76,16 +76,16 @@ cr_string_new_from_gstring (GString *a_string)
return NULL ;
}
if (a_string) {
- result->stryng = g_string_new_len
- (a_string->str, a_string->len) ;
- } else {
- result->stryng = g_string_new (NULL) ;
+ g_string_append_len (result->stryng,
+ a_string->str,
+ a_string->len);
+
}
return result ;
}
CRString *
-cr_string_dup (CRString *a_this)
+cr_string_dup (CRString const *a_this)
{
g_return_val_if_fail (a_this, NULL) ;
@@ -100,7 +100,7 @@ cr_string_dup (CRString *a_this)
}
gchar *
-cr_string_dup2 (CRString *a_this)
+cr_string_dup2 (CRString const *a_this)
{
gchar *result = NULL ;
@@ -121,7 +121,7 @@ cr_string_dup2 (CRString *a_this)
*@param a_this the current instance of #CRString
*/
const gchar *
-cr_string_peek_raw_str (CRString *a_this)
+cr_string_peek_raw_str (CRString const *a_this)
{
g_return_val_if_fail (a_this, NULL) ;
@@ -138,7 +138,7 @@ cr_string_peek_raw_str (CRString *a_this)
*of -1 if no length can be returned.
*/
gint
-cr_string_peek_raw_str_len (CRString *a_this)
+cr_string_peek_raw_str_len (CRString const *a_this)
{
g_return_val_if_fail (a_this && a_this->stryng,
-1) ;
diff --git a/src/libcroco/cr-string.h b/src/libcroco/cr-string.h
index 256453451..2700f0e2e 100644
--- a/src/libcroco/cr-string.h
+++ b/src/libcroco/cr-string.h
@@ -64,11 +64,11 @@ struct _CRString {
CRString * cr_string_new (void) ;
CRString *cr_string_new_from_string (const gchar * a_string) ;
-CRString * cr_string_new_from_gstring (GString *a_string) ;
-CRString *cr_string_dup (CRString *a_this) ;
-gchar *cr_string_dup2 (CRString *a_this) ;
-const gchar *cr_string_peek_raw_str (CRString *a_this) ;
-gint cr_string_peek_raw_str_len (CRString *a_this) ;
+CRString * cr_string_new_from_gstring (GString const *a_string) ;
+CRString *cr_string_dup (CRString const *a_this) ;
+gchar *cr_string_dup2 (CRString const *a_this) ;
+const gchar *cr_string_peek_raw_str (CRString const *a_this) ;
+gint cr_string_peek_raw_str_len (CRString const *a_this) ;
void cr_string_destroy (CRString *a_this) ;
G_END_DECLS
diff --git a/src/libcroco/cr-style.h b/src/libcroco/cr-style.h
index 9abdef6b2..18aeaad09 100644
--- a/src/libcroco/cr-style.h
+++ b/src/libcroco/cr-style.h
@@ -80,7 +80,7 @@ enum CRPositionType
POSITION_RELATIVE,
POSITION_ABSOLUTE,
POSITION_FIXED,
- POSITION_INHERIT,
+ POSITION_INHERIT
} ;
enum CRFloatType
diff --git a/src/libcroco/cr-stylesheet.c b/src/libcroco/cr-stylesheet.c
index 06b27fcab..1b26c64bf 100644
--- a/src/libcroco/cr-stylesheet.c
+++ b/src/libcroco/cr-stylesheet.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -55,11 +55,11 @@ cr_stylesheet_new (CRStatement * a_stmts)
*@return the serialized stylesheet.
*/
gchar *
-cr_stylesheet_to_string (CRStyleSheet *a_this)
+cr_stylesheet_to_string (CRStyleSheet const *a_this)
{
gchar *str = NULL;
GString *stringue = NULL;
- CRStatement *cur_stmt = NULL;
+ CRStatement const *cur_stmt = NULL;
g_return_val_if_fail (a_this, NULL);
@@ -93,7 +93,7 @@ cr_stylesheet_to_string (CRStyleSheet *a_this)
*@param a_fp the destination file
*/
void
-cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp)
+cr_stylesheet_dump (CRStyleSheet const * a_this, FILE * a_fp)
{
gchar *str = NULL ;
@@ -113,7 +113,7 @@ cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp)
*@return number of rules in the stylesheet.
*/
gint
-cr_stylesheet_nr_rules (CRStyleSheet * a_this)
+cr_stylesheet_nr_rules (CRStyleSheet const * a_this)
{
g_return_val_if_fail (a_this, -1);
diff --git a/src/libcroco/cr-stylesheet.h b/src/libcroco/cr-stylesheet.h
index 3766a284a..f35c94e37 100644
--- a/src/libcroco/cr-stylesheet.h
+++ b/src/libcroco/cr-stylesheet.h
@@ -84,10 +84,10 @@ struct _CRStyleSheet
CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ;
-gchar * cr_stylesheet_to_string (CRStyleSheet *a_this) ;
-void cr_stylesheet_dump (CRStyleSheet *a_this, FILE *a_fp) ;
+gchar * cr_stylesheet_to_string (CRStyleSheet const *a_this) ;
+void cr_stylesheet_dump (CRStyleSheet const *a_this, FILE *a_fp) ;
-gint cr_stylesheet_nr_rules (CRStyleSheet *a_this) ;
+gint cr_stylesheet_nr_rules (CRStyleSheet const *a_this) ;
CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ;
diff --git a/src/libcroco/cr-term.c b/src/libcroco/cr-term.c
index ccdff2522..09b6354db 100644
--- a/src/libcroco/cr-term.c
+++ b/src/libcroco/cr-term.c
@@ -275,10 +275,10 @@ cr_term_prepend_term (CRTerm * a_this, CRTerm * a_new_term)
*form of #CRTerm. MUST BE FREED BY THE CALLER using g_free().
*/
guchar *
-cr_term_to_string (CRTerm * a_this)
+cr_term_to_string (CRTerm const * a_this)
{
GString *str_buf = NULL;
- CRTerm *cur = NULL;
+ CRTerm const *cur = NULL;
guchar *result = NULL;
gchar *content = NULL;
@@ -472,7 +472,7 @@ cr_term_to_string (CRTerm * a_this)
}
guchar *
-cr_term_one_to_string (CRTerm * a_this)
+cr_term_one_to_string (CRTerm const * a_this)
{
GString *str_buf = NULL;
guchar *result = NULL;
@@ -675,7 +675,7 @@ cr_term_one_to_string (CRTerm * a_this)
*@param a_fp the destination file pointer.
*/
void
-cr_term_dump (CRTerm * a_this, FILE * a_fp)
+cr_term_dump (CRTerm const * a_this, FILE * a_fp)
{
guchar *content = NULL;
@@ -695,9 +695,9 @@ cr_term_dump (CRTerm * a_this, FILE * a_fp)
*@return number of terms in the expression.
*/
int
-cr_term_nr_values (CRTerm *a_this)
+cr_term_nr_values (CRTerm const *a_this)
{
- CRTerm *cur = NULL ;
+ CRTerm const *cur = NULL ;
int nr = 0;
g_return_val_if_fail (a_this, -1) ;
diff --git a/src/libcroco/cr-term.h b/src/libcroco/cr-term.h
index ae8b234c5..e85867afb 100644
--- a/src/libcroco/cr-term.h
+++ b/src/libcroco/cr-term.h
@@ -169,13 +169,13 @@ CRTerm * cr_term_append_term (CRTerm *a_this, CRTerm *a_new_term) ;
CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ;
-guchar * cr_term_to_string (CRTerm *a_this) ;
+guchar * cr_term_to_string (CRTerm const *a_this) ;
-guchar * cr_term_one_to_string (CRTerm * a_this) ;
+guchar * cr_term_one_to_string (CRTerm const * a_this) ;
-void cr_term_dump (CRTerm *a_this, FILE *a_fp) ;
+void cr_term_dump (CRTerm const *a_this, FILE *a_fp) ;
-int cr_term_nr_values (CRTerm *a_this) ;
+int cr_term_nr_values (CRTerm const *a_this) ;
CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ;
diff --git a/src/libcroco/cr-tknzr.c b/src/libcroco/cr-tknzr.c
index 859b6c553..1f762b5c5 100644
--- a/src/libcroco/cr-tknzr.c
+++ b/src/libcroco/cr-tknzr.c
@@ -448,38 +448,49 @@ cr_tknzr_parse_comment (CRTknzr * a_this,
READ_NEXT_CHAR (a_this, &cur_char);
ENSURE_PARSING_COND (cur_char == '*');
comment = cr_string_new ();
- for (;;) {
+ for (;;) { /* [^*]* */
+ PEEK_NEXT_CHAR (a_this, &next_char);
+ if (next_char == '*')
+ break;
READ_NEXT_CHAR (a_this, &cur_char);
-
- /*make sure there are no nested comments */
- if (cur_char == '/') {
+ g_string_append_unichar (comment->stryng, cur_char);
+ }
+ /* Stop condition: next_char == '*' */
+ for (;;) { /* \*+ */
+ READ_NEXT_CHAR(a_this, &cur_char);
+ ENSURE_PARSING_COND (cur_char == '*');
+ g_string_append_unichar (comment->stryng, cur_char);
+ PEEK_NEXT_CHAR (a_this, &next_char);
+ if (next_char != '*')
+ break;
+ }
+ /* Stop condition: next_char != '*' */
+ for (;;) { /* ([^/][^*]*\*+)* */
+ if (next_char == '/')
+ break;
+ READ_NEXT_CHAR(a_this, &cur_char);
+ g_string_append_unichar (comment->stryng, cur_char);
+ for (;;) { /* [^*]* */
+ PEEK_NEXT_CHAR (a_this, &next_char);
+ if (next_char == '*')
+ break;
READ_NEXT_CHAR (a_this, &cur_char);
- ENSURE_PARSING_COND (cur_char != '*');
- g_string_append_c (comment->stryng, '/');
- g_string_append_unichar (comment->stryng,
- cur_char);
- continue;
+ g_string_append_unichar (comment->stryng, cur_char);
}
-
- /*Detect the end of the comments region */
- if (cur_char == '*') {
+ /* Stop condition: next_char = '*', no need to verify, because peek and read exit to error anyway */
+ for (;;) { /* \*+ */
+ READ_NEXT_CHAR(a_this, &cur_char);
+ ENSURE_PARSING_COND (cur_char == '*');
+ g_string_append_unichar (comment->stryng, cur_char);
PEEK_NEXT_CHAR (a_this, &next_char);
-
- if (next_char == '/') {
- /*
- *end of comments region
- *Now, call the right SAC callback.
- */
- SKIP_CHARS (a_this, 1) ;
- status = CR_OK;
+ if (next_char != '*')
break;
- } else {
- g_string_append_c (comment->stryng,
- '*');
- }
}
- g_string_append_unichar (comment->stryng, cur_char);
+ /* Continue condition: next_char != '*' */
}
+ /* Stop condition: next_char == '\/' */
+ READ_NEXT_CHAR(a_this, &cur_char);
+ g_string_append_unichar (comment->stryng, cur_char);
if (status == CR_OK) {
cr_parsing_location_copy (&comment->location,
@@ -562,39 +573,16 @@ cr_tknzr_parse_unicode_escape (CRTknzr * a_this,
cur_char_val = 10 + (cur_char - 'A');
}
- unicode = unicode * 10 + cur_char_val;
+ unicode = unicode * 16 + cur_char_val;
PEEK_NEXT_CHAR (a_this, &cur_char);
}
- if (occur == 5) {
- /*
- *the unicode escape is 6 digit length
- */
-
- /*
- *parse one space that may
- *appear just after the unicode
- *escape.
- */
- cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
- &tmp_char_ptr2, NULL);
- status = CR_OK;
- } else {
- /*
- *The unicode escape is less than
- *6 digit length. The character
- *that comes right after the escape
- *must be a white space.
- */
- status = cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
- &tmp_char_ptr2, NULL);
- }
-
- if (status == CR_OK) {
- *a_unicode = unicode;
- return CR_OK;
- }
+ /* Eat a whitespace if possible. */
+ cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
+ &tmp_char_ptr2, NULL);
+ *a_unicode = unicode;
+ return CR_OK;
error:
/*
@@ -1478,6 +1466,12 @@ cr_tknzr_parse_important (CRTknzr * a_this,
*@param a_num out parameter. The parsed number.
*@return CR_OK upon successfull completion,
*an error code otherwise.
+ *
+ *The CSS specification says that numbers may be
+ *preceeded by '+' or '-' to indicate the sign.
+ *Technically, the "num" construction as defined
+ *by the tokenizer doesn't allow this, but we parse
+ *it here for simplicity.
*/
static enum CRStatus
cr_tknzr_parse_num (CRTknzr * a_this,
@@ -1493,13 +1487,22 @@ cr_tknzr_parse_num (CRTknzr * a_this,
gdouble numerator, denominator = 1;
CRInputPos init_pos;
CRParsingLocation location = {0,0,0} ;
+ int sign = 1;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& PRIVATE (a_this)->input,
CR_BAD_PARAM_ERROR);
RECORD_INITIAL_POS (a_this, &init_pos);
- READ_NEXT_CHAR (a_this, &cur_char);
+ READ_NEXT_CHAR (a_this, &cur_char);
+
+ if (cur_char == '+' || cur_char == '-') {
+ if (cur_char == '-') {
+ sign = -1;
+ }
+ READ_NEXT_CHAR (a_this, &cur_char);
+ }
+
if (IS_NUM (cur_char)) {
numerator = (cur_char - '0');
parsing_dec = FALSE;
@@ -1552,7 +1555,7 @@ cr_tknzr_parse_num (CRTknzr * a_this,
*Now, set the output param values.
*/
if (status == CR_OK) {
- gdouble val = numerator / denominator;
+ gdouble val = (numerator / denominator) * sign;
if (*a_num == NULL) {
*a_num = cr_num_new_with_val (val, val_type);
@@ -2106,18 +2109,8 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk)
}
goto done;
}
- } else {
- status = cr_tknzr_parse_ident (a_this, &str);
- if (status == CR_OK && str) {
- status = cr_token_set_ident (token, str);
- CHECK_PARSING_STATUS (status, TRUE);
- if (str) {
- cr_parsing_location_copy (&token->location,
- &str->location) ;
- }
- goto done;
- }
- }
+ }
+ goto fallback;
break;
case 'r':
@@ -2136,28 +2129,18 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk)
goto done;
}
- } else {
- status = cr_tknzr_parse_ident (a_this, &str);
- if (status == CR_OK) {
- status = cr_token_set_ident (token, str);
- CHECK_PARSING_STATUS (status, TRUE);
- if (str) {
- cr_parsing_location_copy (&token->location,
- &str->location) ;
- }
- str = NULL;
- goto done;
- }
}
+ goto fallback;
break;
case '<':
- if (BYTE (input, 2, NULL) == '-'
- && BYTE (input, 3, NULL) == '-') {
+ if (BYTE (input, 2, NULL) == '!'
+ && BYTE (input, 3, NULL) == '-'
+ && BYTE (input, 4, NULL) == '-') {
SKIP_CHARS (a_this, 1);
cr_tknzr_get_parsing_location (a_this,
&location) ;
- SKIP_CHARS (a_this, 2);
+ SKIP_CHARS (a_this, 3);
status = cr_token_set_cdo (token);
CHECK_PARSING_STATUS (status, TRUE);
cr_parsing_location_copy (&token->location,
@@ -2189,6 +2172,8 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk)
&str->location) ;
}
goto done;
+ } else {
+ goto parse_number;
}
}
break;
@@ -2382,6 +2367,9 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk)
case '8':
case '9':
case '.':
+ case '+':
+ /* '-' case is handled separately above for --> comments */
+ parse_number:
{
CRNum *num = NULL;
@@ -2538,6 +2526,7 @@ cr_tknzr_get_next_token (CRTknzr * a_this, CRToken ** a_tk)
break;
default:
+ fallback:
/*process the fallback cases here */
if (next_char == '\\'
diff --git a/src/libcroco/cr-token.c b/src/libcroco/cr-token.c
index af95751d0..3dd73ac3e 100644
--- a/src/libcroco/cr-token.c
+++ b/src/libcroco/cr-token.c
@@ -46,6 +46,7 @@ cr_token_clear (CRToken * a_this)
switch (a_this->type) {
case S_TK:
case CDO_TK:
+ case CDC_TK:
case INCLUDES_TK:
case DASHMATCH_TK:
case PAGE_SYM_TK:
diff --git a/src/libcroco/cr-utils.c b/src/libcroco/cr-utils.c
index 487cf4b95..a51c76920 100644
--- a/src/libcroco/cr-utils.c
+++ b/src/libcroco/cr-utils.c
@@ -1299,10 +1299,10 @@ cr_utils_dump_n_chars2 (guchar a_char, GString * a_string, glong a_nb)
*@param a_list_of_strings the list of strings to be duplicated.
*/
GList *
-cr_utils_dup_glist_of_string (GList * a_list_of_strings)
+cr_utils_dup_glist_of_string (GList const * a_list_of_strings)
{
- GList *cur = NULL,
- *result = NULL;
+ GList const *cur = NULL;
+ GList *result = NULL;
g_return_val_if_fail (a_list_of_strings, NULL);
@@ -1325,16 +1325,17 @@ cr_utils_dup_glist_of_string (GList * a_list_of_strings)
*happened.
*/
GList *
-cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings)
+cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings)
{
- GList *cur = NULL, *result = NULL;
+ GList const *cur = NULL;
+ GList *result = NULL;
g_return_val_if_fail (a_list_of_strings, NULL);
for (cur = a_list_of_strings; cur; cur = cur->next) {
CRString *str = NULL;
- str = cr_string_dup ((CRString *) cur->data) ;
+ str = cr_string_dup ((CRString const *) cur->data) ;
if (str)
result = g_list_append (result, str);
}
diff --git a/src/libcroco/cr-utils.h b/src/libcroco/cr-utils.h
index 060842aef..3959b1037 100644
--- a/src/libcroco/cr-utils.h
+++ b/src/libcroco/cr-utils.h
@@ -239,10 +239,10 @@ cr_utils_dump_n_chars2 (guchar a_char,
GString *a_string,
glong a_nb) ;
GList *
-cr_utils_dup_glist_of_string (GList *a_list) ;
+cr_utils_dup_glist_of_string (GList const *a_list) ;
GList *
-cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings) ;
+cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) ;
G_END_DECLS
diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp
index aa50f4be0..759acfb26 100644
--- a/src/libnrtype/font-lister.cpp
+++ b/src/libnrtype/font-lister.cpp
@@ -155,7 +155,7 @@ namespace Inkscape
/* See if font-family (or first in fallback list) is on system. If so, get styles. */
std::vector<Glib::ustring> tokens = Glib::Regex::split_simple(",", *i );
- if( !tokens[0].empty() ) {
+ if( !tokens.empty() && !tokens[0].empty() ) {
Gtk::TreeModel::iterator iter2 = font_list_store->get_iter( "0" );
while( iter2 != font_list_store->children().end() ) {
diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp
index 8d36dca4c..42df898e6 100644
--- a/src/livarot/PathConversion.cpp
+++ b/src/livarot/PathConversion.cpp
@@ -813,13 +813,14 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
double sang;
double eang;
Geom::Point dr_temp;
- ArcAnglesAndCenter(iS, iE, rx, ry, angle, large, wise, sang, eang, dr_temp);
+ ArcAnglesAndCenter(iS, iE, rx, ry, angle*M_PI/180.0, large, wise, sang, eang, dr_temp);
Geom::Point dr = dr_temp;
/* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider
the case of low curvature (i.e. very large radius). */
Geom::Scale const ar(rx, ry);
- Geom::Rotate cb( angle + sang );
+ Geom::Rotate cb(sang);
+ Geom::Rotate cbangle(angle*M_PI/180.0);
if (wise) {
double const incr = -0.1;
@@ -829,7 +830,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
Geom::Rotate const omega(incr);
for (double b = sang + incr ; b > eang ; b += incr) {
cb = omega * cb;
- AddPoint( cb.vector() * ar + dr );
+ AddPoint( cb.vector() * ar * cbangle + dr );
}
} else {
@@ -841,7 +842,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
Geom::Rotate const omega(incr);
for (double b = sang + incr ; b < eang ; b += incr) {
cb = omega * cb;
- AddPoint( cb.vector() * ar + dr);
+ AddPoint( cb.vector() * ar * cbangle + dr);
}
}
}
@@ -956,13 +957,14 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
double sang;
double eang;
Geom::Point dr_temp;
- ArcAnglesAndCenter(iS, iE, rx, ry, angle, large, wise, sang, eang, dr_temp);
+ ArcAnglesAndCenter(iS, iE, rx, ry, angle*M_PI/180.0, large, wise, sang, eang, dr_temp);
Geom::Point dr = dr_temp;
/* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider
the case of low curvature (i.e. very large radius). */
Geom::Scale const ar(rx, ry);
- Geom::Rotate cb(angle + sang);
+ Geom::Rotate cb(sang);
+ Geom::Rotate cbangle(angle*M_PI/180.0);
if (wise) {
double const incr = -0.1;
@@ -972,7 +974,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
Geom::Rotate const omega(incr);
for (double b = sang + incr; b > eang; b += incr) {
cb = omega * cb;
- AddPoint(cb.vector() * ar + dr, piece, (sang - b) / (sang - eang));
+ AddPoint(cb.vector() * ar * cbangle + dr, piece, (sang - b) / (sang - eang));
}
} else {
@@ -984,7 +986,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
Geom::Rotate const omega(incr);
for (double b = sang + incr ; b < eang ; b += incr) {
cb = omega * cb;
- AddPoint(cb.vector() * ar + dr, piece, (b - sang) / (eang - sang));
+ AddPoint(cb.vector() * ar * cbangle + dr, piece, (b - sang) / (eang - sang));
}
}
}
@@ -1074,13 +1076,14 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
double sang;
double eang;
Geom::Point dr_temp;
- ArcAnglesAndCenter(iS, iE, rx, ry, angle, large, wise, sang, eang, dr_temp);
+ ArcAnglesAndCenter(iS, iE, rx, ry, angle*M_PI/180.0, large, wise, sang, eang, dr_temp);
Geom::Point dr = dr_temp;
/* TODO: This isn't as good numerically as treating iS and iE as primary. E.g. consider
the case of low curvature (i.e. very large radius). */
Geom::Scale const ar(rx, ry);
- Geom::Rotate cb(angle + sang);
+ Geom::Rotate cb(sang);
+ Geom::Rotate cbangle(angle*M_PI/180.0);
if (wise) {
double const incr = -0.1;
@@ -1090,7 +1093,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
Geom::Rotate const omega(incr);
for (double b = sang + incr; b > eang ;b += incr) {
cb = omega * cb;
- AddPoint(cb.vector() * ar + dr, piece, (sang - b) / (sang - eang));
+ AddPoint(cb.vector() * ar * cbangle + dr, piece, (sang - b) / (sang - eang));
}
} else {
@@ -1101,7 +1104,7 @@ void Path::DoArc(Geom::Point const &iS, Geom::Point const &iE,
Geom::Rotate const omega(incr);
for (double b = sang + incr ; b < eang ; b += incr) {
cb = omega * cb;
- AddPoint(cb.vector() * ar + dr, piece, (b - sang) / (eang - sang));
+ AddPoint(cb.vector() * ar * cbangle + dr, piece, (b - sang) / (eang - sang));
}
}
}
diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp
index 3ce907bf3..201f64b54 100644
--- a/src/livarot/PathCutting.cpp
+++ b/src/livarot/PathCutting.cpp
@@ -303,7 +303,7 @@ Path::MakePathVector()
{
/* TODO: add testcase for this descr_arcto case */
PathDescrArcTo *nData = dynamic_cast<PathDescrArcTo *>(descr_cmd[i]);
- currentpath->appendNew<Geom::SVGEllipticalArc>( nData->rx, nData->ry, nData->angle, nData->large, !nData->clockwise, nData->p );
+ currentpath->appendNew<Geom::SVGEllipticalArc>( nData->rx, nData->ry, nData->angle*M_PI/180.0, nData->large, !nData->clockwise, nData->p );
lastP = nData->p;
}
break;
@@ -398,7 +398,7 @@ void Path::AddCurve(Geom::Curve const &c)
else if(Geom::SVGEllipticalArc const *svg_elliptical_arc = dynamic_cast<Geom::SVGEllipticalArc const *>(&c)) {
ArcTo( svg_elliptical_arc->finalPoint(),
svg_elliptical_arc->ray(Geom::X), svg_elliptical_arc->ray(Geom::Y),
- svg_elliptical_arc->rotationAngle(), /// \todo check that this parameter is in radians (rotation_angle returns the angle in radians!)
+ svg_elliptical_arc->rotationAngle()*180.0/M_PI, // convert from radians to degrees
svg_elliptical_arc->largeArc(), !svg_elliptical_arc->sweep() );
} else {
//this case handles sbasis as well as all other curve types
@@ -1217,7 +1217,7 @@ void Path::ConvertPositionsToForced(int nbPos, cut_position *poss)
}
{
double sang,eang;
- ArcAngles(startP,endP,rx,ry,angle,large,clockw,sang,eang);
+ ArcAngles(startP,endP,rx,ry,angle*M_PI/180.0,large,clockw,sang,eang);
if (clockw) {
if ( sang < eang ) sang += 2*M_PI;
diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp
index 2cd359328..fbfaa98aa 100644
--- a/src/livarot/PathOutline.cpp
+++ b/src/livarot/PathOutline.cpp
@@ -930,7 +930,7 @@ void Path::TangentOnArcAt(double at, const Geom::Point &iS, PathDescrArcTo const
Geom::Point const iE = fin.p;
double const rx = fin.rx;
double const ry = fin.ry;
- double const angle = fin.angle;
+ double const angle = fin.angle*M_PI/180.0;
bool const large = fin.large;
bool const wise = fin.clockwise;
@@ -1442,7 +1442,7 @@ Path::RecStdArcTo (outline_callback_data * data, double tol, double width,
{
Geom::Point tms(data->x1,data->y1),tme(data->x2,data->y2);
ArcAngles (tms,tme, data->d.a.rx,
- data->d.a.ry, data->d.a.angle, data->d.a.large, !data->d.a.clock,
+ data->d.a.ry, data->d.a.angle*M_PI/180.0, data->d.a.large, !data->d.a.clock,
sang, eang);
}
double scal = eang - sang;
diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp
index 6fd40790f..e5a98f0cf 100644
--- a/src/livarot/ShapeMisc.cpp
+++ b/src/livarot/ShapeMisc.cpp
@@ -327,7 +327,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced)
MakeSweepDestData (false);
}
void
-Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,int &nbNest,int *&nesting,int *&contStart,bool splitWhenForced)
+Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath*/,int &nbNest,int *&nesting,int *&contStart,bool splitWhenForced)
{
nesting=NULL;
contStart=NULL;
@@ -1056,7 +1056,7 @@ Shape::ReFormeArcTo (int bord, int /*curBord*/, Path * dest, Path * from)
PathDescrArcTo* nData = dynamic_cast<PathDescrArcTo *>(from->descr_cmd[nPiece]);
bool nLarge = nData->large;
bool nClockwise = nData->clockwise;
- Path::ArcAngles (from->PrevPoint (nPiece - 1), nData->p,nData->rx,nData->ry,nData->angle, nLarge, nClockwise, sang, eang);
+ Path::ArcAngles (from->PrevPoint (nPiece - 1), nData->p,nData->rx,nData->ry,nData->angle*M_PI/180.0, nLarge, nClockwise, sang, eang);
if (nClockwise)
{
if (sang < eang)
diff --git a/src/marker.cpp b/src/marker.cpp
index 50e7c970f..d145aadaf 100644
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -503,11 +503,11 @@ void SPMarker::hide(unsigned int key) {
SPGroup::hide(key);
}
-Geom::OptRect SPMarker::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPMarker::bbox(Geom::Affine const &/*transform*/, SPItem::BBoxType /*type*/) const {
return Geom::OptRect();
}
-void SPMarker::print(SPPrintContext* ctx) {
+void SPMarker::print(SPPrintContext* /*ctx*/) {
}
diff --git a/src/marker.h b/src/marker.h
index aae4e020f..831b298ac 100644
--- a/src/marker.h
+++ b/src/marker.h
@@ -77,7 +77,7 @@ public:
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide(unsigned int key);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
virtual void print(SPPrintContext *ctx);
};
diff --git a/src/mesh-context.cpp b/src/mesh-context.cpp
index ecd847fa4..142c3d2b1 100644
--- a/src/mesh-context.cpp
+++ b/src/mesh-context.cpp
@@ -104,7 +104,7 @@ const gchar *ms_handle_descr [] = {
N_("Mesh gradient <b>tensor</b>")
};
-void SPMeshContext::selection_changed(Inkscape::Selection* sel) {
+void SPMeshContext::selection_changed(Inkscape::Selection* /*sel*/) {
GrDrag *drag = this->_grdrag;
Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index c5169fff5..e68feb188 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -3232,19 +3232,21 @@ void sp_selection_untile(SPDesktop *desktop)
pat_transform *= item->transform;
for (SPObject *child = pattern->firstChild() ; child != NULL; child = child->next ) {
- Inkscape::XML::Node *copy = child->getRepr()->duplicate(xml_doc);
- SPItem *i = SP_ITEM(desktop->currentLayer()->appendChildRepr(copy));
+ if (SP_IS_ITEM(child)) {
+ Inkscape::XML::Node *copy = child->getRepr()->duplicate(xml_doc);
+ SPItem *i = SP_ITEM(desktop->currentLayer()->appendChildRepr(copy));
- // FIXME: relink clones to the new canvas objects
- // use SPObject::setid when mental finishes it to steal ids of
+ // FIXME: relink clones to the new canvas objects
+ // use SPObject::setid when mental finishes it to steal ids of
- // this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
- doc->ensureUpToDate();
+ // this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
+ doc->ensureUpToDate();
- Geom::Affine transform( i->transform * pat_transform );
- i->doWriteTransform(i->getRepr(), transform);
+ Geom::Affine transform( i->transform * pat_transform );
+ i->doWriteTransform(i->getRepr(), transform);
- new_select = g_slist_prepend(new_select, i);
+ new_select = g_slist_prepend(new_select, i);
+ }
}
SPCSSAttr *css = sp_repr_css_attr_new();
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp
index 5dddb0832..88450dfdf 100644
--- a/src/selection-describer.cpp
+++ b/src/selection-describer.cpp
@@ -62,7 +62,7 @@ static int count_filtered (GSList *items)
int count=0;
for (GSList *i = items; i != NULL; i = i->next) {
SPItem *item = SP_ITEM(i->data);
- count += item->ifilt();
+ count += item->isFiltered();
}
return count;
}
@@ -134,9 +134,12 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
// Parent name
SPObject *parent = item->parent;
gchar const *parent_label = parent->getId();
- char *quoted_parent_label = xml_quote_strdup(parent_label);
- gchar *parent_name = g_strdup_printf(_("<i>%s</i>"), quoted_parent_label);
- g_free(quoted_parent_label);
+ gchar *parent_name = NULL;
+ if (parent_label) {
+ char *quoted_parent_label = xml_quote_strdup(parent_label);
+ parent_name = g_strdup_printf(_("<i>%s</i>"), quoted_parent_label);
+ g_free(quoted_parent_label);
+ }
gchar *in_phrase;
guint num_layers = selection->numberOfLayers();
@@ -147,8 +150,10 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
in_phrase = g_strdup_printf(_(" in %s"), layer_name);
else if (!layer)
in_phrase = g_strdup_printf("%s", _(" hidden in definitions"));
- else
+ else if (parent_name)
in_phrase = g_strdup_printf(_(" in group %s (%s)"), parent_name, layer_name);
+ else
+ in_phrase = g_strdup_printf(_(" in unnamed group (%s)"), layer_name);
} else {
in_phrase = g_strdup_printf(ngettext(" in <b>%i</b> parent (%s)", " in <b>%i</b> parents (%s)", num_parents), num_parents, layer_name);
}
diff --git a/src/selection.cpp b/src/selection.cpp
index aea5f539c..7c696daf0 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -237,8 +237,11 @@ void Selection::_remove(SPObject *obj) {
}
void Selection::setList(GSList const *list) {
- _clear();
- addList(list);
+ // Clear and add, or just clear with emit.
+ if (list != NULL) {
+ _clear();
+ addList(list);
+ } else clear();
}
void Selection::addList(GSList const *list) {
@@ -444,12 +447,7 @@ boost::optional<Geom::Point> Selection::center() const {
return first->getCenter();
}
}
- Geom::OptRect bbox;
- if (Inkscape::Preferences::get()->getInt("/tools/bounding_box") == 0) {
- bbox = visualBounds();
- } else{
- bbox = geometricBounds();
- }
+ Geom::OptRect bbox = preferredBounds();
if (bbox) {
return bbox->midpoint();
} else {
diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp
index a6a41bef3..7b558bf08 100644
--- a/src/sp-anchor.cpp
+++ b/src/sp-anchor.cpp
@@ -115,11 +115,11 @@ Inkscape::XML::Node* SPAnchor::write(Inkscape::XML::Document *xml_doc, Inkscape:
return repr;
}
-const char* SPAnchor::displayName() {
+const char* SPAnchor::displayName() const {
return _("Link");
}
-gchar* SPAnchor::description() {
+gchar* SPAnchor::description() const {
if (this->href) {
char *quoted_href = xml_quote_strdup(this->href);
char *ret = g_strdup_printf(_("to %s"), quoted_href);
diff --git a/src/sp-anchor.h b/src/sp-anchor.h
index 39f6d0b7a..778640032 100644
--- a/src/sp-anchor.h
+++ b/src/sp-anchor.h
@@ -30,8 +30,8 @@ public:
virtual void set(unsigned int key, gchar const* value);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual gint event(SPEvent *event);
};
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 8a0a8f233..4cf96e432 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -362,7 +362,7 @@ Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, I
return repr;
}
-const char *SPGenericEllipse::displayName()
+const char *SPGenericEllipse::displayName() const
{
switch ( type ) {
@@ -560,9 +560,11 @@ Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform)
return ret;
}
-void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
+void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const
{
- this->normalize();
+ // CPPIFY: is this call necessary?
+ const_cast<SPGenericEllipse*>(this)->normalize();
+
Geom::Affine const i2dt = this->i2dt_affine();
// Snap to the 4 quadrant points of the ellipse, but only if the arc
diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h
index 94bddde98..cb988b8bb 100644
--- a/src/sp-ellipse.h
+++ b/src/sp-ellipse.h
@@ -57,12 +57,12 @@ public:
virtual void update(SPCtx *ctx, unsigned int flags);
virtual Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual const char *displayName();
+ virtual const char *displayName() const;
virtual void set_shape();
virtual Geom::Affine set_transform(Geom::Affine const &xform);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual void modified(unsigned int flags);
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 13ab7bc64..709e9e464 100644
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
@@ -188,7 +188,7 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc
return repr;
}
-const char* SPFlowregion::displayName() {
+const char* SPFlowregion::displayName() const {
// TRANSLATORS: "Flow region" is an area where text is allowed to flow
return _("Flow Region");
}
@@ -335,7 +335,7 @@ Inkscape::XML::Node *SPFlowregionExclude::write(Inkscape::XML::Document *xml_doc
return repr;
}
-const char* SPFlowregionExclude::displayName() {
+const char* SPFlowregionExclude::displayName() const {
/* TRANSLATORS: A region "cut out of" a flow region; text is not allowed to flow inside the
* flow excluded region. flowRegionExclude in SVG 1.2: see
* http://www.w3.org/TR/2004/WD-SVG12-20041027/flow.html#flowRegion-elem and
diff --git a/src/sp-flowregion.h b/src/sp-flowregion.h
index 111a32c6c..721eb0432 100644
--- a/src/sp-flowregion.h
+++ b/src/sp-flowregion.h
@@ -31,7 +31,7 @@ public:
virtual void update(SPCtx *ctx, unsigned int flags);
virtual void modified(guint flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual const char* displayName();
+ virtual const char* displayName() const;
};
class SPFlowregionExclude : public SPItem {
@@ -48,7 +48,7 @@ public:
virtual void update(SPCtx *ctx, unsigned int flags);
virtual void modified(guint flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual const char* displayName();
+ virtual const char* displayName() const;
};
#endif
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 49360f9d9..fee320e90 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -260,7 +260,7 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X
return repr;
}
-Geom::OptRect SPFlowtext::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPFlowtext::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
Geom::OptRect bbox = this->layout.bounds(transform);
// Add stroke width
@@ -284,7 +284,7 @@ void SPFlowtext::print(SPPrintContext *ctx) {
this->layout.print(ctx, pbox, dbox, bbox, ctm);
}
-const char* SPFlowtext::displayName() {
+const char* SPFlowtext::displayName() const {
if (SP_FLOWTEXT(this)->has_internal_frame()) {
return _("Flowed Text");
} else {
@@ -292,7 +292,7 @@ const char* SPFlowtext::displayName() {
}
}
-gchar* SPFlowtext::description() {
+gchar* SPFlowtext::description() const {
Inkscape::Text::Layout const &layout = SP_FLOWTEXT(this)->layout;
int const nChars = layout.iteratorToCharIndex(layout.end());
char const *trunc = (layout.inputTruncated()) ? _(" [truncated]") : "";
@@ -300,7 +300,7 @@ gchar* SPFlowtext::description() {
return g_strdup_printf(ngettext(_("(%d character%s)"), _("(%d characters%s)"), nChars), nChars, trunc);
}
-void SPFlowtext::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPFlowtext::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_TEXT_BASELINE)) {
// Choose a point on the baseline for snapping from or to, with the horizontal position
// of this point depending on the text alignment (left vs. right)
@@ -316,7 +316,7 @@ void SPFlowtext::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inksca
}
}
-Inkscape::DrawingItem* SPFlowtext::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
+Inkscape::DrawingItem* SPFlowtext::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) {
Inkscape::DrawingGroup *flowed = new Inkscape::DrawingGroup(drawing);
flowed->setPickChildren(false);
flowed->setStyle(this->style);
diff --git a/src/sp-flowtext.h b/src/sp-flowtext.h
index f56cba3cd..a5b7db22e 100644
--- a/src/sp-flowtext.h
+++ b/src/sp-flowtext.h
@@ -71,13 +71,13 @@ public:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
virtual void print(SPPrintContext *ctx);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide(unsigned int key);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
};
SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p1, Geom::Point p2);
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 86668d9ed..8f7a60ca6 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -555,7 +555,7 @@ Inkscape::XML::Node *SPImage::write(Inkscape::XML::Document *xml_doc, Inkscape::
return repr;
}
-Geom::OptRect SPImage::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPImage::bbox(Geom::Affine const &transform, SPItem::BBoxType /*type*/) const {
Geom::OptRect bbox;
if ((this->width.computed > 0.0) && (this->height.computed > 0.0)) {
@@ -612,11 +612,11 @@ void SPImage::print(SPPrintContext *ctx) {
}
}
-const char* SPImage::displayName() {
+const char* SPImage::displayName() const {
return _("Image");
}
-gchar* SPImage::description() {
+gchar* SPImage::description() const {
char *href_desc;
if (this->href) {
@@ -638,7 +638,7 @@ gchar* SPImage::description() {
return ret;
}
-Inkscape::DrawingItem* SPImage::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
+Inkscape::DrawingItem* SPImage::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) {
Inkscape::DrawingImage *ai = new Inkscape::DrawingImage(drawing);
sp_image_update_arenaitem(this, ai);
@@ -748,7 +748,7 @@ static void sp_image_update_canvas_image(SPImage *image)
}
}
-void SPImage::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPImage::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
/* An image doesn't have any nodes to snap, but still we want to be able snap one image
to another. Therefore we will create some snappoints at the corner, similar to a rect. If
the image is rotated, then the snappoints will rotate with it. Again, just like a rect.
diff --git a/src/sp-image.h b/src/sp-image.h
index b5834c988..3b7208487 100644
--- a/src/sp-image.h
+++ b/src/sp-image.h
@@ -62,12 +62,12 @@ public:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
virtual void modified(unsigned int flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
virtual void print(SPPrintContext *ctx);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual Geom::Affine set_transform(Geom::Affine const &transform);
};
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index ae974200f..2cfe97db8 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -291,11 +291,12 @@ Inkscape::XML::Node* SPGroup::write(Inkscape::XML::Document *xml_doc, Inkscape::
return repr;
}
-Geom::OptRect SPGroup::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype)
+Geom::OptRect SPGroup::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const
{
Geom::OptRect bbox;
- GSList *l = this->childList(false, SPObject::ActionBBox);
+ // CPPIFY: replace this const_cast later
+ GSList *l = const_cast<SPGroup*>(this)->childList(false, SPObject::ActionBBox);
while (l) {
SPObject *o = SP_OBJECT (l->data);
@@ -326,11 +327,11 @@ void SPGroup::print(SPPrintContext *ctx) {
}
}
-const char *SPGroup::displayName() {
+const char *SPGroup::displayName() const {
return _("Group");
}
-gchar *SPGroup::description() {
+gchar *SPGroup::description() const {
gint len = this->getItemCount();
return g_strdup_printf(
ngettext(_("of <b>%d</b> object"), _("of <b>%d</b> objects"), len), len);
@@ -385,7 +386,7 @@ void SPGroup::hide (unsigned int key) {
}
-void SPGroup::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPGroup::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
for ( SPObject const *o = this->firstChild(); o; o = o->getNext() )
{
if (SP_IS_ITEM(o)) {
@@ -720,9 +721,9 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p)
}
}
-gint SPGroup::getItemCount() {
+gint SPGroup::getItemCount() const {
gint len = 0;
- for (SPObject *o = this->firstChild() ; o ; o = o->getNext() ) {
+ for (SPObject const *o = this->firstChild() ; o ; o = o->getNext() ) {
if (SP_IS_ITEM(o)) {
len++;
}
diff --git a/src/sp-item-group.h b/src/sp-item-group.h
index 3954a5d21..deb80a641 100644
--- a/src/sp-item-group.h
+++ b/src/sp-item-group.h
@@ -54,7 +54,7 @@ public:
void translateChildItems(Geom::Translate const &tr);
void scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p);
- gint getItemCount();
+ gint getItemCount() const;
void _showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags);
private:
@@ -74,14 +74,14 @@ public:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const;
virtual void print(SPPrintContext *ctx);
- virtual const char* displayName();
- virtual gchar *description();
+ virtual const char* displayName() const;
+ virtual gchar *description() const;
virtual Inkscape::DrawingItem *show (Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide (unsigned int key);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual void update_patheffect(bool write);
};
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index e8338046b..c6daa853c 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -255,7 +255,7 @@ SPItem::unsetCenter() {
transform_center_y = 0;
}
-bool SPItem::isCenterSet() {
+bool SPItem::isCenterSet() const {
return (transform_center_x != 0 || transform_center_y != 0);
}
@@ -562,7 +562,7 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item)
}
}
-void SPItem::update(SPCtx *ctx, guint flags) {
+void SPItem::update(SPCtx* /*ctx*/, guint flags) {
SPItem *item = this;
SPItem* object = item;
@@ -688,7 +688,7 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X
}
// CPPIFY: make pure virtual
-Geom::OptRect SPItem::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPItem::bbox(Geom::Affine const & /*transform*/, SPItem::BBoxType /*type*/) const {
//throw;
return Geom::OptRect();
}
@@ -848,18 +848,17 @@ Geom::OptRect SPItem::desktopBounds(BBoxType type) const
}
}
-unsigned SPItem::pos_in_parent()
-{
+unsigned int SPItem::pos_in_parent() const {
g_assert(parent != NULL);
g_assert(SP_IS_OBJECT(parent));
- SPObject *object = this;
+ unsigned int pos = 0;
- unsigned pos=0;
for ( SPObject *iter = parent->firstChild() ; iter ; iter = iter->next) {
- if ( iter == object ) {
+ if (iter == this) {
return pos;
}
+
if (SP_IS_ITEM(iter)) {
pos++;
}
@@ -870,7 +869,7 @@ unsigned SPItem::pos_in_parent()
}
// CPPIFY: make pure virtual, see below!
-void SPItem::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPItem::snappoints(std::vector<Inkscape::SnapCandidatePoint> & /*p*/, Inkscape::SnapPreferences const */*snapprefs*/) const {
//throw;
}
/* This will only be called if the derived class doesn't override this.
@@ -920,7 +919,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap
}
// CPPIFY: make pure virtual
-void SPItem::print(SPPrintContext* ctx) {
+void SPItem::print(SPPrintContext* /*ctx*/) {
//throw;
}
@@ -937,11 +936,11 @@ void SPItem::invoke_print(SPPrintContext *ctx)
}
}
-const char* SPItem::displayName() {
+const char* SPItem::displayName() const {
return _("Object");
}
-gchar* SPItem::description() {
+gchar* SPItem::description() const {
return g_strdup("");
}
@@ -950,8 +949,7 @@ gchar* SPItem::description() {
*
* Must be freed by caller.
*/
-gchar *SPItem::detailedDescription()
-{
+gchar *SPItem::detailedDescription() const {
gchar* s = g_strdup_printf("<b>%s</b> %s",
this->displayName(), this->description());
@@ -985,17 +983,11 @@ gchar *SPItem::detailedDescription()
}
/**
- * Returns 1 if the item is filtered, 0 otherwise. Used with groups/lists to determine how many, or if any, are filtered
+ * Returns true if the item is filtered, false otherwise. Used with groups/lists to determine how many, or if any, are filtered
*
*/
-int SPItem::ifilt()
-{
- int retval=0;
- if ( style && style->filter.href && style->filter.href->getObject() ) {
- retval=1;
- }
-
- return retval;
+bool SPItem::isFiltered() const {
+ return (style && style->filter.href && style->filter.href->getObject());
}
/**
@@ -1014,7 +1006,7 @@ unsigned SPItem::display_key_new(unsigned numkeys)
}
// CPPIFY: make pure virtual
-Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
+Inkscape::DrawingItem* SPItem::show(Inkscape::Drawing& /*drawing*/, unsigned int /*key*/, unsigned int /*flags*/) {
//throw;
return 0;
}
@@ -1073,7 +1065,7 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned
}
// CPPIFY: make pure virtual
-void SPItem::hide(unsigned int key) {
+void SPItem::hide(unsigned int /*key*/) {
//throw;
}
@@ -1382,11 +1374,12 @@ void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &tra
if ( // run the object's set_transform (i.e. embed transform) only if:
!preserve && // user did not chose to preserve all transforms
- !clip_ref->getObject() && // the object does not have a clippath
- !mask_ref->getObject() && // the object does not have a mask
+ (!clip_ref || !clip_ref->getObject()) && // the object does not have a clippath
+ (!mask_ref || !mask_ref->getObject()) && // the object does not have a mask
!(!transform.isTranslation() && style && style->getFilter()) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
- ) {
- transform_attr = this->set_transform(transform);
+ )
+ {
+ transform_attr = this->set_transform(transform);
if (freeze_stroke_width) {
freeze_stroke_width_recursive(false);
@@ -1419,7 +1412,7 @@ void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &tra
}
// CPPIFY: see below, do not make pure?
-gint SPItem::event(SPEvent* event) {
+gint SPItem::event(SPEvent* /*event*/) {
return FALSE;
}
@@ -1443,8 +1436,8 @@ void SPItem::set_item_transform(Geom::Affine const &transform_matrix)
}
}
-//void SPItem::convert_to_guides() {
-// // CPPIFY: If not overridden, call SPItem::convert_to_guides(), see below!
+//void SPItem::convert_to_guides() const {
+// // CPPIFY: If not overridden, call SPItem::convert_to_guides() const, see below!
// this->convert_to_guides();
//}
@@ -1607,7 +1600,7 @@ SPItem *sp_item_first_item_child(SPObject *obj)
return child;
}
-void SPItem::convert_to_guides() {
+void SPItem::convert_to_guides() const {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getInt("/tools/bounding_box", 0);
diff --git a/src/sp-item.h b/src/sp-item.h
index ce5400e66..d605c99b9 100644
--- a/src/sp-item.h
+++ b/src/sp-item.h
@@ -157,7 +157,7 @@ public:
void setCenter(Geom::Point const &object_centre);
void unsetCenter();
- bool isCenterSet();
+ bool isCenterSet() const;
Geom::Point getCenter() const;
bool isVisibleAndUnlocked() const;
@@ -187,9 +187,12 @@ public:
Geom::OptRect desktopPreferredBounds() const;
Geom::OptRect desktopBounds(BBoxType type) const;
- unsigned pos_in_parent();
- gchar *detailedDescription();
- int ifilt();
+ unsigned int pos_in_parent() const;
+
+ gchar *detailedDescription() const;
+
+ bool isFiltered() const;
+
void invoke_print(SPPrintContext *ctx);
static unsigned int display_key_new(unsigned int numkeys);
Inkscape::DrawingItem *invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
@@ -204,7 +207,6 @@ public:
void adjust_livepatheffect(Geom::Affine const &postmul, bool set = false);
void doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &transform, Geom::Affine const *adv = NULL, bool compensate = true);
void set_item_transform(Geom::Affine const &transform_matrix);
- void convert_item_to_guides();
gint emitEvent (SPEvent &event);
Inkscape::DrawingItem *get_arenaitem(unsigned int key);
@@ -212,7 +214,6 @@ public:
Geom::Affine i2dt_affine() const;
void set_i2d_affine(Geom::Affine const &transform);
Geom::Affine dt2i_affine() const;
- //void convert_to_guides();
private:
enum EvaluatedStatus
@@ -234,15 +235,17 @@ public:
virtual void update(SPCtx *ctx, guint flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
virtual void print(SPPrintContext *ctx);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide(unsigned int key);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual Geom::Affine set_transform(Geom::Affine const &transform);
- virtual void convert_to_guides();
+
+ virtual void convert_to_guides() const;
+
virtual gint event(SPEvent *event);
};
diff --git a/src/sp-line.cpp b/src/sp-line.cpp
index 6b7df84f6..8af95b4ce 100644
--- a/src/sp-line.cpp
+++ b/src/sp-line.cpp
@@ -122,11 +122,11 @@ Inkscape::XML::Node* SPLine::write(Inkscape::XML::Document *xml_doc, Inkscape::X
return repr;
}
-const char* SPLine::displayName() {
+const char* SPLine::displayName() const {
return _("Line");
}
-void SPLine::convert_to_guides() {
+void SPLine::convert_to_guides() const {
Geom::Point points[2];
Geom::Affine const i2dt(this->i2dt_affine());
diff --git a/src/sp-line.h b/src/sp-line.h
index f76c3449b..c1932d3ee 100644
--- a/src/sp-line.h
+++ b/src/sp-line.h
@@ -34,9 +34,9 @@ public:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
virtual void set(unsigned int key, gchar const* value);
- virtual const char* displayName();
+ virtual const char* displayName() const;
virtual Geom::Affine set_transform(Geom::Affine const &transform);
- virtual void convert_to_guides();
+ virtual void convert_to_guides() const;
virtual void update(SPCtx* ctx, guint flags);
virtual void set_shape();
diff --git a/src/sp-linear-gradient.cpp b/src/sp-linear-gradient.cpp
index 4e7a08f4b..959e8d733 100644
--- a/src/sp-linear-gradient.cpp
+++ b/src/sp-linear-gradient.cpp
@@ -96,7 +96,7 @@ Inkscape::XML::Node* SPLinearGradient::write(Inkscape::XML::Document *xml_doc, I
return repr;
}
-cairo_pattern_t* SPLinearGradient::pattern_new(cairo_t *ct, Geom::OptRect const &bbox, double opacity) {
+cairo_pattern_t* SPLinearGradient::pattern_new(cairo_t * /*ct*/, Geom::OptRect const &bbox, double opacity) {
this->ensureVector();
cairo_pattern_t *cp = cairo_pattern_create_linear(
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 61ba2ae0d..666c79e49 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -258,7 +258,7 @@ bool SPLPEItem::performPathEffect(SPCurve *curve) {
}
// CPPIFY: make pure virtual
-void SPLPEItem::update_patheffect(bool write) {
+void SPLPEItem::update_patheffect(bool /*write*/) {
//throw;
}
diff --git a/src/sp-mesh-gradient.cpp b/src/sp-mesh-gradient.cpp
index 3fd277f52..eb5ed1bd0 100644
--- a/src/sp-mesh-gradient.cpp
+++ b/src/sp-mesh-gradient.cpp
@@ -93,7 +93,7 @@ sp_meshgradient_repr_write(SPMeshGradient *mg)
}
-cairo_pattern_t* SPMeshGradient::pattern_new(cairo_t *ct,
+cairo_pattern_t* SPMeshGradient::pattern_new(cairo_t * /*ct*/,
#if defined(MESH_DEBUG) || (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))
Geom::OptRect const &bbox,
double opacity
diff --git a/src/sp-mesh-row.cpp b/src/sp-mesh-row.cpp
index 04619d6cc..07747f7f5 100644
--- a/src/sp-mesh-row.cpp
+++ b/src/sp-mesh-row.cpp
@@ -81,7 +81,7 @@ void SPMeshRow::build(SPDocument* doc, Inkscape::XML::Node* repr) {
* Virtual build: set meshrow attributes from its associated XML node.
*/
-void SPMeshRow::set(unsigned int key, const gchar* value) {
+void SPMeshRow::set(unsigned int /*key*/, const gchar* /*value*/) {
}
/**
diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp
index a093107ac..bf4ce27a1 100644
--- a/src/sp-metadata.cpp
+++ b/src/sp-metadata.cpp
@@ -98,7 +98,7 @@ void SPMetadata::set(unsigned int key, const gchar* value) {
SPObject::set(key, value);
}
-void SPMetadata::update(SPCtx* ctx, unsigned int flags) {
+void SPMetadata::update(SPCtx* /*ctx*/, unsigned int flags) {
debug("0x%08x",(unsigned int)this);
//SPMetadata *metadata = SP_METADATA(object);
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index e5f119ee0..4a32c9470 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -151,11 +151,11 @@ void SPObject::read_content() {
//throw;
}
-void SPObject::update(SPCtx* ctx, unsigned int flags) {
+void SPObject::update(SPCtx* /*ctx*/, unsigned int /*flags*/) {
//throw;
}
-void SPObject::modified(unsigned int flags) {
+void SPObject::modified(unsigned int /*flags*/) {
//throw;
}
@@ -624,7 +624,7 @@ void SPObject::remove_child(Inkscape::XML::Node* child) {
}
}
-void SPObject::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node *new_ref) {
+void SPObject::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node * /*old_ref*/, Inkscape::XML::Node *new_ref) {
SPObject* object = this;
SPObject *ochild = object->get_child_by_repr(child);
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index f0b152d0e..c5a3557a7 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -339,7 +339,7 @@ void SPOffset::update(SPCtx *ctx, guint flags) {
SPShape::update(ctx, flags);
}
-const char* SPOffset::displayName() {
+const char* SPOffset::displayName() const {
if ( this->sourceHref ) {
return _("Linked Offset");
} else {
@@ -347,7 +347,7 @@ const char* SPOffset::displayName() {
}
}
-gchar* SPOffset::description() {
+gchar* SPOffset::description() const {
// TRANSLATORS COMMENT: %s is either "outset" or "inset" depending on sign
return g_strdup_printf(_("%s by %f pt"), (this->rad >= 0) ?
_("outset") : _("inset"), fabs (this->rad));
@@ -692,7 +692,7 @@ void SPOffset::set_shape() {
}
}
-void SPOffset::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPOffset::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
SPShape::snappoints(p, snapprefs);
}
diff --git a/src/sp-offset.h b/src/sp-offset.h
index b93a6846b..259a69b78 100644
--- a/src/sp-offset.h
+++ b/src/sp-offset.h
@@ -81,9 +81,9 @@ public:
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
virtual void release();
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual void set_shape();
};
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index b225f0735..563c5b326 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -66,11 +66,11 @@ gint SPPath::nodesInPath() const
return _curve ? _curve->nodes_in_path() : 0;
}
-const char* SPPath::displayName() {
+const char* SPPath::displayName() const {
return _("Path");
}
-gchar* SPPath::description() {
+gchar* SPPath::description() const {
int count = this->nodesInPath();
char *lpe_desc = g_strdup("");
@@ -100,7 +100,7 @@ gchar* SPPath::description() {
return ret;
}
-void SPPath::convert_to_guides() {
+void SPPath::convert_to_guides() const {
if (!this->_curve) {
return;
}
diff --git a/src/sp-path.h b/src/sp-path.h
index 77c64a2cc..5f8a91d98 100644
--- a/src/sp-path.h
+++ b/src/sp-path.h
@@ -54,10 +54,10 @@ public:
virtual void set(unsigned int key, gchar const* value);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual Geom::Affine set_transform(Geom::Affine const &transform);
- virtual void convert_to_guides();
+ virtual void convert_to_guides() const;
virtual void update_patheffect(bool write);
};
diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp
index a5ddd653a..10d097e70 100644
--- a/src/sp-polygon.cpp
+++ b/src/sp-polygon.cpp
@@ -178,7 +178,7 @@ void SPPolygon::set(unsigned int key, const gchar* value) {
}
}
-gchar* SPPolygon::description() {
+gchar* SPPolygon::description() const {
return g_strdup(_("<b>Polygon</b>"));
}
diff --git a/src/sp-polygon.h b/src/sp-polygon.h
index f9c93ac8f..41ab245bd 100644
--- a/src/sp-polygon.h
+++ b/src/sp-polygon.h
@@ -27,7 +27,7 @@ public:
virtual void build(SPDocument *document, Inkscape::XML::Node *repr);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
virtual void set(unsigned int key, gchar const* value);
- virtual gchar* description();
+ virtual gchar* description() const;
};
// made 'public' so that SPCurve can set it as friend:
diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp
index 1de5492cd..c80190097 100644
--- a/src/sp-polyline.cpp
+++ b/src/sp-polyline.cpp
@@ -127,7 +127,7 @@ Inkscape::XML::Node* SPPolyLine::write(Inkscape::XML::Document *xml_doc, Inkscap
return repr;
}
-gchar* SPPolyLine::description() {
+gchar* SPPolyLine::description() const {
return g_strdup(_("<b>Polyline</b>"));
}
diff --git a/src/sp-polyline.h b/src/sp-polyline.h
index f8b7e9b49..e24ea95c7 100644
--- a/src/sp-polyline.h
+++ b/src/sp-polyline.h
@@ -15,7 +15,7 @@ public:
virtual void set(unsigned int key, gchar const* value);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual gchar* description();
+ virtual gchar* description() const;
};
#endif // SEEN_SP_POLYLINE_H
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index b327f0b83..af3e2bfb4 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -159,7 +159,7 @@ Inkscape::XML::Node * SPRect::write(Inkscape::XML::Document *xml_doc, Inkscape::
return repr;
}
-const char* SPRect::displayName() {
+const char* SPRect::displayName() const {
return _("Rectangle");
}
@@ -484,7 +484,7 @@ gdouble SPRect::getVisibleHeight() const {
this->transform);
}
-void SPRect::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPRect::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
/* This method overrides sp_shape_snappoints, which is the default for any shape. The default method
returns all eight points along the path of a rounded rectangle, but not the real corners. Snapping
the startpoint and endpoint of each rounded corner is not very useful and really confusing. Instead
@@ -518,7 +518,7 @@ void SPRect::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
}
}
-void SPRect::convert_to_guides() {
+void SPRect::convert_to_guides() const {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) {
diff --git a/src/sp-rect.h b/src/sp-rect.h
index 3219a3ace..aa3f88e42 100644
--- a/src/sp-rect.h
+++ b/src/sp-rect.h
@@ -55,13 +55,13 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual const char* displayName();
+ virtual const char* displayName() const;
virtual void set_shape();
virtual Geom::Affine set_transform(Geom::Affine const& xform);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
- virtual void convert_to_guides();
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
+ virtual void convert_to_guides() const;
SVGLength x;
SVGLength y;
diff --git a/src/sp-script.cpp b/src/sp-script.cpp
index 158796e51..260b3dcfd 100644
--- a/src/sp-script.cpp
+++ b/src/sp-script.cpp
@@ -57,11 +57,11 @@ void SPScript::release() {
SPObject::release();
}
-void SPScript::update(SPCtx* ctx, unsigned int flags) {
+void SPScript::update(SPCtx* /*ctx*/, unsigned int /*flags*/) {
}
-void SPScript::modified(unsigned int flags) {
+void SPScript::modified(unsigned int /*flags*/) {
}
@@ -81,7 +81,7 @@ void SPScript::set(unsigned int key, const gchar* value) {
}
}
-Inkscape::XML::Node* SPScript::write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) {
+Inkscape::XML::Node* SPScript::write(Inkscape::XML::Document* /*doc*/, Inkscape::XML::Node* repr, guint /*flags*/) {
return repr;
}
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 913e208aa..b3a331cba 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -389,7 +389,7 @@ void SPShape::modified(unsigned int flags) {
}
}
-Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) {
+Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const {
Geom::OptRect bbox;
if (!this->_curve) {
@@ -712,7 +712,7 @@ void SPShape::print(SPPrintContext* ctx) {
}
}
-Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
+Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) {
Inkscape::DrawingShape *s = new Inkscape::DrawingShape(drawing);
s->setStyle(this->style);
s->setPath(this->_curve);
@@ -796,8 +796,7 @@ int SPShape::hasMarkers() const
* \param type Marker type (e.g. SP_MARKER_LOC_START)
* \return Number of markers that the shape has of this type.
*/
-int SPShape::numberOfMarkers(int type)
-{
+int SPShape::numberOfMarkers(int type) const {
Geom::PathVector const & pathv = this->_curve->get_pathvector();
if (pathv.size() == 0) {
@@ -1025,7 +1024,7 @@ void SPShape::setCurveInsync(SPCurve *new_curve, unsigned int owner)
}
}
-void SPShape::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPShape::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
if (this->_curve == NULL) {
return;
}
diff --git a/src/sp-shape.h b/src/sp-shape.h
index bc51f3d45..f260c1ee6 100644
--- a/src/sp-shape.h
+++ b/src/sp-shape.h
@@ -44,7 +44,7 @@ public:
void setCurveInsync (SPCurve *curve, unsigned int owner);
void setCurveBeforeLPE (SPCurve *curve);
int hasMarkers () const;
- int numberOfMarkers (int type);
+ int numberOfMarkers (int type) const;
public: // temporarily public, until SPPath is properly classed, etc.
SPCurve *_curve_before_lpe;
@@ -63,13 +63,13 @@ public:
virtual void set(unsigned int key, gchar const* value);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const;
virtual void print(SPPrintContext* ctx);
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide(unsigned int key);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual void set_shape();
};
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index 56aca507f..ffb875f2a 100644
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
@@ -226,11 +226,11 @@ void SPSpiral::update_patheffect(bool write) {
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
-const char* SPSpiral::displayName() {
+const char* SPSpiral::displayName() const {
return _("Spiral");
}
-gchar* SPSpiral::description() {
+gchar* SPSpiral::description() const {
// TRANSLATORS: since turn count isn't an integer, please adjust the
// string as needed to deal with an localized plural forms.
return g_strdup_printf (_("with %3f turns"), this->revo);
@@ -413,7 +413,7 @@ void SPSpiral::setPosition(gdouble cx, gdouble cy, gdouble exp, gdouble revo, gd
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
-void SPSpiral::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPSpiral::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
// We will determine the spiral's midpoint ourselves, instead of trusting on the base class
// Therefore snapping to object midpoints is temporarily disabled
Inkscape::SnapPreferences local_snapprefs = *snapprefs;
diff --git a/src/sp-spiral.h b/src/sp-spiral.h
index 4e067981b..64b95d951 100644
--- a/src/sp-spiral.h
+++ b/src/sp-spiral.h
@@ -66,9 +66,9 @@ public:
virtual void update(SPCtx *ctx, guint flags);
virtual void set(unsigned int key, gchar const* value);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual void set_shape();
virtual void update_patheffect(bool write);
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index e634eccac..da10eeaa3 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -251,13 +251,13 @@ void SPStar::update_patheffect(bool write) {
this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
-const char* SPStar::displayName() {
+const char* SPStar::displayName() const {
if (this->flatsided == false)
return _("Star");
return _("Polygon");
}
-gchar* SPStar::description() {
+gchar* SPStar::description() const {
// while there will never be less than 3 vertices, we still need to
// make calls to ngettext because the pluralization may be different
// for various numbers >=3. The singular form is used as the index.
@@ -498,7 +498,7 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1,
star->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
-void SPStar::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPStar::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
// We will determine the star's midpoint ourselves, instead of trusting on the base class
// Therefore snapping to object midpoints is temporarily disabled
Inkscape::SnapPreferences local_snapprefs = *snapprefs;
diff --git a/src/sp-star.h b/src/sp-star.h
index 799880c42..0070ce685 100644
--- a/src/sp-star.h
+++ b/src/sp-star.h
@@ -50,9 +50,9 @@ public:
virtual void set(unsigned int key, gchar const* value);
virtual void update(SPCtx* ctx, guint flags);
- virtual const char* displayName();
- virtual gchar* description();
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual void update_patheffect(bool write);
virtual void set_shape();
diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp
index fa97cde91..5c88d7af8 100644
--- a/src/sp-switch.cpp
+++ b/src/sp-switch.cpp
@@ -71,17 +71,17 @@ GSList *SPSwitch::_childList(bool add_ref, SPObject::Action action) {
return g_slist_prepend (NULL, child);
}
-const char *SPSwitch::displayName() {
+const char *SPSwitch::displayName() const {
return _("Conditional Group");
}
-gchar *SPSwitch::description() {
+gchar *SPSwitch::description() const {
gint len = this->getItemCount();
return g_strdup_printf(
ngettext(_("of <b>%d</b> object"), _("of <b>%d</b> objects"), len), len);
}
-void SPSwitch::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) {
+void SPSwitch::child_added(Inkscape::XML::Node* /*child*/, Inkscape::XML::Node* /*ref*/) {
this->_reevaluate(true);
}
diff --git a/src/sp-switch.h b/src/sp-switch.h
index e6dc6f01f..3ccc9e3b7 100644
--- a/src/sp-switch.h
+++ b/src/sp-switch.h
@@ -41,8 +41,8 @@ public:
virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref);
virtual void remove_child(Inkscape::XML::Node *child);
virtual void order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
- virtual const char* displayName();
- virtual gchar *description();
+ virtual const char* displayName() const;
+ virtual gchar *description() const;
};
#endif
diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp
index b2346ac91..8ffc2ab2c 100644
--- a/src/sp-symbol.cpp
+++ b/src/sp-symbol.cpp
@@ -363,7 +363,7 @@ void SPSymbol::hide(unsigned int key) {
}
-Geom::OptRect SPSymbol::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPSymbol::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
Geom::OptRect bbox;
// We don't need a bounding box for Symbols dialog when selecting
diff --git a/src/sp-symbol.h b/src/sp-symbol.h
index 952ba00df..7a43ed658 100644
--- a/src/sp-symbol.h
+++ b/src/sp-symbol.h
@@ -54,7 +54,7 @@ public:
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void print(SPPrintContext *ctx);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
virtual void hide (unsigned int key);
};
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index de5e63fe6..d2f433eba 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -293,7 +293,7 @@ Inkscape::XML::Node *SPText::write(Inkscape::XML::Document *xml_doc, Inkscape::X
return repr;
}
-Geom::OptRect SPText::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPText::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
Geom::OptRect bbox = SP_TEXT(this)->layout.bounds(transform);
// FIXME this code is incorrect
@@ -305,7 +305,7 @@ Geom::OptRect SPText::bbox(Geom::Affine const &transform, SPItem::BBoxType type)
return bbox;
}
-Inkscape::DrawingItem* SPText::show(Inkscape::Drawing &drawing, unsigned key, unsigned flags) {
+Inkscape::DrawingItem* SPText::show(Inkscape::Drawing &drawing, unsigned /*key*/, unsigned /*flags*/) {
Inkscape::DrawingGroup *flowed = new Inkscape::DrawingGroup(drawing);
flowed->setPickChildren(false);
flowed->setStyle(this->style);
@@ -326,11 +326,11 @@ void SPText::hide(unsigned int key) {
}
}
-const char* SPText::displayName() {
+const char* SPText::displayName() const {
return _("Text");
}
-gchar* SPText::description() {
+gchar* SPText::description() const {
SPStyle *style = this->style;
font_instance *tf = font_factory::Default()->FaceFromStyle(style);
@@ -364,7 +364,7 @@ gchar* SPText::description() {
return ret;
}
-void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
+void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_TEXT_BASELINE)) {
// Choose a point on the baseline for snapping from or to, with the horizontal position
// of this point depending on the text alignment (left vs. right)
diff --git a/src/sp-text.h b/src/sp-text.h
index a7149159a..f7cf5a3aa 100644
--- a/src/sp-text.h
+++ b/src/sp-text.h
@@ -82,13 +82,13 @@ public:
virtual void modified(unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
virtual void print(SPPrintContext *ctx);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide(unsigned int key);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
virtual Geom::Affine set_transform(Geom::Affine const &transform);
};
diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp
index 1c0481547..edbb9faa7 100644
--- a/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
@@ -206,7 +206,7 @@ Inkscape::XML::Node* SPTRef::write(Inkscape::XML::Document *xml_doc, Inkscape::X
return repr;
}
-Geom::OptRect SPTRef::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPTRef::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
Geom::OptRect bbox;
// find out the ancestor text which holds our layout
SPObject const *parent_text = this;
@@ -233,14 +233,14 @@ Geom::OptRect SPTRef::bbox(Geom::Affine const &transform, SPItem::BBoxType type)
return bbox;
}
-const char* SPTRef::displayName() {
+const char* SPTRef::displayName() const {
return _("Cloned Character Data");
}
-gchar* SPTRef::description() {
- SPObject *referred = this->getObjectReferredTo();
+gchar* SPTRef::description() const {
+ SPObject const *referred = this->getObjectReferredTo();
- if (this->getObjectReferredTo()) {
+ if (referred) {
char *child_desc;
if (SP_IS_ITEM(referred)) {
@@ -313,6 +313,19 @@ SPObject * SPTRef::getObjectReferredTo(void)
return referredObject;
}
+/**
+ * Return the object referred to via the URI reference
+ */
+SPObject const *SPTRef::getObjectReferredTo() const {
+ SPObject *referredObject = NULL;
+
+ if (uriOriginalRef) {
+ referredObject = uriOriginalRef->getObject();
+ }
+
+ return referredObject;
+}
+
/**
* Returns true when the given tref is allowed to refer to a particular object
diff --git a/src/sp-tref.h b/src/sp-tref.h
index 6d43d679d..f5aed9ba6 100644
--- a/src/sp-tref.h
+++ b/src/sp-tref.h
@@ -49,6 +49,7 @@ public:
sigc::connection _changed_connection;
SPObject * getObjectReferredTo();
+ SPObject const *getObjectReferredTo() const;
virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
virtual void release();
@@ -57,9 +58,9 @@ public:
virtual void modified(unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
};
void sp_tref_update_text(SPTRef *tref);
diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp
index 20d404130..8c4105777 100644
--- a/src/sp-tspan.cpp
+++ b/src/sp-tspan.cpp
@@ -138,7 +138,7 @@ void SPTSpan::modified(unsigned int flags) {
}
}
-Geom::OptRect SPTSpan::bbox(Geom::Affine const &transform, SPItem::BBoxType type) {
+Geom::OptRect SPTSpan::bbox(Geom::Affine const &transform, SPItem::BBoxType type) const {
Geom::OptRect bbox;
// find out the ancestor text which holds our layout
SPObject const *parent_text = this;
@@ -216,7 +216,7 @@ Inkscape::XML::Node* SPTSpan::write(Inkscape::XML::Document *xml_doc, Inkscape::
return repr;
}
-const char* SPTSpan::displayName() {
+const char* SPTSpan::displayName() const {
return _("Text Span");
}
diff --git a/src/sp-tspan.h b/src/sp-tspan.h
index a7ae563bb..4c23b2eba 100644
--- a/src/sp-tspan.h
+++ b/src/sp-tspan.h
@@ -33,8 +33,8 @@ public:
virtual void modified(unsigned int flags);
virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type);
- virtual const char* displayName();
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const;
+ virtual const char* displayName() const;
};
#endif /* !INKSCAPE_SP_TSPAN_H */
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index ec367d786..b2a51b8d9 100644
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -178,7 +178,7 @@ Inkscape::XML::Node* SPUse::write(Inkscape::XML::Document *xml_doc, Inkscape::XM
return repr;
}
-Geom::OptRect SPUse::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) {
+Geom::OptRect SPUse::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const {
Geom::OptRect bbox;
if (this->child) {
@@ -208,7 +208,7 @@ void SPUse::print(SPPrintContext* ctx) {
}
}
-const char* SPUse::displayName() {
+const char* SPUse::displayName() const {
if (this->child && SP_IS_SYMBOL( this->child )) {
return _("Symbol");
}
@@ -216,7 +216,7 @@ const char* SPUse::displayName() {
return _("Clone");
}
-gchar* SPUse::description() {
+gchar* SPUse::description() const {
if (this->child) {
if( SP_IS_SYMBOL( this->child ) ) {
return g_strdup_printf(_("called %s"), this->child->title());
@@ -295,6 +295,10 @@ SPItem *SPUse::root() {
return orig;
}
+SPItem const *SPUse::root() const {
+ return const_cast<SPUse*>(this)->root();
+}
+
/**
* Returns the effective transform that goes from the ultimate original to given SPUse, both ends
* included.
@@ -652,8 +656,8 @@ SPItem *SPUse::get_original() {
return ref;
}
-void SPUse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) {
- SPItem *root = this->root();
+void SPUse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const {
+ SPItem const *root = this->root();
if (!root) {
return;
diff --git a/src/sp-use.h b/src/sp-use.h
index 6a83c384f..31a52c1a1 100644
--- a/src/sp-use.h
+++ b/src/sp-use.h
@@ -56,15 +56,16 @@ public:
virtual void update(SPCtx* ctx, unsigned int flags);
virtual void modified(unsigned int flags);
- virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype);
- virtual const char* displayName();
- virtual gchar* description();
+ virtual Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const;
+ virtual const char* displayName() const;
+ virtual gchar* description() const;
virtual void print(SPPrintContext *ctx);
virtual Inkscape::DrawingItem* show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
virtual void hide(unsigned int key);
- virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
+ virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const;
SPItem *root();
+ SPItem const *root() const;
SPItem *unlink();
SPItem *get_original();
diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp
index 6f1a88a58..b9e8e6340 100644
--- a/src/svg/svg-length.cpp
+++ b/src/svg/svg-length.cpp
@@ -65,6 +65,7 @@ unsigned int sp_svg_number_read_d(gchar const *str, double *val)
}
// TODO must add a buffer length parameter for safety:
+// rewrite using std::string?
static unsigned int sp_svg_number_write_ui(gchar *buf, unsigned int val)
{
unsigned int i = 0;
@@ -81,6 +82,7 @@ static unsigned int sp_svg_number_write_ui(gchar *buf, unsigned int val)
}
// TODO unsafe code ingnoring bufLen
+// rewrite using std::string?
static unsigned int sp_svg_number_write_i(gchar *buf, int bufLen, int val)
{
int p = 0;
@@ -98,6 +100,7 @@ static unsigned int sp_svg_number_write_i(gchar *buf, int bufLen, int val)
}
// TODO unsafe code ingnoring bufLen
+// rewrite using std::string?
static unsigned sp_svg_number_write_d(gchar *buf, int bufLen, double val, unsigned int tprec, unsigned int fprec)
{
/* Process sign */
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index cf1c4811f..cae123616 100644
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -1558,7 +1558,7 @@ static SPObject* ascend_while_first(SPObject *item, Glib::ustring::iterator text
/** empty spans: abc<span></span>def
-> abcdef */
-static bool tidy_operator_empty_spans(SPObject **item, bool has_text_decoration)
+static bool tidy_operator_empty_spans(SPObject **item, bool /*has_text_decoration*/)
{
bool result = false;
if ( !(*item)->hasChildren()
@@ -1576,7 +1576,7 @@ static bool tidy_operator_empty_spans(SPObject **item, bool has_text_decoration)
/** inexplicable spans: abc<span style="">def</span>ghi
-> "abc""def""ghi"
the repeated strings will be merged by another operator. */
-static bool tidy_operator_inexplicable_spans(SPObject **item, bool has_text_decoration)
+static bool tidy_operator_inexplicable_spans(SPObject **item, bool /*has_text_decoration*/)
{
//XML Tree being directly used here while it shouldn't be.
if (*item && sp_repr_is_meta_element((*item)->getRepr())) {
@@ -1611,7 +1611,7 @@ static bool tidy_operator_inexplicable_spans(SPObject **item, bool has_text_deco
/** repeated spans: <font a>abc</font><font a>def</font>
-> <font a>abcdef</font> */
-static bool tidy_operator_repeated_spans(SPObject **item, bool has_text_decoration)
+static bool tidy_operator_repeated_spans(SPObject **item, bool /*has_text_decoration*/)
{
SPObject *first = *item;
SPObject *second = first->getNext();
@@ -1657,7 +1657,7 @@ static bool tidy_operator_repeated_spans(SPObject **item, bool has_text_decorati
-> <font b>abc</font>
excessive nesting: <font a><size 1>abc</size></font>
-> <font a,size 1>abc</font> */
-static bool tidy_operator_excessive_nesting(SPObject **item, bool has_text_decoration)
+static bool tidy_operator_excessive_nesting(SPObject **item, bool /*has_text_decoration*/)
{
if (!(*item)->hasChildren()) {
return false;
@@ -1735,7 +1735,7 @@ example. You may note that this only does its work when the doubly-nested
child is the first or last. The other cases are called 'style inversion'
below, and I'm not yet convinced that the result of that operation will be
tidier in all cases. */
-static bool tidy_operator_redundant_double_nesting(SPObject **item, bool has_text_decoration)
+static bool tidy_operator_redundant_double_nesting(SPObject **item, bool /*has_text_decoration*/)
{
if (!(*item)->hasChildren()) return false;
if ((*item)->firstChild() == (*item)->lastChild()) return false; // this is excessive nesting, done above
@@ -1796,7 +1796,7 @@ static bool redundant_semi_nesting_processor(SPObject **item, SPObject *child, b
-> <font b>abc</font><font>def</font>
test this by applying a colour to a region, then a different colour to
a partially-overlapping region. */
-static bool tidy_operator_redundant_semi_nesting(SPObject **item, bool has_text_decoration)
+static bool tidy_operator_redundant_semi_nesting(SPObject **item, bool /*has_text_decoration*/)
{
if (!(*item)->hasChildren()) return false;
if ((*item)->firstChild() == (*item)->lastChild()) return false; // this is redundant nesting, done above
diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp
index 8c9130412..92992d440 100644
--- a/src/trace/siox.cpp
+++ b/src/trace/siox.cpp
@@ -888,7 +888,7 @@ SioxImage Siox::extractForeground(const SioxImage &originalImage,
return workImage;
}
- trace("knownBg:%zu knownFg:%zu", knownBg.size(), knownFg.size());
+ trace("knownBg:%u knownFg:%u", knownBg.size(), knownFg.size());
std::vector<CieLab> bgSignature ;
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 79fb953ac..32f23d55f 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1677,11 +1677,31 @@ void DocumentProperties::onDocUnitChange()
}
// Scale and translate objects
- gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
- ShapeEditor::blockSetItem(true);
- doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px")));
- ShapeEditor::blockSetItem(false);
-
+ // set transform options to scale all things with the transform, so all things scale properly after the viewbox change.
+ /// \todo this "low-level" code of changing viewbox/unit should be moved somewhere else
+
+ // save prefs
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ bool transform_stroke = prefs->getBool("/options/transform/stroke", true);
+ bool transform_rectcorners = prefs->getBool("/options/transform/rectcorners", true);
+ bool transform_pattern = prefs->getBool("/options/transform/pattern", true);
+ bool transform_gradient = prefs->getBool("/options/transform/gradient", true);
+
+ prefs->setBool("/options/transform/stroke", true);
+ prefs->setBool("/options/transform/rectcorners", true);
+ prefs->setBool("/options/transform/pattern", true);
+ prefs->setBool("/options/transform/gradient", true);
+ {
+ ShapeEditor::blockSetItem(true);
+ gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px")));
+ ShapeEditor::blockSetItem(false);
+ }
+ prefs->setBool("/options/transform/stroke", transform_stroke);
+ prefs->setBool("/options/transform/rectcorners", transform_rectcorners);
+ prefs->setBool("/options/transform/pattern", transform_pattern);
+ prefs->setBool("/options/transform/gradient", transform_gradient);
+
doc->setModifiedSinceSave();
DocumentUndo::done(doc, SP_VERB_NONE, _("Changed document unit"));
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index f1f7cf6c1..8ea1a09fa 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -164,6 +164,7 @@ Export::Export (void) :
size_box(false, 3),
file_box(false, 3),
unitbox(false, 0),
+ unit_selector(),
units_label(_("Units:")),
filename_box(false, 5),
browse_label(_("_Export As..."), 1),
@@ -199,14 +200,14 @@ Export::Export (void) :
/* Units box */
/* gets added to the vbox later, but the unit selector is needed
earlier than that */
- unit_selector = new Inkscape::UI::Widget::UnitMenu();
- unit_selector->setUnitType(Inkscape::Util::UNIT_TYPE_LINEAR);
+ unit_selector.setUnitType(Inkscape::Util::UNIT_TYPE_LINEAR);
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop)
- unit_selector->setUnit(sp_desktop_namedview(desktop)->doc_units->abbr);
- unitChangedConn = unit_selector->signal_changed().connect(sigc::mem_fun(*this, &Export::onUnitChanged));
- unitbox.pack_end(*unit_selector, false, false, 0);
+ if (desktop) {
+ unit_selector.setUnit(sp_desktop_namedview(desktop)->doc_units->abbr);
+ }
+ unitChangedConn = unit_selector.signal_changed().connect(sigc::mem_fun(*this, &Export::onUnitChanged));
+ unitbox.pack_end(unit_selector, false, false, 0);
unitbox.pack_end(units_label, false, false, 3);
for (int i = 0; i < SELECTION_NUMBER_OF; i++) {
@@ -230,28 +231,28 @@ Export::Export (void) :
t->set_col_spacings (4);
#endif
- x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, ((Gtk::Widget*) unit_selector)->gobj(),
+ x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaX0Change);
- x1_adj = createSpinbutton ( "x1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, ((Gtk::Widget*) unit_selector)->gobj(),
+ x1_adj = createSpinbutton ( "x1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
t, 0, 1, _("x_1:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaX1Change);
width_adj = createSpinbutton ( "width", 0.0, 0.0, PNG_UINT_31_MAX, 0.1, 1.0,
- ((Gtk::Widget*) unit_selector)->gobj(), t, 0, 2, _("Wid_th:"), "", EXPORT_COORD_PRECISION, 1,
+ t, 0, 2, _("Wid_th:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaWidthChange);
- y0_adj = createSpinbutton ( "y0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, ((Gtk::Widget*) unit_selector)->gobj(),
+ y0_adj = createSpinbutton ( "y0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
t, 2, 0, _("_y0:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaY0Change);
- y1_adj = createSpinbutton ( "y1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, ((Gtk::Widget*) unit_selector)->gobj(),
+ y1_adj = createSpinbutton ( "y1", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
t, 2, 1, _("y_1:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaY1Change);
height_adj = createSpinbutton ( "height", 0.0, 0.0, PNG_UINT_31_MAX, 0.1, 1.0,
- ((Gtk::Widget*) unit_selector)->gobj(), t, 2, 2, _("Hei_ght:"), "", EXPORT_COORD_PRECISION, 1,
+ t, 2, 2, _("Hei_ght:"), "", EXPORT_COORD_PRECISION, 1,
&Export::onAreaHeightChange);
area_box.pack_start(togglebox, false, false, 3);
@@ -283,18 +284,18 @@ Export::Export (void) :
size_box.pack_start(*t);
bmwidth_adj = createSpinbutton ( "bmwidth", 16.0, 1.0, 1000000.0, 1.0, 10.0,
- NULL, t, 0, 0,
+ t, 0, 0,
_("_Width:"), _("pixels at"), 0, 1,
&Export::onBitmapWidthChange);
xdpi_adj = createSpinbutton ( "xdpi",
prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE),
- 0.01, 100000.0, 0.1, 1.0, NULL, t, 3, 0,
+ 0.01, 100000.0, 0.1, 1.0, t, 3, 0,
"", _("dp_i"), 2, 1,
&Export::onExportXdpiChange);
bmheight_adj = createSpinbutton ( "bmheight", 16.0, 1.0, 1000000.0, 1.0, 10.0,
- NULL, t, 0, 1,
+ t, 0, 1,
_("_Height:"), _("pixels at"), 0, 1,
&Export::onBitmapHeightChange);
@@ -302,7 +303,7 @@ Export::Export (void) :
* There's no way to set ydpi currently, so we use the defaultxdpi value here, too...
*/
ydpi_adj = createSpinbutton ( "ydpi", prefs->getDouble("/dialogs/export/defaultxdpi/value", DPI_BASE),
- 0.01, 100000.0, 0.1, 1.0, NULL, t, 3, 1,
+ 0.01, 100000.0, 0.1, 1.0, t, 3, 1,
"", _("dpi"), 2, 0, NULL );
singleexport_box.pack_start(size_box);
@@ -481,14 +482,14 @@ void Export::set_default_filename () {
#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max,
- float step, float page, GtkWidget *us,
+ float step, float page,
Gtk::Grid *t, int x, int y,
const Glib::ustring ll, const Glib::ustring lr,
int digits, unsigned int sensitive,
void (Export::*cb)() )
#else
Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max,
- float step, float page, GtkWidget *us,
+ float step, float page,
Gtk::Table *t, int x, int y,
const Glib::ustring ll, const Glib::ustring lr,
int digits, unsigned int sensitive,
@@ -1884,7 +1885,7 @@ void Export::setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val)
void Export::setValuePx( Gtk::Adjustment *adj, double val)
#endif
{
- Unit const *unit = unit_selector->getUnit();
+ Unit const *unit = unit_selector.getUnit();
setValue(adj, Inkscape::Util::Quantity::convert(val, "px", unit));
@@ -1934,7 +1935,7 @@ float Export::getValuePx( Gtk::Adjustment *adj )
#endif
{
float value = getValue( adj);
- Unit const *unit = unit_selector->getUnit();
+ Unit const *unit = unit_selector.getUnit();
return Inkscape::Util::Quantity::convert(value, unit, "px");
} // end of sp_export_value_get_px()
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index f324f5dc5..79e597414 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -108,7 +108,6 @@ private:
* @param max Maximum value for the spin button
* @param step The step size for the spin button
* @param page Size of the page increment
- * @param us Unit selector that effects this spin button
* @param t Table to put the spin button in
* @param x X location in the table \c t to start with
* @param y Y location in the table \c t to start with
@@ -117,17 +116,19 @@ private:
* @param digits Number of digits to display after the decimal
* @param sensitive Whether the spin button is sensitive or not
* @param cb Callback for when this spin button is changed (optional)
+ *
+ * No unit_selector is stored in the created spinbutton, relies on external unit management
*/
#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max,
- float step, float page, GtkWidget *us,
+ float step, float page,
Gtk::Grid *t, int x, int y,
const Glib::ustring ll, const Glib::ustring lr,
int digits, unsigned int sensitive,
void (Export::*cb)() );
#else
Gtk::Adjustment * createSpinbutton( gchar const *key, float val, float min, float max,
- float step, float page, GtkWidget *us,
+ float step, float page,
Gtk::Table *t, int x, int y,
const Glib::ustring ll, const Glib::ustring lr,
int digits, unsigned int sensitive,
@@ -335,7 +336,7 @@ private:
/* Unit selector widgets */
Gtk::HBox unitbox;
- Inkscape::UI::Widget::UnitMenu *unit_selector;
+ Inkscape::UI::Widget::UnitMenu unit_selector;
Gtk::Label units_label;
/* Filename widgets */
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 4ce2eafd1..38e05a1c7 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1307,7 +1307,7 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa
}
}
-void FilterEffectsDialog::FilterModifier::on_filter_reorder(const Gtk::TreeModel::Path& path) {
+void FilterEffectsDialog::FilterModifier::on_filter_reorder(const Gtk::TreeModel::Path& /*path*/) {
for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
SPObject* object = (*i)[_columns.filter];
if(object && object->getRepr())
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 1023cfb6e..40cce028d 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -362,16 +362,17 @@ bool UnitTable::load(std::string const &filename) {
return true;
}
+/*
bool UnitTable::save(std::string const &filename) {
-
g_warning("UnitTable::save(): not implemented");
- return true;
+ return false;
}
+*/
Inkscape::Util::UnitTable unit_table;
-void UnitParser::on_start_element(Ctx &ctx, Glib::ustring const &name, AttrMap const &attrs)
+void UnitParser::on_start_element(Ctx &/*ctx*/, Glib::ustring const &name, AttrMap const &attrs)
{
if (name == "unit") {
// reset for next use
@@ -413,7 +414,7 @@ void UnitParser::on_text(Ctx &ctx, Glib::ustring const &text)
}
}
-void UnitParser::on_end_element(Ctx &ctx, Glib::ustring const &name)
+void UnitParser::on_end_element(Ctx &/*ctx*/, Glib::ustring const &name)
{
if (name == "unit" && !skip) {
tbl->addUnit(unit, primary);
@@ -463,7 +464,7 @@ double Quantity::value(char const *u) const
}
Glib::ustring Quantity::string(Unit const *u) const {
- return Glib::ustring::format(std::fixed, std::setprecision(2), value(u)) + " " + unit->abbr;
+ return Glib::ustring::format(std::fixed, std::setprecision(2), value(u)) + " " + u->abbr;
}
Glib::ustring Quantity::string(Glib::ustring const &u) const {
return string(unit_table.getUnit(u.c_str()));
diff --git a/src/util/units.h b/src/util/units.h
index e1addaa24..597371369 100644
--- a/src/util/units.h
+++ b/src/util/units.h
@@ -168,8 +168,8 @@ public:
*/
bool load(std::string const &filename);
- /** Saves the current UnitTable to the given file. */
- bool save(std::string const &filename);
+ /* * Saves the current UnitTable to the given file. */
+ //bool save(std::string const &filename);
protected:
UnitCodeMap _unit_map;
diff --git a/src/winmain.cpp b/src/winmain.cpp
index 752ab8e6b..607660740 100644
--- a/src/winmain.cpp
+++ b/src/winmain.cpp
@@ -25,10 +25,10 @@ extern int main (int argc, char **argv);
#endif
int _stdcall
-WinMain (struct HINSTANCE__ *hInstance,
- struct HINSTANCE__ *hPrevInstance,
- char *lpszCmdLine,
- int nCmdShow)
+WinMain (struct HINSTANCE__ */*hInstance*/,
+ struct HINSTANCE__ */*hPrevInstance*/,
+ char */*lpszCmdLine*/,
+ int /*nCmdShow*/)
{
if (fileno (stdout) != -1 &&
_get_osfhandle (fileno (stdout)) != -1)