diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-01-12 23:25:39 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-01-12 23:25:39 +0000 |
| commit | 5eb9b4815a12cc0dafd07905f7715a7e15a92b41 (patch) | |
| tree | f39f5ae5a40012fa010402611d2b133553c22335 /src/2geom/svg-path-parser.cpp | |
| parent | LPE: rename function getHelperPaths --> getCanvasIndicators (the function is ... (diff) | |
| download | inkscape-5eb9b4815a12cc0dafd07905f7715a7e15a92b41.tar.gz inkscape-5eb9b4815a12cc0dafd07905f7715a7e15a92b41.zip | |
update 2geom's copy to r2142
(bzr r12921)
Diffstat (limited to 'src/2geom/svg-path-parser.cpp')
| -rw-r--r-- | src/2geom/svg-path-parser.cpp | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/src/2geom/svg-path-parser.cpp b/src/2geom/svg-path-parser.cpp index 60a734ece..fa31b57b5 100644 --- a/src/2geom/svg-path-parser.cpp +++ b/src/2geom/svg-path-parser.cpp @@ -1,4 +1,5 @@ -#line 1 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" + +#line 1 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" /** * \file * \brief parse SVG path specifications @@ -46,7 +47,7 @@ namespace { class Parser { public: - Parser(SVGPathSink &sink) : _absolute(false), _sink(sink) {} + Parser(PathSink &sink) : _absolute(false), _sink(sink) {} void parse(char const *str) throw(SVGPathParseError); @@ -57,7 +58,7 @@ private: Point _cubic_tangent; Point _quad_tangent; std::vector<double> _params; - SVGPathSink &_sink; + PathSink &_sink; void _reset() { _absolute = false; @@ -140,7 +141,7 @@ private: }; -#line 144 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.cpp" +#line 145 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.cpp" static const char _svg_path_actions[] = { 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 15, 1, @@ -956,7 +957,7 @@ static const short _svg_path_indicies[] = { 1, 0 }; -static const short _svg_path_trans_targs_wi[] = { +static const short _svg_path_trans_targs[] = { 270, 0, 1, 2, 193, 3, 4, 5, 194, 3, 4, 5, 194, 5, 194, 6, 7, 8, 195, 9, 204, 7, 8, 195, @@ -1048,7 +1049,7 @@ static const short _svg_path_trans_targs_wi[] = { 268, 269 }; -static const char _svg_path_trans_actions_wi[] = { +static const char _svg_path_trans_actions[] = { 15, 0, 0, 0, 0, 9, 47, 47, 47, 0, 1, 1, 1, 0, 0, 0, 3, 17, 3, 17, 0, 0, 1, 0, @@ -1145,7 +1146,8 @@ static const int svg_path_first_final = 270; static const int svg_path_en_main = 1; -#line 144 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" + +#line 144 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" void Parser::parse(char const *str) @@ -1158,12 +1160,12 @@ throw(SVGPathParseError) _reset(); -#line 1162 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.cpp" +#line 1164 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.cpp" { cs = svg_path_start; } -#line 1167 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.cpp" +#line 1169 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.cpp" { int _klen; unsigned int _trans; @@ -1192,7 +1194,7 @@ _resume: else if ( (*p) > *_mid ) _lower = _mid + 1; else { - _trans += (_mid - _keys); + _trans += (unsigned int)(_mid - _keys); goto _match; } } @@ -1215,7 +1217,7 @@ _resume: else if ( (*p) > _mid[1] ) _lower = _mid + 2; else { - _trans += ((_mid - _keys)>>1); + _trans += (unsigned int)((_mid - _keys)>>1); goto _match; } } @@ -1224,25 +1226,25 @@ _resume: _match: _trans = _svg_path_indicies[_trans]; - cs = _svg_path_trans_targs_wi[_trans]; + cs = _svg_path_trans_targs[_trans]; - if ( _svg_path_trans_actions_wi[_trans] == 0 ) + if ( _svg_path_trans_actions[_trans] == 0 ) goto _again; - _acts = _svg_path_actions + _svg_path_trans_actions_wi[_trans]; + _acts = _svg_path_actions + _svg_path_trans_actions[_trans]; _nacts = (unsigned int) *_acts++; while ( _nacts-- > 0 ) { switch ( *_acts++ ) { case 0: -#line 156 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 156 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { start = p; } break; case 1: -#line 160 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 160 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { char const *end=p; std::string buf(start, end); @@ -1251,55 +1253,55 @@ _match: } break; case 2: -#line 167 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 167 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _push(1.0); } break; case 3: -#line 171 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 171 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _push(0.0); } break; case 4: -#line 175 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 175 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _absolute = true; } break; case 5: -#line 179 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 179 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _absolute = false; } break; case 6: -#line 183 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 183 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _moveTo(_pop_point()); } break; case 7: -#line 187 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 187 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _lineTo(_pop_point()); } break; case 8: -#line 191 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 191 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _hlineTo(Point(_pop_coord(X), _current[Y])); } break; case 9: -#line 195 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 195 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _vlineTo(Point(_current[X], _pop_coord(Y))); } break; case 10: -#line 199 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 199 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { Point p = _pop_point(); Point c1 = _pop_point(); @@ -1308,7 +1310,7 @@ _match: } break; case 11: -#line 206 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 206 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { Point p = _pop_point(); Point c1 = _pop_point(); @@ -1316,7 +1318,7 @@ _match: } break; case 12: -#line 212 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 212 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { Point p = _pop_point(); Point c = _pop_point(); @@ -1324,14 +1326,14 @@ _match: } break; case 13: -#line 218 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 218 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { Point p = _pop_point(); _quadTo(_quad_tangent, p); } break; case 14: -#line 223 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 223 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { Point point = _pop_point(); bool sweep = _pop_flag(); @@ -1344,16 +1346,16 @@ _match: } break; case 15: -#line 234 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" +#line 234 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" { _closePath(); } break; case 16: -#line 370 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" - {goto _out;} +#line 370 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" + {{p++; goto _out; }} break; -#line 1357 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.cpp" +#line 1359 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.cpp" } } @@ -1364,7 +1366,8 @@ _again: goto _resume; _out: {} } -#line 380 "/opt/shared/work/programming/eclipse/eclipse_3.4/lib2geom/src/2geom/svg-path-parser.rl" + +#line 380 "/home/tweenk/src/lib2geom/src/2geom/svg-path-parser.rl" if ( cs < svg_path_first_final ) { @@ -1374,12 +1377,12 @@ _again: } -void parse_svg_path(char const *str, SVGPathSink &sink) +void parse_svg_path(char const *str, PathSink &sink) throw(SVGPathParseError) { Parser parser(sink); parser.parse(str); - sink.finish(); + sink.flush(); } } @@ -1393,4 +1396,4 @@ throw(SVGPathParseError) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
