[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a new port in C for use in guile

From: Ludovic Courtès
Subject: Re: Creating a new port in C for use in guile
Date: Thu, 04 Sep 2014 13:00:39 +0200
User-agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux)

Joshua Datko <address@hidden> skribis:

> I want to make a new Port. I would like to write the port implementation
> in C and use that port in scheme.
> I'm a bit confused on how to proceed though. From reading the docs, it
> seems I have to create a C function, in the form of an extension, that
> calls scm_make_port_type.
> However, the manual states [1] that the return value from
> scm_make_port_type is a scm_ptob_descriptor. I'm confused on how I
> instantiate this new port type to get a scm_port.

‘scm_make_port_type’ returns a number of the ‘scm_t_bits’ type.  That
number identifies the port type internally.

Then, to instantiate a port of that type, use

--8<---------------cut here---------------start------------->8---
  scm_t_bits port_type;
  port_type = scm_make_port_type (...);


  SCM port;
  port = scm_new_port_table_entry (port_type);
--8<---------------cut here---------------end--------------->8---

Here’s a couple of examples:

Hope this helps!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]