From 8cecf0ae927eae1dfb5ab2eef78f55e8e162a7f9 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 7 Jul 2001 23:34:55 +0000 Subject: use of devdir command --- mixlib/mix_vm_command.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'mixlib/mix_vm_command.c') diff --git a/mixlib/mix_vm_command.c b/mixlib/mix_vm_command.c index 6eab3a2..afabc55 100644 --- a/mixlib/mix_vm_command.c +++ b/mixlib/mix_vm_command.c @@ -27,10 +27,11 @@ #include #include -#include "mix_vm_command.h" +#include "mix_device.h" #include "mix_vm.h" #include "mix_vm_dump.h" #include "mix_eval.h" +#include "mix_vm_command.h" /* hooks */ typedef struct @@ -103,6 +104,7 @@ DEC_FUN (pedit_); DEC_FUN (sedit_); DEC_FUN (pasm_); DEC_FUN (sasm_); +DEC_FUN (devdir_); /* internal command info struct */ typedef struct { @@ -160,6 +162,8 @@ command_ commands_[] = { "tracing [on|off]"}, { "timing", cmd_timing_, N_("Turn on/off timing statistics"), "timing [on|off]"}, + { "devdir", cmd_devdir_, N_("Print/set devices directory"), + "devdir [NEWDIR]"}, { NULL, NULL, NULL, NULL}, }; @@ -257,6 +261,15 @@ mix_vm_cmd_dispatcher_new_with_config (FILE *out, FILE *err, if (val) mix_vm_cmd_dispatcher_set_assembler (result, val); val = mix_config_get (result->config, TIMING_KEY_); if (val) cmd_timing_ (result, val); + val = mix_config_get_devices_dir (result->config); + if (!val) + { + gchar *dirname = g_dirname (mix_config_get_filename (config)); + cmd_devdir_ (result, dirname); + g_free (dirname); + } + else + cmd_devdir_ (result, val); } return result; } @@ -1359,8 +1372,7 @@ cmd_timing_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) } else if (arg && !strlen (arg)) { - fprintf (dis->out, "Instruction timing is currently set %s\n", - dis->printtime ? "ON" : "OFF"); + print_time_ (dis); } else cmd_help_ (dis, "timing"); @@ -1405,3 +1417,16 @@ cmd_sasm_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) mix_vm_cmd_dispatcher_set_assembler (dis, arg); return TRUE; } + +static gboolean +cmd_devdir_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) +{ + if (!arg || !strlen (arg)) + fprintf (dis->out, "Device directory: %s\n", mix_device_get_dir ()); + else if (mix_device_set_dir (arg) && dis->config) + mix_config_set_devices_dir (dis->config, arg); + return TRUE; +} + + + -- cgit v1.2.3