def loadHooks(self):
    target   = self.target
    config   = self.target.config
    lib      = self.target.library
    platform = self.target.project.platform
    
    # Collect hooks in various locations
    for fileName in config.get("hooks", []):
      Log.notice("Parsing hooks from '%s'." % fileName)
      source = self.readSource(fileName)
      functions = Parser.parseSource(source).functions.values()
      if not functions:
        Log.warn("No hooks found.")
      for f in functions:
        Log.debug("%s %s(%s)" % (f.type, f.name, ", ".join(["%s %s" % (t.type, p) for p, t in f.parameters.items()])))
      for function in functions:
        if not function.body:
          Log.warn("Hook function '%s' has no body." % function.name)
          continue
        if function.name.startswith("@"):
          lib.hooks[function.name] = function.body
          continue
        else:
          try:
            name, hookName = function.name.split(".", 1)
            if not name in lib.functions:
              target.fail("Function '%s' referred by hook function '%s' does not exist." % (name, function.name))
            if not hookName.startswith("@") and not hookName in lib.functions[name].parameters:
              target.fail("Parameter '%s' referred by hook function '%s' does not exist." % (hookName, function.name))
            lib.functions[name].hooks[hookName] = function.body
          except __HOLE__:
            target.fail("Hook function name '%s' is not valid." % function.name)
dataset/ETHPy150Open skyostil/tracy/src/generator/Target.py/ParserTool.loadHooks