From 4d7d583e47215304d7be5487a42578081bbc8497 Mon Sep 17 00:00:00 2001 From: jaortega Date: Fri, 8 Dec 2000 21:30:01 +0000 Subject: (mix_eval_{set,remove}symbols_from_table, mix_eval_substract_table) new functions (mix_symbol_table_{merge,substract}_table) const-correct --- mixlib/mix_eval.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'mixlib/mix_eval.c') diff --git a/mixlib/mix_eval.c b/mixlib/mix_eval.c index 5a65391..023a413 100644 --- a/mixlib/mix_eval.c +++ b/mixlib/mix_eval.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mix_eval.c : * Implementation of the functions declared in mix_eval.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "00/12/03 22:27:53 jose" + * Last change: Time-stamp: "00/12/08 13:16:10 jose" * ------------------------------------------------------------------ * Copyright (C) 2000 jose antonio ortega ruiz * @@ -102,7 +102,7 @@ mix_eval_expression_with_loc (mix_eval_t *eval, const gchar *expr, /* get the result of the last evaluation */ mix_word_t -mix_eval_value (mix_eval_t *eval) +mix_eval_value (const mix_eval_t *eval) { g_return_val_if_fail (eval != NULL, MIX_WORD_ZERO); return eval->value; @@ -110,7 +110,7 @@ mix_eval_value (mix_eval_t *eval) /* get the last eval result code */ mix_eval_result_t -mix_eval_last_error (mix_eval_t *eval) +mix_eval_last_error (const mix_eval_t *eval) { g_return_val_if_fail (eval != NULL, MIX_EVAL_INTERN); return eval->result; @@ -118,7 +118,7 @@ mix_eval_last_error (mix_eval_t *eval) /* get the last error string */ const gchar* -mix_eval_last_error_string (mix_eval_t *eval) +mix_eval_last_error_string (const mix_eval_t *eval) { g_return_val_if_fail (eval != NULL, errors_[MIX_EVAL_INTERN]); return errors_[eval->result]; @@ -126,7 +126,7 @@ mix_eval_last_error_string (mix_eval_t *eval) /* get the position of last error */ guint -mix_eval_last_error_pos (mix_eval_t *eval) +mix_eval_last_error_pos (const mix_eval_t *eval) { g_return_val_if_fail (eval != NULL, 0); return eval->errpos; @@ -161,4 +161,25 @@ mix_eval_use_symbol_table (mix_eval_t *eval, eval->towner = FALSE; } - + +gboolean +mix_eval_set_symbols_from_table (mix_eval_t *eval, + const mix_symbol_table_t *table) +{ + g_return_val_if_fail (eval != NULL, FALSE); + if (eval->table != NULL) + return mix_symbol_table_merge_table (eval->table, table); + else + return FALSE; +} + +gboolean +mix_eval_remove_symbols_from_table (mix_eval_t *eval, + const mix_symbol_table_t *table) +{ + g_return_val_if_fail (eval != NULL, FALSE); + if (eval->table != NULL) + return mix_symbol_table_substract_table (eval->table, table); + else + return FALSE; +} -- cgit v1.2.3