Mercurial > hg > Members > shinya > pyrect
changeset 38:06826250198b
modify grep_translator, use property at bufsize.
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Jul 2010 06:24:57 +0900 |
parents | 95fd780875bf |
children | 43b277a00905 |
files | pyrect/grep_translator.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pyrect/grep_translator.py Sun Jul 11 23:04:48 2010 +0900 +++ b/pyrect/grep_translator.py Mon Jul 12 06:24:57 2010 +0900 @@ -25,7 +25,14 @@ self.callType = 'return ' self.breakStatement = '' self.begline = False - self.bufsize = 1024 + self.__bufsize = 1024 + + def getbufsize(self,): + return self.__bufsize + def setbufsize(self, bufsize): + self.__bufsize = abs(bufsize) + + bufsize = property(getbufsize, setbufsize) def emit_accept_state(self): self.emit (""" @@ -45,8 +52,8 @@ self.emit("#include <string.h>\n\n") self.emit("#define LINEBUFSIZE 1024\n") - self.emit("#define READBUFSIZE %d\n\n" % (0 if self.bufsize <= 0 else self.bufsize)) - self.emit("char readbuf[%d];\n\n" % (0 if self.bufsize <= 0 else self.bufsize)) + self.emit("#define READBUFSIZE %d\n\n" % (self.bufsize)) + self.emit("char readbuf[%d];\n\n" % (self.bufsize)) self.emit("%sDFA(char* s);\n" % (self.funType)) for state in self.cg.map.iterkeys():