summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-05-06 21:38:13 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-05-06 21:38:13 +0000
commit070635cb6e0b42c7a485189d1a58db04482de0f8 (patch)
treeb814420bed82cf36ba64bbd44841d63eb2ded1e4 /mixlib
parent6c118b8f8965a5fbb602ad556b584f6f8c0c26c0 (diff)
downloadmdk-070635cb6e0b42c7a485189d1a58db04482de0f8.tar.gz
mdk-070635cb6e0b42c7a485189d1a58db04482de0f8.tar.bz2
support for gtk binary devices added
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_device.c26
-rw-r--r--mixlib/xmix_device.c47
-rw-r--r--mixlib/xmix_device.h15
3 files changed, 63 insertions, 25 deletions
diff --git a/mixlib/mix_device.c b/mixlib/mix_device.c
index 13e7150..6870427 100644
--- a/mixlib/mix_device.c
+++ b/mixlib/mix_device.c
@@ -29,14 +29,7 @@ mix_device_new (mix_device_type_t type)
mix_device_t *result = NULL;
g_return_val_if_fail (type < mix_dev_INVALID, NULL);
result = g_new (mix_device_t, 1);
- 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_;
+ construct_device_ (result, type);
return result;
}
@@ -49,18 +42,7 @@ mix_device_new_with_name (mix_device_type_t type, const gchar *name)
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (type < mix_dev_INVALID, NULL);
result = g_new (mix_device_t, 1);
- 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_;
+ construct_device_with_name_ (result, type, name);
return result;
}
@@ -74,9 +56,7 @@ mix_device_new_with_file (mix_device_type_t type, FILE *file)
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (type < mix_dev_INVALID, NULL);
result = g_new (mix_device_t, 1);
- result->type = type;
- result->file = mix_io_new (file);
- result->vtable = DEF_DEV_VTABLE_;
+ construct_device_with_file_ (result, type, file);
return result;
}
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.
*/
diff --git a/mixlib/xmix_device.h b/mixlib/xmix_device.h
index 45fd7d3..4c2866a 100644
--- a/mixlib/xmix_device.h
+++ b/mixlib/xmix_device.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- xmix_device.h :
* Protected declarations for mix_device_t
* ------------------------------------------------------------------
- * Last change: Time-stamp: <01/03/02 01:15:22 jose>
+ * Last change: Time-stamp: <2001-05-04 23:35:39 jao>
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -56,6 +56,19 @@ struct mix_device_t
const mix_device_vtable_t *vtable;
};
+/* constructors */
+extern void
+construct_device_ (mix_device_t *dev, mix_device_type_t type);
+
+extern void
+construct_device_with_name_ (mix_device_t *dev,
+ mix_device_type_t type, const gchar *name);
+
+extern void
+construct_device_with_file_ (mix_device_t *dev,
+ mix_device_type_t type, FILE *file);
+
+
#define GET_CHANNEL_(dev) (dev->file)
#define GET_FILE_(dev) ((mix_file_t *)(dev->file))