Changes in tools/autogen.py [147a066:795e2bf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/autogen.py
r147a066 r795e2bf 34 34 def usage(): 35 35 print("%s - Automated structure and offsets generator" % sys.argv[0]) 36 print("%s file.ag depend|probe|generate struct.ag" % sys.argv[0])36 print("%s file.ag probe|generate struct.ag" % sys.argv[0]) 37 37 sys.exit() 38 39 def depend(struct):40 deps = ""41 for include in struct['includes']:42 if 'depends' in include.keys():43 deps = deps + include['depends'] + "\n"44 return deps.strip()45 38 46 39 def generate_includes(struct): … … 59 52 60 53 def generate_struct(struct): 61 packed = ""62 if ('packed' in struct.keys() and struct['packed']):63 packed = "__attribute__ ((packed)) "64 54 code = "typedef struct %s {\n" % struct['name'] 65 55 for i in range(len(struct['members'])): … … 69 59 else: 70 60 code = code + "\t%s %s;\n" % (member['type'], member['name']) 71 code = code + "} %s %s_t;" % (packed, struct['name'])61 code = code + "} %s_t;" % struct['name'] 72 62 return code 73 63 … … 167 157 struct = yaml.load(fp) 168 158 169 if sys.argv[1] == "depend": 170 deps = depend(struct) 171 print(deps) 172 elif sys.argv[1] == "probe": 159 if sys.argv[1] == "probe": 173 160 code = probe(struct) 174 161 print(code)
Note:
See TracChangeset
for help on using the changeset viewer.