Lines Matching refs:self
24 def __init__(self): argument
25 self.items = []
26 self.dependencies = {}
27 self.include_chain = []
29 def add_dependency(self, parent, dependency): argument
31 if parent in self.dependencies:
32 self.dependencies[parent].append(dependency)
34 self.dependencies[parent] = [dependency]
36 def get_dependencies(self, parent): argument
39 if parent in self.dependencies:
40 direct_deps = self.dependencies[parent]
43 deps += self.get_dependencies(direct_dep)
48 def parse(self, file_name): argument
52 if file_name not in self.include_chain:
53 self.include_chain.append(file_name)
54 self.dependencies[file_name] = []
68 self.items.append({"type": "reserved"})
72 self.add_dependency(file_name, included_file)
73 self.parse(included_file)
80 self.items.append({"type": "function", "library_name": library_name,
85 self.include_chain.pop()
91 def __init__(self, prog): argument
92 self.args = argparse.ArgumentParser(prog=prog, description=self.__doc__)
93 self.config = None
95 def parse_arguments(self, argv): argument
97 self.config = self.args.parse_args(argv)
99 def build_template(self, name, mapping=None, remove_comment=False): argument
105 with open(self.TEMPLATE_DIR + name, "r") as template_file:
125 def __init__(self, prog): argument
126 RomlibApplication.__init__(self, prog)
128 self.args.add_argument("-o", "--output", help="Output file", metavar="output",
130 self.args.add_argument("--deps", help="Dependency file")
131 self.args.add_argument("file", help="Input file")
133 def main(self): argument
140 index_file_parser.parse(self.config.file)
142 with open(self.config.output, "w") as output_file:
151 if self.config.deps:
152 with open(self.config.deps, "w") as deps_file:
153 deps = [self.config.file] + index_file_parser.get_dependencies(self.config.file)
154 deps_file.write(self.config.output + ": " + " \\\n".join(deps) + "\n")
159 def __init__(self, prog): argument
160 RomlibApplication.__init__(self, prog)
162 self.args.add_argument("-o", "--output", help="Output file", metavar="output",
164 self.args.add_argument("--bti", help="Branch Target Identification", type=int)
165 self.args.add_argument("file", help="Input file")
167 def main(self): argument
175 index_file_parser.parse(self.config.file)
177 with open(self.config.output, "w") as output_file:
178 output_file.write(self.build_template("jmptbl_header.S"))
179 bti = "_bti" if self.config.bti == 1 else ""
183 output_file.write(self.build_template(template_name, item, True))
188 def __init__(self, prog): argument
189 RomlibApplication.__init__(self, prog)
190 self.args.add_argument("file", help="Input file")
192 def main(self): argument
194 index_file_parser.parse(self.config.file)
207 def __init__(self, prog): argument
208 RomlibApplication.__init__(self, prog)
210 self.args.add_argument("-b", help="Build directory", default=".", metavar="build")
211 self.args.add_argument("--bti", help="Branch Target Identification", type=int)
212 self.args.add_argument("--list", help="Only list assembly files", action="store_true")
213 self.args.add_argument("file", help="Input file")
215 def main(self): argument
221 index_file_parser.parse(self.config.file)
223 bti = "_bti" if self.config.bti == 1 else ""
233 if not self.config.list:
236 function_offset = item_index * (8 if self.config.bti else 4)
239 files.append(self.build_template("wrapper" + bti + ".S", item))
241 if self.config.list:
242 print(self.config.b + "/wrappers.s")
244 with open(self.config.b + "/wrappers.s", "w") as asm_file:
250 def __init__(self, prog): argument
251 RomlibApplication.__init__(self, prog)
253 self.args.add_argument("-o", "--output", help="Output file", metavar="output",
255 self.args.add_argument("file", help="Input file")
257 def main(self): argument
262 symbols = subprocess.check_output(["nm", "-a", self.config.file])
266 raise Exception("No '.text' section was found in %s" % self.config.file)
270 with open(self.config.output, "w") as output_file:
271 output_file.write(self.build_template("jmptbl_glob_var.S", mapping))