| 189 | |
| 190 | |
| 191 | def add_encoding_field(model): |
| 192 | for struct in model.structs: |
| 193 | newfields = [] |
| 194 | container = None |
| 195 | idx = 0 |
| 196 | for field in struct.fields: |
| 197 | if field.uatype in ('UInt6', 'NodeIdType'): |
| 198 | container = field.name |
| 199 | b = Bit() |
| 200 | b.name = field.name |
| 201 | b.idx = 0 |
| 202 | b.container = container |
| 203 | b.length = 6 |
| 204 | idx = b.length |
| 205 | struct.bits[b.name] = b |
| 206 | |
| 207 | if field.uatype == 'Bit': |
| 208 | if not container or idx > 7: |
| 209 | container = 'Encoding' |
| 210 | idx = 0 |
| 211 | f = Field() |
| 212 | f.sourcetype = field.sourcetype |
| 213 | f.name = 'Encoding' |
| 214 | f.uatype = 'Byte' |
| 215 | newfields.append(f) |
| 216 | |
| 217 | b = Bit() |
| 218 | b.name = field.name |
| 219 | b.idx = idx |
| 220 | b.container = container |
| 221 | b.length = field.bitlength |
| 222 | idx += field.bitlength |
| 223 | struct.bits[b.name] = b |
| 224 | else: |
| 225 | newfields.append(field) |
| 226 | struct.fields = newfields |
| 227 | |
| 228 | |
| 229 | def remove_vector_length(model): |