mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
add scm_c_program_source
* libguile/programs.h: * libguile/programs.c (scm_c_program_source): New helper for getting source information from C.
This commit is contained in:
parent
e052d29640
commit
9a9f64874a
2 changed files with 20 additions and 0 deletions
|
@ -199,6 +199,24 @@ SCM_DEFINE (scm_program_meta, "program-meta", 1, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
extern SCM
|
||||
scm_c_program_source (struct scm_program *p, size_t ip)
|
||||
{
|
||||
SCM meta, sources, source;
|
||||
|
||||
if (scm_is_false (p->meta))
|
||||
return SCM_BOOL_F;
|
||||
meta = scm_call_0 (p->meta);
|
||||
if (scm_is_false (meta))
|
||||
return SCM_BOOL_F;
|
||||
sources = scm_cadr (meta);
|
||||
source = scm_assv (scm_from_size_t (ip), sources);
|
||||
if (scm_is_false (source))
|
||||
return SCM_BOOL_F;
|
||||
|
||||
return scm_cdr (source); /* a #(line column file) vector */
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_program_objects, "program-objects", 1, 0, 0,
|
||||
(SCM program),
|
||||
"")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue