예제 #1
0
    def run(self):
        builder = build.Builder(self.project,
            os.path.join("/tmp", self.project.get_name() + ".h"))

        build.write_header_file(builder)
        builder.write_to_file()

        tester = base.tester.Tester()
        tester.prepare_writer = self.prepare_writer
        tester.args = [ "-I", os.path.join(paths.KAIRA_ROOT, paths.CAILIE_INCLUDE_DIR),
                        "-I", self.project.root_directory ]

        if self.project.get_build_with_octave():
            import ptp # To avoid cyclic import
            tester.args += [ "-I", os.path.join(paths.KAIRA_ROOT, paths.CAOCTAVE_INCLUDE_DIR) ]
            tester.args += ptp.get_config("Octave", "INCFLAGS").split()

        if self.project.build_target == "simrun":
            tester.args += [ "-I", os.path.join(paths.KAIRA_ROOT, paths.CASIMRUN_INCLUDE_DIR) ]

        tester.args += self.project.get_build_option("CFLAGS").split()
        tester.run()

        if tester.stderr:
            raise utils.PtpException(tester.stderr)

        for t in self.types.values():
            t.add_checks(tester)

        for check in self.checks:
            tester.add(check)

        check = tester.run()
        if check is not None:
            check.throw_exception()
예제 #2
0
def write_library_header_file(builder):
    build.write_header_file(builder, close_guard=False)
    builder.emptyline()
    builder.line("void calib_init(int argc, char **argv);")
    for p in builder.project.get_parameters():
        builder.line("void set_parameter_{0.name}({0.type} {0.name});", p)

    for net in builder.project.nets:
        builder.line("void {0}({1});", net.name,
                     get_library_function_declaration(net))
    build.write_header_file_close_guard(builder)
예제 #3
0
파일: library.py 프로젝트: DiPi22/kaira
def write_library_header_file(builder):
    build.write_header_file(builder, close_guard=False)
    builder.emptyline()
    builder.line("void calib_init(int argc, char **argv);")
    for p in builder.project.get_parameters():
        builder.line("void set_parameter_{0.name}({0.type} {0.name});", p)

    for net in builder.project.nets:
        builder.line("void {0}({1});",
                 net.name,
                 get_library_function_declaration(net))
    build.write_header_file_close_guard(builder)
예제 #4
0
파일: checker.py 프로젝트: Palasekm/Kaira
    def run(self):
        builder = build.Builder(self.project,
            os.path.join("/tmp", self.project.get_name() + ".h"))

        build.write_header_file(builder)
        builder.write_to_file()

        tester = base.tester.Tester()
        tester.prepare_writer = self.prepare_writer
        tester.args = [ "-I", os.path.join(paths.KAIRA_ROOT, paths.CAILIE_INCLUDE_DIR),
                        "-I", self.project.root_directory ]

        if self.project.get_build_with_octave():
            import ptp # To avoid cyclic import
            tester.args += [ "-I", os.path.join(paths.KAIRA_ROOT, paths.CAOCTAVE_INCLUDE_DIR) ]
            tester.args += ptp.get_config("Octave", "INCFLAGS").split()

        if self.project.build_target == "simrun":
            tester.args += [ "-I", os.path.join(paths.KAIRA_ROOT, paths.CASIMRUN_INCLUDE_DIR) ]

        tester.args += self.project.get_build_option("CFLAGS").split()
        tester.run()

        if tester.stderr:
            raise utils.PtpException(tester.stderr)

        for t in self.types.values():
            t.add_checks(tester)

        for expr, decls, return_type, source, message in self.expressions:
            check = CheckStatement(expr + ";", decls, source=source)
            if message:
                check.own_message = message
            tester.add(check)
            check = CheckStatement("return (" + expr + ");", decls, return_type, source)
            if message:
                check.own_message = message
            else:
                check.own_message = "Invalid type of expression"
            tester.add(check)

        check = tester.run()
        if check is not None:
            check.throw_exception()
예제 #5
0
파일: checker.py 프로젝트: Kobzol/kaira
    def run(self):
        builder = build.Builder(self.project, os.path.join("/tmp", self.project.get_name() + ".h"))

        build.write_header_file(builder)
        builder.write_to_file()

        tester = base.tester.Tester()
        tester.prepare_writer = self.prepare_writer
        tester.args = [
            "-I",
            os.path.join(paths.KAIRA_ROOT, paths.CAILIE_INCLUDE_DIR),
            "-I",
            self.project.root_directory,
        ]

        if self.project.get_build_with_octave():
            import ptp  # To avoid cyclic import

            tester.args += ["-I", os.path.join(paths.KAIRA_ROOT, paths.CAOCTAVE_INCLUDE_DIR)]
            tester.args += ptp.get_config("Octave", "INCFLAGS").split()

        if self.project.build_target == "simrun":
            tester.args += ["-I", os.path.join(paths.KAIRA_ROOT, paths.CASIMRUN_INCLUDE_DIR)]

        tester.args += self.project.get_build_option("CFLAGS").split()
        tester.run()

        if tester.stderr:
            raise utils.PtpException(tester.stderr)

        for t in self.types.values():
            t.add_checks(tester)

        for check in self.checks:
            tester.add(check)

        check = tester.run()
        if check is not None:
            check.throw_exception()
예제 #6
0
 def write_header_file(self, directory):
     builder = build.Builder(self.project,
                             self.get_filename(directory, ".h"))
     build.write_header_file(builder)
     builder.write_to_file()
예제 #7
0
파일: generator.py 프로젝트: Kobzol/kaira
 def write_header_file(self, directory):
     builder = build.Builder(self.project, self.get_filename(directory, ".h"))
     build.write_header_file(builder)
     builder.write_to_file()
예제 #8
0
파일: generator.py 프로젝트: Kobzol/kaira
 def get_header(self):
     builder = build.Builder(self.project)
     build.write_header_file(builder)
     return builder.get_string()
예제 #9
0
파일: generator.py 프로젝트: spirali/kaira
 def get_header(self):
     builder = build.Builder(self.project)
     build.write_header_file(builder)
     return builder.get_string()