Changeset 3950


Ignore:
Timestamp:
Aug 3, 2014, 6:27:34 AM (5 years ago)
Author:
cameron
Message:

Initialize predeclared bit variables in constructor

Location:
proto/charsetcompiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/CC_compiler.py

    r3948 r3950  
    1717        self.generated_code = []
    1818        self.common_expression_map = {}
    19         self.typedecl = typedecl
     19        self.typedecl = typedecl
     20        predeclared = [self.bit_var(i) for i in range(0, self.mEncoding.bits)]
     21        for sym in predeclared: self.common_expression_map[sym] = sym
    2022
    2123    def bit_var(self, n):
     
    253255               return '((%s & %s)|(~(%s) & %s))' %(sel, e1, sel, e2)
    254256            elif isinstance(expr, Adv):
    255                operand = self.expr_string_to_variable(self.expr2py(expr.operand))
    256                return 'Advance((%s, %i)' %(operand, expr.offset)
     257               e = self.expr_string_to_variable(self.expr2py(expr.operand))
     258               return 'Advance(%s, %i)' % (e, expr.offset)
     259            else: raise Exception("Bad expression: %s" % repr(e))
    257260
    258261    def chardef2py(self, chardef):
     
    260263   
    261264    def chardeflist2py(self, chardeflist):
    262             predeclared = [self.bit_var(i) for i in range(0, self.mEncoding.bits)]
    263             for sym in predeclared: self.common_expression_map[sym] = sym
    264265            for d in chardeflist:
    265266                self.chardef2py(d)
  • proto/charsetcompiler/charset_compiler.py

    r3947 r3950  
    151151        if options.use_EBCDIC:
    152152            defs = EBCDIC.ascii2ebcdic_chardeflist(defs)
    153         cgo = CC_compiler(UTF_encoding.Encoding, options.gensym_pattern, options.little_endian)
     153        cgo = CC_compiler(UTF_encoding.Encoding, options.gensym_pattern, options.little_endian, '')
    154154        stmts = cgo.chardeflist2py(defs)
    155155        if options.Pablo_skeleton or options.test_skeleton:
Note: See TracChangeset for help on using the changeset viewer.