summaryrefslogtreecommitdiffhomepage
path: root/mixlib/xmix_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixlib/xmix_device.c')
-rw-r--r--mixlib/xmix_device.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/mixlib/xmix_device.c b/mixlib/xmix_device.c
index 4754015..c93153a 100644
--- a/mixlib/xmix_device.c
+++ b/mixlib/xmix_device.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- xmix_device.c :
* Implementation of the functions declared in xmix_device.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/03/02 23:14:57 jose"
+ * Last change: Time-stamp: "2001-05-04 23:40:31 jao"
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -54,6 +54,51 @@ const mix_fmode_t FMODES_[] = {
mix_io_READ, mix_io_WRITE, mix_io_WRITE, mix_io_WRITE, mix_io_WRITE
};
+/* constructors */
+void
+construct_device_ (mix_device_t *result, mix_device_type_t type)
+{
+ result->type = type;
+ if (type != mix_dev_CONSOLE) {
+ result->file = MIX_IOCHANNEL(mix_file_new_with_def_ext (DEF_NAMES_[type],
+ FMODES_[type],
+ DEV_EXT_));
+ } else
+ result->file = mix_io_new (stdout);
+ result->vtable = DEF_DEV_VTABLE_;
+}
+
+
+void
+construct_device_with_name_ (mix_device_t *result,
+ mix_device_type_t type, const gchar *name)
+{
+ result->type = type;
+ if (type != mix_dev_CONSOLE)
+ {
+ result->file = MIX_IOCHANNEL(mix_file_new_with_def_ext (name,
+ FMODES_[type],
+ DEV_EXT_));
+ }
+ else
+ {
+ result->file = mix_io_new (stdout);
+ }
+ result->vtable = DEF_DEV_VTABLE_;
+}
+
+
+void
+construct_device_with_file_ (mix_device_t *result,
+ mix_device_type_t type, FILE *file)
+{
+ result->type = type;
+ result->file = mix_io_new (file);
+ result->vtable = DEF_DEV_VTABLE_;
+}
+
+
+
/*
Write a block to the device.
*/