[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] FILE* interface
From: |
felix |
Subject: |
Re: [Chicken-users] FILE* interface |
Date: |
Wed, 3 Jul 2002 09:35:16 +0200 |
> What are your thoughts on implementing a FILE* interface for chicken?
>
> For example, I have some functions that looks like this:
>
> Emit a string representation of op in base to stream.
> size_t mpq_out_str(FILE *stream, int base, mpq_t op);
>
> Read a string representation of op in base from stream.
> size_t mpq_inp_str(mpq_t, FILE *stream, int base);
>
> How would you represent these nicely with file i/o in chicken?
Hm. A good question.
Something along these lines would perhaps be nice:
[procedure] (file*->port FILEPTR) -> PORT
[procedure] (port->file* FILEPTR) -> FILEPTR
(I will implement something and send you the code)
> The size_t still makes me jittery with chicken. I'm still not sure how I
feel
> about not handling typedefs natively.
>
> (define-foreign-type pid_t
> (typedef "pid_t"))
>
> has a nice ring to it. :) But I'm not sure how to implement this.
Currently not possible: when `pid_t' is used directly as a foreign
argument- or return-type, the compiler can not infer a conversion
operation.
>
> I think I'd just have to do:
>
> (define-foreign-type size_t int)
>
> but that sorta defeats the purpose of <sys/types.h> providing this for you
> automatically on each architecture you wish to use. Maybe there is a way
to
> automate this and provide a chicken interface for it, like:
>
> (include "unix/sys/types.sch")
>
> where types.sch is automatically provided for you when you build the
system
> and is found automatically during the compilation process. It would hold
> all sorts of definitions for things like size_t and what not. Just an
idea.
>
Sensible. I will think about this. Perhaps we can provide something similar.
cheers,
felix