Mercurial > hg > Members > shinya > pyrect
changeset 79:623eccb93ca1
modify filter emit-option's bug.
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Nov 2010 10:56:55 +0900 |
parents | 240475723cd8 |
children | 53c3ce58fc8a |
files | pyrect/translator/grep_translator.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pyrect/translator/grep_translator.py Mon Nov 08 05:14:06 2010 +0900 +++ b/pyrect/translator/grep_translator.py Mon Nov 08 10:56:55 2010 +0900 @@ -74,7 +74,7 @@ if self.filter == "bmh": self.emit_bmh_filter(key) - else: + elif self.filter: self.emit_quick_filter(key) if self.skip_boost and not self.filter_only and \ @@ -101,7 +101,6 @@ self.emit("%s(%s);" % (self.state_name(self.cg.start), self.args)) self.emit("UCHARP get_line_beg(UCHARP p, UCHARP beg);", 2) - self.emiti("void bmh_filter(%s) {" % self.interface) l = len(key) if l == 1: @@ -117,8 +116,8 @@ for i in range(l-1): skip[key[i]] = l-1-i - self.emit("UCHARP tmp1, *tmp2;", 2) - self.emit("buf += %d;" % (l-1)) + self.emit("UCHARP tmp1, *tmp2; buf += %d;" % (l-1), 2) + self.emiti("while (buf < end) {") self.emiti( "if (*buf == %d /* %s */) {" % (ord(key[-1]), Character.ascii(key[-1]))) self.emit( "tmp1 = buf, tmp2 = (UCHARP)key+%d;" % (l-1)) @@ -216,8 +215,7 @@ self.emit( "UCHARP ret = (UCHARP)memchr(buf, '\\n', (buf - end));") if self.skip_boost or self.filter: self.emit( "beg = get_line_beg(buf, beg);") - self.emit( 'if (ret == NULL) ret = end;') - self.emiti( "if (ret > end) {") + self.emiti( "if (ret == NULL) {") self.emit( "print_line(beg, end);") self.emit( "return;") self.emitd( "}")