Fix name collisions
authorbdemsky <bdemsky@uci.edu>
Thu, 31 Aug 2017 00:12:14 +0000 (17:12 -0700)
committerbdemsky <bdemsky@uci.edu>
Thu, 31 Aug 2017 00:13:32 +0000 (17:13 -0700)
23 files changed:
src/AST/asthash.h
src/AST/order.cc
src/AST/order.h
src/AST/table.cc
src/AST/table.h
src/ASTAnalyses/orderanalysis.cc
src/ASTAnalyses/ordergraph.cc
src/ASTAnalyses/ordergraph.h
src/ASTAnalyses/ordernode.h
src/ASTTransform/integerencoding.cc
src/ASTTransform/integerencoding.h
src/ASTTransform/integerencodingrecord.cc
src/ASTTransform/integerencodingrecord.h
src/Backend/satencoder.h
src/Backend/satorderencoder.cc
src/Collections/corestructs.h
src/Collections/hashset.h
src/Collections/hashtable.h
src/Collections/structs.h
src/Tuner/searchtuner.h
src/classes.h [changed mode: 0755->0644]
src/classlist.h
src/csolver.h

index bdb5ec6e315d1819502a4f391fc38e40a1429c14..6dd50dc8ec4229e2bbf9880de169016896f619b4 100644 (file)
@@ -9,8 +9,8 @@ bool compareBoolean(Boolean *b1, Boolean *b2);
 uint hashElement(Element *element);
 bool compareElement(Element *e1, Element *e2);
 
-typedef HashTable<Boolean *, Boolean *, uintptr_t, 4, hashBoolean, compareBoolean> BooleanMatchMap;
+typedef Hashtable<Boolean *, Boolean *, uintptr_t, 4, hashBoolean, compareBoolean> BooleanMatchMap;
 
-typedef HashTable<Element *, Element *, uintptr_t, 4, hashElement, compareElement> ElementMatchMap;
+typedef Hashtable<Element *, Element *, uintptr_t, 4, hashElement, compareElement> ElementMatchMap;
 
 #endif
index 0944bcae0e3b5ae9602ce351bbc25faeffe54eaa..d359ee62392fba5a0979d064a802822d87220d12 100644 (file)
@@ -14,8 +14,8 @@ Order::Order(OrderType _type, Set *_set) :
 {
 }
 
