Mercurial > MadButterfly
changeset 333:bdf36a26e420
Make generated code clean.
- Before changes, generated code include a lot of redundant empty lines.
- Add dnl after each command when svg2code.py generates code lines.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 07 Mar 2009 10:55:42 +0800 |
parents | f90c60967a9c |
children | 02e457d374f5 |
files | tools/mb_c_header.m4 tools/mb_c_source.m4 tools/svg2code.py |
diffstat | 3 files changed, 31 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/mb_c_header.m4 Sat Mar 07 08:33:01 2009 +0800 +++ b/tools/mb_c_header.m4 Sat Mar 07 10:55:42 2009 +0800 @@ -1,12 +1,12 @@ changequote(`[', `]')dnl divert([-1]) -define([ADD_LINEAR_PAINT],[[ - paint_t *$1; +define([ADD_LINEAR_PAINT],[ +[ paint_t *$1; ]]) -define([ADD_RADIAL_PAINT],[[ - paint_t *$1; +define([ADD_RADIAL_PAINT],[ +[ paint_t *$1; ]]) define([ADD_PATH],[ [ shape_t *$1; @@ -27,8 +27,7 @@ define([PANGO_BEGIN_TEXT],[ [ shape_t *$1; ]]) -define([PANGO_END_TEXT],[ -]) +define([PANGO_END_TEXT],[]) define([PANGO_SIZE],[]) define([PANGO_STYLE],[]) define([PANGO_WEIGHT],[]) @@ -37,11 +36,11 @@ define([REF_STOPS_RADIAL],) define([REF_STOPS_LINEAR],) -define([FILL_SHAPE],[[ - paint_t *$1_fill; +define([FILL_SHAPE],[ +[ paint_t *$1_fill; ]]) -define([STROKE_SHAPE],[[ - paint_t *$1_stroke; +define([STROKE_SHAPE],[ +[ paint_t *$1_stroke; ]]) define([FILL_SHAPE_WITH_PAINT],) define([STROKE_SHAPE_WITH_PAINT],)
--- a/tools/mb_c_source.m4 Sat Mar 07 08:33:01 2009 +0800 +++ b/tools/mb_c_source.m4 Sat Mar 07 10:55:42 2009 +0800 @@ -443,9 +443,9 @@ $2[ }; -]DEFINE_SCENES -$2 -DEFINE_SCENES_ARRAY +]DEFINE_SCENES[]dnl +$2[]dnl +DEFINE_SCENES_ARRAY[]dnl static const int *$1_scenes[[]] = { $2[]dnl NULL
--- a/tools/svg2code.py Sat Mar 07 08:33:01 2009 +0800 +++ b/tools/svg2code.py Sat Mar 07 10:55:42 2009 +0800 @@ -477,25 +477,25 @@ # FIXME: Implement all units here if style_map['font-size'].endswith('px'): font_sz = float(style_map['font-size'][:-2]) - print >> codefo, 'PANGO_SIZE(%d,%d,%d)' % (font_sz*1024,start,end) + print >> codefo, 'PANGO_SIZE(%d,%d,%d)dnl' % (font_sz*1024,start,end) else: font_sz = float(style_map['font-size']) - print >> codefo, 'PANGO_SIZE(%d,%d,%d)' % (font_sz*1024,start,end) + print >> codefo, 'PANGO_SIZE(%d,%d,%d)dnl' % (font_sz*1024,start,end) pass if style_map.has_key('font-style'): font_style = style_map['font-style'].lower() if font_style == 'normal': - print >> codefo, 'PANGO_STYLE(PANGO_STYLE_NORMAL,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_STYLE_NORMAL,%d,%d)dnl' % (start,end) elif font_style == 'italic': - print >> codefo, 'PANGO_STYLE(PANGO_STYLE_ITALIC,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_STYLE_ITALIC,%d,%d)dnl' % (start,end) elif font_style == 'oblique': - print >> codefo, 'PANGO_STYLE(PANGO_STYLE_OBLIQUE,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_STYLE_OBLIQUE,%d,%d)dnl' % (start,end) pass if style_map.has_key('font-family'): font_family = style_map['font-family'] - print >> codefo, 'PANGO_FAMILY(%s,%d,%d)' % (font_family,start,end) + print >> codefo, 'PANGO_FAMILY(%s,%d,%d)dnl' % (font_family,start,end) pass if style_map.has_key('text-anchor'): text_anchor = style_map['text-anchor'].lower() @@ -509,31 +509,31 @@ if style_map.has_key('font-weight'): font_weight = style_map['font-weight'].lower() if font_weight == 'normal': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_NORMAL,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_NORMAL,%d,%d)dnl' % (start,end) elif font_weight == 'bold': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_BOLD,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_BOLD,%d,%d)dnl' % (start,end) elif font_weight == 'bolder': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_HEAVY,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_HEAVY,%d,%d)dnl' % (start,end) elif font_weight == 'lighter': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRALIGHT,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRALIGHT,%d,%d)dnl' % (start,end) elif font_weight == '100': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRALIGHT,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRALIGHT,%d,%d)dnl' % (start,end) elif font_weight == '200': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRALIGHT,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRALIGHT,%d,%d)dnl' % (start,end) elif font_weight == '300': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_LIGHT,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_LIGHT,%d,%d)dnl' % (start,end) elif font_weight == '400': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_NORMAL,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_NORMAL,%d,%d)dnl' % (start,end) elif font_weight == '500': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_NORMAL,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_NORMAL,%d,%d)dnl' % (start,end) elif font_weight == '600': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_SEMIBOLD,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_SEMIBOLD,%d,%d)dnl' % (start,end) elif font_weight == '700': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_BOLD,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_BOLD,%d,%d)dnl' % (start,end) elif font_weight == '800': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRABOLD,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_ULTRABOLD,%d,%d)dnl' % (start,end) elif font_weight == '900': - print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_HEAVY,%d,%d)' % (start,end) + print >> codefo, 'PANGO_STYLE(PANGO_WEIGHT_HEAVY,%d,%d)dnl' % (start,end) else: print "The font-weight %s is not supported" % font_weight pass