12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182(**************************************************************************)(* *)(* This file is part of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)(** Frama-C Entry Point (last linked module).
@see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> Plug-in Development Guide *)letplay_analysis()=ifKernel.TypeCheck.get()thenbeginifKernel.Files.get()<>[]||Kernel.TypeCheck.is_set()thenbeginAst.compute();(* Printing files before anything else (in debug mode only) *)ifKernel.debug_atleast1&&Kernel.is_debug_key_enabledKernel.dkey_astthenFile.pretty_ast()endend;tryDb.Main.apply();Log.treat_deferred_error();(* Printing code, if required, have to be done at end. *)ifKernel.PrintCode.get()thenFile.pretty_ast();(* Easier to handle option -set-project-as-default at the last moment:
no need to worry about nested [Project.on] *)Project.set_keep_current(Kernel.Set_project_as_default.get());(* unset Kernel.Set_project_as_default, but only if it set.
This avoids disturbing the "set by user" flag. *)ifKernel.Set_project_as_default.get()thenKernel.Set_project_as_default.off()withGlobals.No_such_entry_pointmsg->Kernel.abort"%s"msgleton_from_namenamef=tryProject.on(Project.from_unique_namename)f()withProject.Unknown_project->Kernel.abort"no project `%s'."namelet()=Db.Main.play:=play_analysis(* ************************************************************************* *)(** Booting Frama-C *)(* ************************************************************************* *)(* Main: let's go! *)let()=Sys.catch_breaktrue;letf()=ignore(Project.create"default");leton_from_name={Cmdline.on_from_name}inCmdline.parse_and_boot~on_from_name~get_toplevel:(fun()->!Db.Toplevel.run)~play_analysisinCmdline.catch_toplevel_run~f~at_normal_exit:Cmdline.run_normal_exit_hook~on_error:Cmdline.run_error_exit_hook;(* Implicit exit 0 if we haven't exited yet *)(*
Local Variables:
compile-command: "make -C ../../.."
End:
*)