summaryrefslogtreecommitdiff
path: root/guile/src/errors.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@chbouib.org>2007-05-30 00:39:23 +0200
committerLudovic Courtès <ludo@chbouib.org>2007-05-30 00:39:23 +0200
commitd374e7df710477ae0212234d688064876cb7d05f (patch)
tree9130cc704019c6b89da9eb2b5dd7da59d41b8b31 /guile/src/errors.c
parent331a51173f748bca0850a275dd9454486948a9da (diff)
downloadgnutls-d374e7df710477ae0212234d688064876cb7d05f.tar.gz
Started Guile integration.
Documentation is still missing. A bit rough on the edges, but `make' and `make check' do work.
Diffstat (limited to 'guile/src/errors.c')
-rw-r--r--guile/src/errors.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/guile/src/errors.c b/guile/src/errors.c
new file mode 100644
index 0000000000..fdc46c4a9b
--- /dev/null
+++ b/guile/src/errors.c
@@ -0,0 +1,53 @@
+/* GNUTLS --- Guile bindings for GnuTLS.
+ Copyright (C) 2007 Free Software Foundation
+
+ GNUTLS is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ GNUTLS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with GNUTLS; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/* Written by Ludovic Courtès <ludo@chbouib.org>. */
+
+#include <libguile.h>
+#include <gnutls/gnutls.h>
+
+#include "errors.h"
+#include "enums.h"
+
+SCM_SYMBOL (gnutls_error_key, "gnutls-error");
+
+void
+scm_gnutls_error (int c_err, const char *c_func)
+{
+ SCM err, func;
+
+ /* Note: If error code C_ERR is unknown, then ERR will be `#f'. */
+ err = scm_from_gnutls_error (c_err);
+ func = scm_from_locale_symbol (c_func);
+
+ (void) scm_throw (gnutls_error_key, scm_list_2 (err, func));
+
+ /* XXX: This is actually never reached, but since the Guile headers don't
+ declare `scm_throw ()' as `noreturn', we must add this to avoid GCC's
+ complaints. */
+ abort ();
+}
+
+
+void
+scm_init_gnutls_error (void)
+{
+#include "errors.c.x"
+}
+
+/* arch-tag: 48f07ecf-65c4-480c-b043-a51eab592d6b
+ */