1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Add internal function mapping subr index to function

* libguile/gsubr.h:
* libguile/gsubr.c (scm_subr_function_by_index): New internal function.
  (scm_subr_function): Use new function.
This commit is contained in:
Andy Wingo 2018-08-19 17:38:11 +02:00
parent 3827769aff
commit cf0270cb4c
2 changed files with 9 additions and 2 deletions

View file

@ -441,12 +441,18 @@ scm_i_primitive_name (const uint32_t *code)
}
scm_t_subr
scm_subr_function (SCM subr)
scm_subr_function_by_index (uint32_t idx)
{
uint32_t idx = primitive_subr_idx (SCM_PROGRAM_CODE (subr));
if (idx == NOT_A_SUBR_CALL)
abort ();
return subrs[idx];
}
scm_t_subr
scm_subr_function (SCM subr)
{
uint32_t idx = primitive_subr_idx (SCM_PROGRAM_CODE (subr));
return scm_subr_function_by_index (idx);
}
SCM

View file

@ -57,6 +57,7 @@ SCM_INTERNAL uintptr_t scm_i_primitive_call_ip (SCM subr);
SCM_INTERNAL SCM scm_i_primitive_name (const uint32_t *code);
SCM_API scm_t_subr scm_subr_function (SCM subr);
SCM_INTERNAL scm_t_subr scm_subr_function_by_index (uint32_t subr_idx);
SCM_API SCM scm_subr_name (SCM subr);
SCM_INTERNAL SCM scm_apply_subr (union scm_vm_stack_element *sp,