From 83849cbb24f9680d1ca7c09d09ecefc6fe461d66 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 30 Aug 2017 17:12:14 -0700 Subject: [PATCH] Fix name collisions --- src/AST/asthash.h | 4 +- src/AST/order.cc | 4 +- src/AST/order.h | 6 +-- src/AST/table.cc | 2 +- src/AST/table.h | 2 +- src/ASTAnalyses/orderanalysis.cc | 14 ++--- src/ASTAnalyses/ordergraph.cc | 4 +- src/ASTAnalyses/ordergraph.h | 4 +- src/ASTAnalyses/ordernode.h | 4 +- src/ASTTransform/integerencoding.cc | 2 +- src/ASTTransform/integerencoding.h | 2 +- src/ASTTransform/integerencodingrecord.cc | 2 +- src/ASTTransform/integerencodingrecord.h | 2 +- src/Backend/satencoder.h | 6 +-- src/Backend/satorderencoder.cc | 6 +-- src/Collections/corestructs.h | 2 +- src/Collections/hashset.h | 62 +++++++++++----------- src/Collections/hashtable.h | 64 +++++++++++------------ src/Collections/structs.h | 16 +++--- src/Tuner/searchtuner.h | 6 +-- src/classes.h | 1 + src/classlist.h | 4 -- src/csolver.h | 2 +- 23 files changed, 109 insertions(+), 112 deletions(-) mode change 100755 => 100644 src/classes.h diff --git a/src/AST/asthash.h b/src/AST/asthash.h index bdb5ec6..6dd50dc 100644 --- a/src/AST/asthash.h +++ b/src/AST/asthash.h @@ -9,8 +9,8 @@ bool compareBoolean(Boolean *b1, Boolean *b2); uint hashElement(Element *element); bool compareElement(Element *e1, Element *e2); -typedef HashTable BooleanMatchMap; +typedef Hashtable BooleanMatchMap; -typedef HashTable ElementMatchMap; +typedef Hashtable ElementMatchMap; #endif diff --git a/src/AST/order.cc b/src/AST/order.cc index 0944bca..d359ee6 100644 --- a/src/AST/order.cc +++ b/src/AST/order.cc @@ -14,8 +14,8 @@ Order::Order(OrderType _type, Set *_set) : { } -void Order::initializeOrderHashTable() { - orderPairTable = new HashTableOrderPair(); +void Order::initializeOrderHashtable() { + orderPairTable = new HashtableOrderPair(); } diff --git a/src/AST/order.h b/src/AST/order.h index ea2de5e..ed82695 100644 --- a/src/AST/order.h +++ b/src/AST/order.h @@ -14,13 +14,13 @@ public: ~Order(); OrderType type; Set *set; - HashTableOrderPair *orderPairTable; + HashtableOrderPair *orderPairTable; OrderGraph *graph; Order *clone(CSolver *solver, CloneMap *map); Vector constraints; OrderEncoding order; - void initializeOrderHashTable(); - void initializeOrderElementsHashTable(); + void initializeOrderHashtable(); + void initializeOrderElementsHashtable(); void addOrderConstraint(BooleanOrder *constraint); void setOrderEncodingType(OrderEncodingType type); CMEMALLOC; diff --git a/src/AST/table.cc b/src/AST/table.cc index 4d0716e..e0f735f 100644 --- a/src/AST/table.cc +++ b/src/AST/table.cc @@ -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) { diff --git a/src/AST/table.h b/src/AST/table.h index 51c1581..39b561c 100644 --- a/src/AST/table.h +++ b/src/AST/table.h @@ -13,7 +13,7 @@ public: ~Table(); Array domains; Set *range; - HashSetTableEntry *entries; + HashsetTableEntry *entries; CMEMALLOC; }; diff --git a/src/ASTAnalyses/orderanalysis.cc b/src/ASTAnalyses/orderanalysis.cc index 56544f4..196561c 100644 --- a/src/ASTAnalyses/orderanalysis.cc +++ b/src/ASTAnalyses/orderanalysis.cc @@ -147,7 +147,7 @@ void completePartialOrderGraph(OrderGraph *graph) { Vector finishNodes; DFS(graph, &finishNodes); resetNodeInfoStatusSCC(graph); - HashTableNodeToNodeSet *table = new HashTableNodeToNodeSet(128, 0.25); + HashtableNodeToNodeSet *table = new HashtableNodeToNodeSet(128, 0.25); Vector 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 *finishNodes) { void DFSClearContradictions(CSolver *solver, OrderGraph *graph, Vector *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, Vectorsource; if (edge->mustPos) { sources->add(parent); - HashSetOrderNode *parent_srcs = (HashSetOrderNode *) table->get(parent); + HashsetOrderNode *parent_srcs = (HashsetOrderNode *) table->get(parent); sources->addAll(parent_srcs); } } diff --git a/src/ASTAnalyses/ordergraph.cc b/src/ASTAnalyses/ordergraph.cc index c0df7a5..6169bd8 100644 --- a/src/ASTAnalyses/ordergraph.cc +++ b/src/ASTAnalyses/ordergraph.cc @@ -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) { } diff --git a/src/ASTAnalyses/ordergraph.h b/src/ASTAnalyses/ordergraph.h index d28c4b6..5f10c1f 100644 --- a/src/ASTAnalyses/ordergraph.h +++ b/src/ASTAnalyses/ordergraph.h @@ -30,8 +30,8 @@ public: CMEMALLOC; private: - HashSetOrderNode *nodes; - HashSetOrderEdge *edges; + HashsetOrderNode *nodes; + HashsetOrderEdge *edges; Order *order; }; diff --git a/src/ASTAnalyses/ordernode.h b/src/ASTAnalyses/ordernode.h index 3ffecb8..08685d4 100644 --- a/src/ASTAnalyses/ordernode.h +++ b/src/ASTAnalyses/ordernode.h @@ -26,8 +26,8 @@ public: uint64_t id; NodeStatus status; uint sccNum; - HashSetOrderEdge inEdges; - HashSetOrderEdge outEdges; + HashsetOrderEdge inEdges; + HashsetOrderEdge outEdges; CMEMALLOC; }; #endif/* ORDERNODE_H */ diff --git a/src/ASTTransform/integerencoding.cc b/src/ASTTransform/integerencoding.cc index 7d7ea92..d15c60e 100644 --- a/src/ASTTransform/integerencoding.cc +++ b/src/ASTTransform/integerencoding.cc @@ -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), diff --git a/src/ASTTransform/integerencoding.h b/src/ASTTransform/integerencoding.h index 6434a95..858f7ad 100644 --- a/src/ASTTransform/integerencoding.h +++ b/src/ASTTransform/integerencoding.h @@ -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; }; diff --git a/src/ASTTransform/integerencodingrecord.cc b/src/ASTTransform/integerencodingrecord.cc index ee3a427..6589df7 100644 --- a/src/ASTTransform/integerencodingrecord.cc +++ b/src/ASTTransform/integerencodingrecord.cc @@ -12,7 +12,7 @@ IntegerEncodingRecord::IntegerEncodingRecord(Set* _set): set(_set) { - elementTable = new HashSetOrderElement(); + elementTable = new HashsetOrderElement(); } IntegerEncodingRecord::~IntegerEncodingRecord(){ diff --git a/src/ASTTransform/integerencodingrecord.h b/src/ASTTransform/integerencodingrecord.h index da53918..bafc018 100644 --- a/src/ASTTransform/integerencodingrecord.h +++ b/src/ASTTransform/integerencodingrecord.h @@ -20,7 +20,7 @@ public: CMEMALLOC; private: - HashSetOrderElement *elementTable; + HashsetOrderElement *elementTable; }; #endif /* INTEGERENCODINGRECORD_H */ diff --git a/src/Backend/satencoder.h b/src/Backend/satencoder.h index 25a46d0..94115ce 100644 --- a/src/Backend/satencoder.h +++ b/src/Backend/satencoder.h @@ -6,7 +6,7 @@ #include "inc_solver.h" #include "constraint.h" -typedef HashTable BooleanToEdgeMap; +typedef Hashtable 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 diff --git a/src/Backend/satorderencoder.cc b/src/Backend/satorderencoder.cc index 10a87dd..31afdfc 100644 --- a/src/Backend/satorderencoder.cc +++ b/src/Backend/satorderencoder.cc @@ -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; diff --git a/src/Collections/corestructs.h b/src/Collections/corestructs.h index 48447af..1e808cb 100644 --- a/src/Collections/corestructs.h +++ b/src/Collections/corestructs.h @@ -4,7 +4,7 @@ #include "cppvector.h" #include "hashset.h" -typedef HashSet HashSetBoolean; +typedef Hashset HashsetBoolean; typedef SetIterator SetIteratorBoolean; #endif diff --git a/src/Collections/hashset.h b/src/Collections/hashset.h index fa3f327..47b6f50 100644 --- a/src/Collections/hashset.h +++ b/src/Collections/hashset.h @@ -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 -struct LinkNode { +struct Linknode { _Key key; - LinkNode<_Key> *prev; - LinkNode<_Key> *next; + Linknode<_Key> *prev; + Linknode<_Key> *next; }; template -class HashSet; +class Hashset; -template, bool (*equals)(_Key, _Key) = default_equals<_Key> > +template, 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, bool (*equals)(_Key, _Key) = default_equals<_Key> > -class HashSet { +template, 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 diff --git a/src/Collections/hashtable.h b/src/Collections/hashtable.h index 3e60048..18d7353 100644 --- a/src/Collections/hashtable.h +++ b/src/Collections/hashtable.h @@ -11,8 +11,8 @@ * @brief Hashtable. Standard chained bucket variety. */ -#ifndef __HASHTABLE_H__ -#define __HASHTABLE_H__ +#ifndef HASHTABLE_H__ +#define HASHTABLE_H__ #include #include @@ -21,24 +21,24 @@ #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 -struct hashlistnode { +struct Hashlistnode { _Key key; _Val val; }; template -inline unsigned int default_hash_function(_Key hash) { +inline unsigned int defaultHashFunction(_Key hash) { return (unsigned int)(((_KeyInt)hash) >> _Shift); } template -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, bool (*equals)(_Key, _Key) = default_equals<_Key> > -class HashTable { +template, 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: diff --git a/src/Collections/structs.h b/src/Collections/structs.h index 88cd42a..d0c9185 100644 --- a/src/Collections/structs.h +++ b/src/Collections/structs.h @@ -20,14 +20,14 @@ bool order_pair_equals(OrderPair *key1, OrderPair *key2); -typedef HashSet HashSetTableEntry; -typedef HashSet HashSetOrderNode; -typedef HashSet HashSetOrderEdge; -typedef HashSet HashSetOrderElement; -typedef HashTable HashTableNodeToNodeSet; -typedef HashTable HashTableOrderPair; -typedef HashTable CloneMap; -typedef HashTable HashTableOrderIntegerEncoding; +typedef Hashset HashsetTableEntry; +typedef Hashset HashsetOrderNode; +typedef Hashset HashsetOrderEdge; +typedef Hashset HashsetOrderElement; +typedef Hashtable HashtableNodeToNodeSet; +typedef Hashtable HashtableOrderPair; +typedef Hashtable CloneMap; +typedef Hashtable HashtableOrderIntegerEncoding; typedef SetIterator SetIteratorTableEntry; typedef SetIterator SetIteratorOrderEdge; diff --git a/src/Tuner/searchtuner.h b/src/Tuner/searchtuner.h index b410d01..862faf6 100644 --- a/src/Tuner/searchtuner.h +++ b/src/Tuner/searchtuner.h @@ -28,7 +28,7 @@ class TunableSetting { unsigned int tunableSettingHash(TunableSetting *setting); bool tunableSettingEquals(TunableSetting *setting1, TunableSetting *setting2); -typedef HashSet HashSetTunableSetting; +typedef Hashset HashsetTunableSetting; typedef SetIterator 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 diff --git a/src/classes.h b/src/classes.h old mode 100755 new mode 100644 index fd370a7..fe2eab5 --- a/src/classes.h +++ b/src/classes.h @@ -26,5 +26,6 @@ class Tuner; class Set; class BooleanLogic; typedef uint64_t VarType; +typedef unsigned int uint; #endif diff --git a/src/classlist.h b/src/classlist.h index 1145d67..35370e1 100644 --- a/src/classlist.h +++ b/src/classlist.h @@ -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 diff --git a/src/csolver.h b/src/csolver.h index a37434c..85da23e 100644 --- a/src/csolver.h +++ b/src/csolver.h @@ -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 allBooleans; -- 2.34.1