Mercurial > hg > Members > shinya > pyrect
changeset 50:d1afae06e776
jitgrep: set bufsize default 1M. and remove with statement.
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Aug 2010 15:06:24 +0900 |
parents | 7f4221018adf |
children | c48284580d5a |
files | pyrect/translator/__init__.py pyrect/translator/c_translator.py pyrect/translator/grep_translator.py |
diffstat | 3 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pyrect/translator/__init__.py Mon Aug 09 04:34:13 2010 +0900 +++ b/pyrect/translator/__init__.py Mon Aug 09 15:06:24 2010 +0900 @@ -3,10 +3,14 @@ from c_translator import CTranslator as CTranslator from cbc_translator import CbCTranslator as CbCTranslator -from llvm_translator import LLVMTranslator as LLVMTranslator from dot_translator import DotTranslator as DotTranslator from grep_translator import GREPTranslator as GREPTranslator from goto_grep_translator import GoToGREPTranslator as GoToGREPTranslator from dfa_translator import GNUGREPTranslator as GNUGREPTranslator from cbc_grep_translator import CbCGREPTranslator as CbCGREPTranslator -from llvm_grep_translator import LLVMGREPTranslator as LLVMGREPTranslator + +try: + from llvm_translator import LLVMTranslator as LLVMTranslator + from llvm_grep_translator import LLVMGREPTranslator as LLVMGREPTranslator +except ImportError: + LLVMTranslator, LLVMGREPTranslator = None, None
--- a/pyrect/translator/c_translator.py Mon Aug 09 04:34:13 2010 +0900 +++ b/pyrect/translator/c_translator.py Mon Aug 09 15:06:24 2010 +0900 @@ -1,6 +1,5 @@ #!/Usr/bin/env python -from __future__ import with_statement from pyrect.regexp import Regexp from pyrect.regexp.ast import * from translator import Translator
--- a/pyrect/translator/grep_translator.py Mon Aug 09 04:34:13 2010 +0900 +++ b/pyrect/translator/grep_translator.py Mon Aug 09 15:06:24 2010 +0900 @@ -22,7 +22,7 @@ def __init__(self, regexp): CTranslator.__init__(self, regexp, fa="DFA") - self.__bufsize = 1024 + self.__bufsize = 1024 * 1024 def getbufsize(self,): return self.__bufsize @@ -33,8 +33,8 @@ def emit_initialization(self): CTranslator.emit_initialization(self) - self.emit("#define LINEBUFSIZE 1024") - self.emit("#define READBUFSIZE %d" % (self.bufsize)) + self.emit("#define LINEBUFSIZE %d" % self.bufsize) + self.emit("#define READBUFSIZE %d" % self.bufsize) self.emit("#include <stdlib.h>") self.emit("#include <string.h>") self.emit("char readbuf[%d];" % (self.bufsize))