-void Order::initializeOrderHashTable() {
-       orderPairTable = new HashTableOrderPair();
+void Order::initializeOrderHashtable() {
+       orderPairTable = new HashtableOrderPair();
 }
 
 
index ea2de5eea72a50e19330401313a21cacbb1b9747..ed82695a49c3482f1e65cda6ea752b2e430296c5 100644 (file)
@@ -14,13 +14,13 @@ public:
        ~Order();
        OrderType type;
        Set *set;
-       HashTableOrderPair *orderPairTable;
+       HashtableOrderPair *orderPairTable;
        OrderGraph *graph;
        Order *clone(CSolver *solver, CloneMap *map);
        Vector<BooleanOrder *> constraints;
        OrderEncoding order;
-       void initializeOrderHashTable();
-       void initializeOrderElementsHashTable();
+       void initializeOrderHashtable();
+       void initializeOrderElementsHashtable();
        void addOrderConstraint(BooleanOrder *constraint);
        void setOrderEncodingType(OrderEncodingType type);
        CMEMALLOC;
index 4d0716eb00b94def7db28c2794b6f1cc8e720503..e0f735f0d21c5cd9110a41e4a42fdfae94da592d 100644 (file)
@@ -9,7 +9,7 @@
 Table::Table(Set **_domains, uint numDomain, Set *_range) :
        domains(_domains, numDomain),
        range(_range) {
-       entries = new HashSetTableEntry();
+       entries = new HashsetTableEntry();
 }
 
 void Table::addNewTableEntry(uint64_t *inputs, uint inputSize, uint64_t result) {
index 51c15818aa6b73446ad9154d416d8afe5e36f1db..39b561ce386b38f6efee7a1b7dd20864cccdeffe 100644 (file)
@@ -13,7 +13,7 @@ public:
        ~Table();
        Array<Set *> domains;
        Set *range;
-       HashSetTableEntry *entries;
+       HashsetTableEntry *entries;
        CMEMALLOC;
 };
 
index 56544f4c8983374845e9c44dbcde06a80efa0a2c..196561caa434e0ff74c42d9eb55481084a889fb8 100644 (file)
@@ -147,7 +147,7 @@ void completePartialOrderGraph(OrderGraph *graph) {
        Vector<OrderNode *> finishNodes;
        DFS(graph, &finishNodes);
        resetNodeInfoStatusSCC(graph);
-       HashTableNodeToNodeSet *table = new HashTableNodeToNodeSet(128, 0.25);
+       HashtableNodeToNodeSet *table = new HashtableNodeToNodeSet(128, 0.25);
 
        Vector<OrderNode *> sccNodes;
 
@@ -155,7 +155,7 @@ void completePartialOrderGraph(OrderGraph *graph) {
        uint sccNum = 1;
        for (int i = size - 1; i >= 0; i--) {
                OrderNode *node = finishNodes.get(i);
-               HashSetOrderNode *sources = new HashSetOrderNode(4, 0.25);
+               HashsetOrderNode *sources = new HashsetOrderNode(4, 0.25);
                table->put(node, sources);
 
                if (node->status == NOTVISITED) {
@@ -178,7 +178,7 @@ void completePartialOrderGraph(OrderGraph *graph) {
                                        OrderNode *parent = edge->source;
                                        if (edge->polPos) {
                                                sources->add(parent);
-                                               HashSetOrderNode *parent_srcs = (HashSetOrderNode *)table->get(parent);
+                                               HashsetOrderNode *parent_srcs = (HashsetOrderNode *)table->get(parent);
                                                sources->addAll(parent_srcs);
                                        }
                                }
@@ -187,7 +187,7 @@ void completePartialOrderGraph(OrderGraph *graph) {
                        for (uint j = 0; j < rSize; j++) {
                                //Copy in set of entire SCC
                                OrderNode *rnode = sccNodes.get(j);
-                               HashSetOrderNode *set = (j == 0) ? sources : sources->copy();
+                               HashsetOrderNode *set = (j == 0) ? sources : sources->copy();
                                table->put(rnode, set);
 
                                //Use source sets to compute pseudoPos edges
@@ -230,11 +230,11 @@ void DFSMust(OrderGraph *graph, Vector<OrderNode *> *finishNodes) {
 
 void DFSClearContradictions(CSolver *solver, OrderGraph *graph, Vector<OrderNode *> *finishNodes, bool computeTransitiveClosure) {
        uint size = finishNodes->getSize();
-       HashTableNodeToNodeSet *table = new HashTableNodeToNodeSet(128, 0.25);
+       HashtableNodeToNodeSet *table = new HashtableNodeToNodeSet(128, 0.25);
 
        for (int i = size - 1; i >= 0; i--) {
                OrderNode *node = finishNodes->get(i);
-               HashSetOrderNode *sources = new HashSetOrderNode(4, 0.25);
+               HashsetOrderNode *sources = new HashsetOrderNode(4, 0.25);
                table->put(node, sources);
 
                {
@@ -245,7 +245,7 @@ void DFSClearContradictions(CSolver *solver, OrderGraph *graph, Vector<OrderNode
                                OrderNode *parent = edge->source;
                                if (edge->mustPos) {
                                        sources->add(parent);
-                                       HashSetOrderNode *parent_srcs = (HashSetOrderNode *) table->get(parent);
+                                       HashsetOrderNode *parent_srcs = (HashsetOrderNode *) table->get(parent);
                                        sources->addAll(parent_srcs);
                                }
                        }
index c0df7a54d87196e67f5011fe8ab40e1f25aad2a9..6169bd875b6afbf75e141e83539af56cfa8e2eb1 100644 (file)
@@ -6,8 +6,8 @@
 #include "order.h"
 
 OrderGraph::OrderGraph(Order *_order) :
-       nodes(new HashSetOrderNode()),
-       edges(new HashSetOrderEdge()),
+       nodes(new HashsetOrderNode()),
+       edges(new HashsetOrderEdge()),
        order(_order) {
 }
 
index d28c4b699582a69179f768d00f83505d1280c473..5f10c1fba5430fd4736ffe0a45cc9841abf070fd 100644 (file)
@@ -30,8 +30,8 @@ public:
 
        CMEMALLOC;
 private:
-       HashSetOrderNode *nodes;
-       HashSetOrderEdge *edges;
+       HashsetOrderNode *nodes;
+       HashsetOrderEdge *edges;
        Order *order;
 };
 
index 3ffecb8cbd92235790ae0b7193a49c3142774ba1..08685d47c8f938c19da8797a1cbcdba72e1273d1 100644 (file)
@@ -26,8 +26,8 @@ public:
        uint64_t id;
        NodeStatus status;
        uint sccNum;
-       HashSetOrderEdge inEdges;
-       HashSetOrderEdge outEdges;
+       HashsetOrderEdge inEdges;
+       HashsetOrderEdge outEdges;
        CMEMALLOC;
 };
 #endif/* ORDERNODE_H */
index 7d7ea92896110f8f796e1870cc0b8174e0035958..d15c60e365798254924277c8fd77c0fe86935359 100644 (file)
@@ -6,7 +6,7 @@
 #include "csolver.h"
 #include "integerencodingrecord.h"
 
-HashTableOrderIntegerEncoding* IntegerEncodingTransform::orderIntegerEncoding = new HashTableOrderIntegerEncoding();
+HashtableOrderIntegerEncoding* IntegerEncodingTransform::orderIntegerEncoding = new HashtableOrderIntegerEncoding();
 
 IntegerEncodingTransform::IntegerEncodingTransform(CSolver* _solver, Order* _order) 
        :Transform(_solver),
index 6434a95d903218b64a0d1092041395dd499fdcaf..858f7ad08da009ba9418954b07b6a2526a0d2767 100644 (file)
@@ -22,7 +22,7 @@ private:
        Order* order;
        // In future we can use a singleton class instead of static variable for keeping data that needed
        // for translating back result
-       static HashTableOrderIntegerEncoding* orderIntegerEncoding;
+       static HashtableOrderIntegerEncoding* orderIntegerEncoding;
 };
 
 
index ee3a42779b748c532f21bba17132c6fb931cc3f8..6589df76df30f22a3e4cc80cbcdbe8d79cbcd863 100644 (file)
@@ -12,7 +12,7 @@
 IntegerEncodingRecord::IntegerEncodingRecord(Set* _set):
        set(_set)
 {
-       elementTable = new HashSetOrderElement();
+       elementTable = new HashsetOrderElement();
 }
 
 IntegerEncodingRecord::~IntegerEncodingRecord(){
index da539189ffcdb667f85f1607a4cc675145cc8617..bafc01812314ad943b79adb2fe9cb44063b5adf1 100644 (file)
@@ -20,7 +20,7 @@ public:
        CMEMALLOC;
        
 private:
-       HashSetOrderElement *elementTable;
+       HashsetOrderElement *elementTable;
 };
 
 #endif /* INTEGERENCODINGRECORD_H */
index 25a46d0124ee3451fc673fba6a2007e56a269a5f..94115cefbb467088d2dbcbd68dce9422ba8fc0d0 100644 (file)
@@ -6,7 +6,7 @@
 #include "inc_solver.h"
 #include "constraint.h"
 
-typedef HashTable<Boolean *, Node *, uintptr_t, 4> BooleanToEdgeMap;
+typedef Hashtable<Boolean *, Node *, uintptr_t, 4> BooleanToEdgeMap;
 
 class SATEncoder {
  public:
@@ -50,7 +50,7 @@ class SATEncoder {
        Edge encodeTotalOrderSATEncoder(BooleanOrder *constraint);
        Edge encodePartialOrderSATEncoder(BooleanOrder *constraint);
        void createAllTotalOrderConstraintsSATEncoder(Order *order);
-       Edge getOrderConstraint(HashTableOrderPair *table, OrderPair *pair);
+       Edge getOrderConstraint(HashtableOrderPair *table, OrderPair *pair);
        Edge generateTransOrderConstraintSATEncoder(Edge constIJ, Edge constJK, Edge constIK);
        Edge encodeEnumEntriesTablePredicateSATEncoder(BooleanPredicate *constraint);
        Edge encodeEnumTablePredicateSATEncoder(BooleanPredicate *constraint);
@@ -64,5 +64,5 @@ class SATEncoder {
 };
 
 void allocElementConstraintVariables(ElementEncoding *ee, uint numVars);
-Edge getOrderConstraint(HashTableOrderPair *table, OrderPair *pair);
+Edge getOrderConstraint(HashtableOrderPair *table, OrderPair *pair);
 #endif
index 10a87dd8c8a6e705d725b9b3677f5ab3c0040191..31afdfc6d2858bccbf5cde66d02111b2ba2f2fe7 100644 (file)
@@ -55,7 +55,7 @@ Edge SATEncoder::getPairConstraint(Order *order, OrderPair *pair) {
        if (!edgeIsNull(gvalue))
                return gvalue;
 
-       HashTableOrderPair *table = order->orderPairTable;
+       HashtableOrderPair *table = order->orderPairTable;
        bool negate = false;
        OrderPair flipped;
        if (pair->first < pair->second) {
@@ -78,7 +78,7 @@ Edge SATEncoder::getPairConstraint(Order *order, OrderPair *pair) {
 Edge SATEncoder::encodeTotalOrderSATEncoder(BooleanOrder *boolOrder) {
        ASSERT(boolOrder->order->type == SATC_TOTAL);
        if (boolOrder->order->orderPairTable == NULL) {
-               boolOrder->order->initializeOrderHashTable();
+               boolOrder->order->initializeOrderHashtable();
                bool doOptOrderStructure = GETVARTUNABLE(solver->getTuner(), boolOrder->order->type, OPTIMIZEORDERSTRUCTURE, &onoff);
                if (doOptOrderStructure) {
                        boolOrder->order->graph = buildMustOrderGraph(boolOrder->order);
@@ -117,7 +117,7 @@ void SATEncoder::createAllTotalOrderConstraintsSATEncoder(Order *order) {
        }
 }
 
-Edge getOrderConstraint(HashTableOrderPair *table, OrderPair *pair) {
+Edge getOrderConstraint(HashtableOrderPair *table, OrderPair *pair) {
        ASSERT(pair->first != pair->second);
        bool negate = false;
        OrderPair flipped;
index 48447af7f440e63ed1548a342c9a45f6b79de47f..1e808cb6166b63052a75dd2211f099d987f19717 100644 (file)
@@ -4,7 +4,7 @@
 #include "cppvector.h"
 #include "hashset.h"
 
-typedef HashSet<Boolean *, uintptr_t, 4> HashSetBoolean;
+typedef Hashset<Boolean *, uintptr_t, 4> HashsetBoolean;
 typedef SetIterator<Boolean *, uintptr_t, 4> SetIteratorBoolean;
 
 #endif
index fa3f3272538c21c50b777fcd040a79197c3bc372..47b6f500d54a7dc94fac9a3f8ed3d46ae6ba974e 100644 (file)
@@ -7,24 +7,24 @@
  *      version 2 as published by the Free Software Foundation.
  */
 
-#ifndef HASH_SET_H
-#define HASH_SET_H
+#ifndef HASHSET_H
+#define HASHSET_H
 #include "hashtable.h"
 
 template<typename _Key>
-struct LinkNode {
+struct Linknode {
        _Key key;
-       LinkNode<_Key> *prev;
-       LinkNode<_Key> *next;
+       Linknode<_Key> *prev;
+       Linknode<_Key> *next;
 };
 
 template<typename _Key, typename _KeyInt, int _Shift, unsigned int (*hash_function)(_Key), bool (*equals)(_Key, _Key)>
-class HashSet;
+class Hashset;
 
-template<typename _Key, typename _KeyInt, int _Shift, unsigned int (*hash_function)(_Key) = default_hash_function<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = default_equals<_Key> >
+template<typename _Key, typename _KeyInt, int _Shift, unsigned int (*hash_function)(_Key) = defaultHashFunction<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = defaultEquals<_Key> >
 class SetIterator {
 public:
-       SetIterator(LinkNode<_Key> *_curr, HashSet <_Key, _KeyInt, _Shift, hash_function, equals> *_set) :
+       SetIterator(Linknode<_Key> *_curr, Hashset <_Key, _KeyInt, _Shift, hash_function, equals> *_set) :
                curr(_curr),
                set(_set)
        {
@@ -71,34 +71,34 @@ public:
        }
 
 private:
-       LinkNode<_Key> *curr;
-       LinkNode<_Key> *last;
-       HashSet <_Key, _KeyInt, _Shift, hash_function, equals> *set;
+       Linknode<_Key> *curr;
+       Linknode<_Key> *last;
+       Hashset <_Key, _KeyInt, _Shift, hash_function, equals> *set;
 };
 
-template<typename _Key, typename _KeyInt, int _Shift = 0, unsigned int (*hash_function)(_Key) = default_hash_function<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = default_equals<_Key> >
-class HashSet {
+template<typename _Key, typename _KeyInt, int _Shift = 0, unsigned int (*hash_function)(_Key) = defaultHashFunction<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = defaultEquals<_Key> >
+class Hashset {
 public:
-       HashSet(unsigned int initialcapacity = 16, double factor = 0.5) :
-               table(new HashTable<_Key, LinkNode<_Key> *, _KeyInt, _Shift, hash_function, equals>(initialcapacity, factor)),
+       Hashset(unsigned int initialcapacity = 16, double factor = 0.5) :
+               table(new Hashtable<_Key, Linknode<_Key> *, _KeyInt, _Shift, hash_function, equals>(initialcapacity, factor)),
                list(NULL),
                tail(NULL)
        {
        }
 
        /** @brief Hashset destructor */
-       ~HashSet() {
-               LinkNode<_Key> *tmp = list;
+       ~Hashset() {
+               Linknode<_Key> *tmp = list;
                while (tmp != NULL) {
-                       LinkNode<_Key> *tmpnext = tmp->next;
+                       Linknode<_Key> *tmpnext = tmp->next;
                        ourfree(tmp);
                        tmp = tmpnext;
                }
                delete table;
        }
 
-       HashSet<_Key, _KeyInt, _Shift, hash_function, equals> *copy() {
-               HashSet<_Key, _KeyInt, _Shift, hash_function, equals> *copy = new HashSet<_Key, _KeyInt, _Shift, hash_function, equals>(table->getCapacity(), table->getLoadFactor());
+       Hashset<_Key, _KeyInt, _Shift, hash_function, equals> *copy() {
+               Hashset<_Key, _KeyInt, _Shift, hash_function, equals> *copy = new Hashset<_Key, _KeyInt, _Shift, hash_function, equals>(table->getCapacity(), table->getLoadFactor());
                SetIterator<_Key, _KeyInt, _Shift, hash_function, equals> *it = iterator();
                while (it->hasNext())
                        copy->add(it->next());
@@ -107,9 +107,9 @@ public:
        }
 
        void reset() {
-               LinkNode<_Key> *tmp = list;
+               Linknode<_Key> *tmp = list;
                while (tmp != NULL) {
-                       LinkNode<_Key> *tmpnext = tmp->next;
+                       Linknode<_Key> *tmpnext = tmp->next;
                        ourfree(tmp);
                        tmp = tmpnext;
                }
@@ -120,7 +120,7 @@ public:
        /** @brief Adds a new key to the hashset.  Returns false if the key
         *  is already present. */
 
-       void addAll(HashSet<_Key, _KeyInt, _Shift, hash_function, equals> *table) {
+       void addAll(Hashset<_Key, _KeyInt, _Shift, hash_function, equals> *table) {
                SetIterator<_Key, _KeyInt, _Shift, hash_function, equals> *it = iterator();
                while (it->hasNext())
                        add(it->next());
@@ -131,9 +131,9 @@ public:
         *  is already present. */
 
        bool add(_Key key) {
-               LinkNode<_Key> *val = table->get(key);
+               Linknode<_Key> *val = table->get(key);
                if (val == NULL) {
-                       LinkNode<_Key> *newnode = (LinkNode<_Key> *)ourmalloc(sizeof(struct LinkNode<_Key>));
+                       Linknode<_Key> *newnode = (Linknode<_Key> *)ourmalloc(sizeof(struct Linknode<_Key>));
                        newnode->prev = tail;
                        newnode->next = NULL;
                        newnode->key = key;
@@ -155,7 +155,7 @@ public:
                        return NULL;
                else if (getSize() < 6) {
                        uint count = random() % getSize();
-                       LinkNode<_Key> *ptr=list;
+                       Linknode<_Key> *ptr=list;
                        while(count > 0) {
                                ptr = ptr->next;
                                count--;
@@ -169,7 +169,7 @@ public:
         *  hashset.  Returns NULL if not present. */
 
        _Key get(_Key key) {
-               LinkNode<_Key> *val = table->get(key);
+               Linknode<_Key> *val = table->get(key);
                if (val != NULL)
                        return val->key;
                else
@@ -185,7 +185,7 @@ public:
        }
 
        bool remove(_Key key) {
-               LinkNode<_Key> *oldlinknode;
+               Linknode<_Key> *oldlinknode;
                oldlinknode = table->get(key);
                if (oldlinknode == NULL) {
                        return false;
@@ -237,8 +237,8 @@ public:
                ourfree(p);
        }
 private:
-       HashTable<_Key, LinkNode<_Key> *, _KeyInt, _Shift, hash_function, equals> *table;
-       LinkNode<_Key> *list;
-       LinkNode<_Key> *tail;
+       Hashtable<_Key, Linknode<_Key> *, _KeyInt, _Shift, hash_function, equals> *table;
+       Linknode<_Key> *list;
+       Linknode<_Key> *tail;
 };
 #endif
index 3e60048a536f46a0a3e823fe36dee564a440556c..18d7353d71b56ffec84eeb1bf0c74e8c5e069553 100644 (file)
@@ -11,8 +11,8 @@
  *  @brief Hashtable.  Standard chained bucket variety.
  */
 
-#ifndef __HASHTABLE_H__
-#define __HASHTABLE_H__
+#ifndef HASHTABLE_H__
+#define HASHTABLE_H__
 
 #include <stdlib.h>
 #include <stdio.h>
 #include "common.h"
 
 /**
- * @brief HashTable node
+ * @brief Hashtable node
  *
  * @tparam _Key    Type name for the key
  * @tparam _Val    Type name for the values to be stored
  */
 template<typename _Key, typename _Val>
-struct hashlistnode {
+struct Hashlistnode {
        _Key key;
        _Val val;
 };
 
 template<typename _Key, int _Shift, typename _KeyInt>
-inline unsigned int default_hash_function(_Key hash) {
+inline unsigned int defaultHashFunction(_Key hash) {
        return (unsigned int)(((_KeyInt)hash) >> _Shift);
 }
 
 template<typename _Key>
-inline bool default_equals(_Key key1, _Key key2) {
+inline bool defaultEquals(_Key key1, _Key key2) {
        return key1 == key2;
 }
 
@@ -56,8 +56,8 @@ inline bool default_equals(_Key key1, _Key key2) {
  *                 manipulation and storage.
  * @tparam _Shift  Logical shift to apply to all keys. Default 0.
  */
-template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, unsigned int (*hash_function)(_Key) = default_hash_function<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = default_equals<_Key> >
-class HashTable {
+template<typename _Key, typename _Val, typename _KeyInt, int _Shift = 0, unsigned int (*hash_function)(_Key) = defaultHashFunction<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = defaultEquals<_Key> >
+class Hashtable {
 public:
        /**
         * @brief Hash table constructor
@@ -66,9 +66,9 @@ public:
         * @param factor Sets the percentage full before the hashtable is
         * resized. Default ratio 0.5.
         */
-       HashTable(unsigned int initialcapacity = 1024, double factor = 0.5) {
+       Hashtable(unsigned int initialcapacity = 1024, double factor = 0.5) {
                // Allocate space for the hash table
-               table = (struct hashlistnode<_Key, _Val> *)ourcalloc(initialcapacity, sizeof(struct hashlistnode<_Key, _Val>));
+               table = (struct Hashlistnode<_Key, _Val> *)ourcalloc(initialcapacity, sizeof(struct Hashlistnode<_Key, _Val>));
                zero = NULL;
                loadfactor = factor;
                capacity = initialcapacity;
@@ -79,7 +79,7 @@ public:
        }
 
        /** @brief Hash table destructor */
-       ~HashTable() {
+       ~Hashtable() {
                ourfree(table);
                if (zero)
                        ourfree(zero);
@@ -107,7 +107,7 @@ public:
 
        /** @brief Reset the table to its initial state. */
        void reset() {
-               memset(table, 0, capacity * sizeof(struct hashlistnode<_Key, _Val>));
+               memset(table, 0, capacity * sizeof(struct Hashlistnode<_Key, _Val>));
                if (zero) {
                        ourfree(zero);
                        zero = NULL;
@@ -119,7 +119,7 @@ public:
   _Val getRandomValue() {
                while(true) {
                        unsigned int index=random() & capacitymask;
-                       struct hashlistnode<_Key, _Val> *bin = &table[index];
+                       struct Hashlistnode<_Key, _Val> *bin = &table[index];
                        if (bin->key != NULL && bin->val != NULL) {
                                return bin->val;
                        }
@@ -128,7 +128,7 @@ public:
 
        void resetanddelete() {
                for (unsigned int i = 0; i < capacity; i++) {
-                       struct hashlistnode<_Key, _Val> *bin = &table[i];
+                       struct Hashlistnode<_Key, _Val> *bin = &table[i];
                        if (bin->key != NULL) {
                                bin->key = NULL;
                                if (bin->val != NULL) {
@@ -148,7 +148,7 @@ public:
 
        void resetandfree() {
                for (unsigned int i = 0; i < capacity; i++) {
-                       struct hashlistnode<_Key, _Val> *bin = &table[i];
+                       struct Hashlistnode<_Key, _Val> *bin = &table[i];
                        if (bin->key != NULL) {
                                bin->key = NULL;
                                if (bin->val != NULL) {
@@ -172,10 +172,10 @@ public:
         * @param val The value to store in the table
         */
        void put(_Key key, _Val val) {
-               /* HashTable cannot handle 0 as a key */
+               /* Hashtable cannot handle 0 as a key */
                if (!key) {
                        if (!zero) {
-                               zero = (struct hashlistnode<_Key, _Val> *)ourmalloc(sizeof(struct hashlistnode<_Key, _Val>));
+                               zero = (struct Hashlistnode<_Key, _Val> *)ourmalloc(sizeof(struct Hashlistnode<_Key, _Val>));
                                size++;
                        }
                        zero->key = key;
@@ -186,7 +186,7 @@ public:
                if (size > threshold)
                        resize(capacity << 1);
 
-               struct hashlistnode<_Key, _Val> *search;
+               struct Hashlistnode<_Key, _Val> *search;
 
                unsigned int index = hash_function(key);
                do {
@@ -214,9 +214,9 @@ public:
         * @return The value in the table, if the key is found; otherwise 0
         */
        _Val get(_Key key) const {
-               struct hashlistnode<_Key, _Val> *search;
+               struct Hashlistnode<_Key, _Val> *search;
 
-               /* HashTable cannot handle 0 as a key */
+               /* Hashtable cannot handle 0 as a key */
                if (!key) {
                        if (zero)
                                return zero->val;
@@ -248,9 +248,9 @@ public:
         * @return The value in the table, if the key is found; otherwise 0
         */
        _Val remove(_Key key) {
-               struct hashlistnode<_Key, _Val> *search;
+               struct Hashlistnode<_Key, _Val> *search;
 
-               /* HashTable cannot handle 0 as a key */
+               /* Hashtable cannot handle 0 as a key */
                if (!key) {
                        if (!zero) {
                                return (_Val)0;
@@ -296,9 +296,9 @@ public:
         * @return True, if the key is found; false otherwise
         */
        bool contains(_Key key) const {
-               struct hashlistnode<_Key, _Val> *search;
+               struct Hashlistnode<_Key, _Val> *search;
 
-               /* HashTable cannot handle 0 as a key */
+               /* Hashtable cannot handle 0 as a key */
                if (!key) {
                        return zero != NULL;
                }
@@ -323,11 +323,11 @@ public:
         * @param newsize The new size of the table
         */
        void resize(unsigned int newsize) {
-               struct hashlistnode<_Key, _Val> *oldtable = table;
-               struct hashlistnode<_Key, _Val> *newtable;
+               struct Hashlistnode<_Key, _Val> *oldtable = table;
+               struct Hashlistnode<_Key, _Val> *newtable;
                unsigned int oldcapacity = capacity;
 
-               if ((newtable = (struct hashlistnode<_Key, _Val> *)ourcalloc(newsize, sizeof(struct hashlistnode<_Key, _Val>))) == NULL) {
+               if ((newtable = (struct Hashlistnode<_Key, _Val> *)ourcalloc(newsize, sizeof(struct Hashlistnode<_Key, _Val>))) == NULL) {
                        model_print("calloc error %s %d\n", __FILE__, __LINE__);
                        exit(EXIT_FAILURE);
                }
@@ -338,12 +338,12 @@ public:
 
                threshold = (unsigned int)(newsize * loadfactor);
 
-               struct hashlistnode<_Key, _Val> *bin = &oldtable[0];
-               struct hashlistnode<_Key, _Val> *lastbin = &oldtable[oldcapacity];
+               struct Hashlistnode<_Key, _Val> *bin = &oldtable[0];
+               struct Hashlistnode<_Key, _Val> *lastbin = &oldtable[oldcapacity];
                for (; bin < lastbin; bin++) {
                        _Key key = bin->key;
 
-                       struct hashlistnode<_Key, _Val> *search;
+                       struct Hashlistnode<_Key, _Val> *search;
                        if (!key)
                                continue;
 
@@ -362,8 +362,8 @@ public:
        }
        double getLoadFactor() {return loadfactor;}
        unsigned int getCapacity() {return capacity;}
-       struct hashlistnode<_Key, _Val> *table;
-       struct hashlistnode<_Key, _Val> *zero;
+       struct Hashlistnode<_Key, _Val> *table;
+       struct Hashlistnode<_Key, _Val> *zero;
        unsigned int capacity;
        unsigned int size;
 private:
index 88cd42a0941ccaff833137237abe3ae1fc36d7ad..d0c9185857ed489330263a2c00c9d29b7f2bbe6d 100644 (file)
@@ -20,14 +20,14 @@ bool order_pair_equals(OrderPair *key1, OrderPair *key2);
 
 
 
-typedef HashSet<TableEntry *, uintptr_t, 4, table_entry_hash_function, table_entry_equals> HashSetTableEntry;
-typedef HashSet<OrderNode *, uintptr_t, 4, order_node_hash_function, order_node_equals> HashSetOrderNode;
-typedef HashSet<OrderEdge *, uintptr_t, 4, order_edge_hash_function, order_edge_equals> HashSetOrderEdge;
-typedef HashSet<OrderElement *, uintptr_t, 4, order_element_hash_function, order_element_equals> HashSetOrderElement;
-typedef HashTable<OrderNode *, HashSetOrderNode *, uintptr_t, 4> HashTableNodeToNodeSet;
-typedef HashTable<OrderPair *, OrderPair *, uintptr_t, 4, order_pair_hash_function, order_pair_equals> HashTableOrderPair;
-typedef HashTable<void *, void *, uintptr_t, 4> CloneMap;
-typedef HashTable<Order* , IntegerEncodingRecord*, uintptr_t, 4> HashTableOrderIntegerEncoding; 
+typedef Hashset<TableEntry *, uintptr_t, 4, table_entry_hash_function, table_entry_equals> HashsetTableEntry;
+typedef Hashset<OrderNode *, uintptr_t, 4, order_node_hash_function, order_node_equals> HashsetOrderNode;
+typedef Hashset<OrderEdge *, uintptr_t, 4, order_edge_hash_function, order_edge_equals> HashsetOrderEdge;
+typedef Hashset<OrderElement *, uintptr_t, 4, order_element_hash_function, order_element_equals> HashsetOrderElement;
+typedef Hashtable<OrderNode *, HashsetOrderNode *, uintptr_t, 4> HashtableNodeToNodeSet;
+typedef Hashtable<OrderPair *, OrderPair *, uintptr_t, 4, order_pair_hash_function, order_pair_equals> HashtableOrderPair;
+typedef Hashtable<void *, void *, uintptr_t, 4> CloneMap;
+typedef Hashtable<Order* , IntegerEncodingRecord*, uintptr_t, 4> HashtableOrderIntegerEncoding; 
 
 typedef SetIterator<TableEntry *, uintptr_t, 4, table_entry_hash_function, table_entry_equals> SetIteratorTableEntry;
 typedef SetIterator<OrderEdge *, uintptr_t, 4, order_edge_hash_function, order_edge_equals> SetIteratorOrderEdge;
index b410d01bc4725a3c968326b874f602a150879180..862faf690c45ad6b1f29cfd4d14dce95638b876f 100644 (file)
@@ -28,7 +28,7 @@ class TunableSetting {
 unsigned int tunableSettingHash(TunableSetting *setting);
 bool tunableSettingEquals(TunableSetting *setting1, TunableSetting *setting2);
 
-typedef HashSet<TunableSetting *, uintptr_t, 4, tunableSettingHash, tunableSettingEquals> HashSetTunableSetting;
+typedef Hashset<TunableSetting *, uintptr_t, 4, tunableSettingHash, tunableSettingEquals> HashsetTunableSetting;
 typedef SetIterator<TunableSetting *, uintptr_t, 4, tunableSettingHash, tunableSettingEquals> SetIteratorTunableSetting;
 
 class SearchTuner : public Tuner {
@@ -48,8 +48,8 @@ class SearchTuner : public Tuner {
        /** Used Settings keeps track of settings that were actually used by
                 the example. Mutating settings may cause the Constraint Compiler
                 not to query other settings.*/
-       HashSetTunableSetting usedSettings;
+       HashsetTunableSetting usedSettings;
        /** Settings contains all settings. */
-       HashSetTunableSetting settings;
+       HashsetTunableSetting settings;
 };
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index fd370a7..fe2eab5
@@ -26,5 +26,6 @@ class Tuner;
 class Set;
 class BooleanLogic;
 typedef uint64_t VarType;
+typedef unsigned int uint;
 
 #endif
index 1145d676225657396a2363ac3e52d22c422659bf..35370e1a1a5c21681bf562191d0f485c6c1d06bc 100644 (file)
@@ -59,12 +59,8 @@ class TunableDesc;
 
 struct IncrementalSolver;
 typedef struct IncrementalSolver IncrementalSolver;
-
 struct TableEntry;
 typedef struct TableEntry TableEntry;
-
 typedef int TunableParam;
-typedef unsigned int uint;
-typedef long int int64;
 
 #endif
index a37434cf3e86bc39d3c209aeda7f99a5f6d6fb1c..85da23e117e8c0e5b4f5c699bbc4f16209b8a3fc 100644 (file)
@@ -139,7 +139,7 @@ private:
        void handleORFalse(BooleanLogic *bexpr, Boolean *child);
 
        /** This is a vector of constraints that must be satisfied. */
-       HashSetBoolean constraints;
+       HashsetBoolean constraints;
 
        /** This is a vector of all boolean structs that we have allocated. */
        Vector<Boolean *> allBooleans;