From 6f6feddf9a07214e133438c4af4d32064d671a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 2 Feb 2019 23:13:47 +0100 Subject: Made code.scm do same stuff as main. --- scheme.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scheme.c') diff --git a/scheme.c b/scheme.c index 05bc4b0d..cacd502e 100644 --- a/scheme.c +++ b/scheme.c @@ -47,9 +47,16 @@ SCM calendar_get_attr(SCM calendar, SCM id, SCM attr) { return scm_from_strbuf(&c->val); } +SCM number_events(SCM calendar) { + scm_assert_foreign_object_type (calendar_type, calendar); + vcalendar* cal = scm_foreign_object_ref (calendar, 0); + return scm_from_size_t (cal->n_events); +} + void init_calendar () { init_calendar_type(); scm_c_define_gsubr ("make-calendar", 1, 0, 0, make_calendar); scm_c_define_gsubr ("get-attr", 3, 0, 0, calendar_get_attr); + scm_c_define_gsubr ("calendar-size", 1, 0, 0, number_events); } -- cgit v1.2.3