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
b32aed55
Commit
b32aed55
authored
5 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[Ivette/server] configure
parent
e0770106
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Ivette/src/frama-c/server.js
+11
-43
11 additions, 43 deletions
Ivette/src/frama-c/server.js
with
11 additions
and
43 deletions
Ivette/src/frama-c/server.js
+
11
−
43
View file @
b32aed55
...
@@ -27,33 +27,6 @@ import Zmq from 'zeromq' ;
...
@@ -27,33 +27,6 @@ import Zmq from 'zeromq' ;
*/
*/
export
const
SERVER
=
'
frama-c.server
'
;
export
const
SERVER
=
'
frama-c.server
'
;
// --------------------------------------------------------------------------
// --- Server Utilities
// --------------------------------------------------------------------------
/*
const SERVER_LOG = '-server-log' ;
const SERVER_NO_LOG = '-server-no-log' ;
const SERVER_OPT = '-server-zmq' ;
const SERVER_DEF = '-server-zmq=' ;
const SERVER_URL = '.frama-c.socket.io' ;
const getZmqLog = (params) => params.find((opt) => (
opt === SERVER_LOG || opt === SERVER_NO_LOG
));
const getZmqURL = (params) => {
let def = params.findIndex((opt) => opt.startsWith(SERVER_DEF));
if (def) {
let quote = def[ SERVER_DEF.length ];
return ( quote === "'" || quote === '"' )
? def.slice( SERVER_DEF.length + 1 , -1 )
: def.slice( SERVER_DEF.length );
}
let pos = params.findIndex((opt) => opt.startsWith(SERVER_OPT));
if (pos) return params[pos+1];
return undefined ;
};
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- Server Status
// --- Server Status
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -317,25 +290,19 @@ export function clear() {
...
@@ -317,25 +290,19 @@ export function clear() {
/**
/**
@summary Configure the Server.
@summary Configure the Server.
@param {object} config - Server Configuration
@param {object} config - Server Configuration
@param {Object} [config.env] - Process environment variables (default: `undefined`)
@param {string} [config.cwd] - Working directory (default: current)
@param {string} [config.cwd] - Working directory (default: current)
@param {string} [config.command] - Server command (default: `frama-c`)
@param {string} [config.command] - Server command (default: `frama-c`)
@param {Array.<string>} [config.params] - Server arguments (default: `-server-zmq .frama-c.socket.io`)
@param {Array.<string>} [config.params] - Additional server arguments (default: empty)
@param {string} [config.sockaddr] - Server socket name (default: `.frama-c.socket.io`)
@param {string} [config.sockaddr] - Server socket (default: `ipc:///.frama-c.socket.io`)
@param {number} [config.timeout] - Shutdown timeout before server is hard killed, in milliseconds (default: 300ms)
@param {number} [config.polling] - Server polling period, in milliseconds (default: 50ms)
@param {string} [config.logout] - Process stdout log file (default: `undefined`)
@param {string} [config.logout] - Process stdout log file (default: `undefined`)
@param {string} [config.logerr] - Process stderr log file (default: `undefined`)
@param {string} [config.logerr] - Process stderr log file (default: `undefined`)
@param {Object} [config.env] - Process environment variables (default: `undefined`)
*/
*/
export
function
configure
(
cfg
)
export
function
configure
(
cfg
)
{
{
if
(
!
cfg
)
config
=
cfg
;
config
=
{
command
:
'
frama-c
'
,
params
:
[
'
-server-zmq
'
,
'
.frama-c.socket.io
'
],
sockaddr
:
'
.frama-c.socket.io
'
};
else
config
=
cfg
;
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -345,11 +312,12 @@ export function configure( cfg )
...
@@ -345,11 +312,12 @@ export function configure( cfg )
async
function
_launch
()
{
async
function
_launch
()
{
_reset
();
_reset
();
if
(
!
config
)
throw
(
'
Frama-C Server not configured
'
);
if
(
!
config
)
throw
(
'
Frama-C Server not configured
'
);
let
{
env
,
cwd
,
command
,
params
,
sockaddr
,
logout
,
logerr
}
=
config
;
let
{
env
,
cwd
,
command
=
'
frama-c
'
,
params
,
sockaddr
,
logout
,
logerr
}
=
config
;
if
(
!
cwd
)
cwd
=
System
.
getWorkingDir
();
if
(
!
cwd
)
cwd
=
System
.
getWorkingDir
();
sockaddr
=
System
.
join
(
cwd
,
sockaddr
);
if
(
!
sockaddr
)
sockaddr
=
System
.
join
(
cwd
,
'
.frama-c.socket.io
'
);
logout
=
logout
&&
System
.
join
(
cwd
,
logout
);
logout
=
logout
&&
System
.
join
(
cwd
,
logout
);
logerr
=
logerr
&&
System
.
join
(
cwd
,
logerr
);
logerr
=
logerr
&&
System
.
join
(
cwd
,
logerr
);
params
=
params
.
concat
(
'
-then
'
,
'
-server-zmq
'
,
'
ipc://
'
+
sockaddr
);
let
options
=
{
let
options
=
{
cwd
,
cwd
,
stdout
:
{
path
:
logout
,
pipe
:
true
},
stdout
:
{
path
:
logout
,
pipe
:
true
},
...
@@ -502,11 +470,11 @@ function _flush() {
...
@@ -502,11 +470,11 @@ function _flush() {
function
_poll
()
{
function
_poll
()
{
if
(
!
polling
)
{
if
(
!
polling
)
{
let
timeout
=
(
config
&&
config
.
polling
)
||
50
;
let
delay
=
(
config
&&
config
.
polling
)
||
50
;
polling
=
setTimeout
(()
=>
{
polling
=
setTimeout
(()
=>
{
polling
=
false
;
polling
=
false
;
_send
();
_send
();
},
timeout
);
},
delay
);
}
}
}
}
...
...
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