X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=src%2FAST%2Ftable.c;h=a8af588fb4a67e9f4dff37176c125b4c9a099256;hb=73415104c9001d8154b226d320c5963d1364b858;hp=48bd532d52c4aade239cb49c9cc35f5cd15e00e8;hpb=d4e365ab7ea6d97d8ad65c1f230871254ce36737;p=satune.git diff --git a/src/AST/table.c b/src/AST/table.c index 48bd532..a8af588 100644 --- a/src/AST/table.c +++ b/src/AST/table.c @@ -2,19 +2,30 @@ #include "common.h" #include "structs.h" #include "tableentry.h" +#include "set.h" +#include "mutableset.h" -Table * allocTable(Set **domains, uint numDomain, Set * range){ - Table* table = (Table*) ourmalloc(sizeof(Table)); - table->domains = allocDefVectorSet(); - for(int i=0; idomains, domains[i]); - } - table->range =range; +Table * allocTable(Element **domains, uint numDomain, Element * range){ + Table* table = (Table*) ourmalloc(sizeof(Table)); + allocInlineArrayInitElement(&table->domains, domains, numDomain); + allocInlineDefVectorTableEntry(&table->entries); + table->range =range; + return table; } void addNewTableEntry(Table* table, uint64_t* inputs, uint inputSize, uint64_t result){ - ASSERT(getSizeVectorSet( table->domains) == inputSize); - pushVectorTableEntry(table->entries, allocTableEntry(inputs, inputSize, result)); + ASSERT(getSizeArrayElement( &table->domains) == inputSize); + pushVectorTableEntry(&table->entries, allocTableEntry(inputs, inputSize, result)); +} + +void deleteTable(Table* table){ + deleteInlineArrayElement(&table->domains); + uint size = getSizeVectorTableEntry(&table->entries); + for(uint i=0; ientries, i)); + } + deleteVectorArrayTableEntry(&table->entries); + ourfree(table); }