1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Add "custom ports"

Custom ports are a kind of port that exposes the C port type interface
directly to Scheme.  In this way the full capability of C is available
to Scheme, and also the read and write functions can be tail-called from
Scheme (via port-read / port-write).

* libguile/custom-ports.c:
* libguile/custom-ports.h:
* module/ice-9/custom-ports.scm: New files.
* libguile/init.c:
* libguile/Makefile.am:
* am/bootstrap.am: Add to the build.
* doc/ref/api-io.texi: Update the manual.
This commit is contained in:
Andy Wingo 2023-05-27 21:51:57 +02:00
parent 67dbc60e8f
commit 1852fbfef9
7 changed files with 664 additions and 180 deletions

View file

@ -1,4 +1,4 @@
/* Copyright 1995-2004,2006,2009-2014,2016-2020
/* Copyright 1995-2004,2006,2009-2014,2016-2021,2023
Free Software Foundation, Inc.
This file is part of Guile.
@ -52,6 +52,7 @@
#include "chars.h"
#include "continuations.h"
#include "control.h"
#include "custom-ports.h"
#include "debug.h"
#ifdef GUILE_DEBUG_MALLOC
#include "debug-malloc.h"
@ -373,6 +374,7 @@ scm_i_init_guile (void *base)
scm_bootstrap_programs ();
scm_bootstrap_vm ();
scm_register_atomic ();
scm_register_custom_ports ();
scm_register_fdes_finalizers ();
scm_register_foreign ();
scm_register_foreign_object ();