summaryrefslogtreecommitdiffhomepage
path: root/mixlib/mix_predicate.h
blob: 63c33efc74975ea4ebe7a62f181f05ad9e1d686a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* -*-c-*- ---------------- mix_predicate.h :
 * Predicates and lists of predicates testing vm status.
 * ------------------------------------------------------------------
 *  Last change: Time-stamp: <2001-07-13 22:32:42 jao>
 * ------------------------------------------------------------------
 * Copyright (C) 2001 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.
 *  
 */


#ifndef MIX_PREDICATE_H
#define MIX_PREDICATE_H

#include "mix.h"
#include "mix_types.h"
#include "mix_ins.h"

/* the predicate type */
typedef struct mix_predicate_t mix_predicate_t;

/* predicate types */
typedef enum {
  MIX_PRED_REG_A,
  MIX_PRED_REG_X,
  MIX_PRED_REG_J,
  MIX_PRED_REG_I1,
  MIX_PRED_REG_I2,
  MIX_PRED_REG_I3,
  MIX_PRED_REG_I4,
  MIX_PRED_REG_I5,
  MIX_PRED_REG_I6,
  MIX_PRED_OVER,
  MIX_PRED_CMP,
  MIX_PRED_MEM,
  MIX_PRED_INVALID
} mix_predicate_type_t;

/* create predicates based on vm status */
extern mix_predicate_t *
mix_predicate_new (mix_predicate_type_t type);

/* delete a predicate */
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,
			       mix_address_t address);

/* get message about predicate evaluation */
extern const gchar *
mix_predicate_get_message (const mix_predicate_t *predicate);

/* test a predicate */
#include "mix_vm.h"

extern gboolean
mix_predicate_eval(mix_predicate_t *pred, const mix_vm_t *vm);

#endif /* MIX_PREDICATE_H */