summaryrefslogtreecommitdiffhomepage
path: root/mixlib
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
commiteaa8d1f7813437d6b1bc55de786f34e9a92433c8 (patch)
tree6c1342fe13ff2b8bb7072acccd9029a2f4094a6c /mixlib
parent0c88c6453f6b401970dfa97971dace7783ac2f47 (diff)
downloadmdk-eaa8d1f7813437d6b1bc55de786f34e9a92433c8.tar.gz
mdk-eaa8d1f7813437d6b1bc55de786f34e9a92433c8.tar.bz2
access to the predicate type added
Diffstat (limited to 'mixlib')
-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);