/* ports.i --- Guile typemaps for handling ports -*- c -*-
Copyright (C) 2000, 2004 Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>
$Header: /cvsroot/swig/SWIG/Lib/guile/ports.i,v 1.5 2004/04/26 14:09:02 mkoeppe Exp $
/* This is needed on Solaris for fdopen(). */
# define _POSIX_SOURCE 199506L
/* This typemap for FILE * accepts
(1) FILE * pointer objects,
(2) Scheme file ports. In this case, it creates a temporary C stream
which reads or writes from a dup'ed file descriptor.
%typemap(in, doc="$NAME is a file port or a FILE * pointer") FILE *
if (SWIG_ConvertPtr($input, (void**) &($1), $1_descriptor, 0) == 0) {
else if(!(SCM_FPORTP($input)))
scm_wrong_type_arg("$name", $argnum, $input);
if (SCM_OUTPUT_PORT_P($input))
scm_force_output($input);
fd=dup(SCM_FPORT_FDES($input));
scm_misc_error("$name", strerror(errno), SCM_EOL);
SCM_OUTPUT_PORT_P($input)
? (SCM_INPUT_PORT_P($input)
scm_misc_error("$name", strerror(errno), SCM_EOL);
%typemap(freearg) FILE* {