Changeset 8f2a852 in mainline for tools/xstruct.py
- Timestamp:
- 2008-08-10T00:04:55Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5749372
- Parents:
- 0516fd7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/xstruct.py
r0516fd7 r8f2a852 59 59 # Member tags 60 60 comment = False 61 variable = False61 variable = None 62 62 for token in tokens[1:]: 63 63 if (comment): … … 66 66 continue 67 67 68 if (variable): 69 inst.__dict__[token] = None 70 list.append(token) 71 variable = False 68 if (token == "/*"): 69 comment = True 72 70 continue 73 71 74 if (token == "/*"): 75 comment = True 76 elif (token[0:8] == "padding["): 72 if (variable != None): 73 subtokens = token.split("[") 74 75 if (len(subtokens) > 1): 76 format += "%d" % int(subtokens[1].split("]")[0]) 77 78 format += variable 79 80 inst.__dict__[subtokens[0]] = None 81 list.append(subtokens[0]) 82 83 variable = None 84 continue 85 86 if (token[0:8] == "padding["): 77 87 size = token[8:].split("]")[0] 78 88 format += "%dx" % int(size) 79 elif (token[0:5] == "char["): 80 size = token[5:].split("]")[0] 81 format += "%ds" % int(size) 82 variable = True 83 else: 84 format += { 85 "uint8_t": lambda: "B", 86 "uint16_t": lambda: "H", 87 "uint32_t": lambda: "L", 88 "uint64_t": lambda: "Q", 89 90 "int8_t": lambda: "b", 91 "int16_t": lambda: "h", 92 "int32_t": lambda: "l", 93 "int64_t": lambda: "q" 94 }[token]() 95 variable = True 89 continue 90 91 variable = { 92 "char": lambda: "s", 93 "uint8_t": lambda: "B", 94 "uint16_t": lambda: "H", 95 "uint32_t": lambda: "L", 96 "uint64_t": lambda: "Q", 97 98 "int8_t": lambda: "b", 99 "int16_t": lambda: "h", 100 "int32_t": lambda: "l", 101 "int64_t": lambda: "q" 102 }[token]() 96 103 97 104 inst.__dict__['_format_'] = format
Note:
See TracChangeset
for help on using the changeset viewer.