Exemplo n.º 1
0
 def __init__(self, cheaderfile, pyrules = None, tab="    "):
     """Initialize
     """
     ##Rules
     if (pyrules == None):
         self.rules = rules()
     else:
         self.rules = pyrules
     ##What is a tab (same as rules)
     self.tab = str(tab)
     self.rules.tab = self.tab
     ##Reference to C header file
     self.cheader = cheaderfile
     ##Reference to cstruct2py
     self.__c2py = c2py.cstruct2py()
     ##Code for assertion
     self.__assertcode = []
Exemplo n.º 2
0
    if (opt in ("-h", "--help")):
        usage()
        sys.exit(0)
    elif (opt in ("-s", "--size")):
        printsize = True
    elif (opt in ("-c", "--cstruct")):
        printc = True
    elif (opt in ("-n", "--names")):
        printname = True
    else:
        print "Unhandled option :" + opt
        sys.exit(1)

headerfile = cheader.cheaderfile(args[:-1])
cstruct = headerfile.structs[args[-1].strip()]
cs2p = c2py.cstruct2py()
pattern = cs2p.get_pattern(cstruct)

#Print C struct
if (printc):
    print cstruct

#Print pattern
print "Python pattern = " + pattern

#Print name
if (printname):
    print cstruct.get_names()

#Print size
if (printsize):
Exemplo n.º 3
0
    if (opt in ("-h","--help")):
        usage()
        sys.exit(0)
    elif (opt in ("-s","--size")): 
        printsize = True
    elif (opt in ("-c","--cstruct")): 
        printc = True
    elif (opt in ("-n","--names")): 
        printname = True
    else:
        print "Unhandled option :"+opt
        sys.exit(1)

headerfile = cheader.cheaderfile(args[:-1])
cstruct = headerfile.structs[args[-1].strip()]
cs2p = c2py.cstruct2py()
pattern = cs2p.get_pattern(cstruct)

#Print C struct
if (printc):
    print cstruct

#Print pattern
print "Python pattern = "+pattern

#Print name
if (printname):
    print cstruct.get_names()

#Print size
if (printsize):