Rev 3259 | Rev 3262 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3259 | Rev 3260 | ||
|---|---|---|---|
| Line 40... | Line 40... | ||
| 40 | struct = { |
40 | struct = { |
| 41 | "little:": lambda: "<", |
41 | "little:": lambda: "<", |
| 42 | "big:": lambda: ">", |
42 | "big:": lambda: ">", |
| 43 | "network:": lambda: "!" |
43 | "network:": lambda: "!" |
| 44 | }[tokens[0]]() |
44 | }[tokens[0]]() |
| 45 | 45 | ||
| 46 | # Member tags |
46 | # Member tags |
| 47 | 47 | ||
| - | 48 | comment = False |
|
| 48 | for token in tokens[1:]: |
49 | for token in tokens[1:]: |
| - | 50 | if (comment): |
|
| - | 51 | if (token == "*/"): |
|
| - | 52 | comment = False |
|
| - | 53 | continue |
|
| - | 54 | ||
| - | 55 | if (token == "/*"): |
|
| - | 56 | comment = True |
|
| 49 | if (token[0:5] == "char["): |
57 | elif (token[0:5] == "char["): |
| 50 | size = token[5:].split("]")[0] |
58 | size = token[5:].split("]")[0] |
| 51 | struct += ("%d" % int(size)) + "s" |
59 | struct += ("%d" % int(size)) + "s" |
| 52 | else: |
60 | else: |
| 53 | struct += { |
61 | struct += { |
| 54 | "uint8_t": lambda: "B", |
62 | "uint8_t": lambda: "B", |
| Line 64... | Line 72... | ||
| 64 | 72 | ||
| 65 | return struct |
73 | return struct |
| 66 | 74 | ||
| 67 | def little_string(string): |
75 | def little_string(string): |
| 68 | return struct.pack("<" + ("%d" % len(string)) + "s", string) |
76 | return struct.pack("<" + ("%d" % len(string)) + "s", string) |
| - | 77 | ||
| - | 78 | def little_padding(length): |
|
| - | 79 | return struct.pack("<" + ("%d" % length) + "x") |
|