aboutsummaryrefslogtreecommitdiff
path: root/guile_type_helpers.c__
blob: 3f76c2d466740f77720ba812eb5fe34d9b8dd069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "guile_type_helpers.h"

#include "macro.h"

SCM scm_from_strbuf(strbuf* s)
	{ return scm_from_utf8_stringn (s->mem, s->len - 1); }

SCM scm_from_vector(VECT(vcomponent)* vect, SCM element_type) {
	SCM l = SCM_EOL;
	for (size_t i = 0; i < vect->length; i++) {
		l = scm_cons(
				scm_make_foreign_object_1 (element_type, GET(VECT(vcomponent))(vect, i)),
				l);
	}
	return scm_reverse(l);
}