From ffc2f73816d9331db37fbd773b65b7ec17ce4780 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 23 Jun 2004 10:46:17 +0000 Subject: update to glib 2.x --- mixlib/mix_config.c | 6 ++-- mixlib/mix_vm_command.c | 83 ++++++++++++++++++++++++----------------------- mixlib/xmix_vm_command.h | 19 ++++++----- mixlib/xmix_vm_handlers.c | 5 +-- 4 files changed, 58 insertions(+), 55 deletions(-) diff --git a/mixlib/mix_config.c b/mixlib/mix_config.c index cba9c80..c62d527 100644 --- a/mixlib/mix_config.c +++ b/mixlib/mix_config.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mix_config.c : * Implementation of the functions declared in mix_config.h * ------------------------------------------------------------------ - * $Id: mix_config.c,v 1.10 2004/06/07 12:18:22 jao Exp $ + * $Id: mix_config.c,v 1.11 2004/06/23 10:46:17 jao Exp $ * ------------------------------------------------------------------ * Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. * @@ -94,7 +94,7 @@ mix_config_new (const gchar *dirname, const gchar *filename) } autosave = mix_config_get (result, AUTOSAVE_KEY_); - result->autosave = autosave && !g_strcasecmp (autosave, AUTOSAVE_YES_); + result->autosave = autosave && !g_ascii_strcasecmp (autosave, AUTOSAVE_YES_); return result; } @@ -267,7 +267,7 @@ mix_config_set_history_file (mix_config_t *config, const gchar *path) } else { - gchar *base = g_dirname (config->filename); + gchar *base = g_path_get_dirname (config->filename); gchar *hf = g_strconcat (base, G_DIR_SEPARATOR_S, path, NULL); mix_config_update (config, HISTORY_KEY_, hf); g_free (hf); diff --git a/mixlib/mix_vm_command.c b/mixlib/mix_vm_command.c index d99bd6d..55da6a5 100644 --- a/mixlib/mix_vm_command.c +++ b/mixlib/mix_vm_command.c @@ -1,24 +1,24 @@ /* -*-c-*- -------------- mix_vm_command.c : * Implementation of the functions declared in mix_vm_command.h * ------------------------------------------------------------------ - * $Id: mix_vm_command.c,v 1.28 2002/04/10 23:39:40 jao Exp $ + * $Id: mix_vm_command.c,v 1.29 2004/06/23 10:46:17 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001, 2002 Free Software Foundation, Inc. - * + * Copyright (C) 2001, 2002, 2004 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. - * + * */ @@ -98,7 +98,7 @@ make_completions_ (void) { GList *cmds = NULL; gint k; - + GCompletion *completions = g_completion_new (NULL); for (k = 0; k < MIX_CMD_INVALID; ++k) cmds = g_list_append (cmds, (gpointer) mix_vm_command_to_string (k)); @@ -112,9 +112,9 @@ mix_vm_cmd_dispatcher_new (FILE *out_fd, /* output messages file */ { mix_vm_cmd_dispatcher_t *result = NULL; int k; - + /* g_return_val_if_fail (out_fd && err_fd, NULL); */ - + result = g_new (mix_vm_cmd_dispatcher_t, 1); result->result = TRUE; result->out = out_fd; @@ -127,24 +127,24 @@ mix_vm_cmd_dispatcher_new (FILE *out_fd, /* output messages file */ result->editor = NULL; result->assembler = NULL; result->eval = mix_eval_new (); - result->dump = mix_dump_context_new (out_fd, + result->dump = mix_dump_context_new (out_fd, MIX_SHORT_ZERO, MIX_SHORT_ZERO, MIX_DUMP_ALL); result->vm = mix_vm_new (); result->global_pre = result->global_post = NULL; - + for (k =0; k < MIX_CMD_INVALID; ++k) result->pre_hooks[k] = result->post_hooks[k] = NULL; result->config = NULL; - + for (k = 0; k < PRNO_; ++k) result->preds[k] = mix_predicate_new (k); - + result->mem_preds = g_hash_table_new (NULL, NULL); result->commands = g_hash_table_new (g_str_hash, g_str_equal); result->completions = make_completions_ (); - + return result; } @@ -167,7 +167,8 @@ mix_vm_cmd_dispatcher_new_with_config (FILE *out, FILE *err, val = mix_config_get_devices_dir (result->config); if (!val || !mix_stat_dir (val, "devices")) { - gchar *dirname = g_dirname (mix_config_get_filename (config)); + gchar *dirname = + g_path_get_dirname (mix_config_get_filename (config)); cmd_sddir_ (result, dirname); g_free (dirname); } @@ -189,7 +190,7 @@ mix_vm_cmd_dispatcher_new_with_config (FILE *out, FILE *err, } return result; } - + /* delete (does not close the fds in the constructor) */ static gboolean @@ -220,7 +221,7 @@ mix_vm_cmd_dispatcher_delete (mix_vm_cmd_dispatcher_t *dis) { const gchar *hfile = NULL; gint k; - + g_return_if_fail (dis != NULL); mix_eval_delete (dis->eval); mix_dump_context_delete (dis->dump); @@ -266,10 +267,10 @@ mix_vm_cmd_dispatcher_complete (const mix_vm_cmd_dispatcher_t *dis, { char *cp; GList *result; - + g_return_val_if_fail (dis != NULL, NULL); g_return_val_if_fail (cmd != NULL, NULL); - + cp = g_strdup (cmd); result = g_completion_complete (dis->completions, cp, prefix); g_free (cp); @@ -355,10 +356,10 @@ const gchar * mix_vm_cmd_dispatcher_get_src_file_path (const mix_vm_cmd_dispatcher_t *dis) { static gchar *PATH = NULL; - + const mix_vm_t *vm = mix_vm_cmd_dispatcher_get_vm (dis); const mix_src_file_t *f = mix_vm_get_src_file (vm); - + if (PATH) { g_free (PATH); @@ -367,7 +368,7 @@ mix_vm_cmd_dispatcher_get_src_file_path (const mix_vm_cmd_dispatcher_t *dis) if (f) PATH = mix_file_complete_name (mix_src_file_get_path (f), MIX_SRC_DEFEXT); - + return PATH; } @@ -385,14 +386,14 @@ mix_vm_cmd_dispatcher_pre_hook (mix_vm_cmd_dispatcher_t *dis, mix_vm_cmd_hook_t hook, gpointer data) { hook_ *phook; - + g_return_if_fail (dis != NULL); g_return_if_fail (cmd < MIX_CMD_INVALID); phook = g_new (hook_, 1); phook->func = hook; phook->data = data; - + dis->pre_hooks[cmd] = g_slist_append (dis->pre_hooks[cmd], phook); } @@ -402,14 +403,14 @@ mix_vm_cmd_dispatcher_post_hook (mix_vm_cmd_dispatcher_t *dis, mix_vm_cmd_hook_t hook, gpointer data) { hook_ *phook; - + g_return_if_fail (dis != NULL); g_return_if_fail (cmd < MIX_CMD_INVALID); phook = g_new (hook_, 1); phook->func = hook; phook->data = data; - + dis->post_hooks[cmd] = g_slist_append (dis->post_hooks[cmd], phook); } @@ -419,13 +420,13 @@ mix_vm_cmd_dispatcher_global_pre_hook (mix_vm_cmd_dispatcher_t *dis, gpointer data) { global_hook_ *phook; - + g_return_if_fail (dis != NULL); phook = g_new (global_hook_, 1); phook->func = hook; phook->data = data; - + dis->global_pre = g_slist_append (dis->global_pre, phook); } @@ -435,13 +436,13 @@ mix_vm_cmd_dispatcher_global_post_hook (mix_vm_cmd_dispatcher_t *dis, gpointer data) { global_hook_ *phook; - + g_return_if_fail (dis != NULL); phook = g_new (global_hook_, 1); phook->func = hook; phook->data = data; - + dis->global_post = g_slist_append (dis->global_post, phook); } @@ -451,10 +452,10 @@ mix_vm_cmd_dispatcher_dispatch (mix_vm_cmd_dispatcher_t *dis, mix_vm_command_t cmd, const gchar *arg) { g_return_val_if_fail (dis != NULL, FALSE); - + if (dis->global_pre) exec_global_hook_list_ (dis->global_pre, dis, cmd, arg); - + if (cmd < MIX_CMD_INVALID) { if (dis->pre_hooks[cmd]) @@ -494,10 +495,10 @@ mix_vm_cmd_dispatcher_dispatch_text (mix_vm_cmd_dispatcher_t *dis, { gchar *cp, *arg = ""; int k = 0; - + g_return_val_if_fail (dis != NULL, FALSE); g_return_val_if_fail (text != NULL, FALSE); - + cp = g_strdup (text); while (cp[k] && !isspace (cp[k])) ++k; if (cp[k]) @@ -508,7 +509,7 @@ mix_vm_cmd_dispatcher_dispatch_text (mix_vm_cmd_dispatcher_t *dis, } (void) mix_vm_cmd_dispatcher_dispatch_split_text (dis, cp, arg); - + g_free (cp); return dis->result; @@ -521,12 +522,12 @@ mix_vm_cmd_dispatcher_dispatch_split_text (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) { mix_vm_command_info_t *info; - + g_return_val_if_fail (dis, FALSE); - + if (!command) return FALSE; if (!arg) arg = ""; - + info = (mix_vm_command_info_t *)g_hash_table_lookup (dis->commands, command); if (info) @@ -619,11 +620,11 @@ mix_vm_cmd_dispatcher_get_src_file_line (const mix_vm_cmd_dispatcher_t *dis, { const mix_src_file_t *file; g_return_val_if_fail (dis != NULL, NULL); - + file = mix_vm_get_src_file (dis->vm); - + if (line == 0 || file == NULL) return cr? "" : "\n"; - + if (cr) return mix_src_file_get_line (file, line); else diff --git a/mixlib/xmix_vm_command.h b/mixlib/xmix_vm_command.h index ce3ca5b..8ea1a76 100644 --- a/mixlib/xmix_vm_command.h +++ b/mixlib/xmix_vm_command.h @@ -1,24 +1,24 @@ /* -*-c-*- ---------------- xmix_vm_command.h : * Private type declarations form mix_vm_command * ------------------------------------------------------------------ - * $Id: xmix_vm_command.h,v 1.3 2001/09/16 22:39:41 jao Exp $ + * $Id: xmix_vm_command.h,v 1.4 2004/06/23 10:46:17 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2001 Free Software Foundation, Inc. - * + * Copyright (C) 2001, 2004 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. - * + * */ @@ -31,6 +31,7 @@ #include #include +#include "mix.h" #include "mix_device.h" #include "mix_vm.h" #include "mix_vm_dump.h" @@ -47,13 +48,13 @@ extern const gchar *ASM_KEY_; extern const gchar *LOGGING_KEY_; /* hooks */ -typedef struct +typedef struct { mix_vm_cmd_hook_t func; gpointer data; } hook_; -typedef struct +typedef struct { mix_vm_cmd_global_hook_t func; gpointer data; @@ -61,7 +62,7 @@ typedef struct enum {PRNO_ = MIX_PRED_MEM, HOOKNO_ = MIX_CMD_INVALID}; -struct mix_vm_cmd_dispatcher_t +struct mix_vm_cmd_dispatcher_t { mix_vm_t *vm; /* the virtual machine */ gboolean result; /* last command's outcome */ diff --git a/mixlib/xmix_vm_handlers.c b/mixlib/xmix_vm_handlers.c index a778750..a5ff3da 100644 --- a/mixlib/xmix_vm_handlers.c +++ b/mixlib/xmix_vm_handlers.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- xmix_vm_handlers.c : * Implementation of the functions declared in xmix_vm_handlers.h * ------------------------------------------------------------------ - * $Id: xmix_vm_handlers.c,v 1.8 2004/06/06 19:54:11 jao Exp $ + * $Id: xmix_vm_handlers.c,v 1.9 2004/06/23 10:46:17 jao Exp $ * ------------------------------------------------------------------ * Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. * @@ -1276,7 +1276,8 @@ cmd_pbt_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg) gint k = 0, address; guint line; const mix_src_file_t *file = mix_vm_get_src_file (dis->vm); - char *name = file ? g_basename (mix_src_file_get_path (file)) : NULL; + char *name = + file ? g_path_get_basename (mix_src_file_get_path (file)) : NULL; const GSList *add = mix_vm_get_backtrace (dis->vm); while (add && (no == 0 || k < no)) -- cgit v1.2.3