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