diff options
Diffstat (limited to 'mixlib/xmix_vm_command.c')
-rw-r--r-- | mixlib/xmix_vm_command.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mixlib/xmix_vm_command.c b/mixlib/xmix_vm_command.c index 0c0ec8a..32acc92 100644 --- a/mixlib/xmix_vm_command.c +++ b/mixlib/xmix_vm_command.c @@ -21,6 +21,8 @@ * */ +#include <stdarg.h> +#include <stdio.h> #include "xmix_vm_command.h" @@ -29,3 +31,34 @@ const gchar *TRACING_KEY_ = "Tracing"; const gchar *TIMING_KEY_ = "Timing"; const gchar *EDITOR_KEY_ = "Editor"; const gchar *ASM_KEY_ = "Assembler"; +const gchar *LOGGING_KEY_ = "Logs"; + +void +log_message_ (mix_vm_cmd_dispatcher_t *dis, const gchar *fmt, ...) +{ + if (dis && fmt && dis->log_msg && dis->out) + { + va_list args; + va_start (args, fmt); + vfprintf (dis->out, fmt, args); + fprintf (dis->out, "\n"); + va_end (args); + } +} + + +extern void +log_error_ (mix_vm_cmd_dispatcher_t *dis, const gchar *fmt, ...) +{ + enum {BUFF_SIZE = 256}; + static gchar BUFFER[256]; + + if (dis && fmt && dis->err) + { + va_list args; + va_start (args, fmt); + snprintf (BUFFER, BUFF_SIZE, "ERROR: %s\n", fmt); + vfprintf (dis->err, BUFFER, args); + va_end (args); + } +} |