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
8bab18aa
Commit
8bab18aa
authored
3 years ago
by
Olivier Dion
Committed by
Sébastien Blin
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
agent: Add compilation of Scheme file
Change-Id: Ic25a41cb28ae1e8b8dc51a149c304edc7f04ef50
parent
aadc8690
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/agent/.gitignore
+2
-1
2 additions, 1 deletion
test/agent/.gitignore
test/agent/Makefile.am
+18
-0
18 additions, 0 deletions
test/agent/Makefile.am
test/agent/src/main.cpp
+42
-6
42 additions, 6 deletions
test/agent/src/main.cpp
with
62 additions
and
7 deletions
test/agent/.gitignore
+
2
−
1
View file @
8bab18aa
...
...
@@ -3,4 +3,5 @@ agent
*.txt
*.log
.gdbinit
*.gdb
\ No newline at end of file
*.gdb
*.go
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/agent/Makefile.am
+
18
−
0
View file @
8bab18aa
...
...
@@ -17,3 +17,21 @@ agent_exe_SOURCES = \
src/bindings/signal.h
agent_exe_LDADD
=
$(
top_builddir
)
/src/libring.la
MODULES
=
\
agent.scm
\
examples/active-agent.scm
\
examples/passive-agent.scm
\
jami/logger.scm
\
scenarios/peer-monitor/scenario.scm
GOBJECTS
=
$(
MODULES:%
=
%.go
)
%.go
:
% | agent.exe
@
echo
"agent.exe compile
$^
"
@
ASAN_OPTIONS
=
alloc_dealloc_mismatch
=
0:detect_leaks
=
0
\
./agent.exe compile
$<
$@
compile
:
$(GOBJECTS)
CLEANFILES
=
$(
GOBJECTS
)
This diff is collapsed.
Click to expand it.
test/agent/src/main.cpp
+
42
−
6
View file @
8bab18aa
...
...
@@ -33,6 +33,11 @@ struct args {
char
**
argv
;
};
static
bool
streq
(
const
char
*
A
,
const
char
*
B
)
{
return
0
==
strcmp
(
A
,
B
);
}
void
*
main_in_guile
(
void
*
args_raw
)
{
...
...
@@ -48,18 +53,49 @@ main_in_guile(void* args_raw)
return
nullptr
;
}
void
*
compile_in_guile
(
void
*
args_raw
)
{
struct
args
*
args
=
static_cast
<
struct
args
*>
(
args_raw
);
char
buf
[
4096
];
if
(
args
->
argc
<
4
)
{
fprintf
(
stderr
,
"Usage: agent.exe compile FILE OUT
\n
"
);
exit
(
EXIT_FAILURE
);
}
install_scheme_primitives
();
snprintf
(
buf
,
sizeof
(
buf
),
"(use-modules (system base compile)) (compile-file
\"
%s
\"
#:output-file
\"
%s
\"
)"
,
args
->
argv
[
2
],
args
->
argv
[
3
]);
scm_c_eval_string
(
buf
);
scm_gc
();
return
nullptr
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
args
args
=
{
argc
,
argv
};
setenv
(
"GUILE_LOAD_PATH"
,
"."
,
1
);
setenv
(
"GUILE_LOAD_COMPILED_PATH"
,
"."
,
1
);
/* NOTE! It's very important to initialize the daemon before entering Guile!!! */
DRing
::
init
(
DRing
::
InitFlag
(
DRing
::
DRING_FLAG_DEBUG
));
if
(
argc
>
1
&&
streq
(
argv
[
1
],
"compile"
))
{
scm_with_guile
(
compile_in_guile
,
(
void
*
)
&
args
);
}
else
{
AGENT_ASSERT
(
DRing
::
start
(
""
),
"Failed to start daemon"
);
/* NOTE! It's very important to initialize the daemon before entering Guile!!! */
DRing
::
init
(
DRing
::
InitFlag
(
DRing
::
DRING_FLAG_DEBUG
));
struct
args
args
=
{
argc
,
argv
};
AGENT_ASSERT
(
DRing
::
start
(
""
),
"Failed to start daemon"
);
/* Entering guile context - This never returns */
scm_with_guile
(
main_in_guile
,
(
void
*
)
&
args
);
}
/* Entering guile context - This never returns */
scm_with_guile
(
main_in_guile
,
(
void
*
)
&
args
);
exit
(
EXIT_SUCCESS
);
}
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