Changeset b3105ff6 in mainline for tools/xstruct.py


Ignore:
Timestamp:
2008-08-09T20:16:47Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
838e14e2
Parents:
8c25a4a
Message:

support comments in structures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/xstruct.py

    r8c25a4a rb3105ff6  
    4343                "network:": lambda: "!"
    4444        }[tokens[0]]()
    45                
     45       
    4646        # Member tags
    4747       
     48        comment = False
    4849        for token in tokens[1:]:
    49                 if (token[0:5] == "char["):
     50                if (comment):
     51                        if (token == "*/"):
     52                                comment = False
     53                        continue
     54               
     55                if (token == "/*"):
     56                        comment = True
     57                elif (token[0:5] == "char["):
    5058                        size = token[5:].split("]")[0]
    5159                        struct += ("%d" % int(size)) + "s"
     
    6775def little_string(string):
    6876        return struct.pack("<" + ("%d" % len(string)) + "s", string)
     77
     78def little_padding(length):
     79        return struct.pack("<" + ("%d" % length) + "x")
Note: See TracChangeset for help on using the changeset viewer.