summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-16 22:28:41 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-16 22:28:41 +0000
commit5430bc3493d4012fb11f32675eaa9c437e4e83bd (patch)
treef77e5f1f7d63d3f4d55c289f268d0fe4d10bab13
parente259b37f7316117d7c0f74b53373481c94c3cf02 (diff)
downloadmdk-5430bc3493d4012fb11f32675eaa9c437e4e83bd.tar.gz
mdk-5430bc3493d4012fb11f32675eaa9c437e4e83bd.tar.bz2
access to the predicate type added
-rw-r--r--mixlib/mix_predicate.c10
-rw-r--r--mixlib/mix_predicate.h7
-rw-r--r--mixlib/mix_predicate_list.h3
3 files changed, 18 insertions, 2 deletions
diff --git a/mixlib/mix_predicate.c b/mixlib/mix_predicate.c
index 38049dc..1406ef5 100644
--- a/mixlib/mix_predicate.c
+++ b/mixlib/mix_predicate.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mix_predicate.c :
* Implementation of the functions declared in mix_predicate.h
* ------------------------------------------------------------------
- * Last change: Time-stamp: "2001-07-16 01:15:51 jao"
+ * $Id: mix_predicate.c,v 1.3 2001/09/16 22:28:41 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -134,6 +134,14 @@ mix_predicate_delete (mix_predicate_t *predicate)
g_free (predicate);
}
+/* return the predicate's type */
+mix_predicate_type_t
+mix_predicate_get_type (const mix_predicate_t *pred)
+{
+ g_return_val_if_fail (pred != NULL, MIX_PRED_INVALID);
+ return pred->type;
+}
+
/* test a predicate */
gboolean
mix_predicate_eval(mix_predicate_t *pred, const mix_vm_t *vm)
diff --git a/mixlib/mix_predicate.h b/mixlib/mix_predicate.h
index df76afb..63c33ef 100644
--- a/mixlib/mix_predicate.h
+++ b/mixlib/mix_predicate.h
@@ -45,7 +45,8 @@ typedef enum {
MIX_PRED_REG_I6,
MIX_PRED_OVER,
MIX_PRED_CMP,
- MIX_PRED_MEM
+ MIX_PRED_MEM,
+ MIX_PRED_INVALID
} mix_predicate_type_t;
/* create predicates based on vm status */
@@ -56,6 +57,10 @@ mix_predicate_new (mix_predicate_type_t type);
extern void
mix_predicate_delete (mix_predicate_t *predicate);
+/* return the predicate's type */
+extern mix_predicate_type_t
+mix_predicate_get_type (const mix_predicate_t *pred);
+
/* change mem address of a MIX_PRED_MEM predicate */
extern void
mix_predicate_set_mem_address (mix_predicate_t *predicate,
diff --git a/mixlib/mix_predicate_list.h b/mixlib/mix_predicate_list.h
index 3d22028..ae67d95 100644
--- a/mixlib/mix_predicate_list.h
+++ b/mixlib/mix_predicate_list.h
@@ -46,6 +46,9 @@ mix_predicate_list_eval (mix_predicate_list_t *list);
extern const mix_predicate_t *
mix_predicate_list_last_true_eval (const mix_predicate_list_t *list);
+#define mix_predicate_list_last_true_eval_type(list) \
+ mix_predicate_get_type (mix_predicate_list_last_true_eval (list))
+
/* add/remove predicates to the list */
extern void
mix_predicate_list_add (mix_predicate_list_t *list, mix_predicate_t *predicate);