summaryrefslogtreecommitdiffhomepage
path: root/mixlib/xmix_device.h
diff options
context:
space:
mode:
Diffstat (limited to 'mixlib/xmix_device.h')
-rw-r--r--mixlib/xmix_device.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/mixlib/xmix_device.h b/mixlib/xmix_device.h
new file mode 100644
index 0000000..45fd7d3
--- /dev/null
+++ b/mixlib/xmix_device.h
@@ -0,0 +1,77 @@
+/* -*-c-*- ---------------- xmix_device.h :
+ * Protected declarations for mix_device_t
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: <01/03/02 01:15:22 jose>
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef XMIX_DEVICE_H
+#define XMIX_DEVICE_H
+
+#include "mix_file.h"
+#include "mix_device.h"
+
+/* table of overridable device operations */
+typedef gboolean (*mix_dev_write_func_t) (mix_device_t *, const mix_word_t *);
+typedef gboolean (*mix_dev_read_func_t) (mix_device_t *, mix_word_t *);
+typedef gboolean (*mix_dev_ioc_func_t) (mix_device_t *, mix_short_t);
+typedef gboolean (*mix_dev_busy_func_t) (const mix_device_t *);
+
+typedef struct mix_device_vtable_t
+{
+ mix_dev_write_func_t write;
+ mix_dev_read_func_t read;
+ mix_dev_ioc_func_t ioc;
+ mix_dev_busy_func_t busy;
+} mix_device_vtable_t;
+
+/* default vtable */
+extern const mix_device_vtable_t *DEF_DEV_VTABLE_;
+
+/*
+ Actual definition of a mix device, which can be cast to
+ a mix file.
+*/
+struct mix_device_t
+{
+ mix_iochannel_t *file;
+ mix_device_type_t type;
+ const mix_device_vtable_t *vtable;
+};
+
+#define GET_CHANNEL_(dev) (dev->file)
+#define GET_FILE_(dev) ((mix_file_t *)(dev->file))
+
+/* default extension for device files */
+extern const char *DEV_EXT_;
+/* default names for device files */
+extern const char *DEF_NAMES_[];
+/* block sizes for devices */
+extern const size_t SIZES_[];
+/* io modes for devices */
+extern const mix_device_mode_t MODES_[];
+/* files modes for devices */
+extern const mix_fmode_t FMODES_[];
+
+
+
+
+#endif /* XMIX_DEVICE_H */
+