aboutsummaryrefslogtreecommitdiff
path: root/guile_interface.scm.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-18 22:39:56 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-18 22:39:56 +0100
commit33fa5b5d0c512c72c1d50b9420a36431cd10eb5d (patch)
tree6642ec876ecd15ce62f83075d7f9d261050fe3a6 /guile_interface.scm.c
parentStart rework of guile interface. (diff)
downloadcalp-33fa5b5d0c512c72c1d50b9420a36431cd10eb5d.tar.gz
calp-33fa5b5d0c512c72c1d50b9420a36431cd10eb5d.tar.xz
Made to compile as C++.
Diffstat (limited to 'guile_interface.scm.c')
-rw-r--r--guile_interface.scm.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/guile_interface.scm.c b/guile_interface.scm.c
deleted file mode 100644
index 6aeeba66..00000000
--- a/guile_interface.scm.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "guile_interface.h"
-
-#include "vcal.h"
-#include "calendar.h"
-#include "guile_type_helpers.h"
-
-static SCM vcomponent_type;
-
-void init_vcomponent_type (void) {
- SCM name = scm_from_utf8_symbol("vcomponent");
- SCM slots = scm_list_1(scm_from_utf8_symbol("data"));
-
- vcomponent_type = scm_make_foreign_object_type(name, slots, NULL);
-}
-
-SCM_DEFINE (make_vcomponent, "make-vcomponent", 1, 0, 0,
- (SCM path),
- "Loads a vdir iCalendar from the given path.")
-{
- vcomponent* cal =
- (vcomponent*) scm_gc_malloc (
- sizeof(*cal), "vcomponent");
- INIT(vcomponent, cal, "ROOT");
-
- char* p = scm_to_utf8_stringn(path, NULL);
- read_vcalendar(cal, p);
- free(p);
-
- return scm_make_foreign_object_1
- (vcomponent_type, cal);
-
-}
-
-/*
- * Returns a line from a component.
- */
-SCM_DEFINE (vcomponent_get_attribute, "vcomponent-get-attribute", 2, 0, 0,
- (SCM calendar, SCM attr),
- "Retuns the given attribute from the vevent object at index in calendar.")
-{
- scm_assert_foreign_object_type (vcomponent_type, calendar);
- vcomponent* cal = scm_foreign_object_ref (calendar, 0);
-
- char* key = scm_to_utf8_stringn(scm_string_upcase(attr), NULL);
- content_line* c = get_property (cal, key);
- free(key);
-
- if (c == NULL) return SCM_BOOL_F;
-
- SCM llist = SCM_EOL;
- FOR (LLIST, content_set, v, &c->val) {
- llist = scm_cons(scm_from_strbuf(&v->key), llist);
- }
- return llist;
-}
-
-SCM_DEFINE (vcomponent_child_count, "vcomponent-child-count", 1, 0, 0,
- (SCM component),
- "Returns number of child components.")
-{
- scm_assert_foreign_object_type (vcomponent_type, component);
- vcomponent* c = scm_foreign_object_ref (component, 0);
- return scm_from_size_t (SIZE(VECT(vcomponent))(&c->components));
-}
-
-/* TODO This currently returns a new foreign object each time I call it. */
-SCM_DEFINE(vcomponent_children, "vcomponent-children", 1, 0, 0,
- (SCM component),
- "")
-{
- scm_assert_foreign_object_type (vcomponent_type, component);
- vcomponent* cal = scm_foreign_object_ref (component, 0);
- return scm_from_vector(&cal->components, vcomponent_type);
-}
-
-SCM_DEFINE(vcomponent_typeof, "vcomponent-typeof", 1, 0, 0,
- (SCM component),
- "Returns type of vcomponent")
-{
- scm_assert_foreign_object_type (vcomponent_type, component);
- vcomponent* comp = scm_foreign_object_ref (component, 0);
- return scm_from_utf8_symbol(comp->type);
-}
-
-void init_vcomponent () {
- init_vcomponent_type();
-
-#ifndef SCM_MAGIC_SNARFER
-#include "guile_interface.x"
-#endif
-}