summaryrefslogtreecommitdiffhomepage
path: root/mixguile/mixguile_cmd_dispatcher.c
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-01 00:22:13 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-01 00:22:13 +0000
commit48ed62ac924e49fcf0c551d3e65562e523bb578a (patch)
treeaf6f400da3a150acd85d10540b91bfc324ac4eff /mixguile/mixguile_cmd_dispatcher.c
parent37fa04203be9e4a98fe81679a1072cc596c43f13 (diff)
downloadmdk-48ed62ac924e49fcf0c551d3e65562e523bb578a.tar.gz
mdk-48ed62ac924e49fcf0c551d3e65562e523bb578a.tar.bz2
new mixguile commands
Diffstat (limited to 'mixguile/mixguile_cmd_dispatcher.c')
-rw-r--r--mixguile/mixguile_cmd_dispatcher.c89
1 files changed, 0 insertions, 89 deletions
diff --git a/mixguile/mixguile_cmd_dispatcher.c b/mixguile/mixguile_cmd_dispatcher.c
index b55d0ed..df3c051 100644
--- a/mixguile/mixguile_cmd_dispatcher.c
+++ b/mixguile/mixguile_cmd_dispatcher.c
@@ -55,25 +55,6 @@ static mix_vm_command_info_t commands_[] = {
};
/* create/destroy cmd dispatcher */
-static void
-make_pipe_ (mixguile_cmd_dispatcher_t *dis)
-{
- int fildes[2], r;
- FILE *out;
- r = pipe (fildes);
- g_return_if_fail (r == 0);
- out = fdopen (fildes[1], "w");
- g_return_if_fail (out != NULL);
- r = fcntl (fildes[0], F_GETFL, 0);
- g_return_if_fail (r != -1);
- r = fcntl (fildes[0], F_SETFL, r | O_NONBLOCK);
- g_return_if_fail (r != -1);
-
- dis->guile_out = out;
- dis->fildes[0] = fildes[0];
- dis->fildes[1] = fildes[1];
-}
-
mixguile_cmd_dispatcher_t *
mixguile_cmd_dispatcher_new (mix_vm_cmd_dispatcher_t *dis)
{
@@ -91,10 +72,6 @@ mixguile_cmd_dispatcher_new (mix_vm_cmd_dispatcher_t *dis)
result = g_new (mixguile_cmd_dispatcher_t, 1);
result->dispatcher = dis;
- result->err = result->out = NULL;
- result->result = NULL;
- result->fildes[0] = result->fildes[1] = -1;
- result->guile_out = NULL;
while (commands_[k].name)
{
@@ -112,12 +89,6 @@ void
mixguile_cmd_dispatcher_delete (mixguile_cmd_dispatcher_t *dis)
{
g_return_if_fail (dis != NULL);
- if (dis->guile_out)
- {
- fclose (dis->guile_out);
- close (dis->fildes[0]);
- close (dis->fildes[1]);
- }
mix_vm_cmd_dispatcher_delete (dis->dispatcher);
}
@@ -129,66 +100,6 @@ mixguile_cmd_dispatcher_get_vm_dispatcher (const mixguile_cmd_dispatcher_t *dis)
return dis->dispatcher;
}
-/* get the result string of last executed command */
-const gchar *
-mixguile_cmd_dispatcher_last_result (mixguile_cmd_dispatcher_t *dis)
-{
- enum {BLKSIZE = 256};
- static gchar BUFFER[BLKSIZE + 1];
-
- ssize_t k;
- gchar *tmp = NULL;
-
- g_return_val_if_fail (dis != NULL, NULL);
- if (!dis->guile_out) return NULL;
- if (dis->result) g_free (dis->result);
- dis->result = NULL;
- fflush (dis->guile_out);
- while ((k = read (dis->fildes[0], BUFFER, BLKSIZE)) != 0)
- {
- if (k == -1 && errno != EINTR) break;
- if (k != -1)
- {
- tmp = dis->result;
- BUFFER[k] = '\0';
- dis->result = g_strconcat (tmp ? tmp : "", BUFFER, NULL);
- g_free (tmp);
- }
- }
-
- if (dis->result && dis->result[strlen (dis->result) - 1] == '\n')
- dis->result[strlen (dis->result) - 1] = '\0';
-
- return dis->result;
-}
-
-/* prepare dispatcher for repl */
-static void
-prepare_dispatcher_ (mixguile_cmd_dispatcher_t *dis)
-{
- if (!dis->guile_out) make_pipe_ (dis);
- dis->out = mix_vm_cmd_dispatcher_set_out_stream (dis->dispatcher,
- dis->guile_out);
- dis->err = mix_vm_cmd_dispatcher_set_error_stream (dis->dispatcher,
- dis->guile_out);
-}
-
-void
-mixguile_cmd_dispatcher_prepare (mixguile_cmd_dispatcher_t *dis)
-{
- g_return_if_fail (dis != NULL);
- prepare_dispatcher_ (dis);
-}
-
-/* interpret commands from file or string
-static void
-reset_dispatcher_ (mixguile_cmd_dispatcher_t *dis)
-{
- (void) mix_vm_cmd_dispatcher_set_out_stream (dis->dispatcher, dis->out);
- (void) mix_vm_cmd_dispatcher_set_error_stream (dis->dispatcher, dis->err);
-}
-*/
-
void
mixguile_cmd_dispatcher_interpret_file (mixguile_cmd_dispatcher_t *dis,
const gchar *path)