Commit 9c21b773 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

Merge branch 'feature/michele/server/get-current-project-files' into 'master'

[Server] Add service for retrieving the current project source filenames.

See merge request frama-c/frama-c!2480
parents af482dc9 904ea7aa
......@@ -164,3 +164,38 @@ let () = Request.register ~page
(fun kf -> Jbuffer.to_json PP.pp_global (Kernel_function.get_global kf))
(* -------------------------------------------------------------------------- *)
(* --- Files --- *)
(* -------------------------------------------------------------------------- *)
let () =
Request.register
~page
~descr:(Md.plain "Get the currently analyzed source file names")
~kind:`GET
~name:"kernel.ast.getFiles"
~input:(module Junit) ~output:(module Jstring.Jlist)
Kernel.Files.get
let () =
Request.register
~page
~descr:(Md.plain "Set the source file names to analyze.")
~kind:`SET
~name:"kernel.ast.setFiles"
~input:(module Jstring.Jlist)
~output:(module Junit)
Kernel.Files.set
let () =
Request.register
~page
~descr:(Md.plain "Compute the AST of the currently set source file names.")
~kind:`EXEC
~name:"kernel.ast.execCompute"
~input:(module Junit)
~output:(module Junit)
(fun () ->
if not (Ast.is_computed ())
then File.init_from_cmdline ())
(* -------------------------------------------------------------------------- *)
......@@ -121,3 +121,17 @@ let () = Request.register ~page
(ProjectRequest.process `EXEC)
(* -------------------------------------------------------------------------- *)
(* --- Project Management --- *)
(* -------------------------------------------------------------------------- *)
let () =
Request.register
~page
~descr:(Md.plain "Create a new project")
~kind:`SET
~name:"kernel.project.setCreate"
~input:(module Jstring)
~output:(module ProjectInfo)
Project.create
(* -------------------------------------------------------------------------- *)
......@@ -147,10 +147,33 @@ let execute exec : _ response =
exec.request (Cmdline.protect exn) ;
`Error(exec.id,Printexc.to_string exn)
let acceptable_between_yield = 0.25 (* seconds *)
let execute_with_yield yield exec =
let db = !Db.progress in
Db.progress := if exec.yield then yield else no_yield ;
Extlib.try_finally ~finally:(fun () -> Db.progress := db) execute exec
let yield, check =
if Senv.debug_atleast 1 then
let time = ref (Unix.gettimeofday ()) in
let check () =
let time' = Unix.gettimeofday () in
let diff = time' -. !time in
if diff > acceptable_between_yield
then
Senv.debug
"Db.progress missing during %s request (spent %fs between calls)"
exec.request
diff
in
(fun () ->
check ();
yield ();
time := Unix.gettimeofday ()),
check
else
yield, ignore
in
Db.progress := if exec.yield then yield else no_yield;
Extlib.try_finally ~finally:(fun () -> Db.progress := db; check ()) execute exec
let execute_debug pp yield exec =
if Senv.debug_atleast 1 then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment