Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
savoirfairelinux
jami-daemon
Commits
c4da9deb
Commit
c4da9deb
authored
3 years ago
by
Olivier Dion
Browse files
Options
Downloads
Patches
Plain Diff
agent: Use scm_schell() for execution of the agent
Change-Id: Ief1fd8fc1058f77784260d5be7a116d13ce06480
parent
8468af34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/agent/README.md
+1
-1
1 addition, 1 deletion
test/agent/README.md
test/agent/main.cpp
+20
-37
20 additions, 37 deletions
test/agent/main.cpp
with
21 additions
and
38 deletions
test/agent/README.md
+
1
−
1
View file @
c4da9deb
...
...
@@ -31,7 +31,7 @@ stage, Guile must be already available.
cd
daemon
./configure
--enable-agent
# you can other options if needed such as --enable-debug
cd test
/agent
make
agent
make
check
```
# Running the agent
...
...
This diff is collapsed.
Click to expand it.
test/agent/main.cpp
+
20
−
37
View file @
c4da9deb
...
...
@@ -32,50 +32,30 @@
/* std */
#include
<fstream>
/* Guile helpers */
static
SCM
main_body
(
void
*
path_raw
)
static
void
fini
()
{
const
char
*
path
=
(
const
char
*
)
path_raw
;
if
(
0
==
strcmp
(
"-"
,
path
))
{
scm_c_primitive_load
(
"/dev/stdin"
);
}
else
{
scm_c_primitive_load
(
path
);
}
return
SCM_UNDEFINED
;
Agent
::
instance
().
fini
();
DRing
::
fini
();
}
static
SCM
main_catch
(
void
*
nil
,
SCM
key_sym
,
SCM
rest_lst
)
{
(
void
)
nil
;
SCM
fmt_str
=
scm_from_utf8_string
(
"Guile exception `~a`: ~a"
);
SCM
args_lst
=
scm_list_2
(
key_sym
,
rest_lst
);
SCM
to_print_str
=
scm_simple_format
(
SCM_BOOL_F
,
fmt_str
,
args_lst
);
char
*
to_print_raw
=
scm_to_locale_string
(
to_print_str
);
AGENT_ERR
(
"%s
\n
"
,
to_print_raw
);
free
(
to_print_raw
);
return
SCM_UNDEFINED
;
}
struct
args
{
int
argc
;
char
**
argv
;
};
void
*
main_inner
(
void
*
a
gent_config
_raw
)
/* In Guile context */
main_inner
(
void
*
a
rgs
_raw
)
/* In Guile context */
{
struct
args
*
args
=
(
struct
args
*
)
args_raw
;
install_scheme_primitives
();
Agent
::
instance
().
init
();
scm_internal_catch
(
SCM_BOOL_T
,
main_body
,
agent_config_raw
,
main_catch
,
nullptr
);
atexit
(
fini
);
Agent
::
instance
().
fini
(
);
scm_shell
(
args
->
argc
,
args
->
argv
);
return
nullptr
;
}
...
...
@@ -91,12 +71,15 @@ main(int argc, char* argv[])
setenv
(
"GUILE_LOAD_PATH"
,
"."
,
1
);
/* NOTE! It's very important to initialize the daemon before entering Guile!!! */
DRing
::
init
(
DRing
::
InitFlag
(
DRing
::
DRING_FLAG_DEBUG
|
DRing
::
DRING_FLAG_CONSOLE_LOG
));
DRing
::
init
(
DRing
::
InitFlag
(
DRing
::
DRING_FLAG_DEBUG
));
AGENT_ASSERT
(
DRing
::
start
(
""
),
"Failed to start daemon"
);
/* Entering guile context */
scm_with_guile
(
main_inner
,
argv
[
1
]);
struct
args
args
;
DRing
::
fini
();
args
.
argc
=
argc
;
args
.
argv
=
argv
;
/* Entering guile context */
scm_with_guile
(
main_inner
,
(
void
*
)
&
args
);
}
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