Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
904ea7aa
Commit
904ea7aa
authored
5 years ago
by
Michele Alberti
Browse files
Options
Downloads
Patches
Plain Diff
[Server] Implement proposed API for get/set/exec files.
parent
bee34c79
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/server/kernel_ast.ml
+35
-0
35 additions, 0 deletions
src/plugins/server/kernel_ast.ml
src/plugins/server/kernel_project.ml
+7
-8
7 additions, 8 deletions
src/plugins/server/kernel_project.ml
src/plugins/server/main.ml
+25
-2
25 additions, 2 deletions
src/plugins/server/main.ml
with
67 additions
and
10 deletions
src/plugins/server/kernel_ast.ml
+
35
−
0
View file @
904ea7aa
...
@@ -164,3 +164,38 @@ let () = Request.register ~page
...
@@ -164,3 +164,38 @@ let () = Request.register ~page
(
fun
kf
->
Jbuffer
.
to_json
PP
.
pp_global
(
Kernel_function
.
get_global
kf
))
(
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
()
)
(* -------------------------------------------------------------------------- *)
This diff is collapsed.
Click to expand it.
src/plugins/server/kernel_project.ml
+
7
−
8
View file @
904ea7aa
...
@@ -126,13 +126,12 @@ let () = Request.register ~page
...
@@ -126,13 +126,12 @@ let () = Request.register ~page
let
()
=
let
()
=
Request
.
register
Request
.
register
~
kind
:
`GET
~
page
~
page
~
name
:
"kernel.project.getSourceFileNames"
~
descr
:
(
Md
.
plain
"Create a new project"
)
~
descr
:
(
Md
.
plain
"Get the source file names of the current project"
)
~
kind
:
`SET
~
input
:
(
module
Junit
)
~
output
:
(
module
Jstring
.
Jlist
)
~
name
:
"kernel.project.setCreate"
(
fun
()
->
~
input
:
(
module
Jstring
)
List
.
map
~
output
:
(
module
ProjectInfo
)
(
fun
fname
->
(
Filepath
.
Normalized
.
of_string
fname
:>
string
))
Project
.
create
(
Kernel
.
Files
.
get
()
))
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
This diff is collapsed.
Click to expand it.
src/plugins/server/main.ml
+
25
−
2
View file @
904ea7aa
...
@@ -147,10 +147,33 @@ let execute exec : _ response =
...
@@ -147,10 +147,33 @@ let execute exec : _ response =
exec
.
request
(
Cmdline
.
protect
exn
)
;
exec
.
request
(
Cmdline
.
protect
exn
)
;
`Error
(
exec
.
id
,
Printexc
.
to_string
exn
)
`Error
(
exec
.
id
,
Printexc
.
to_string
exn
)
let
acceptable_between_yield
=
0
.
25
(* seconds *)
let
execute_with_yield
yield
exec
=
let
execute_with_yield
yield
exec
=
let
db
=
!
Db
.
progress
in
let
db
=
!
Db
.
progress
in
Db
.
progress
:=
if
exec
.
yield
then
yield
else
no_yield
;
let
yield
,
check
=
Extlib
.
try_finally
~
finally
:
(
fun
()
->
Db
.
progress
:=
db
)
execute
exec
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
=
let
execute_debug
pp
yield
exec
=
if
Senv
.
debug_atleast
1
then
if
Senv
.
debug_atleast
1
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment