Changeset 8565a42 in mainline for tools/xstruct.py


Ignore:
Timestamp:
2018-03-02T20:34:50Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/xstruct.py

    r3061bc1 r8565a42  
    7272        def size(self):
    7373                return struct.calcsize(self._format_)
    74        
     74
    7575        def pack(self):
    7676                args = []
     
    9090                                args.append(value)
    9191                return struct.pack(self._format_, *args)
    92        
     92
    9393        def unpack(self, data):
    9494                values = struct.unpack(self._format_, data)
     
    100100def create(definition):
    101101        "Create structure object"
    102        
     102
    103103        tokens = definition.split(None)
    104        
     104
    105105        # Initial byte order tag
    106106        format = {
     
    111111        inst = Struct()
    112112        args = []
    113        
     113
    114114        # Member tags
    115115        comment = False
     
    120120                                comment = False
    121121                        continue
    122                
     122
    123123                if (token == "/*"):
    124124                        comment = True
    125125                        continue
    126                
     126
    127127                if (variable != None):
    128128                        subtokens = token.split("[")
    129                        
     129
    130130                        length = None
    131131                        if (len(subtokens) > 1):
    132132                                length = int(subtokens[1].split("]")[0])
    133133                                format += "%d" % length
    134                        
     134
    135135                        format += variable
    136                        
     136
    137137                        inst.__dict__[subtokens[0]] = None
    138138                        args.append((subtokens[0], variable, length))
    139                        
     139
    140140                        variable = None
    141141                        continue
    142                
     142
    143143                if (token[0:8] == "padding["):
    144144                        size = token[8:].split("]")[0]
    145145                        format += "%dx" % int(size)
    146146                        continue
    147                
     147
    148148                variable = {
    149149                        "char":     lambda: "s",
     
    152152                        "uint32_t": lambda: "L",
    153153                        "uint64_t": lambda: "Q",
    154                        
     154
    155155                        "int8_t":   lambda: "b",
    156156                        "int16_t":  lambda: "h",
     
    158158                        "int64_t":  lambda: "q"
    159159                }[token]()
    160        
     160
    161161        inst.__dict__['_format_'] = format
    162162        inst.__dict__['_args_'] = args
Note: See TracChangeset for help on using the changeset viewer.