Beispiel #1
0
struct ui_file *
ui_file_new (void)
{
  struct ui_file *file = xmalloc (sizeof (struct ui_file));
  file->magic = &ui_file_magic;
  set_ui_file_data (file, NULL, null_file_delete);
  set_ui_file_flush (file, null_file_flush);
  set_ui_file_write (file, null_file_write);
  set_ui_file_fputs (file, null_file_fputs);
  set_ui_file_isatty (file, null_file_isatty);
  set_ui_file_rewind (file, null_file_rewind);
  set_ui_file_put (file, null_file_put);
  return file;
}
static struct ui_file *
ioscm_file_port_new (SCM port)
{
  ioscm_file_port *stream = XCNEW (ioscm_file_port);
  struct ui_file *file = ui_file_new ();

  set_ui_file_data (file, stream, ioscm_file_port_delete);
  set_ui_file_rewind (file, ioscm_file_port_rewind);
  set_ui_file_put (file, ioscm_file_port_put);
  set_ui_file_write (file, ioscm_file_port_write);
  stream->magic = &file_port_magic;
  stream->port = port;

  return file;
}