add pic_proc_name
This commit is contained in:
parent
a304feaa28
commit
cf1e1a8746
|
@ -48,6 +48,8 @@ struct pic_proc {
|
||||||
struct pic_proc *pic_proc_new(pic_state *, pic_func_t, const char *);
|
struct pic_proc *pic_proc_new(pic_state *, pic_func_t, const char *);
|
||||||
struct pic_proc *pic_proc_new_irep(pic_state *, struct pic_irep *, struct pic_env *);
|
struct pic_proc *pic_proc_new_irep(pic_state *, struct pic_irep *, struct pic_env *);
|
||||||
|
|
||||||
|
pic_sym pic_proc_name(struct pic_proc *);
|
||||||
|
|
||||||
/* closed variables accessor */
|
/* closed variables accessor */
|
||||||
void pic_proc_cv_init(pic_state *, struct pic_proc *, size_t);
|
void pic_proc_cv_init(pic_state *, struct pic_proc *, size_t);
|
||||||
int pic_proc_cv_size(pic_state *, struct pic_proc *);
|
int pic_proc_cv_size(pic_state *, struct pic_proc *);
|
||||||
|
|
12
src/proc.c
12
src/proc.c
|
@ -34,6 +34,18 @@ pic_proc_new_irep(pic_state *pic, struct pic_irep *irep, struct pic_env *env)
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pic_sym
|
||||||
|
pic_proc_name(struct pic_proc *proc)
|
||||||
|
{
|
||||||
|
switch (proc->kind) {
|
||||||
|
case PIC_PROC_KIND_FUNC:
|
||||||
|
return proc->u.func.name;
|
||||||
|
case PIC_PROC_KIND_IREP:
|
||||||
|
return proc->u.irep->name;
|
||||||
|
}
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pic_proc_cv_init(pic_state *pic, struct pic_proc *proc, size_t cv_size)
|
pic_proc_cv_init(pic_state *pic, struct pic_proc *proc, size_t cv_size)
|
||||||
{
|
{
|
||||||
|
|
4
src/vm.c
4
src/vm.c
|
@ -687,12 +687,12 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
|
||||||
puts(")");
|
puts(")");
|
||||||
if (! pic_proc_func_p(proc)) {
|
if (! pic_proc_func_p(proc)) {
|
||||||
printf(" irep = %p\n", proc->u.irep);
|
printf(" irep = %p\n", proc->u.irep);
|
||||||
printf(" name = %s\n", pic_symbol_name(pic, proc->u.irep->name));
|
printf(" name = %s\n", pic_symbol_name(pic, pic_proc_name(proc)));
|
||||||
pic_dump_irep(proc->u.irep);
|
pic_dump_irep(proc->u.irep);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf(" cfunc = %p\n", (void *)proc->u.func.f);
|
printf(" cfunc = %p\n", (void *)proc->u.func.f);
|
||||||
printf(" name = %s\n", pic_symbol_name(pic, proc->u.func.name));
|
printf(" name = %s\n", pic_symbol_name(pic, pic_proc_name(proc)));
|
||||||
}
|
}
|
||||||
puts("== end\n");
|
puts("== end\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue