Fix final makefile target
[satune.git] / src / csolver.h
1 #ifndef CSOLVER_H
2 #define CSOLVER_H
3 #include "classlist.h"
4 #include "ops.h"
5 #include "structs.h"
6
7 struct CSolver {
8         VectorBoolean * constraints;
9         VectorBoolean * allBooleans;
10         VectorSet * allSets;
11         VectorElement * allElements;
12 };
13
14 /** Create a new solver instance. */
15
16 CSolver * allocCSolver();
17
18 /** This function creates a set containing the elements passed in the array. */
19
20 Set * createSet(CSolver *, VarType type, uint64_t * elements, uint num);
21
22 /** This function creates a set from lowrange to highrange (inclusive). */
23
24 Set * createRangeSet(CSolver *, VarType type, uint64_t lowrange, uint64_t highrange);
25
26 /** This function creates a mutable set. */
27
28 MutableSet * createMutableSet(CSolver *, VarType type);
29
30 /** This function adds a new item to a set. */
31
32 void addItem(CSolver *, MutableSet * set, uint64_t element);
33
34 /** This function adds a new unique item to the set and returns it.
35     This function cannot be used in conjunction with manually adding
36     items to the set. */
37
38 uint64_t createUniqueItem(CSolver *, MutableSet * set);
39
40 /** This function creates an element variable over a set. */
41
42 Element * getElementVar(CSolver *, Set * set);
43
44 /** This function creates a boolean variable. */
45
46 Boolean * getBooleanVar(CSolver *, VarType type);
47
48 /** This function creates a function operator. */
49
50 Function * createFunctionOperator(CSolver *solver, enum ArithOp op, Set ** domain, uint numDomain, Set * range,
51                                                                                                                                         enum OverFlowBehavior overflowbehavior, Boolean * overflowstatus);
52
53 /** This function creates a predicate operator. */
54
55 Predicate * createPredicateOperator(CSolver *solver, enum CompOp op, Set ** domain, uint numDomain);
56
57 /** This function creates an empty instance table.*/
58
59 Table * createTable(CSolver *solver, Set **domains, uint numDomain, Set * range);
60
61 /** This function adds an input output relation to a table. */
62
63 void addTableEntry(CSolver *solver, uint64_t* inputs, uint inputSize, uint64_t result);
64
65 /** This function converts a completed table into a function. */
66
67 Function * completeTable(CSolver *, Table *);
68
69 /** This function applies a function to the Elements in its input. */
70
71 Element * applyFunction(CSolver *, Function * function, Element ** array);
72
73 /** This function applies a predicate to the Elements in its input. */
74
75 Boolean * applyPredicate(CSolver *, Predicate * predicate, Element ** inputs);
76
77 /** This function applies a logical operation to the Booleans in its input. */
78
79 Boolean * applyLogicalOperation(CSolver *, enum LogicOp op, Boolean ** array);
80
81 /** This function adds a boolean constraint to the set of constraints
82     to be satisfied */
83
84 void addBoolean(CSolver *, Boolean * constraint);
85
86 /** This function instantiates an order of type type over the set set. */
87 Order * createOrder(CSolver *, enum OrderType type, Set * set);
88
89 /** This function instantiates a predicate on two items in an order. */
90 Boolean * orderConstraint(CSolver *, Order * order, uint64_t first, uint64_t second);
91 #endif