├── .gitignore ├── AUTHORS ├── Barrier.cpp ├── Barrier.h ├── Doxyfile ├── LICENSE ├── Makefile ├── ProcessorMap.cpp ├── ProcessorMap.h ├── README.md ├── comparator.cpp ├── comparator.h ├── conjunctionevaluator.cpp ├── conjunctionevaluator.h ├── debug ├── drivers ├── executequery.cpp └── sample_queries │ ├── data │ ├── lineitem.tbl.bz2 │ ├── nation.tbl │ ├── order.tbl.bz2 │ ├── part.tbl.bz2 │ └── region.tbl │ └── q1 │ ├── answer_query1.sh │ ├── q1_plan.pdf │ ├── query1.conf │ └── query1.cpp ├── exceptions.h ├── externals ├── bzip2-1.0.5 │ ├── CHANGES │ ├── LICENSE │ ├── Makefile │ ├── Makefile-libbz2_so │ ├── README │ ├── README.COMPILATION.PROBLEMS │ ├── README.XML.STUFF │ ├── blocksort.c │ ├── bz-common.xsl │ ├── bz-fo.xsl │ ├── bz-html.xsl │ ├── bzdiff │ ├── bzdiff.1 │ ├── bzgrep │ ├── bzgrep.1 │ ├── bzip.css │ ├── bzip2.1 │ ├── bzip2.1.preformatted │ ├── bzip2.c │ ├── bzip2.txt │ ├── bzip2recover.c │ ├── bzlib.c │ ├── bzlib.h │ ├── bzlib_private.h │ ├── bzmore │ ├── bzmore.1 │ ├── compress.c │ ├── crctable.c │ ├── decompress.c │ ├── dlltest.c │ ├── dlltest.dsp │ ├── entities.xml │ ├── format.pl │ ├── huffman.c │ ├── libbz2.def │ ├── libbz2.dsp │ ├── makefile.msc │ ├── manual.html │ ├── manual.pdf │ ├── manual.ps │ ├── manual.xml │ ├── mk251.c │ ├── randtable.c │ ├── sample1.bz2 │ ├── sample1.ref │ ├── sample2.bz2 │ ├── sample2.ref │ ├── sample3.bz2 │ ├── sample3.ref │ ├── spewG.c │ ├── unzcrash.c │ ├── words0 │ ├── words1 │ ├── words2 │ ├── words3 │ └── xmlproc.sh ├── hdf5-1.8.11.tar.xz └── libconfig-1.2 │ ├── AUTHORS │ ├── COPYING.LIB │ ├── ChangeLog │ ├── INSTALL │ ├── Makefile.am │ ├── Makefile.in │ ├── NEWS │ ├── README │ ├── TODO │ ├── ac_config.h.in │ ├── aclocal.m4 │ ├── compile │ ├── config.guess │ ├── config.sub │ ├── configure │ ├── configure.ac │ ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── libconfigduo-dev.docs │ ├── libconfigduo-dev.install │ ├── libconfigduo.install │ └── rules │ ├── depcomp │ ├── doc │ ├── LGPL.texi │ ├── Makefile.am │ ├── Makefile.in │ ├── libconfig.info │ ├── libconfig.texi │ └── texinfo.tex │ ├── grammar.c │ ├── grammar.h │ ├── grammar.y │ ├── install-sh │ ├── libconfig++.pc.in │ ├── libconfig++.vcproj │ ├── libconfig++_stub.vcproj │ ├── libconfig.c │ ├── libconfig.h │ ├── libconfig.h++ │ ├── libconfig.pc.in │ ├── libconfig.sln │ ├── libconfig.spec.in │ ├── libconfig.vcproj │ ├── libconfig_stub.vcproj │ ├── libconfigcpp.c++ │ ├── ltmain.sh │ ├── missing │ ├── mkinstalldirs │ ├── private.h │ ├── samples │ ├── Makefile.am │ ├── Makefile.in │ ├── c++ │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── sample1.cpp │ │ ├── sample2.cpp │ │ ├── sample3.cpp │ │ └── stubcpp.cpp │ └── c │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── sample1.c │ │ ├── sample2.c │ │ ├── sample3.c │ │ └── stub.c │ ├── scanner.c │ ├── scanner.h │ ├── scanner.l │ ├── test.cfg │ └── ylwrap ├── hash.cpp ├── hash.h ├── lock.h ├── operators ├── aggregatecount.cpp ├── aggregatesum.cpp ├── base.cpp ├── bitentropy.cpp ├── checker_callstate.cpp ├── consume.cpp ├── cycleaccountant.cpp ├── fastbitscan.cpp ├── filter.cpp ├── generator_int.cpp ├── genericaggregate.cpp ├── hdf5index.cpp ├── hdf5random.cpp ├── hdf5scan.cpp ├── indexjoin.cpp ├── join.cpp ├── loaders │ ├── loader.cpp │ ├── loader.h │ ├── parser.cpp │ ├── parser.h │ ├── sfmt │ │ ├── SFMT-params.h │ │ ├── SFMT-params19937.h │ │ ├── SFMT.c │ │ └── SFMT.h │ ├── table.cpp │ └── table.h ├── mapwrapper.cpp ├── memsegmentwriter.cpp ├── merge.cpp ├── operators.h ├── operators_priv.h ├── parallelscan.cpp ├── partition.cpp ├── partitionedscan.cpp ├── printer_perfcnt.cpp ├── printer_tuplecount.cpp ├── project.cpp ├── scan.cpp ├── shuffle.cpp ├── sortandrangepartition.cpp ├── sortlimit.cpp └── threadidprepend.cpp ├── perfcounters.cpp ├── perfcounters.h ├── pre-init.sh ├── query.cpp ├── query.h ├── rawcompfns.cpp ├── rawcompfns.h ├── rdtsc.h ├── schema.cpp ├── schema.h ├── schema.inl ├── system.inc ├── unit_tests ├── common.h ├── conjunctionevaluator.cpp ├── data │ ├── identity.tbl │ ├── ptf_small.h5.ls.xz │ ├── ptf_small.h5.xz │ ├── ptfascii │ │ ├── ascii2int.cpp │ │ ├── buildfastbitindex.sh │ │ ├── candidate.csv.xz │ │ ├── candidate.first3proj │ │ ├── candidate │ │ │ ├── -part.txt │ │ │ ├── id │ │ │ ├── id.idx │ │ │ ├── id.ind │ │ │ └── id.srt │ │ ├── indexedhashjoin │ │ │ ├── keys │ │ │ └── payload │ │ ├── rb_classifier.csv.xz │ │ └── subtraction.csv.xz │ ├── toascii.tbl │ └── todouble.tbl ├── getnext.cpp ├── loadertest │ ├── test.tbl │ └── test.tbl.bz2 ├── queryagg.cpp ├── queryagg_compositekey.cpp ├── queryaggsum.cpp ├── queryaggsum_global.cpp ├── querydate.cpp ├── queryhashjoin.cpp ├── queryhdf5.cpp ├── queryindexhashjoin.cpp ├── querymap.cpp ├── querymapsequence.cpp ├── querymemsegmentwriter.cpp ├── querymerge.cpp ├── querympsmcartesianprod.cpp ├── querympsmcartesianprodtwogroups.cpp ├── querympsmjoin.cpp ├── querympsmpartitionedjoin.cpp ├── querympsmpkfkjoin.cpp ├── querypartition.cpp ├── querypartitionedmpsmpkfkjoin.cpp ├── querypreprejoin.cpp ├── querypreprejoincartesianprod.cpp ├── querypreprejoinfkpk.cpp ├── querypreprejoinpkfk.cpp ├── queryproject.cpp ├── queryshuffle.cpp ├── querysort.cpp ├── querysortmergecartesianprod.cpp ├── querysortmergejoin.cpp ├── querythreadidprepend.cpp ├── testaffinitizer.cpp ├── testcomparator.cpp ├── testfastbit.cpp ├── testhash.cpp ├── testhashtable.cpp ├── testhdf5scan.cpp ├── testindexhdf5.cpp ├── testloader.cpp ├── testmemmaptable.cpp ├── testpagebitonicsort.cpp ├── testpagesort.cpp ├── testparallelqueue.cpp ├── testparser.cpp ├── testschema.cpp └── testtable.cpp ├── util ├── affinitizer.cpp ├── affinitizer.h ├── atomics.h ├── bitonicsort.cpp ├── buffer.cpp ├── buffer.h ├── buffer.inl ├── custom_asserts.h ├── hashtable.cpp ├── hashtable.h ├── numaallocate.cpp ├── numaallocate.h ├── numaasserts.cpp ├── numaasserts.h ├── parallelqueue.h ├── parallelqueue.inl ├── reentrant_random.h ├── reentrant_random.inl └── static_assert.h └── visitors ├── allvisitors.h ├── prettyprint.cpp ├── recursivedestroy.cpp ├── recursivefree.cpp ├── threadclose.cpp ├── threadinit.cpp └── visitor.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Active contributors 2 | ------------------- 3 | Spyros Blanas 4 | 5 | Past contributors 6 | ----------------- 7 | Willis Lang (SortLimit, Shuffle operators) 8 | Dan Gibson (Barrier, ProcessorMap stubs) 9 | Venkatraman Govindaraju (Bitonic sorting code) 10 | -------------------------------------------------------------------------------- /Barrier.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014, Pythia authors (see AUTHORS file). 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * 3. Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "Barrier.h" 35 | #define fatal(...) 36 | 37 | PThreadLockCVBarrier::PThreadLockCVBarrier(int nThreads) { 38 | m_nThreads = nThreads; 39 | 40 | int ret; 41 | ret = pthread_mutex_init(&m_l_SyncLock, NULL); 42 | if(ret!=0) fatal("pthread_mutex_init failed at barrier creation.\n"); 43 | 44 | ret = pthread_cond_init(&m_cv_SyncCV, NULL); 45 | if(ret!=0) fatal("pthread_cond_init failed at barrier creation.\n"); 46 | 47 | m_nSyncCount = 0; 48 | } 49 | 50 | PThreadLockCVBarrier::PThreadLockCVBarrier() { 51 | int ret; 52 | ret = pthread_mutex_init(&m_l_SyncLock, NULL); 53 | if(ret!=0) fatal("pthread_mutex_init failed at barrier creation.\n"); 54 | 55 | ret = pthread_cond_init(&m_cv_SyncCV, NULL); 56 | if(ret!=0) fatal("pthread_cond_init failed at barrier creation.\n"); 57 | 58 | m_nSyncCount = 0; 59 | m_nThreads = 0; 60 | } 61 | 62 | void PThreadLockCVBarrier::init(int nThreads) { 63 | m_nThreads = nThreads; 64 | } 65 | 66 | PThreadLockCVBarrier::~PThreadLockCVBarrier() { 67 | pthread_mutex_destroy(&m_l_SyncLock); 68 | pthread_cond_destroy(&m_cv_SyncCV); 69 | } 70 | 71 | void PThreadLockCVBarrier::Arrive() { 72 | if( m_nThreads < 1 ) { 73 | fatal("Invalid number of threads for barrier: %i\n", m_nThreads ); 74 | } 75 | 76 | pthread_mutex_lock(&m_l_SyncLock); 77 | m_nSyncCount++; 78 | if(m_nSyncCount == m_nThreads) { 79 | pthread_cond_broadcast(&m_cv_SyncCV); 80 | m_nSyncCount = 0; 81 | } else { 82 | pthread_cond_wait(&m_cv_SyncCV, &m_l_SyncLock); 83 | } 84 | 85 | pthread_mutex_unlock(&m_l_SyncLock); 86 | 87 | } 88 | 89 | -------------------------------------------------------------------------------- /Barrier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014, Pythia authors (see AUTHORS file). 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * 3. Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _BARRIER_H_ 35 | #define _BARRIER_H_ 36 | 37 | #include 38 | 39 | /* C++ object-oriented barriers -- use Barrier.C */ 40 | class PThreadLockCVBarrier { 41 | public: 42 | PThreadLockCVBarrier( int nThreads ); 43 | PThreadLockCVBarrier(); 44 | ~PThreadLockCVBarrier(); 45 | 46 | void init(int nThreads); 47 | 48 | void Arrive(); 49 | 50 | private: 51 | int m_nThreads; 52 | pthread_mutex_t m_l_SyncLock; 53 | pthread_cond_t m_cv_SyncCV; 54 | volatile int m_nSyncCount; 55 | }; 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Pythia authors (see AUTHORS file). 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 25 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /ProcessorMap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014, Pythia authors (see AUTHORS file). 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * 3. Neither the name of the copyright holder nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef PROCMAP_H 35 | #define PROCMAP_H 36 | 37 | void fatal(const char * msg, ...); 38 | 39 | class ProcessorMap { 40 | public: 41 | ProcessorMap(); 42 | ~ProcessorMap(); 43 | 44 | int LogicalToPhysical(int lproc) const; 45 | int PhysicalToLogical(int pproc) const; 46 | int NumberOfProcessors() const { return m_nProcs; } 47 | 48 | int operator[]( int index ) const { return LogicalToPhysical( index ); } 49 | 50 | void BindToPhysicalCPU( int pproc ) const; 51 | 52 | private: 53 | void IntegrityCheck() const; 54 | int DetermineNumberOfProcessors(); 55 | 56 | int * m_p_nProcessor_Ids; 57 | int m_nProcs; 58 | 59 | }; 60 | 61 | #endif // #ifndef PROCMAP_H 62 | -------------------------------------------------------------------------------- /comparator.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009, Pythia authors (see AUTHORS file). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the copyright holder nor the names of its 18 | * contributors may be used to endorse or promote products derived from 19 | * this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef __MY_COMPARATOR__ 36 | #define __MY_COMPARATOR__ 37 | 38 | #include "schema.h" 39 | 40 | /** 41 | * Helper object to simplify comparisons of known data types. 42 | */ 43 | class Comparator { 44 | public: 45 | 46 | enum Comparison { 47 | Equal, 48 | Less, 49 | LessEqual, 50 | Greater, 51 | GreaterEqual, 52 | NotEqual 53 | }; 54 | 55 | /** 56 | * Parses the following: "<", "<=", "=", "==", "<>", "!=", ">=", ">". 57 | * @return The appropriate Comparison value for the input string. 58 | * @throws UnknownComparisonException Input string not recognized. 59 | */ 60 | static Comparison parseString(const string& opstr); 61 | 62 | Comparator() : loffset(0), roffset(0), size(0), fn(NULL) { } 63 | 64 | /** 65 | * Initializes comparator object. 66 | * @param lct ColumnSpec in left tuple. 67 | * @param loff Offset in left tuple. 68 | * @param rct ColumnSpec in right tuple. 69 | * @param roff Offset in right tuple. 70 | * @param op Comparison operation to perform. 71 | */ 72 | void init(ColumnSpec lct, unsigned int loff, 73 | ColumnSpec rct, unsigned int roff, 74 | Comparison op); 75 | 76 | inline bool eval(void* ltup, void* rtup) { 77 | char* lreal = (char*)ltup + loffset; 78 | char* rreal = (char*)rtup + roffset; 79 | return fn(lreal, rreal, size); 80 | } 81 | 82 | private: 83 | int loffset, roffset; 84 | int size; // passed to strncmp for CT_CHAR comparisons 85 | bool (*fn)(void*, void*, int); 86 | }; 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /conjunctionevaluator.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010, Pythia authors (see AUTHORS file). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the copyright holder nor the names of its 18 | * contributors may be used to endorse or promote products derived from 19 | * this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #include "conjunctionevaluator.h" 36 | using std::string; 37 | 38 | /** 39 | * Specifies the expression the object is evaluating. 40 | * 41 | * The expression evaluated when \a eval is called is: 42 | * expr = (s1[attr1[0]] op[0] s2[attr2[0]]) 43 | * && (s1[attr1[1]] op[1] s2[attr2[1]]) 44 | * && (s1[attr1[2]] op[2] s2[attr2[2]]) 45 | * && ... 46 | * where s1[0] is the first column of schema s1. 47 | * 48 | * If the input vectors are empty, expression always evaluates to true. 49 | * This is useful for comparison expressions with empty predicates (eg. 50 | * aggregation without a GROUP BY clause). 51 | */ 52 | void ConjunctionEvaluator::init(Schema& s1, Schema& s2, 53 | vector& attr1, vector& attr2, 54 | vector& op) 55 | { 56 | comps.clear(); 57 | //dbgassert(op.size() == attr1.size()); 58 | //dbgassert(attr1.size() == attr2.size()); 59 | 60 | //WILLIS CHANGED: 61 | //WE GO BY OP SIZE SO THAT THIS NEED NOT EVAL ON THE ENTIRE TUPLE BY MAYBE A PORTION OF IT 62 | for (unsigned int i=0; i& attr1, vector& attr2) 86 | { 87 | vector op(attr1.size(), Comparator::Equal); 88 | ConjunctionEvaluator::init(s1, s2, attr1, attr2, op); 89 | } 90 | -------------------------------------------------------------------------------- /conjunctionevaluator.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010, Pythia authors (see AUTHORS file). 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * 3. Neither the name of the copyright holder nor the names of its 18 | * contributors may be used to endorse or promote products derived from 19 | * this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #include "schema.h" 36 | #include "comparator.h" 37 | #include 38 | #include 39 | 40 | /** 41 | * Class evaluates a special form of conjunction, where every clause is of the 42 | * form X op Y. 43 | */ 44 | class ConjunctionEvaluator 45 | { 46 | public: 47 | void init(Schema& s1, Schema& s2, 48 | vector& attr1, vector& attr2, 49 | vector& op); 50 | inline bool eval(void* tup1, void* tup2); 51 | 52 | private: 53 | vector comps; 54 | }; 55 | 56 | 57 | bool ConjunctionEvaluator::eval(void* tup1, void* tup2) { 58 | for (unsigned int i=0; i& attr1, vector& attr2); 78 | }; 79 | -------------------------------------------------------------------------------- /debug: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LD_LIBRARY_PATH=dist/lib/:$LD_LIBRARY_PATH gdb --args $* 4 | -------------------------------------------------------------------------------- /drivers/executequery.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012, Spyros Blanas. 4 | */ 5 | 6 | #include 7 | #include 8 | #include "libconfig.h++" 9 | 10 | #include "../query.h" 11 | #include "../visitors/allvisitors.h" 12 | #include "../rdtsc.h" 13 | 14 | #define QUERYPLAN 15 | 16 | using namespace std; 17 | using namespace libconfig; 18 | 19 | void fail(const char* explanation) { 20 | std::cout << " ** FAILED: " << explanation << std::endl; 21 | throw QueryExecutionError(); 22 | } 23 | 24 | extern size_t TotalBytesAllocated; 25 | 26 | #ifdef STATS_ALLOCATE 27 | void dbgPrintAllocations(Query& q); 28 | #endif 29 | 30 | Query q; 31 | 32 | void compute() 33 | { 34 | unsigned long long cycles = 0; 35 | Operator::GetNextResultT result; 36 | result.first = Operator::Ready; 37 | 38 | startTimer(&cycles); 39 | 40 | if (q.scanStart() == Operator::Error) 41 | fail("Scan initialization failed."); 42 | 43 | while(result.first == Operator::Ready) { 44 | result = q.getNext(); 45 | 46 | if (result.first == Operator::Error) 47 | fail("GetNext returned error."); 48 | 49 | Operator::Page::Iterator it = result.second->createIterator(); 50 | void* tuple; 51 | while ((tuple = it.next()) ) { 52 | cout << q.getOutSchema().prettyprint(tuple, '|') << endl; 53 | } 54 | } 55 | 56 | if (q.scanStop() == Operator::Error) 57 | fail("Scan stop failed."); 58 | 59 | stopTimer(&cycles); 60 | 61 | #warning Cycles to seconds conversion is hardcoded for our prototype system 62 | cout << "ResponseTimeInSec: " << cycles/1000./1000./2000. << endl; 63 | } 64 | 65 | 66 | int main(int argc, char** argv) 67 | { 68 | Config cfg; 69 | 70 | if (argc < 2) { 71 | cout << "ERROR: Configuration file not specified." << endl; 72 | cout << "Usage: " << argv[0] << " conf-file" << endl; 73 | return 2; 74 | } 75 | 76 | cfg.readFile(argv[1]); 77 | q.create(cfg); 78 | 79 | q.threadInit(); 80 | 81 | compute(); 82 | 83 | #ifdef QUERYPLAN 84 | cout << "---------- QUERY PLAN START ----------" << endl; 85 | PrettyPrinterVisitor ppv; 86 | q.accept(&ppv); 87 | cout << "----------- QUERY PLAN END -----------" << endl; 88 | #endif 89 | 90 | cout << "Max Memory Allocated (bytes): " << TotalBytesAllocated << endl; 91 | 92 | #ifdef STATS_ALLOCATE 93 | dbgPrintAllocations(q); 94 | #endif 95 | 96 | q.threadClose(); 97 | 98 | q.destroy(); 99 | 100 | return 0; 101 | } 102 | -------------------------------------------------------------------------------- /drivers/sample_queries/data/lineitem.tbl.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/drivers/sample_queries/data/lineitem.tbl.bz2 -------------------------------------------------------------------------------- /drivers/sample_queries/data/nation.tbl: -------------------------------------------------------------------------------- 1 | 0|ALGERIA|0| 2 | 1|ARGENTINA|1| 3 | 2|BRAZIL|1| 4 | 3|CANADA|1| 5 | 4|EGYPT|4| 6 | 5|ETHIOPIA|0| 7 | 6|FRANCE|3| 8 | 7|GERMANY|3| 9 | 8|INDIA|2| 10 | 9|INDONESIA|2| 11 | 10|IRAN|4| 12 | 11|IRAQ|4| 13 | 12|JAPAN|2| 14 | 13|JORDAN|4| 15 | 14|KENYA|0| 16 | 15|MOROCCO|0| 17 | 16|MOZAMBIQUE|0| 18 | 17|PERU|1| 19 | 18|CHINA|2| 20 | 19|ROMANIA|3| 21 | 20|SAUDI ARABIA|4| 22 | 21|VIETNAM|2| 23 | 22|RUSSIA|3| 24 | 23|UNITED KINGDOM|3| 25 | 24|UNITED STATES|1| 26 | -------------------------------------------------------------------------------- /drivers/sample_queries/data/order.tbl.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/drivers/sample_queries/data/order.tbl.bz2 -------------------------------------------------------------------------------- /drivers/sample_queries/data/part.tbl.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/drivers/sample_queries/data/part.tbl.bz2 -------------------------------------------------------------------------------- /drivers/sample_queries/data/region.tbl: -------------------------------------------------------------------------------- 1 | 0|AFRICA| 2 | 1|AMERICA| 3 | 2|ASIA| 4 | 3|EUROPE| 5 | 4|MIDDLE EAST| 6 | -------------------------------------------------------------------------------- /drivers/sample_queries/q1/answer_query1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat | sqlite3 < 39 | #include 40 | 41 | class InvalidParameter { }; 42 | 43 | class IllegalConversionException { }; 44 | 45 | class IllegalSchemaDeclarationException { }; 46 | 47 | class UnknownComparisonException { }; 48 | 49 | class UnknownAlgorithmException { }; 50 | 51 | class UnknownPartitionerException { }; 52 | 53 | class UnknownHashException { }; 54 | 55 | class QueryExecutionError { }; 56 | 57 | class UnknownCommand : public QueryExecutionError { }; 58 | 59 | class PageFullException { 60 | public: 61 | PageFullException(int b) : value(b) { } 62 | int value; 63 | }; 64 | 65 | class LoadBZ2Exception { }; 66 | 67 | class PerfCountersException { }; 68 | 69 | class AffinitizationException : public std::exception 70 | { 71 | public: 72 | AffinitizationException(const std::string c) 73 | : desc(c) 74 | { } 75 | 76 | virtual ~AffinitizationException() throw () { } 77 | 78 | virtual const char* what() { return desc.c_str(); } 79 | 80 | private: 81 | std::string desc; 82 | }; 83 | 84 | class FileNotFoundException { }; 85 | 86 | class NotYetImplemented { }; 87 | 88 | class MissingParameterException : public std::exception 89 | { 90 | public: 91 | MissingParameterException() 92 | { } 93 | 94 | MissingParameterException(const std::string c) 95 | : desc(c) 96 | { } 97 | 98 | virtual ~MissingParameterException() throw () { } 99 | 100 | virtual const char* what() { return desc.c_str(); } 101 | 102 | private: 103 | std::string desc; 104 | }; 105 | 106 | class SingleThreadedOnly : public QueryExecutionError { }; 107 | 108 | class CreateSegmentFailure { }; 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /externals/bzip2-1.0.5/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------- 3 | 4 | This program, "bzip2", the associated library "libbzip2", and all 5 | documentation, are copyright (C) 1996-2007 Julian R Seward. All 6 | rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | 1. Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | 15 | 2. The origin of this software must not be misrepresented; you must 16 | not claim that you wrote the original software. If you use this 17 | software in a product, an acknowledgment in the product 18 | documentation would be appreciated but is not required. 19 | 20 | 3. Altered source versions must be plainly marked as such, and must 21 | not be misrepresented as being the original software. 22 | 23 | 4. The name of the author may not be used to endorse or promote 24 | products derived from this software without specific prior written 25 | permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 28 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 33 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 37 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | Julian Seward, jseward@bzip.org 40 | bzip2/libbzip2 version 1.0.5 of 10 December 2007 41 | 42 | -------------------------------------------------------------------------- 43 | -------------------------------------------------------------------------------- /externals/bzip2-1.0.5/Makefile-libbz2_so: -------------------------------------------------------------------------------- 1 | 2 | # This Makefile builds a shared version of the library, 3 | # libbz2.so.1.0.4, with soname libbz2.so.1.0, 4 | # at least on x86-Linux (RedHat 7.2), 5 | # with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). 6 | # Please see the README file for some important info 7 | # about building the library like this. 8 | 9 | # ------------------------------------------------------------------ 10 | # This file is part of bzip2/libbzip2, a program and library for 11 | # lossless, block-sorting data compression. 12 | # 13 | # bzip2/libbzip2 version 1.0.5 of 10 December 2007 14 | # Copyright (C) 1996-2007 Julian Seward 15 | # 16 | # Please read the WARNING, DISCLAIMER and PATENTS sections in the 17 | # README file. 18 | # 19 | # This program is released under the terms of the license contained 20 | # in the file LICENSE. 21 | # ------------------------------------------------------------------ 22 | 23 | 24 | SHELL=/bin/sh 25 | CC=gcc 26 | BIGFILES=-D_FILE_OFFSET_BITS=64 27 | CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) 28 | 29 | OBJS= blocksort.o \ 30 | huffman.o \ 31 | crctable.o \ 32 | randtable.o \ 33 | compress.o \ 34 | decompress.o \ 35 | bzlib.o 36 | 37 | all: $(OBJS) 38 | $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.4 $(OBJS) 39 | $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4 40 | rm -f libbz2.so.1.0 41 | ln -s libbz2.so.1.0.4 libbz2.so.1.0 42 | 43 | clean: 44 | rm -f $(OBJS) bzip2.o libbz2.so.1.0.4 libbz2.so.1.0 bzip2-shared 45 | 46 | blocksort.o: blocksort.c 47 | $(CC) $(CFLAGS) -c blocksort.c 48 | huffman.o: huffman.c 49 | $(CC) $(CFLAGS) -c huffman.c 50 | crctable.o: crctable.c 51 | $(CC) $(CFLAGS) -c crctable.c 52 | randtable.o: randtable.c 53 | $(CC) $(CFLAGS) -c randtable.c 54 | compress.o: compress.c 55 | $(CC) $(CFLAGS) -c compress.c 56 | decompress.o: decompress.c 57 | $(CC) $(CFLAGS) -c decompress.c 58 | bzlib.o: bzlib.c 59 | $(CC) $(CFLAGS) -c bzlib.c 60 | -------------------------------------------------------------------------------- /externals/bzip2-1.0.5/README.COMPILATION.PROBLEMS: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------ 2 | This file is part of bzip2/libbzip2, a program and library for 3 | lossless, block-sorting data compression. 4 | 5 | bzip2/libbzip2 version 1.0.5 of 10 December 2007 6 | Copyright (C) 1996-2007 Julian Seward 7 | 8 | Please read the WARNING, DISCLAIMER and PATENTS sections in the 9 | README file. 10 | 11 | This program is released under the terms of the license contained 12 | in the file LICENSE. 13 | ------------------------------------------------------------------ 14 | 15 | bzip2-1.0.5 should compile without problems on the vast majority of 16 | platforms. Using the supplied Makefile, I've built and tested it 17 | myself for x86-linux and amd64-linux. With makefile.msc, Visual C++ 18 | 6.0 and nmake, you can build a native Win32 version too. Large file 19 | support seems to work correctly on at least on amd64-linux. 20 | 21 | When I say "large file" I mean a file of size 2,147,483,648 (2^31) 22 | bytes or above. Many older OSs can't handle files above this size, 23 | but many newer ones can. Large files are pretty huge -- most files 24 | you'll encounter are not Large Files. 25 | 26 | Early versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide variety 27 | of platforms without difficulty, and I hope this version will continue 28 | in that tradition. However, in order to support large files, I've had 29 | to include the define -D_FILE_OFFSET_BITS=64 in the Makefile. This 30 | can cause problems. 31 | 32 | The technique of adding -D_FILE_OFFSET_BITS=64 to get large file 33 | support is, as far as I know, the Recommended Way to get correct large 34 | file support. For more details, see the Large File Support 35 | Specification, published by the Large File Summit, at 36 | 37 | http://ftp.sas.com/standards/large.file 38 | 39 | As a general comment, if you get compilation errors which you think 40 | are related to large file support, try removing the above define from 41 | the Makefile, ie, delete the line 42 | 43 | BIGFILES=-D_FILE_OFFSET_BITS=64 44 | 45 | from the Makefile, and do 'make clean ; make'. This will give you a 46 | version of bzip2 without large file support, which, for most 47 | applications, is probably not a problem. 48 | 49 | Alternatively, try some of the platform-specific hints listed below. 50 | 51 | You can use the spewG.c program to generate huge files to test bzip2's 52 | large file support, if you are feeling paranoid. Be aware though that 53 | any compilation problems which affect bzip2 will also affect spewG.c, 54 | alas. 55 | 56 | AIX: I have reports that for large file support, you need to specify 57 | -D_LARGE_FILES rather than -D_FILE_OFFSET_BITS=64. I have not tested 58 | this myself. 59 | -------------------------------------------------------------------------------- /externals/bzip2-1.0.5/README.XML.STUFF: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | This file is part of bzip2/libbzip2, a program and library for 3 | lossless, block-sorting data compression. 4 | 5 | bzip2/libbzip2 version 1.0.5 of 10 December 2007 6 | Copyright (C) 1996-2007 Julian Seward 7 | 8 | Please read the WARNING, DISCLAIMER and PATENTS sections in the 9 | README file. 10 | 11 | This program is released under the terms of the license contained 12 | in the file LICENSE. 13 | ---------------------------------------------------------------- 14 | 15 | The script xmlproc.sh takes an xml file as input, 16 | and processes it to create .pdf, .html or .ps output. 17 | It uses format.pl, a perl script to format
 blocks nicely,
18 |  and add CDATA tags so writers do not have to use eg. < 
19 | 
20 | The file "entities.xml" must be edited to reflect current
21 | version, year, etc.
22 | 
23 | 
24 | Usage:
25 | 
26 |   ./xmlproc.sh -v manual.xml
27 |   Validates an xml file to ensure no dtd-compliance errors
28 | 
29 |   ./xmlproc.sh -html manual.xml
30 |   Output: manual.html
31 | 
32 |   ./xmlproc.sh -pdf manual.xml
33 |   Output: manual.pdf
34 | 
35 |   ./xmlproc.sh -ps manual.xml
36 |   Output: manual.ps
37 | 
38 | 
39 | Notum bene: 
40 | - pdfxmltex barfs if given a filename with an underscore in it
41 | 
42 | - xmltex won't work yet - there's a bug in passivetex
43 |     which we are all waiting for Sebastian to fix.
44 |   So we are going the xml -> pdf -> ps route for the time being,
45 |     using pdfxmltex.
46 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bz-common.xsl:
--------------------------------------------------------------------------------
 1 |  
 2 | 
 4 | 
 5 | 
 6 |  
 7 | 
 8 | 
 9 | 
10 |  
11 |  
12 |    
13 |     
14 |       
15 |      
16 |   
17 | 
18 | 
19 | 
20 | 
21 | set       toc,title
22 | book      toc,title,figure,table,example,equation
23 | chapter   toc,title
24 | section   toc
25 | sect1     toc
26 | sect2     toc
27 | sect3     toc
28 | sect4     nop
29 | sect5     nop
30 | qandaset  toc
31 | qandadiv  nop
32 | appendix  toc,title
33 | article/appendix  nop
34 | article   toc,title
35 | preface   toc,title
36 | reference toc,title
37 | 
38 | 
39 | 
40 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bz-html.xsl:
--------------------------------------------------------------------------------
 1 |  
 2 |  ]>
 3 | 
 4 | 
 6 | 
 7 | 
 8 | 
 9 | 
10 | 
11 | 
12 | 
13 | 
14 |   
15 |   
18 | 
19 | 
20 | 
21 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bzdiff:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
 3 | 
 4 | # Bzcmp/diff wrapped for bzip2, 
 5 | # adapted from zdiff by Philippe Troin  for Debian GNU/Linux.
 6 | 
 7 | # Bzcmp and bzdiff are used to invoke the cmp or the  diff  pro-
 8 | # gram  on compressed files.  All options specified are passed
 9 | # directly to cmp or diff.  If only 1 file is specified,  then
10 | # the  files  compared  are file1 and an uncompressed file1.gz.
11 | # If two files are specified, then they are  uncompressed  (if
12 | # necessary) and fed to cmp or diff.  The exit status from cmp
13 | # or diff is preserved.
14 | 
15 | PATH="/usr/bin:/bin:$PATH"; export PATH
16 | prog=`echo $0 | sed 's|.*/||'`
17 | case "$prog" in
18 |   *cmp) comp=${CMP-cmp}   ;;
19 |   *)    comp=${DIFF-diff} ;;
20 | esac
21 | 
22 | OPTIONS=
23 | FILES=
24 | for ARG
25 | do
26 |     case "$ARG" in
27 |     -*)	OPTIONS="$OPTIONS $ARG";;
28 |      *)	if test -f "$ARG"; then
29 |             FILES="$FILES $ARG"
30 |         else
31 |             echo "${prog}: $ARG not found or not a regular file"
32 | 	    exit 1
33 |         fi ;;
34 |     esac
35 | done
36 | if test -z "$FILES"; then
37 | 	echo "Usage: $prog [${comp}_options] file [file]"
38 | 	exit 1
39 | fi
40 | tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
41 |       echo 'cannot create a temporary file' >&2
42 |       exit 1
43 | }
44 | set $FILES
45 | if test $# -eq 1; then
46 | 	FILE=`echo "$1" | sed 's/.bz2$//'`
47 | 	bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
48 | 	STAT="$?"
49 | 
50 | elif test $# -eq 2; then
51 | 	case "$1" in
52 |         *.bz2)
53 |                 case "$2" in
54 | 	        *.bz2)
55 | 			F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
56 |                         bzip2 -cdfq "$2" > $tmp
57 |                         bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
58 |                         STAT="$?"
59 | 			/bin/rm -f $tmp;;
60 | 
61 |                 *)      bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
62 |                         STAT="$?";;
63 |                 esac;;
64 |         *)      case "$2" in
65 | 	        *.bz2)
66 |                         bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
67 |                         STAT="$?";;
68 |                 *)      $comp $OPTIONS "$1" "$2"
69 |                         STAT="$?";;
70 |                 esac;;
71 | 	esac
72 |         exit "$STAT"
73 | else
74 | 	echo "Usage: $prog [${comp}_options] file [file]"
75 | 	exit 1
76 | fi
77 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bzdiff.1:
--------------------------------------------------------------------------------
 1 | \"Shamelessly copied from zmore.1 by Philippe Troin 
 2 | \"for Debian GNU/Linux
 3 | .TH BZDIFF 1
 4 | .SH NAME
 5 | bzcmp, bzdiff \- compare bzip2 compressed files
 6 | .SH SYNOPSIS
 7 | .B bzcmp
 8 | [ cmp_options ] file1
 9 | [ file2 ]
10 | .br
11 | .B bzdiff
12 | [ diff_options ] file1
13 | [ file2 ]
14 | .SH DESCRIPTION
15 | .I  Bzcmp
16 | and 
17 | .I bzdiff
18 | are used to invoke the
19 | .I cmp
20 | or the
21 | .I diff
22 | program on bzip2 compressed files.  All options specified are passed
23 | directly to
24 | .I cmp
25 | or
26 | .IR diff "."
27 | If only 1 file is specified, then the files compared are
28 | .I file1
29 | and an uncompressed
30 | .IR file1 ".bz2."
31 | If two files are specified, then they are uncompressed if necessary and fed to
32 | .I cmp
33 | or
34 | .IR diff "."
35 | The exit status from 
36 | .I cmp
37 | or
38 | .I diff
39 | is preserved.
40 | .SH "SEE ALSO"
41 | cmp(1), diff(1), bzmore(1), bzless(1), bzgrep(1), bzip2(1)
42 | .SH BUGS
43 | Messages from the
44 | .I cmp
45 | or
46 | .I diff
47 | programs refer to temporary filenames instead of those specified.
48 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bzgrep:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | # Bzgrep wrapped for bzip2, 
 4 | # adapted from zgrep by Philippe Troin  for Debian GNU/Linux.
 5 | ## zgrep notice:
 6 | ## zgrep -- a wrapper around a grep program that decompresses files as needed
 7 | ## Adapted from a version sent by Charles Levert 
 8 | 
 9 | PATH="/usr/bin:$PATH"; export PATH
10 | 
11 | prog=`echo $0 | sed 's|.*/||'`
12 | case "$prog" in
13 | 	*egrep)	grep=${EGREP-egrep}	;;
14 | 	*fgrep)	grep=${FGREP-fgrep}	;;
15 | 	*)	grep=${GREP-grep}	;;
16 | esac
17 | pat=""
18 | while test $# -ne 0; do
19 |   case "$1" in
20 |   -e | -f) opt="$opt $1"; shift; pat="$1"
21 |            if test "$grep" = grep; then  # grep is buggy with -e on SVR4
22 |              grep=egrep
23 |            fi;;
24 |   -A | -B) opt="$opt $1 $2"; shift;;
25 |   -*)	   opt="$opt $1";;
26 |    *)      if test -z "$pat"; then
27 | 	     pat="$1"
28 | 	   else
29 | 	     break;
30 |            fi;;
31 |   esac
32 |   shift
33 | done
34 | 
35 | if test -z "$pat"; then
36 |   echo "grep through bzip2 files"
37 |   echo "usage: $prog [grep_options] pattern [files]"
38 |   exit 1
39 | fi
40 | 
41 | list=0
42 | silent=0
43 | op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
44 | case "$op" in
45 |   *l*) list=1
46 | esac
47 | case "$op" in
48 |   *h*) silent=1
49 | esac
50 | 
51 | if test $# -eq 0; then
52 |   bzip2 -cdfq | $grep $opt "$pat"
53 |   exit $?
54 | fi
55 | 
56 | res=0
57 | for i do
58 |   if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
59 |   if test $list -eq 1; then
60 |     bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
61 |     r=$?
62 |   elif test $# -eq 1 -o $silent -eq 1; then
63 |     bzip2 -cdfq "$i" | $grep $opt "$pat"
64 |     r=$?
65 |   else
66 |     j=${i//\\/\\\\}
67 |     j=${j//|/\\|}
68 |     j=${j//&/\\&}
69 |     j=`printf "%s" "$j" | tr '\n' ' '`
70 |     bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
71 |     r=$?
72 |   fi
73 |   test "$r" -ne 0 && res="$r"
74 | done
75 | exit $res
76 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bzgrep.1:
--------------------------------------------------------------------------------
 1 | \"Shamelessly copied from zmore.1 by Philippe Troin 
 2 | \"for Debian GNU/Linux
 3 | .TH BZGREP 1
 4 | .SH NAME
 5 | bzgrep, bzfgrep, bzegrep \- search possibly bzip2 compressed files for a regular expression
 6 | .SH SYNOPSIS
 7 | .B bzgrep
 8 | [ grep_options ]
 9 | .BI  [\ -e\ ] " pattern"
10 | .IR filename ".\|.\|."
11 | .br
12 | .B bzegrep
13 | [ egrep_options ]
14 | .BI  [\ -e\ ] " pattern"
15 | .IR filename ".\|.\|."
16 | .br
17 | .B bzfgrep
18 | [ fgrep_options ]
19 | .BI  [\ -e\ ] " pattern"
20 | .IR filename ".\|.\|."
21 | .SH DESCRIPTION
22 | .IR  Bzgrep
23 | is used to invoke the
24 | .I grep
25 | on bzip2-compressed files. All options specified are passed directly to
26 | .I grep.
27 | If no file is specified, then the standard input is decompressed
28 | if necessary and fed to grep.
29 | Otherwise the given files are uncompressed if necessary and fed to
30 | .I grep.
31 | .PP
32 | If
33 | .I bzgrep
34 | is invoked as
35 | .I bzegrep
36 | or
37 | .I bzfgrep
38 | then
39 | .I egrep
40 | or
41 | .I fgrep
42 | is used instead of
43 | .I grep.
44 | If the GREP environment variable is set,
45 | .I bzgrep
46 | uses it as the
47 | .I grep
48 | program to be invoked. For example:
49 | 
50 |     for sh:  GREP=fgrep  bzgrep string files
51 |     for csh: (setenv GREP fgrep; bzgrep string files)
52 | .SH AUTHOR
53 | Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe
54 | Troin  for Debian GNU/Linux.
55 | .SH "SEE ALSO"
56 | grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1)
57 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bzip.css:
--------------------------------------------------------------------------------
 1 | /* Colours:
 2 | #74240f  dark brown      h1, h2, h3, h4
 3 | #336699  medium blue     links
 4 | #339999  turquoise       link hover colour
 5 | #202020  almost black    general text
 6 | #761596  purple          md5sum text
 7 | #626262  dark gray       pre border
 8 | #eeeeee  very light gray pre background
 9 | #f2f2f9  very light blue nav table background
10 | #3366cc  medium blue     nav table border
11 | */
12 | 
13 | a, a:link, a:visited, a:active { color: #336699; }
14 | a:hover { color: #339999; }
15 | 
16 | body { font: 80%/126% sans-serif; }
17 | h1, h2, h3, h4 { color: #74240f; }
18 | 
19 | dt { color: #336699; font-weight: bold }
20 | dd { 
21 |  margin-left: 1.5em; 
22 |  padding-bottom: 0.8em;
23 | }
24 | 
25 | /* -- ruler -- */
26 | div.hr_blue { 
27 |   height:  3px; 
28 |   background:#ffffff url("/images/hr_blue.png") repeat-x; }
29 | div.hr_blue hr { display:none; }
30 | 
31 | /* release styles */
32 | #release p { margin-top: 0.4em; }
33 | #release .md5sum { color: #761596; }
34 | 
35 | 
36 | /* ------ styles for docs|manuals|howto ------ */
37 | /* -- lists -- */
38 | ul  { 
39 |  margin:     0px 4px 16px 16px;
40 |  padding:    0px;
41 |  list-style: url("/images/li-blue.png"); 
42 | }
43 | ul li { 
44 |  margin-bottom: 10px;
45 | }
46 | ul ul	{ 
47 |  list-style-type:  none; 
48 |  list-style-image: none; 
49 |  margin-left:      0px; 
50 | }
51 | 
52 | /* header / footer nav tables */
53 | table.nav {
54 |  border:     solid 1px #3366cc;
55 |  background: #f2f2f9;
56 |  background-color: #f2f2f9;
57 |  margin-bottom: 0.5em;
58 | }
59 | /* don't have underlined links in chunked nav menus */
60 | table.nav a { text-decoration: none; }
61 | table.nav a:hover { text-decoration: underline; }
62 | table.nav td { font-size: 85%; }
63 | 
64 | code, tt, pre { font-size: 120%; }
65 | code, tt { color: #761596; }
66 | 
67 | div.literallayout, pre.programlisting, pre.screen {
68 |  color:      #000000;
69 |  padding:    0.5em;
70 |  background: #eeeeee;
71 |  border:     1px solid #626262;
72 |  background-color: #eeeeee;
73 |  margin: 4px 0px 4px 0px; 
74 | }
75 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/bzmore:
--------------------------------------------------------------------------------
 1 | #!/bin/sh
 2 | 
 3 | # Bzmore wrapped for bzip2, 
 4 | # adapted from zmore by Philippe Troin  for Debian GNU/Linux.
 5 | 
 6 | PATH="/usr/bin:$PATH"; export PATH
 7 | 
 8 | prog=`echo $0 | sed 's|.*/||'`
 9 | case "$prog" in
10 | 	*less)	more=less	;;
11 | 	*)	more=more       ;;
12 | esac
13 | 
14 | if test "`echo -n a`" = "-n a"; then
15 |   # looks like a SysV system:
16 |   n1=''; n2='\c'
17 | else
18 |   n1='-n'; n2=''
19 | fi
20 | oldtty=`stty -g 2>/dev/null`
21 | if stty -cbreak 2>/dev/null; then
22 |   cb='cbreak'; ncb='-cbreak'
23 | else
24 |   # 'stty min 1' resets eof to ^a on both SunOS and SysV!
25 |   cb='min 1 -icanon'; ncb='icanon eof ^d'
26 | fi
27 | if test $? -eq 0 -a -n "$oldtty"; then
28 |    trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
29 | else
30 |    trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
31 | fi
32 | 
33 | if test $# = 0; then
34 |     if test -t 0; then
35 | 	echo usage: $prog files...
36 |     else
37 | 	bzip2 -cdfq | eval $more
38 |     fi
39 | else
40 |     FIRST=1
41 |     for FILE
42 |     do
43 | 	if test $FIRST -eq 0; then
44 | 		echo $n1 "--More--(Next file: $FILE)$n2"
45 | 		stty $cb -echo 2>/dev/null
46 | 		ANS=`dd bs=1 count=1 2>/dev/null` 
47 | 		stty $ncb echo 2>/dev/null
48 | 		echo " "
49 | 		if test "$ANS" = 'e' -o "$ANS" = 'q'; then
50 | 			exit
51 | 		fi
52 | 	fi
53 | 	if test "$ANS" != 's'; then
54 | 		echo "------> $FILE <------"
55 | 		bzip2 -cdfq "$FILE" | eval $more
56 | 	fi
57 | 	if test -t; then
58 | 		FIRST=0
59 | 	fi
60 |     done
61 | fi
62 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/dlltest.dsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/dlltest.dsp


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/entities.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 | 
 4 | 
 5 | 
 6 | 
 7 | 
 8 | 
 9 | 
10 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/format.pl:
--------------------------------------------------------------------------------
 1 | #!/usr/bin/perl -w
 2 | #
 3 | # ------------------------------------------------------------------
 4 | # This file is part of bzip2/libbzip2, a program and library for
 5 | # lossless, block-sorting data compression.
 6 | #
 7 | # bzip2/libbzip2 version 1.0.5 of 10 December 2007
 8 | # Copyright (C) 1996-2007 Julian Seward 
 9 | #
10 | # Please read the WARNING, DISCLAIMER and PATENTS sections in the 
11 | # README file.
12 | #
13 | # This program is released under the terms of the license contained
14 | # in the file LICENSE.
15 | # ------------------------------------------------------------------
16 | #
17 | use strict;
18 | 
19 | # get command line values:
20 | if ( $#ARGV !=1 ) {
21 |     die "Usage:  $0 xml_infile xml_outfile\n";
22 | }
23 | 
24 | my $infile = shift;
25 | # check infile exists
26 | die "Can't find file \"$infile\""
27 |   unless -f $infile;
28 | # check we can read infile
29 | if (! -r $infile) {
30 |     die "Can't read input $infile\n";
31 | }
32 | # check we can open infile
33 | open( INFILE,"<$infile" ) or 
34 |     die "Can't input $infile $!";
35 | 
36 | #my $outfile = 'fmt-manual.xml';
37 | my $outfile = shift;
38 | #print "Infile: $infile, Outfile: $outfile\n";
39 | # check we can write to outfile
40 | open( OUTFILE,">$outfile" ) or 
41 |     die "Can't output $outfile $! for writing";
42 | 
43 | my ($prev, $curr, $str);
44 | $prev = ''; $curr = '';
45 | while (  ) {
46 | 
47 | 		print OUTFILE $prev;
48 |     $prev = $curr;
49 |     $curr = $_;
50 |     $str = '';
51 | 
52 |     if ( $prev =~ /$|$/ ) {
53 |         chomp $prev;
54 |         $curr = join( '', $prev, "|<\/screen>/ ) {
59 |         chomp $prev;
60 |         $curr = join( '', $prev, "]]>", $curr );
61 | 				$prev = '';
62 |         next;
63 |     }
64 | }
65 | print OUTFILE $curr;
66 | close INFILE;
67 | close OUTFILE;
68 | exit;
69 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/libbz2.def:
--------------------------------------------------------------------------------
 1 | LIBRARY			LIBBZ2
 2 | DESCRIPTION		"libbzip2: library for data compression"
 3 | EXPORTS
 4 | 	BZ2_bzCompressInit
 5 | 	BZ2_bzCompress
 6 | 	BZ2_bzCompressEnd
 7 | 	BZ2_bzDecompressInit
 8 | 	BZ2_bzDecompress
 9 | 	BZ2_bzDecompressEnd
10 | 	BZ2_bzReadOpen
11 | 	BZ2_bzReadClose
12 | 	BZ2_bzReadGetUnused
13 | 	BZ2_bzRead
14 | 	BZ2_bzWriteOpen
15 | 	BZ2_bzWrite
16 | 	BZ2_bzWriteClose
17 | 	BZ2_bzWriteClose64
18 | 	BZ2_bzBuffToBuffCompress
19 | 	BZ2_bzBuffToBuffDecompress
20 | 	BZ2_bzlibVersion
21 | 	BZ2_bzopen
22 | 	BZ2_bzdopen
23 | 	BZ2_bzread
24 | 	BZ2_bzwrite
25 | 	BZ2_bzflush
26 | 	BZ2_bzclose
27 | 	BZ2_bzerror
28 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/libbz2.dsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/libbz2.dsp


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/makefile.msc:
--------------------------------------------------------------------------------
 1 | # Makefile for Microsoft Visual C++ 6.0
 2 | # usage: nmake -f makefile.msc
 3 | # K.M. Syring (syring@gsf.de)
 4 | # Fixed up by JRS for bzip2-0.9.5d release.
 5 | 
 6 | CC=cl
 7 | CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
 8 | 
 9 | OBJS= blocksort.obj  \
10 |       huffman.obj    \
11 |       crctable.obj   \
12 |       randtable.obj  \
13 |       compress.obj   \
14 |       decompress.obj \
15 |       bzlib.obj
16 | 
17 | all: lib bzip2 test
18 | 
19 | bzip2: lib
20 | 	$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
21 | 	$(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
22 | 
23 | lib: $(OBJS)
24 | 	lib /out:libbz2.lib $(OBJS)
25 | 
26 | test: bzip2
27 | 	type words1
28 | 	.\\bzip2 -1  < sample1.ref > sample1.rb2
29 | 	.\\bzip2 -2  < sample2.ref > sample2.rb2
30 | 	.\\bzip2 -3  < sample3.ref > sample3.rb2
31 | 	.\\bzip2 -d  < sample1.bz2 > sample1.tst
32 | 	.\\bzip2 -d  < sample2.bz2 > sample2.tst
33 | 	.\\bzip2 -ds < sample3.bz2 > sample3.tst
34 | 	@echo All six of the fc's should find no differences.
35 | 	@echo If fc finds an error on sample3.bz2, this could be
36 | 	@echo because WinZip's 'TAR file smart CR/LF conversion'
37 | 	@echo is too clever for its own good.  Disable this option.
38 | 	@echo The correct size for sample3.ref is 120,244.  If it
39 | 	@echo is 150,251, WinZip has messed it up.
40 | 	fc sample1.bz2 sample1.rb2 
41 | 	fc sample2.bz2 sample2.rb2
42 | 	fc sample3.bz2 sample3.rb2
43 | 	fc sample1.tst sample1.ref
44 | 	fc sample2.tst sample2.ref
45 | 	fc sample3.tst sample3.ref
46 | 
47 | 
48 | 
49 | clean: 
50 | 	del *.obj
51 | 	del libbz2.lib 
52 | 	del bzip2.exe
53 | 	del bzip2recover.exe
54 | 	del sample1.rb2 
55 | 	del sample2.rb2 
56 | 	del sample3.rb2
57 | 	del sample1.tst 
58 | 	del sample2.tst
59 | 	del sample3.tst
60 | 
61 | .c.obj: 
62 | 	$(CC) $(CFLAGS) -c $*.c -o $*.obj
63 | 
64 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/manual.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/manual.html


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/manual.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/manual.pdf


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/mk251.c:
--------------------------------------------------------------------------------
 1 | 
 2 | /* Spew out a long sequence of the byte 251.  When fed to bzip2
 3 |    versions 1.0.0 or 1.0.1, causes it to die with internal error
 4 |    1007 in blocksort.c.  This assertion misses an extremely rare
 5 |    case, which is fixed in this version (1.0.2) and above.
 6 | */
 7 | 
 8 | /* ------------------------------------------------------------------
 9 |    This file is part of bzip2/libbzip2, a program and library for
10 |    lossless, block-sorting data compression.
11 | 
12 |    bzip2/libbzip2 version 1.0.5 of 10 December 2007
13 |    Copyright (C) 1996-2007 Julian Seward 
14 | 
15 |    Please read the WARNING, DISCLAIMER and PATENTS sections in the 
16 |    README file.
17 | 
18 |    This program is released under the terms of the license contained
19 |    in the file LICENSE.
20 |    ------------------------------------------------------------------ */
21 | 
22 | 
23 | #include 
24 | 
25 | int main ()
26 | {
27 |    int i;
28 |    for (i = 0; i < 48500000 ; i++)
29 |      putchar(251);
30 |    return 0;
31 | }
32 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/sample1.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/sample1.bz2


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/sample1.ref:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/sample1.ref


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/sample2.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/sample2.bz2


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/sample2.ref:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/sample2.ref


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/sample3.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/externals/bzip2-1.0.5/sample3.bz2


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/spewG.c:
--------------------------------------------------------------------------------
 1 | 
 2 | /* spew out a thoroughly gigantic file designed so that bzip2
 3 |    can compress it reasonably rapidly.  This is to help test
 4 |    support for large files (> 2GB) in a reasonable amount of time.
 5 |    I suggest you use the undocumented --exponential option to
 6 |    bzip2 when compressing the resulting file; this saves a bit of
 7 |    time.  Note: *don't* bother with --exponential when compressing 
 8 |    Real Files; it'll just waste a lot of CPU time :-)
 9 |    (but is otherwise harmless).
10 | */
11 | 
12 | /* ------------------------------------------------------------------
13 |    This file is part of bzip2/libbzip2, a program and library for
14 |    lossless, block-sorting data compression.
15 | 
16 |    bzip2/libbzip2 version 1.0.5 of 10 December 2007
17 |    Copyright (C) 1996-2007 Julian Seward 
18 | 
19 |    Please read the WARNING, DISCLAIMER and PATENTS sections in the 
20 |    README file.
21 | 
22 |    This program is released under the terms of the license contained
23 |    in the file LICENSE.
24 | 	 ------------------------------------------------------------------ */
25 | 
26 | 
27 | #define _FILE_OFFSET_BITS 64
28 | 
29 | #include 
30 | #include 
31 | 
32 | /* The number of megabytes of junk to spew out (roughly) */
33 | #define MEGABYTES 5000
34 | 
35 | #define N_BUF 1000000
36 | char buf[N_BUF];
37 | 
38 | int main ( int argc, char** argv )
39 | {
40 |    int ii, kk, p;
41 |    srandom(1);
42 |    setbuffer ( stdout, buf, N_BUF );
43 |    for (kk = 0; kk < MEGABYTES * 515; kk+=3) {
44 |       p = 25+random()%50;
45 |       for (ii = 0; ii < p; ii++)
46 |          printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" );
47 |       for (ii = 0; ii < p-1; ii++)
48 |          printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" );
49 |       for (ii = 0; ii < p+1; ii++)
50 |          printf ( "ccccccccccccccccccccccccccccccccccccc" );
51 |    }
52 |    fflush(stdout);
53 |    return 0;
54 | }
55 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/words0:
--------------------------------------------------------------------------------
 1 | 
 2 | If compilation produces errors, or a large number of warnings,
 3 | please read README.COMPILATION.PROBLEMS -- you might be able to
 4 | adjust the flags in this Makefile to improve matters.
 5 | 
 6 | Also in README.COMPILATION.PROBLEMS are some hints that may help
 7 | if your build produces an executable which is unable to correctly
 8 | handle so-called 'large files' -- files of size 2GB or more.
 9 | 
10 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/words1:
--------------------------------------------------------------------------------
1 | 
2 | Doing 6 tests (3 compress, 3 uncompress) ...
3 | If there's a problem, things might stop at this point.
4 |  
5 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/words2:
--------------------------------------------------------------------------------
1 | 
2 | Checking test results.  If any of the four "cmp"s which follow
3 | report any differences, something is wrong.  If you can't easily
4 | figure out what, please let me know (jseward@bzip.org).
5 | 
6 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/words3:
--------------------------------------------------------------------------------
 1 | 
 2 | If you got this far and the 'cmp's didn't complain, it looks
 3 | like you're in business.  
 4 | 
 5 | To install in /usr/local/bin, /usr/local/lib, /usr/local/man and 
 6 | /usr/local/include, type
 7 | 
 8 |    make install
 9 | 
10 | To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type 
11 | 
12 |    make install PREFIX=/xxx/yyy
13 | 
14 | If you are (justifiably) paranoid and want to see what 'make install'
15 | is going to do, you can first do
16 | 
17 |    make -n install                      or
18 |    make -n install PREFIX=/xxx/yyy      respectively.
19 | 
20 | The -n instructs make to show the commands it would execute, but
21 | not actually execute them.
22 | 
23 | Instructions for use are in the preformatted manual page, in the file
24 | bzip2.txt.  For more detailed documentation, read the full manual.  
25 | It is available in Postscript form (manual.ps), PDF form (manual.pdf),
26 | and HTML form (manual.html).
27 | 
28 | You can also do "bzip2 --help" to see some helpful information. 
29 | "bzip2 -L" displays the software license.
30 | 
31 | 


--------------------------------------------------------------------------------
/externals/bzip2-1.0.5/xmlproc.sh:
--------------------------------------------------------------------------------
  1 | #!/bin/bash
  2 | # see the README file for usage etc.
  3 | #
  4 | # ------------------------------------------------------------------
  5 | #  This file is part of bzip2/libbzip2, a program and library for
  6 | #  lossless, block-sorting data compression.
  7 | #
  8 | #  bzip2/libbzip2 version 1.0.5 of 10 December 2007
  9 | #  Copyright (C) 1996-2007 Julian Seward 
 10 | #
 11 | #  Please read the WARNING, DISCLAIMER and PATENTS sections in the 
 12 | #  README file.
 13 | #
 14 | #  This program is released under the terms of the license contained
 15 | #  in the file LICENSE.
 16 | # ----------------------------------------------------------------
 17 | 
 18 | 
 19 | usage() {
 20 |   echo '';
 21 |   echo 'Usage: xmlproc.sh -[option] ';
 22 |   echo 'Specify a target from:';
 23 |   echo '-v      verify xml file conforms to dtd';
 24 |   echo '-html   output in html format (single file)';
 25 |   echo '-ps     output in postscript format';
 26 |   echo '-pdf    output in pdf format';
 27 |   exit;
 28 | }
 29 | 
 30 | if test $# -ne 2; then
 31 |   usage
 32 | fi
 33 | # assign the variable for the output type
 34 | action=$1; shift
 35 | # assign the output filename
 36 | xmlfile=$1; shift
 37 | # and check user input it correct
 38 | if !(test -f $xmlfile); then
 39 |   echo "No such file: $xmlfile";
 40 |   exit;
 41 | fi
 42 | # some other stuff we will use
 43 | OUT=output
 44 | xsl_fo=bz-fo.xsl
 45 | xsl_html=bz-html.xsl
 46 | 
 47 | basename=$xmlfile
 48 | basename=${basename//'.xml'/''}
 49 | 
 50 | fofile="${basename}.fo"
 51 | htmlfile="${basename}.html"
 52 | pdffile="${basename}.pdf"
 53 | psfile="${basename}.ps"
 54 | xmlfmtfile="${basename}.fmt"
 55 | 
 56 | # first process the xmlfile with CDATA tags
 57 | ./format.pl $xmlfile $xmlfmtfile
 58 | # so the shell knows where the catalogs live
 59 | export XML_CATALOG_FILES=/etc/xml/catalog
 60 | 
 61 | # post-processing tidy up
 62 | cleanup() {
 63 |   echo "Cleaning up: $@" 
 64 |   while [ $# != 0 ]
 65 |   do
 66 |     arg=$1; shift;
 67 |     echo "  deleting $arg";
 68 |     rm $arg
 69 |   done
 70 | }
 71 | 
 72 | case $action in
 73 |   -v)
 74 |    flags='--noout --xinclude --noblanks --postvalid'
 75 |    dtd='--dtdvalid http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'
 76 |    xmllint $flags $dtd $xmlfmtfile 2> $OUT 
 77 |    egrep 'error' $OUT 
 78 |    rm $OUT
 79 |   ;;
 80 | 
 81 |   -html)
 82 |    echo "Creating $htmlfile ..."
 83 |    xsltproc --nonet --xinclude  -o $htmlfile $xsl_html $xmlfmtfile
 84 |    cleanup $xmlfmtfile
 85 |   ;;
 86 | 
 87 |   -pdf)
 88 |    echo "Creating $pdffile ..."
 89 |    xsltproc --nonet --xinclude -o $fofile $xsl_fo $xmlfmtfile
 90 |    pdfxmltex $fofile >$OUT $OUT $OUT $OUT $OUT $OUT $OUT $OUT $OUT  header file. */
 4 | #undef HAVE_DLFCN_H
 5 | 
 6 | /* Define to 1 if you have the  header file. */
 7 | #undef HAVE_INTTYPES_H
 8 | 
 9 | /* Define to 1 if you have the  header file. */
10 | #undef HAVE_MEMORY_H
11 | 
12 | /* Define to 1 if you have the  header file. */
13 | #undef HAVE_STDINT_H
14 | 
15 | /* Define to 1 if you have the  header file. */
16 | #undef HAVE_STDLIB_H
17 | 
18 | /* Define to 1 if you have the  header file. */
19 | #undef HAVE_STRINGS_H
20 | 
21 | /* Define to 1 if you have the  header file. */
22 | #undef HAVE_STRING_H
23 | 
24 | /* Define to 1 if you have the  header file. */
25 | #undef HAVE_SYS_STAT_H
26 | 
27 | /* Define to 1 if you have the  header file. */
28 | #undef HAVE_SYS_TYPES_H
29 | 
30 | /* Define to 1 if you have the  header file. */
31 | #undef HAVE_UNISTD_H
32 | 
33 | /* Name of package */
34 | #undef PACKAGE
35 | 
36 | /* Define to the address where bug reports for this package should be sent. */
37 | #undef PACKAGE_BUGREPORT
38 | 
39 | /* Define to the full name of this package. */
40 | #undef PACKAGE_NAME
41 | 
42 | /* Define to the full name and version of this package. */
43 | #undef PACKAGE_STRING
44 | 
45 | /* Define to the one symbol short name of this package. */
46 | #undef PACKAGE_TARNAME
47 | 
48 | /* Define to the version of this package. */
49 | #undef PACKAGE_VERSION
50 | 
51 | /* Define to 1 if you have the ANSI C header files. */
52 | #undef STDC_HEADERS
53 | 
54 | /* Version number of package */
55 | #undef VERSION
56 | 
57 | /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
58 |    `char[]'. */
59 | #undef YYTEXT_POINTER
60 | 
61 | /* Define to empty if `const' does not conform to ANSI C. */
62 | #undef const
63 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/configure.ac:
--------------------------------------------------------------------------------
 1 | dnl Process this file with autoconf to produce a configure script.
 2 | AC_INIT(libconfig.c)
 3 | AM_INIT_AUTOMAKE(libconfig, 1.2)
 4 | AM_CONFIG_HEADER(ac_config.h)
 5 | 
 6 | dnl Checks for programs.
 7 | dnl AC_PROG_INSTALL
 8 | AC_PROG_CC
 9 | AC_PROG_RANLIB
10 | AC_LIBTOOL_WIN32_DLL
11 | AC_PROG_LIBTOOL
12 | 
13 | AM_PROG_LEX
14 | if test Z"$LEX" != Zflex; then
15 | cat <  Mon, 25 Jun 2007 16:21:56 +0200
10 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/compat:
--------------------------------------------------------------------------------
1 | 5
2 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/control:
--------------------------------------------------------------------------------
 1 | Source: libconfigduo
 2 | Priority: extra
 3 | Maintainer: Klaus Schneider 
 4 | Build-Depends: debhelper (>= 5), autotools-dev, texinfo
 5 | Standards-Version: 3.7.2
 6 | Section: libs
 7 | 
 8 | Package: libconfigduo-dev
 9 | Section: libdevel
10 | Architecture: any
11 | Depends: libconfigduo (= ${Source-Version})
12 | Description: A library for manipulating configuration files, developement files
13 | 
14 | Package: libconfigduo
15 | Section: libs
16 | Architecture: any
17 | Depends: ${shlibs:Depends}
18 | Description: A library for manipulating configuration files
19 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/copyright:
--------------------------------------------------------------------------------
 1 | This package was debianized by Klaus Schneider  on
 2 | Mon, 25 Jun 2007 16:21:56 +0200.
 3 | 
 4 | It was downloaded from http://www.hyperrealm.com/libconfig/libconfig.html
 5 | 
 6 | Upstream Author: Mark A. Lindner
 7 | 
 8 | Copyright: (c) 2005-2007 Mark A. Linder
 9 | 
10 | License:
11 | 
12 |     This package is free software; you can redistribute it and/or
13 |     modify it under the terms of the GNU Lesser General Public
14 |     License as published by the Free Software Foundation; either
15 |     version 2 of the License, or (at your option) any later version.
16 | 
17 |     This package is distributed in the hope that it will be useful,
18 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
19 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 |     Lesser General Public License for more details.
21 | 
22 |     You should have received a copy of the GNU Lesser General Public
23 |     License along with this package; if not, write to the Free Software
24 |     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
25 | 
26 | On Debian systems, the complete text of the GNU Lesser General
27 | Public License can be found in `/usr/share/common-licenses/LGPL'.
28 | 
29 | 
30 | The Debian packaging is (C) 2007, Klaus Schneider  and
31 | is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
32 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/libconfigduo-dev.docs:
--------------------------------------------------------------------------------
1 | doc/libconfig.pdf
2 | NEWS
3 | README
4 | TODO
5 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/libconfigduo-dev.install:
--------------------------------------------------------------------------------
1 | usr/include/*
2 | usr/lib/lib*.a
3 | usr/lib/lib*.so
4 | usr/lib/*.la
5 | usr/lib/pkgconfig/*
6 | usr/share/info/*
7 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/libconfigduo.install:
--------------------------------------------------------------------------------
1 | usr/lib/lib*.so.*
2 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/debian/rules:
--------------------------------------------------------------------------------
  1 | #!/usr/bin/make -f
  2 | # -*- makefile -*-
  3 | # Sample debian/rules that uses debhelper.
  4 | # This file was originally written by Joey Hess and Craig Small.
  5 | # As a special exception, when this file is copied by dh-make into a
  6 | # dh-make output file, you may use that output file without restriction.
  7 | # This special exception was added by Craig Small in version 0.37 of dh-make.
  8 | 
  9 | # Uncomment this to turn on verbose mode.
 10 | #export DH_VERBOSE=1
 11 | 
 12 | 
 13 | # These are used for cross-compiling and for saving the configure script
 14 | # from having to guess our platform (since we know it already)
 15 | DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 16 | DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 17 | 
 18 | 
 19 | CFLAGS = -Wall -g
 20 | 
 21 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 22 | 	CFLAGS += -O0
 23 | else
 24 | 	CFLAGS += -O2
 25 | endif
 26 | 
 27 | # shared library versions, option 1
 28 | version=2.0.5
 29 | major=2
 30 | # option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
 31 | #version=`ls src/.libs/lib*.so.* | \
 32 | # awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
 33 | #major=`ls src/.libs/lib*.so.* | \
 34 | # awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
 35 | 
 36 | config.status: configure
 37 | 	dh_testdir
 38 | 	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
 39 |                     --prefix=/usr --mandir=\$${prefix}/share/man \
 40 |                     --infodir=\$${prefix}/share/info \
 41 |                     CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
 42 | 
 43 | 
 44 | build: build-stamp
 45 | build-stamp:  config.status
 46 | 	dh_testdir
 47 | 	$(MAKE)
 48 | 	$(MAKE) pdf
 49 | 	touch $@
 50 | 
 51 | clean:
 52 | 	dh_testdir
 53 | 	dh_testroot
 54 | 	rm -f build-stamp 
 55 | 	-$(MAKE) distclean
 56 | ifneq "$(wildcard /usr/share/misc/config.sub)" ""
 57 | 	cp -f /usr/share/misc/config.sub config.sub
 58 | endif
 59 | ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 60 | 	cp -f /usr/share/misc/config.guess config.guess
 61 | endif
 62 | 
 63 | 
 64 | 	dh_clean 
 65 | 
 66 | install: build
 67 | 	dh_testdir
 68 | 	dh_testroot
 69 | 	dh_clean -k 
 70 | 	dh_installdirs
 71 | 	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
 72 | 
 73 | # Build architecture-independent files here.
 74 | binary-indep: build install
 75 | # We have nothing to do by default.
 76 | 
 77 | # Build architecture-dependent files here.
 78 | binary-arch: build install
 79 | 	dh_testdir
 80 | 	dh_testroot
 81 | 	dh_installchangelogs ChangeLog
 82 | 	dh_installdocs
 83 | 	dh_installexamples
 84 | 	dh_install --sourcedir=$(CURDIR)/debian/tmp
 85 | #	dh_installmenu
 86 | #	dh_installdebconf	
 87 | #	dh_installlogrotate
 88 | #	dh_installemacsen
 89 | #	dh_installpam
 90 | #	dh_installmime
 91 | #	dh_installinit
 92 | #	dh_installcron
 93 | #	dh_installinfo
 94 | 	dh_installman
 95 | 	dh_link
 96 | 	dh_strip
 97 | 	dh_compress
 98 | 	dh_fixperms
 99 | #	dh_perl
100 | #	dh_python
101 | #	dh_makeshlibs
102 | 	dh_installdeb
103 | 	dh_shlibdeps
104 | 	dh_gencontrol
105 | 	dh_md5sums
106 | 	dh_builddeb
107 | 
108 | binary: binary-indep binary-arch
109 | .PHONY: build clean binary-indep binary-arch binary install 
110 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/doc/Makefile.am:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | info_TEXINFOS = libconfig.texi
4 | libconfig_TEXINFOS = LGPL.texi
5 | 
6 | html:
7 | 	$(MAKEINFO) --html --no-split $(info_TEXINFOS)
8 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/grammar.h:
--------------------------------------------------------------------------------
  1 | /* A Bison parser, made by GNU Bison 2.3.  */
  2 | 
  3 | /* Skeleton interface for Bison's Yacc-like parsers in C
  4 | 
  5 |    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  6 |    Free Software Foundation, Inc.
  7 | 
  8 |    This program is free software; you can redistribute it and/or modify
  9 |    it under the terms of the GNU General Public License as published by
 10 |    the Free Software Foundation; either version 2, or (at your option)
 11 |    any later version.
 12 | 
 13 |    This program is distributed in the hope that it will be useful,
 14 |    but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 |    GNU General Public License for more details.
 17 | 
 18 |    You should have received a copy of the GNU General Public License
 19 |    along with this program; if not, write to the Free Software
 20 |    Foundation, Inc., 51 Franklin Street, Fifth Floor,
 21 |    Boston, MA 02110-1301, USA.  */
 22 | 
 23 | /* As a special exception, you may create a larger work that contains
 24 |    part or all of the Bison parser skeleton and distribute that work
 25 |    under terms of your choice, so long as that work isn't itself a
 26 |    parser generator using the skeleton or a modified version thereof
 27 |    as a parser skeleton.  Alternatively, if you modify or redistribute
 28 |    the parser skeleton itself, you may (at your option) remove this
 29 |    special exception, which will cause the skeleton and the resulting
 30 |    Bison output files to be licensed under the GNU General Public
 31 |    License without this special exception.
 32 | 
 33 |    This special exception was added by the Free Software Foundation in
 34 |    version 2.2 of Bison.  */
 35 | 
 36 | /* Tokens.  */
 37 | #ifndef YYTOKENTYPE
 38 | # define YYTOKENTYPE
 39 |    /* Put the tokens into the symbol table, so that GDB and other debuggers
 40 |       know about them.  */
 41 |    enum yytokentype {
 42 |      TOK_BOOLEAN = 258,
 43 |      TOK_INTEGER = 259,
 44 |      TOK_HEX = 260,
 45 |      TOK_FLOAT = 261,
 46 |      TOK_STRING = 262,
 47 |      TOK_NAME = 263,
 48 |      TOK_EQUALS = 264,
 49 |      TOK_NEWLINE = 265,
 50 |      TOK_ARRAY_START = 266,
 51 |      TOK_ARRAY_END = 267,
 52 |      TOK_LIST_START = 268,
 53 |      TOK_LIST_END = 269,
 54 |      TOK_COMMA = 270,
 55 |      TOK_GROUP_START = 271,
 56 |      TOK_GROUP_END = 272,
 57 |      TOK_END = 273,
 58 |      TOK_GARBAGE = 274
 59 |    };
 60 | #endif
 61 | /* Tokens.  */
 62 | #define TOK_BOOLEAN 258
 63 | #define TOK_INTEGER 259
 64 | #define TOK_HEX 260
 65 | #define TOK_FLOAT 261
 66 | #define TOK_STRING 262
 67 | #define TOK_NAME 263
 68 | #define TOK_EQUALS 264
 69 | #define TOK_NEWLINE 265
 70 | #define TOK_ARRAY_START 266
 71 | #define TOK_ARRAY_END 267
 72 | #define TOK_LIST_START 268
 73 | #define TOK_LIST_END 269
 74 | #define TOK_COMMA 270
 75 | #define TOK_GROUP_START 271
 76 | #define TOK_GROUP_END 272
 77 | #define TOK_END 273
 78 | #define TOK_GARBAGE 274
 79 | 
 80 | 
 81 | 
 82 | 
 83 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 84 | typedef union YYSTYPE
 85 | #line 73 "grammar.y"
 86 | {
 87 |   long ival;
 88 |   double fval;
 89 |   char *sval;
 90 | }
 91 | /* Line 1529 of yacc.c.  */
 92 | #line 93 "grammar.h"
 93 | 	YYSTYPE;
 94 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 95 | # define YYSTYPE_IS_DECLARED 1
 96 | # define YYSTYPE_IS_TRIVIAL 1
 97 | #endif
 98 | 
 99 | 
100 | 
101 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/libconfig++.pc.in:
--------------------------------------------------------------------------------
 1 | prefix=@prefix@
 2 | exec_prefix=@exec_prefix@
 3 | libdir=@libdir@
 4 | includedir=@includedir@
 5 | 
 6 | Name: libconfig++
 7 | Description: C++ Configuration File Library
 8 | Version: @VERSION@
 9 | URL: http://www.hyperrealm.com/main.php?s=libconfig
10 | Requires:
11 | Conflicts:
12 | Libs: -L${libdir} -lconfig++
13 | Libs.private: @LIBS@ 
14 | Cflags: -I${includedir}
15 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/libconfig.pc.in:
--------------------------------------------------------------------------------
 1 | prefix=@prefix@
 2 | exec_prefix=@exec_prefix@
 3 | libdir=@libdir@
 4 | includedir=@includedir@
 5 | 
 6 | Name: libconfig
 7 | Description: C Configuration File Library
 8 | Version: @VERSION@
 9 | URL: http://www.hyperrealm.com/main.php?s=libconfig
10 | Requires:
11 | Conflicts:
12 | Libs: -L${libdir} -lconfig
13 | Libs.private: @LIBS@ 
14 | Cflags: -I${includedir}
15 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/libconfig.sln:
--------------------------------------------------------------------------------
 1 | 
 2 | Microsoft Visual Studio Solution File, Format Version 9.00
 3 | # Visual Studio 2005
 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig++_stub", "libconfig++_stub.vcproj", "{2A94C9E9-A7C7-4770-A24C-694312ADB850}"
 5 | EndProject
 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig++", "libconfig++.vcproj", "{A0C36CE7-D908-4573-8B69-249EEEB7D2BE}"
 7 | EndProject
 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig", "libconfig.vcproj", "{1A234565-926D-49B2-83E4-D56E0C38C9F2}"
 9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig_stub", "libconfig_stub.vcproj", "{6CD5E648-E434-4C9A-9872-AF884149CE93}"
11 | EndProject
12 | Global
13 | 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | 		Debug|Win32 = Debug|Win32
15 | 		Release|Win32 = Release|Win32
16 | 	EndGlobalSection
17 | 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | 		{2A94C9E9-A7C7-4770-A24C-694312ADB850}.Debug|Win32.ActiveCfg = Debug|Win32
19 | 		{2A94C9E9-A7C7-4770-A24C-694312ADB850}.Debug|Win32.Build.0 = Debug|Win32
20 | 		{2A94C9E9-A7C7-4770-A24C-694312ADB850}.Release|Win32.ActiveCfg = Release|Win32
21 | 		{2A94C9E9-A7C7-4770-A24C-694312ADB850}.Release|Win32.Build.0 = Release|Win32
22 | 		{A0C36CE7-D908-4573-8B69-249EEEB7D2BE}.Debug|Win32.ActiveCfg = Debug|Win32
23 | 		{A0C36CE7-D908-4573-8B69-249EEEB7D2BE}.Debug|Win32.Build.0 = Debug|Win32
24 | 		{A0C36CE7-D908-4573-8B69-249EEEB7D2BE}.Release|Win32.ActiveCfg = Release|Win32
25 | 		{A0C36CE7-D908-4573-8B69-249EEEB7D2BE}.Release|Win32.Build.0 = Release|Win32
26 | 		{1A234565-926D-49B2-83E4-D56E0C38C9F2}.Debug|Win32.ActiveCfg = Debug|Win32
27 | 		{1A234565-926D-49B2-83E4-D56E0C38C9F2}.Debug|Win32.Build.0 = Debug|Win32
28 | 		{1A234565-926D-49B2-83E4-D56E0C38C9F2}.Release|Win32.ActiveCfg = Release|Win32
29 | 		{1A234565-926D-49B2-83E4-D56E0C38C9F2}.Release|Win32.Build.0 = Release|Win32
30 | 		{6CD5E648-E434-4C9A-9872-AF884149CE93}.Debug|Win32.ActiveCfg = Debug|Win32
31 | 		{6CD5E648-E434-4C9A-9872-AF884149CE93}.Debug|Win32.Build.0 = Debug|Win32
32 | 		{6CD5E648-E434-4C9A-9872-AF884149CE93}.Release|Win32.ActiveCfg = Release|Win32
33 | 		{6CD5E648-E434-4C9A-9872-AF884149CE93}.Release|Win32.Build.0 = Release|Win32
34 | 	EndGlobalSection
35 | 	GlobalSection(SolutionProperties) = preSolution
36 | 		HideSolutionNode = FALSE
37 | 	EndGlobalSection
38 | EndGlobal
39 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/libconfig.spec.in:
--------------------------------------------------------------------------------
 1 | Name:		@PACKAGE@
 2 | Version:	@VERSION@
 3 | Release:	1
 4 | Summary:	C/C++ Configuration File Library
 5 | 
 6 | Group:		System Environment/Libraries
 7 | License:	LGPL
 8 | URL:		http://hyperrealm.com/main.php?s=libconfig
 9 | Source0:	%{name}-%{version}.tar.gz
10 | BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id} -u -n)
11 | 
12 | Packager:	Deneys S. Maartens  
13 | 
14 | BuildRequires:	texinfo
15 | 
16 | %description
17 | %{name} is a simple library for manipulating structured configuration
18 | files. The file format is more compact and more readable than XML. And
19 | unlike XML, it is type-aware, so it is not necessary to do string
20 | parsing in application code.
21 | 
22 | %{name} is very compact -- just 25K for the stripped C shared library
23 | (one-fifth the size of the expat XML parser library) and 39K for the
24 | stripped C++ shared library. This makes it well-suited for
25 | memory-constrained systems like handheld devices.
26 | 
27 | The library includes bindings for both the C and C++ languages. It works
28 | on POSIX-compliant UNIX systems.
29 | 
30 | %package devel
31 | Summary:	%{name} development package
32 | Group:		Development/Libraries
33 | Requires:	%{name} = %{version}
34 | 
35 | %description devel
36 | Development files for %{name}.
37 | 
38 | %prep
39 | %setup -q
40 | 
41 | %build
42 | %configure
43 | make %{?_smp_mflags}
44 | make html
45 | 
46 | %install
47 | rm -rf $RPM_BUILD_ROOT
48 | make install DESTDIR=$RPM_BUILD_ROOT
49 | 
50 | %clean
51 | rm -rf $RPM_BUILD_ROOT
52 | 
53 | %post
54 | ldconfig
55 | 
56 | %postun
57 | ldconfig
58 | 
59 | %files
60 | %defattr(-,root,root,-)
61 | %doc AUTHORS COPYING.LIB ChangeLog INSTALL NEWS README
62 | %{_libdir}/%{name}.so*
63 | %{_libdir}/%{name}++.so*
64 | 
65 | %files devel
66 | %defattr(-,root,root,-)
67 | %doc AUTHORS COPYING.LIB ChangeLog INSTALL NEWS README
68 | %doc doc/%{name}.html
69 | %doc test.cfg
70 | %doc samples/c/*.c
71 | %doc samples/c++/*.cpp
72 | %{_infodir}
73 | %{_includedir}
74 | %{_libdir}/pkgconfig
75 | %{_libdir}/%{name}.a
76 | %{_libdir}/%{name}.la
77 | %{_libdir}/%{name}++.a
78 | %{_libdir}/%{name}++.la
79 | 
80 | %changelog
81 | * Wed Aug 19 2007  Deneys S. Maartens    1.1.3-1
82 | - create spec file
83 | 
84 | # -fin-
85 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/private.h:
--------------------------------------------------------------------------------
 1 | /* ----------------------------------------------------------------------------
 2 |    libconfig - A structured configuration file parsing library
 3 |    Copyright (C) 2005  Mark A Lindner
 4 |  
 5 |    This file is part of libconfig.
 6 |     
 7 |    This library is free software; you can redistribute it and/or
 8 |    modify it under the terms of the GNU Lesser General Public License
 9 |    as published by the Free Software Foundation; either version 2.1 of
10 |    the License, or (at your option) any later version.
11 |     
12 |    This library is distributed in the hope that it will be useful, but
13 |    WITHOUT ANY WARRANTY; without even the implied warranty of
14 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 |    Lesser General Public License for more details.
16 |     
17 |    You should have received a copy of the GNU Lesser General Public
18 |    License along with this library; if not, write to the Free Software
19 |    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
20 |    ----------------------------------------------------------------------------
21 | */
22 | 
23 | #ifndef __libconfig_private_h
24 | #define __libconfig_private_h
25 | 
26 | #include "libconfig.h"
27 | 
28 | struct parse_context
29 | {
30 |   config_t *config;
31 |   config_setting_t *parent;
32 |   config_setting_t *setting;
33 |   char *name;
34 | };
35 | 
36 | // ---------------------------------------------------------------------------
37 | #endif // __libconfig_private_h
38 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/Makefile.am:
--------------------------------------------------------------------------------
1 | 
2 | SUBDIRS = c
3 | 
4 | if BUILDCXX
5 | 
6 | SUBDIRS += c++
7 | 
8 | endif
9 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c++/Makefile.am:
--------------------------------------------------------------------------------
 1 | 
 2 | noinst_PROGRAMS = stubcpp sample1 sample2 sample3
 3 | 
 4 | stubcpp_SOURCES = stubcpp.cpp
 5 | 
 6 | sample1_SOURCES = sample1.cpp
 7 | 
 8 | sample2_SOURCES = sample2.cpp
 9 | 
10 | sample3_SOURCES = sample3.cpp
11 | 
12 | AM_CPPFLAGS = -I $(top_srcdir)
13 | 
14 | LDADD = -L../../.libs -lconfig++
15 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c++/sample1.cpp:
--------------------------------------------------------------------------------
 1 | /*************************************************************************
 2 |  ** Sample1
 3 |  ** Load sample.cfg and increment the "X" setting
 4 |  *************************************************************************/
 5 | 
 6 | #include 
 7 | #include 
 8 | 
 9 | using namespace libconfig;
10 | using namespace std;
11 | 
12 | /***************************************************************************/
13 | 
14 | int main()
15 | {
16 |   Config cfg;
17 | 
18 |   try
19 |   {
20 |     /* Load the configuration.. */
21 |     cout << "loading [sample.cfg]..";
22 |     cfg.readFile("sample.cfg");
23 |     cout << "ok" << endl;
24 | 
25 |     /* Increment "x" */
26 |     cout << "increment \"x\"..";
27 |     Setting& s = cfg.lookup("x");
28 |     long x = s;
29 |     s = ++x;
30 |     cout << "ok (x=" << x << ")" << endl;
31 | 
32 |     // Save the configuration
33 |     cout << "saving [sample.cfg]..";
34 |     cfg.writeFile("sample.cfg");
35 |     cout << "ok" << endl;
36 | 
37 |     cout << "Done!" << endl;
38 |   }
39 |   catch (...)
40 |   {
41 |     cout << "failed" << endl;
42 |   }
43 | 
44 |   return 0;
45 | }
46 | 
47 | /***************************************************************************/
48 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c++/sample2.cpp:
--------------------------------------------------------------------------------
 1 | /*************************************************************************
 2 |  ** Sample2
 3 |  ** Load sample.cfg and access the "values" array
 4 |  *************************************************************************/
 5 | 
 6 | #include 
 7 | #include 
 8 | 
 9 | using namespace libconfig;
10 | using namespace std;
11 | 
12 | /***************************************************************************/
13 | 
14 | int main()
15 | {
16 |   Config cfg;
17 |   try
18 |   {
19 |     /* Load the configuration.. */
20 |     cout << "loading [sample.cfg]..";
21 |     cfg.readFile("sample.cfg");
22 |     cout << "ok" << endl;
23 | 
24 |     // Display the "values" array
25 |     cout << "display the \"values\" array..";
26 |     Setting& s = cfg.lookup("values");
27 |     long value1 = s[0];
28 |     long value2 = s[1];
29 |     cout << "[" << value1 << "," << value2 << "]..";
30 |     cout << "ok" << endl;
31 | 
32 |     cout << "Done!" << endl;
33 |   }
34 |   catch (...)
35 |   {
36 |     cout << "failed" << endl;
37 |   }
38 | 
39 |   return 0;
40 | }
41 | 
42 | 
43 | /***************************************************************************/
44 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c++/sample3.cpp:
--------------------------------------------------------------------------------
 1 | /*************************************************************************
 2 |  ** Sample3
 3 |  ** Load sample.cfg and try to add a setting "foo"..
 4 |  **   on success save to testfoo.cfg
 5 |  *************************************************************************/
 6 | 
 7 | #include 
 8 | #include 
 9 | 
10 | using namespace libconfig;
11 | using namespace std;
12 | 
13 | /***************************************************************************/
14 | 
15 | int main()
16 | {
17 |   Config cfg;
18 |   try
19 |   {
20 |     /* Load the configuration.. */
21 |     cout << "loading [sample.cfg]..";
22 |     cfg.readFile("sample.cfg");
23 |     cout << "ok" << endl;
24 | 
25 |     /* Add setting "foo" */
26 |     cout << "add setting \"foo\"..";
27 |     Setting &root = cfg.getRoot();
28 |     Setting &foo  = root.add("foo", Setting::TypeInt);
29 |     foo = 1234;
30 |     cout << "ok" << endl;
31 | 
32 |     /* Save to "samplefoo.cfg" */
33 |     cout << "saving [samplefoo.cfg]..";
34 |     cfg.writeFile("samplefoo.cfg");
35 |     cout << "ok" << endl;
36 | 
37 |     cout << "Done!" << endl;
38 |   }
39 |   catch (...)
40 |   {
41 |     cout << "failed" << endl;
42 |   }
43 | 
44 |   return 0;
45 | }
46 | 
47 | /***************************************************************************/
48 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c++/stubcpp.cpp:
--------------------------------------------------------------------------------
  1 | 
  2 | #include 
  3 | #include 
  4 | #include 
  5 | 
  6 | #include "libconfig.h++"
  7 | 
  8 | using namespace libconfig;
  9 | 
 10 | int main(int argc, char **argv)
 11 |   {
 12 |   Config cfg;
 13 | 
 14 |   try
 15 |     {
 16 |     FILE *fp = fopen("test.cfg", "r");
 17 | 
 18 |     if(! fp)
 19 |     {
 20 |       printf("Unable to open test.cfg\n");
 21 |       exit(1);
 22 |     }
 23 |     
 24 |     cfg.read(fp);
 25 |     fclose(fp);
 26 |     
 27 | //  const ConfigSetting& setting = cfg.lookup("application.window.size.w");
 28 | //  long val = setting;
 29 |     
 30 |     long val = cfg.lookup("application.window.size.w");
 31 |     printf("val: %ld\n", val);
 32 | 
 33 |     std::string title = cfg.lookup("application.window.title");
 34 |     std::cout << "title: " << title << std::endl;
 35 | 
 36 |     Setting &ss = cfg.lookup("application.window.title");
 37 |     std::string title2 = ss;
 38 |     std::cout << "title: " << title2 << std::endl;
 39 | 
 40 |     std::string rr = "foo";
 41 | 
 42 |     rr = (const char *)cfg.lookup("application.window.title");
 43 | //    rr = (std::string)(cfg.lookup("application.window.title"));
 44 |     std::cout << "rr: " << rr << std::endl;
 45 | 
 46 |     const char *rrr = cfg.lookup("application.window.title");
 47 |     
 48 |     Setting &s = cfg.lookup("application.group1.my_array");  
 49 |     long val4;
 50 |     val4 = s[4];
 51 |     printf("item #4 is: %ld\n", val4);
 52 |     printf("location of my_array is %d\n", s.getSourceLine());
 53 | 
 54 |     Setting &grp = cfg.lookup("application.group1.group2");
 55 | 
 56 |     Setting &zzz = cfg.lookup("application.group1.group2.zzz");
 57 |     printf("location of zzz is at %d\n", zzz.getSourceLine());
 58 | 
 59 |     Setting &root = cfg.getRoot();
 60 | 
 61 |     Setting &rootn = root.add("new-one-at-top", Setting::TypeGroup);
 62 | 
 63 |     Setting &ngp = rootn.add("element",  Setting::TypeFloat);
 64 | 
 65 |     Setting &misc = root["misc"];
 66 |     unsigned int portnum = 0;
 67 |     misc.lookupValue("port", portnum);
 68 |     printf("port # is: %d\n", portnum);
 69 |     
 70 |     ngp = 1.1234567890123;
 71 |     
 72 | //    long val22 = s[22];
 73 | //    printf("item #22 is: %d\n", val22);
 74 | 
 75 |     Setting &snew = grp.add("foobar",  Setting::TypeArray);
 76 | 
 77 |     snew.add(Setting::TypeInt);
 78 |     snew.add(Setting::TypeInt);
 79 | 
 80 |     snew.add(Setting::TypeInt);
 81 |     snew.add(Setting::TypeInt);
 82 |     
 83 |     puts("created new array");
 84 | 
 85 |     snew[0] = 55;
 86 |     puts("elem 0");
 87 |     snew[1] = 66;
 88 |     puts("elem 1");
 89 | 
 90 |     cfg.setAutoConvert(true);
 91 | 
 92 |     double dd = cfg.lookup("application.group1.x");
 93 |     printf("auto-converted int->double: %f\n", dd);
 94 | 
 95 |     int ii = cfg.lookup("misc.pi");
 96 |     printf("auto-converted double->int: %d\n", ii);
 97 |    
 98 |     Setting &sdel = cfg.lookup("application");
 99 | 
100 |     sdel.remove("group1");
101 | 
102 |     
103 |     Setting &books = cfg.lookup("books");
104 |     puts("found books");
105 |     Setting &book = books.add(Setting::TypeGroup);
106 |     puts("added book");
107 | 
108 |     Setting &sss = book.add("Title", Setting::TypeString);
109 |     puts("added title");
110 |     
111 |     sss = "Alice in Wonderland";
112 | 
113 |     Setting &sss2 = book.add("Price", Setting::TypeFloat);
114 |     sss2 = 9.99;
115 | 
116 |     cfg.write(stdout);
117 | 
118 |     
119 |     }
120 |   catch(ParseException& ex)
121 |     {
122 |     printf("error on line %d: %s\n", ex.getLine(),
123 |            ex.getError());
124 |     }
125 |   catch(ConfigException& cex)
126 |   {
127 |     printf("config exception!\n");
128 |   }
129 |     
130 |   return(0);
131 |   }
132 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c/Makefile.am:
--------------------------------------------------------------------------------
 1 | 
 2 | noinst_PROGRAMS = stub sample1 sample2 sample3
 3 | 
 4 | stub_SOURCES = stub.c
 5 | 
 6 | sample1_SOURCES = sample1.c
 7 | 
 8 | sample2_SOURCES = sample2.c
 9 | 
10 | sample3_SOURCES = sample3.c
11 | 
12 | AM_CPPFLAGS = -I $(top_srcdir)
13 | 
14 | LDADD = -L../../.libs -lconfig
15 | 
16 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c/sample1.c:
--------------------------------------------------------------------------------
 1 | /*************************************************************************
 2 |  ** Sample1
 3 |  ** Load sample.cfg and increment the "X" setting
 4 |  *************************************************************************/
 5 | 
 6 | #include 
 7 | #include 
 8 | 
 9 | struct config_t cfg;
10 | 
11 | /***************************************************************************/
12 | 
13 | int main()
14 | {
15 |   /* Initialize the configuration */
16 |   config_init(&cfg);
17 | 
18 |   /* Load the file */
19 |   printf("loading [sample.cfg]..");
20 |   if (!config_read_file(&cfg, "sample.cfg"))
21 |     printf("failed\n");
22 |   else
23 |   {
24 |     printf("ok\n");
25 |     
26 |     /* Get the "x" setting from the configuration.. */
27 |     printf("increment \"x\"..");
28 |     config_setting_t *setting = config_lookup(&cfg, "x");
29 |     if (!setting)
30 |       printf("failed\n");
31 |     else
32 |     {
33 |       long x = config_setting_get_int(setting);
34 |       x++;
35 |       config_setting_set_int(setting, x);
36 |       printf("ok (x=%lu)\n", x);
37 | 
38 |       /* Save the changes */
39 |       printf("saving [sample.cfg]..");
40 |       config_write_file(&cfg, "sample.cfg");
41 |       printf("ok\n");
42 | 
43 |       printf("Done!\n");
44 |     }
45 |   }
46 | 
47 |   /* Free the configuration */
48 |   config_destroy(&cfg);
49 | 
50 |   return 0;
51 | }
52 | 
53 | /***************************************************************************/
54 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c/sample2.c:
--------------------------------------------------------------------------------
 1 | /*************************************************************************
 2 |  ** Sample2
 3 |  ** Load sample.cfg and access the "values" array
 4 |  *************************************************************************/
 5 | 
 6 | #include 
 7 | #include 
 8 | 
 9 | struct config_t cfg;
10 | 
11 | /***************************************************************************/
12 | 
13 | int main()
14 | {
15 |   /* Initialize the configuration */
16 |   config_init(&cfg);
17 | 
18 |   /* Load the file */
19 |   printf("loading [sample.cfg]..");
20 |   if (!config_read_file(&cfg, "sample.cfg"))
21 |     printf("failed\n");
22 |   else
23 |   {
24 |     printf("ok\n");
25 |     
26 |     /* Display the "values" array */
27 |     printf("display \"values\"..");
28 |     config_setting_t *array = config_lookup(&cfg, "values");
29 |     if (!array)
30 |       printf("failed\n");
31 |     else
32 |     {
33 |       long value1,value2;
34 |       value1 = config_setting_get_int_elem(array, 0);
35 |       value2 = config_setting_get_int_elem(array, 1);
36 |       printf("[%lu %lu]..ok\n", value1, value2);
37 | 
38 |       printf("Done!\n");
39 |     }
40 | 
41 |   }
42 | 
43 |   /* Free the configuration */
44 |   config_destroy(&cfg);
45 | 
46 |   return 0;
47 | }
48 | 
49 | 
50 | /***************************************************************************/
51 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c/sample3.c:
--------------------------------------------------------------------------------
 1 | /*************************************************************************
 2 |  ** Sample3
 3 |  ** Load sample.cfg and try to add a setting "foo"..
 4 |  **   on success save to testfoo.cfg
 5 |  *************************************************************************/
 6 | 
 7 | #include 
 8 | #include 
 9 | 
10 | struct config_t cfg;
11 | 
12 | /***************************************************************************/
13 | 
14 | int main()
15 | {
16 |   /* Initialize the configuration */
17 |   config_init(&cfg);
18 | 
19 |   /* Load the file */
20 |   printf("loading [sample.cfg]..");
21 |   if (!config_read_file(&cfg, "sample.cfg"))
22 |     printf("failed\n");
23 |   else
24 |   {
25 |     printf("ok\n");
26 | 
27 |     /* Add setting "foo" */
28 |     printf("add setting \"foo\"..");
29 |     config_setting_t *setting = config_setting_add(cfg.root,"foo",
30 |                                                    CONFIG_TYPE_INT);
31 |     if (!setting)
32 |       printf("failed\n");
33 |     else
34 |     {
35 |       config_setting_set_int(setting,1234);
36 |       printf("ok\n");
37 | 
38 |       /* Save to "samplefoo.cfg" */
39 |       printf("saving [samplefoo.cfg]..");
40 |       config_write_file(&cfg, "samplefoo.cfg");
41 |       printf("ok\n");
42 | 
43 |       printf("Done!\n");
44 |     }
45 |   }
46 | 
47 |   /* Free the configuration */
48 |   config_destroy(&cfg);
49 | 
50 |   return 0;
51 | }
52 | 
53 | /***************************************************************************/
54 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/samples/c/stub.c:
--------------------------------------------------------------------------------
 1 | #ifdef _MSC_VER
 2 | #pragma warning (disable: 4996)
 3 | #endif
 4 | 
 5 | #include 
 6 | #include 
 7 | #include "libconfig.h"
 8 | 
 9 | int main(int argc, char **argv)
10 | {
11 |   config_t cfg;
12 |   FILE *fp;
13 |   int i, x;
14 |   const char *s;
15 |   const config_setting_t *array;
16 |   config_setting_t *old;
17 | 
18 |   fp = fopen("test.cfg", "rb");
19 | 
20 |   if(! fp)
21 |   {
22 |     printf("Unable to open test.cfg\n");
23 |     exit(1);
24 |   }
25 |   
26 |   config_init(&cfg);
27 |   x = config_read(&cfg, fp);
28 | 
29 |   fclose(fp);
30 | 
31 |   if(! x)
32 |   {
33 |     printf("error on line %d: %s\n", cfg.error_line, cfg.error_text);
34 |     exit(1);
35 |   }
36 | 
37 |   s = config_lookup_string(&cfg, "application.group1.group2.zzz");
38 | 
39 |   if(! s)
40 |     puts("NOT FOUND");
41 |   else
42 |     printf("found: %s\n", s);
43 | 
44 |   array = config_lookup(&cfg, "application.group1.my_array");
45 |   if(array)
46 |   {
47 |     for(i = 0; i < config_setting_length(array); i++)
48 |     {
49 |       long val = config_setting_get_int_elem(array, i);
50 |       printf("value [%i]: %ld\n", i, val);
51 |     }
52 |   }
53 | 
54 |   {
55 |     config_setting_t *root = config_root_setting(&cfg);
56 | 
57 |     config_setting_t *new = config_setting_add(root, "foobar",
58 |                                                CONFIG_TYPE_LIST);
59 | 
60 |     config_setting_t *newgrp, *newval;
61 |     
62 | 
63 |     if(! config_setting_set_float_elem(new, -1, 3.141592654))
64 |       puts("FAILED");
65 |     
66 |     if(! config_setting_set_string_elem(new, -1, "Hello, world!"))
67 |       puts("FAILED");
68 | 
69 |     newgrp = config_setting_add(new, NULL, CONFIG_TYPE_GROUP);
70 |     
71 |     newval = config_setting_add(newgrp, "baz", CONFIG_TYPE_INT);
72 | 
73 |     old = config_lookup(&cfg, "application.group1");
74 | 
75 |     printf("old is: %p\n", old);
76 |     config_setting_remove(old, "group2");
77 |   }
78 | 
79 |   config_write(&cfg, stdout);
80 | 
81 |   
82 |   config_destroy(&cfg);
83 | 
84 |   
85 |   return(0);
86 | }
87 | 


--------------------------------------------------------------------------------
/externals/libconfig-1.2/test.cfg:
--------------------------------------------------------------------------------
 1 | #----------------------------
 2 | # Example Configuration File
 3 | #---------------------------
 4 | #
 5 | 
 6 | application:
 7 | {
 8 | 
 9 |  /* This section defines some settings for our
10 |   * main application window, such as size and
11 |   * position.
12 |   */
13 | 
14 |   window:
15 |   {
16 |     title = "My Application";
17 |     size = { /* width */ w = 640; /* height */ h = 480; };
18 |     pos = { x = 350; y = 250; };
19 |   };
20 | 
21 |   a = 5;
22 |   b = 6;
23 |   ff = 1E6;
24 |   test-comment = "/* hello\n \"there\"*/";
25 | 
26 |   test-long-string = "A very long string that spans multiple lines. "
27 |   /* but wait, there's more... */ "Adjacent strings are automatically"
28 |   " concatenated.";
29 | 
30 |   test-escaped-string = "\"This is\n a test.\"";
31 | 
32 |   group1:
33 |   {
34 |     x = 5;  y = 10;
35 |     my_array = [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 ];
36 |     flag = TRUE;
37 | 
38 |     group2: { zzz = "this is a test"; };
39 | 
40 |     states = [	"CT", // Connecticut
41 | 		"CA", // California
42 | 		"TX", // Texas
43 | 		"NV", // Nevada
44 | 		"FL"  // Florida
45 |     ];
46 |   };
47 | 
48 |   /* this would cause an error */
49 |   // a = "hi!";
50 | };
51 | 
52 | binary = [ 0xAA, 0xBB, 0xCC ];
53 | 
54 | list = ( ( "abc", 123, true ), 1.234, ( /* an empty list */ ) ,[ 1, 2, 3 ],
55 | 	   { a = (1, 2, true); } );
56 | 
57 | books = ( "inventory",
58 |           { title  = "Treasure Island";
59 |             author = "Robert Louis Stevenson";
60 |             price  = 29.99;
61 |             qty    = 5; },
62 |           { title  = "Snow Crash";
63 |             author = "Neal Stephenson";
64 |             price  = 9.99;
65 |             qty    = 8; },
66 |           { } );
67 | 
68 | # miscellaneous stuff
69 | 
70 | misc:
71 | {
72 |   port = 5000;
73 |   pi = 3.14159265;
74 |   enabled = FALSE;
75 |   mask = 0xAABBCCDD;
76 |   unicode = "Markus Kuhn [ˈmaʳkʊs kuːn]"; // UTF-8 string
77 | };
78 | 
79 | 
80 | ### eof
81 | 


--------------------------------------------------------------------------------
/lock.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | 
35 | #ifndef __MYLOCK__
36 | #define __MYLOCK__
37 | 
38 | /**
39 |  * Non-recursive spinlock. Using `xchg` and `ldstub` as in PostgresSQL.
40 |  */
41 | class Lock {
42 | 	public:
43 | 		Lock() : _l(0) { }
44 | 
45 | 		/** Call blocks and retunrs only when it has the lock. */
46 | 		inline void lock() 
47 | 		{
48 | 			while(tas(&_l)) {
49 | #if defined(__i386__) || defined(__x86_64__)
50 | 				__asm__ __volatile__ ("pause\n");
51 | #endif
52 | 			}
53 | 		}
54 | 
55 | 		/** Unlocks the lock object. */
56 | 		inline void unlock() 
57 | 		{ 
58 | 			_l = 0;
59 | 		}
60 | 
61 | 		/** Resets lock, guaranteed to be called non-concurrently. */
62 | 		inline void reset()
63 | 		{
64 | 			unlock();
65 | 		}
66 | 
67 | 	private:
68 | 		inline int tas(volatile char* lock)
69 | 		{
70 | 			register char res = 1;
71 | #if defined(__i386__) || defined(__x86_64__)
72 | 			__asm__ __volatile__ (
73 | 					"lock xchgb %0, %1\n"
74 | 					: "+q"(res), "+m"(*lock)
75 | 					:
76 | 					: "memory", "cc");
77 | #elif defined(__sparc__)
78 | 			__asm__ __volatile__ (
79 | 					"ldstub [%2], %0"
80 | 					: "=r"(res), "+m"(*lock)
81 | 					: "r"(lock)
82 | 					: "memory");
83 | #else
84 | #error TAS not defined for this architecture.
85 | #endif
86 | 			return res;
87 | 		}
88 | 
89 | 		volatile char _l;
90 | 
91 | };
92 | 
93 | #endif
94 | 


--------------------------------------------------------------------------------
/operators/aggregatecount.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "operators.h"
36 | 
37 | Schema& AggregateCount::foldinit(libconfig::Config& root, libconfig::Setting& cfg)
38 | {
39 | 	aggregatecountschema = Schema();
40 | 	aggregatecountschema.add(CT_LONG);
41 | 	return aggregatecountschema;
42 | }
43 | 
44 | void AggregateCount::foldstart(void* output, void* tuple)
45 | {
46 | 	*(CtLong*)output = 1;
47 | }
48 | 
49 | void AggregateCount::fold(void* partialresult, void* tuple)
50 | {
51 | 	(*(CtLong*)partialresult)++;
52 | }
53 | 


--------------------------------------------------------------------------------
/operators/aggregatesum.cpp:
--------------------------------------------------------------------------------
  1 | 
  2 | /*
  3 |  * Copyright 2011, Pythia authors (see AUTHORS file).
  4 |  * All rights reserved.
  5 |  * 
  6 |  * Redistribution and use in source and binary forms, with or without
  7 |  * modification, are permitted provided that the following conditions
  8 |  * are met:
  9 |  * 
 10 |  * 1. Redistributions of source code must retain the above copyright
 11 |  * notice, this list of conditions and the following disclaimer.
 12 |  * 
 13 |  * 2. Redistributions in binary form must reproduce the above copyright
 14 |  * notice, this list of conditions and the following disclaimer in the
 15 |  * documentation and/or other materials provided with the distribution.
 16 |  * 
 17 |  * 3. Neither the name of the copyright holder nor the names of its
 18 |  * contributors may be used to endorse or promote products derived from
 19 |  * this software without specific prior written permission.
 20 |  * 
 21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 32 |  * POSSIBILITY OF SUCH DAMAGE.
 33 |  */
 34 | 
 35 | #include "operators.h"
 36 | 
 37 | Schema& AggregateSum::foldinit(libconfig::Config& root, libconfig::Setting& cfg)
 38 | {
 39 | 	sumfieldno = cfg["sumfield"];
 40 | 	inschema = nextOp->getOutSchema();
 41 | 
 42 | 	// Assert we sum numeric types.
 43 | 	//
 44 | 	assert(inschema.getColumnType(sumfieldno) == CT_DECIMAL
 45 | 			|| inschema.getColumnType(sumfieldno) == CT_INTEGER
 46 | 			|| inschema.getColumnType(sumfieldno) == CT_LONG);
 47 | 
 48 | 	aggregateschema = Schema();
 49 | 	aggregateschema.add(inschema.getColumnType(sumfieldno));
 50 | 	return aggregateschema;
 51 | }
 52 | 
 53 | void AggregateSum::foldstart(void* output, void* tuple)
 54 | {
 55 | 	switch (aggregateschema.getColumnType(0))
 56 | 	{
 57 | 		case CT_INTEGER:
 58 | 		{
 59 | 			CtInt val = inschema.asInt(tuple, sumfieldno);
 60 | 			*(CtInt*)output = val;
 61 | 			break;
 62 | 		}
 63 | 		case CT_LONG:
 64 | 		{
 65 | 			CtLong val = inschema.asLong(tuple, sumfieldno);
 66 | 			*(CtLong*)output = val;
 67 | 			break;
 68 | 		}
 69 | 		case CT_DECIMAL:
 70 | 		{
 71 | 			CtDecimal val = inschema.asDecimal(tuple, sumfieldno);
 72 | 			*(CtDecimal*)output = val;
 73 | 			break;
 74 | 		}
 75 | 		default:
 76 | 			throw NotYetImplemented();
 77 | 			break;
 78 | 	};
 79 | }
 80 | 
 81 | void AggregateSum::fold(void* partialresult, void* tuple)
 82 | {
 83 | 	switch (aggregateschema.getColumnType(0))
 84 | 	{
 85 | 		case CT_INTEGER:
 86 | 		{
 87 | 			CtInt nextval = inschema.asInt(tuple, sumfieldno);
 88 | 			*(CtInt*)partialresult += nextval;
 89 | 			break;
 90 | 		}
 91 | 		case CT_LONG:
 92 | 		{
 93 | 			CtLong nextval = inschema.asLong(tuple, sumfieldno);
 94 | 			*(CtLong*)partialresult += nextval;
 95 | 			break;
 96 | 		}
 97 | 		case CT_DECIMAL:
 98 | 		{
 99 | 			CtDecimal nextval = inschema.asDecimal(tuple, sumfieldno);
100 | 			*(CtDecimal*)partialresult += nextval;
101 | 			break;
102 | 		}
103 | 		default:
104 | 			throw NotYetImplemented();
105 | 			break;
106 | 	};
107 | }
108 | 


--------------------------------------------------------------------------------
/operators/base.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "operators.h"
36 | 
37 | void Operator::init(libconfig::Config& root, libconfig::Setting& cfg)
38 | {
39 | 	buffsize = root.getRoot()["buffsize"];
40 | }
41 | 


--------------------------------------------------------------------------------
/operators/consume.cpp:
--------------------------------------------------------------------------------
  1 | 
  2 | /*
  3 |  * Copyright 2011, Pythia authors (see AUTHORS file).
  4 |  * All rights reserved.
  5 |  * 
  6 |  * Redistribution and use in source and binary forms, with or without
  7 |  * modification, are permitted provided that the following conditions
  8 |  * are met:
  9 |  * 
 10 |  * 1. Redistributions of source code must retain the above copyright
 11 |  * notice, this list of conditions and the following disclaimer.
 12 |  * 
 13 |  * 2. Redistributions in binary form must reproduce the above copyright
 14 |  * notice, this list of conditions and the following disclaimer in the
 15 |  * documentation and/or other materials provided with the distribution.
 16 |  * 
 17 |  * 3. Neither the name of the copyright holder nor the names of its
 18 |  * contributors may be used to endorse or promote products derived from
 19 |  * this software without specific prior written permission.
 20 |  * 
 21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 32 |  * POSSIBILITY OF SUCH DAMAGE.
 33 | */
 34 | 
 35 | #include "operators.h"
 36 | #include "operators_priv.h"
 37 | 
 38 | #include "../util/numaallocate.h"
 39 | #include "../util/numaasserts.h"
 40 | 
 41 | void ConsumeOp::init(libconfig::Config& root, libconfig::Setting& node)
 42 | {
 43 | 	SingleInputOp::init(root, node);
 44 | 	schema.add(CT_INTEGER);
 45 | 
 46 | 	assert(nextOp->getOutSchema().getTupleSize() >= 4);
 47 | 	static_assert(sizeof(CtInt) == 4);
 48 | 
 49 | 	for (int i=0; i<128; ++i)
 50 | 		vec.push_back(NULL);
 51 | }
 52 | 
 53 | void ConsumeOp::threadInit(unsigned short threadid)
 54 | {
 55 | 	void* space = numaallocate_local("Cons", sizeof(Page), this);
 56 | 	vec.at(threadid) = new(space) Page(buffsize, schema.getTupleSize(), this);
 57 | 	assertaddresslocal(vec[threadid]);
 58 | }
 59 | 
 60 | Operator::GetNextResultT ConsumeOp::getNext(unsigned short threadid)
 61 | {
 62 | 	CtInt val = 0;
 63 | 	dbgassert(vec.at(threadid) != NULL);
 64 | 	Page* out = vec[threadid];
 65 | 	GetNextResultT result;
 66 | 
 67 | 	assertaddresslocal(&val);
 68 | 
 69 | 	const int tupw = nextOp->getOutSchema().getTupleSize();
 70 | 
 71 | 	do {
 72 | 		result = nextOp->getNext(threadid);
 73 | 		dbgassert(result.first != Error);
 74 | 
 75 | 		Page* in = result.second;
 76 | 		Page::Iterator it = in->createIterator();
 77 | 
 78 | 		void* tuple;
 79 | 		while ( (tuple = it.next()) ) 
 80 | 		{
 81 | 			CtInt* casttuple = (CtInt*) tuple;
 82 | 			for (int i=0; i<(tupw/4); ++i)
 83 | 			{
 84 | 				val ^= casttuple[i];
 85 | 			}
 86 | 		}
 87 | 	} while(result.first == Operator::Ready);
 88 | 
 89 | 	assertaddresslocal(&val);
 90 | 
 91 | 	void* dest = out->allocateTuple();
 92 | 	schema.writeData(dest, 0, &val);
 93 | 
 94 | 	return make_pair(Finished, out);
 95 | }
 96 | 
 97 | void ConsumeOp::threadClose(unsigned short threadid)
 98 | {
 99 | 	numadeallocate(vec.at(threadid));
100 | }
101 | 
102 | 


--------------------------------------------------------------------------------
/operators/cycleaccountant.cpp:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #include "operators.h"
35 | #include "operators_priv.h"
36 | 
37 | #include "../rdtsc.h"
38 | #include "../util/numaallocate.h"
39 | 
40 | void CycleAccountant::init(libconfig::Config& root, libconfig::Setting& node)
41 | {
42 | 	SingleInputOp::init(root, node);
43 | 
44 | 	schema = nextOp->getOutSchema();
45 | 
46 | 	for (int i=0; iScanStartCycles -= curtick();
62 | 	res = nextOp->scanStart(threadid, indexdatapage, indexdataschema);
63 | 	cycles[threadid]->ScanStartCycles += curtick();
64 | 	return res;
65 | }
66 | 
67 | Operator::GetNextResultT CycleAccountant::getNext(unsigned short threadid)
68 | {
69 | 	GetNextResultT res;
70 | 	cycles[threadid]->GetNextCycles -= curtick();
71 | 	res = nextOp->getNext(threadid);
72 | 	cycles[threadid]->GetNextCycles += curtick();
73 | 	return res;
74 | }
75 | 
76 | Operator::ResultCode CycleAccountant::scanStop(unsigned short threadid)
77 | {
78 | 	ResultCode res;
79 | 	cycles[threadid]->ScanStopCycles -= curtick();
80 | 	res = nextOp->scanStop(threadid);
81 | 	cycles[threadid]->ScanStopCycles += curtick();
82 | 	return res;
83 | }
84 | 
85 | void CycleAccountant::threadClose(unsigned short threadid)
86 | {
87 | 	numadeallocate(cycles.at(threadid));
88 | }
89 | 
90 | 


--------------------------------------------------------------------------------
/operators/filter.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "operators.h"
36 | #include "operators_priv.h"
37 | 
38 | using std::make_pair;
39 | 
40 | void Filter::init(libconfig::Config& root, libconfig::Setting& cfg)
41 | {
42 | 	MapWrapper::init(root, cfg);	//< calls Filter::mapinit below
43 | 
44 | 	fieldno = cfg["field"];
45 | 
46 | 	// Read column spec from input and create comparator. 
47 | 	//
48 | 	ColumnSpec cs = schema.get(fieldno);
49 | 	string tmpstr = cfg["op"];
50 | 	opstr = tmpstr;
51 | 	Comparator::Comparison compop = Comparator::parseString(opstr);
52 | 	comparator = Schema::createComparator(schema, fieldno, cs, compop);
53 | 	
54 | 	// Create dummy schema and parse input to create comparator.
55 | 	//
56 | 	const char* inputval = cfg["value"];
57 | 	Schema dummyschema;
58 | 	dummyschema.add(cs);
59 | 	dbgassert(sizeof(value) == FILTERMAXWIDTH);
60 | 	dbgassert(dummyschema.getTupleSize() <= sizeof(value));
61 | 	dbgassert(dummyschema.columns() == 1);
62 | 	dummyschema.parseTuple(value, &inputval);
63 | }
64 | 
65 | void Filter::mapinit(Schema& schema)
66 | {
67 | 	schema = nextOp->getOutSchema();
68 | 
69 | 	// We don't bother with setting a description, because Filter is a
70 | 	// first-class citizen for the engine and is recognized by the visitor
71 | 	// classes for pretty-printing.
72 | }
73 | 
74 | /**
75 |  * Filter and do copy.
76 |  */
77 | void Filter::map(void* tuple, Page* out, Schema& schema) 
78 | {
79 | 	if (comparator.eval(tuple, &value))
80 | 	{
81 | 		void* dest = out->allocateTuple();
82 | 		dbgassert(out->isValidTupleAddress(dest));
83 | 		schema.copyTuple(dest, tuple);
84 | 	}
85 | }
86 | 


--------------------------------------------------------------------------------
/operators/hdf5random.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2013, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "operators.h"
36 | #include "operators_priv.h"
37 | 
38 | #include "../util/numaallocate.h"
39 | #include "../util/numaasserts.h"
40 | #include "../util/reentrant_random.h"
41 | 
42 | void RandomLookupsHdf5Op::init(libconfig::Config& root, libconfig::Setting& cfg)
43 | {
44 | 	ScanHdf5Op::init(root, cfg);
45 | 
46 | 	assert(totalpartitions == 1);
47 | 	assert(thispartition == 0);
48 | 
49 | 	hdf5length = totaltuples;
50 | 	totaltuples = 0;
51 | 
52 | 	randomlookups = (unsigned long) cfg["randomlookups"];
53 | }
54 | 
55 | Operator::ResultCode RandomLookupsHdf5Op::scanStart(unsigned short threadid,
56 | 		Page* indexdata, Schema& indexdataschema)
57 | {
58 | 	dbgCheckSingleThreaded(threadid);
59 | 
60 | 	// Reset memspace that may have shrunk from last index lookup.
61 | 	// 
62 | 	sizeintup = buffsize/schema.getTupleSize();
63 | 	hsize_t zero = 0;
64 | 	H5Sselect_hyperslab(memspace, H5S_SELECT_SET, &zero, NULL, &sizeintup, NULL);
65 | 
66 | 	// Generate random ids.
67 | 	//
68 | 	ReentrantRandom rndgen;
69 | 	rndgen.init(0);
70 | 	rowstoaccess.reserve(randomlookups);
71 | 	for (unsigned int i=0; i
39 | using std::string;
40 | 
41 | #include "table.h"
42 | 
43 | class Loader {
44 | 	public:
45 | 		Loader(const string& separators);
46 | 
47 | 		void load(const string& filename, PreloadedTextTable& output, bool verbose);
48 | 
49 | 	private:
50 | 		bool isBz2(const string& filename);
51 | 
52 | 		char* readFullLine(char* cur, const char* bufstart, const int buflen);
53 | 
54 | 		/** Column separating character. */
55 | 		const string sep;
56 | 
57 | 	public:
58 | 		/** Maximum characters in line. */
59 | 		static const unsigned int MAX_LINE = 1024;
60 | 
61 | 		/** Maximum columns in line. */
62 | 		static const unsigned int MAX_COL = 64;
63 | 
64 | };
65 | 
66 | #endif
67 | 


--------------------------------------------------------------------------------
/operators/loaders/parser.cpp:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * Copyright 2009, Pythia authors (see AUTHORS file).
  3 |  * All rights reserved.
  4 |  * 
  5 |  * Redistribution and use in source and binary forms, with or without
  6 |  * modification, are permitted provided that the following conditions
  7 |  * are met:
  8 |  * 
  9 |  * 1. Redistributions of source code must retain the above copyright
 10 |  * notice, this list of conditions and the following disclaimer.
 11 |  * 
 12 |  * 2. Redistributions in binary form must reproduce the above copyright
 13 |  * notice, this list of conditions and the following disclaimer in the
 14 |  * documentation and/or other materials provided with the distribution.
 15 |  * 
 16 |  * 3. Neither the name of the copyright holder nor the names of its
 17 |  * contributors may be used to endorse or promote products derived from
 18 |  * this software without specific prior written permission.
 19 |  * 
 20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 31 |  * POSSIBILITY OF SUCH DAMAGE.
 32 |  */
 33 | 
 34 | #include "parser.h"
 35 | 
 36 | #include "../../util/custom_asserts.h"
 37 | 
 38 | /**
 39 |  * Returns true if character \a c exists in \a str.
 40 |  */
 41 | inline bool notExistsIn(const char c, const string& str)
 42 | {
 43 | 	return str.find(c) == string::npos;
 44 | }
 45 | 
 46 | Parser::Parser (const string& separator)
 47 | 	: _sep(separator) 
 48 | { 
 49 | 	dbg2assert(notExistsIn('\0', _sep));
 50 | }
 51 | 
 52 | unsigned short Parser::parseLine(char* line, const char** result, const short maxfields) 
 53 | {
 54 | 	char* s=line; /**< Points to beginning of token. */
 55 | 	char* p=line; /**< Points to end of token. */
 56 | 	unsigned short ret = 0;
 57 | 
 58 | 	while (*s) 
 59 | 	{
 60 | 		// While not separator or end-of-line, advance end-of-token pointer.
 61 | 		while (notExistsIn(*p, _sep) && *p)
 62 | 		{	
 63 | 			p++;
 64 | 		}
 65 | 
 66 | 		// If an empty field, skip over it.
 67 | 		//
 68 | 		if (s!=p)
 69 | 		{
 70 | 			// If there's space in result array, store start of token in result.
 71 | 			//
 72 | 			if (ret < maxfields)
 73 | 			{
 74 | 				result[ret++]=s;
 75 | 			}
 76 | 			// Otherwise return, there's no more space in the output array.
 77 | 			//
 78 | 			else
 79 | 			{
 80 | 				break;
 81 | 			}
 82 | 		}
 83 | 
 84 | 		// If stopped because of separator, replace it with \0, so that output
 85 | 		// array contains null-terminated strings.
 86 | 		//
 87 | 		if (*p)
 88 | 		{	
 89 | 			(*p)=0;
 90 | 			s=++p;
 91 | 		}
 92 | 		// Otherwise return, we stopped because of end of string.
 93 | 		// (Normal loop exit point.)
 94 | 		//
 95 | 		else
 96 | 		{
 97 | 			break;
 98 | 		}
 99 | 	}
100 | 
101 | 	dbg2assert(ret <= maxfields);
102 | 	return ret;
103 | }
104 | 


--------------------------------------------------------------------------------
/operators/loaders/parser.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2007, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #ifndef __MYPARSER__
35 | #define __MYPARSER__
36 | 
37 | #include 
38 | using std::string;
39 | 
40 | /**
41 |  * Parses text input into binary data.
42 |  */
43 | class Parser {
44 | 	public:
45 | 		Parser (const string& separator);
46 | 
47 | 		/** 
48 | 		 * Returns the offsets of all data contained in this \a line in 
49 | 		 * variable \a result. Will read until it encounters a \\0 in \a line,
50 | 		 * or until \a maxfields answers have been written in the \a result
51 | 		 * array.
52 | 		 * @return The number of valid entries in \a result. Guaranteed to be
53 | 		 * less or equal to maxfields.
54 | 		 */
55 | 		unsigned short parseLine(char* line, const char** result, const short maxfields);
56 | 	private:
57 | 		const string _sep;
58 | };
59 | 
60 | #endif
61 | 


--------------------------------------------------------------------------------
/operators/loaders/sfmt/SFMT-params.h:
--------------------------------------------------------------------------------
 1 | #ifndef SFMT_PARAMS_H
 2 | #define SFMT_PARAMS_H
 3 | 
 4 | #if !defined(MEXP)
 5 | #ifdef __GNUC__
 6 |   #warning "MEXP is not defined. I assume MEXP is 19937."
 7 | #endif
 8 |   #define MEXP 19937
 9 | #endif
10 | /*-----------------
11 |   BASIC DEFINITIONS
12 |   -----------------*/
13 | /** Mersenne Exponent. The period of the sequence 
14 |  *  is a multiple of 2^MEXP-1.
15 |  * #define MEXP 19937 */
16 | /** SFMT generator has an internal state array of 128-bit integers,
17 |  * and N is its size. */
18 | #define N (MEXP / 128 + 1)
19 | /** N32 is the size of internal state array when regarded as an array
20 |  * of 32-bit integers.*/
21 | #define N32 (N * 4)
22 | /** N64 is the size of internal state array when regarded as an array
23 |  * of 64-bit integers.*/
24 | #define N64 (N * 2)
25 | 
26 | /*----------------------
27 |   the parameters of SFMT
28 |   following definitions are in paramsXXXX.h file.
29 |   ----------------------*/
30 | /** the pick up position of the array.
31 | #define POS1 122 
32 | */
33 | 
34 | /** the parameter of shift left as four 32-bit registers.
35 | #define SL1 18
36 |  */
37 | 
38 | /** the parameter of shift left as one 128-bit register. 
39 |  * The 128-bit integer is shifted by (SL2 * 8) bits. 
40 | #define SL2 1 
41 | */
42 | 
43 | /** the parameter of shift right as four 32-bit registers.
44 | #define SR1 11
45 | */
46 | 
47 | /** the parameter of shift right as one 128-bit register. 
48 |  * The 128-bit integer is shifted by (SL2 * 8) bits. 
49 | #define SR2 1 
50 | */
51 | 
52 | /** A bitmask, used in the recursion.  These parameters are introduced
53 |  * to break symmetry of SIMD.
54 | #define MSK1 0xdfffffefU
55 | #define MSK2 0xddfecb7fU
56 | #define MSK3 0xbffaffffU
57 | #define MSK4 0xbffffff6U 
58 | */
59 | 
60 | /** These definitions are part of a 128-bit period certification vector.
61 | #define PARITY1	0x00000001U
62 | #define PARITY2	0x00000000U
63 | #define PARITY3	0x00000000U
64 | #define PARITY4	0xc98e126aU
65 | */
66 | 
67 | #if MEXP == 607
68 |   #include "SFMT-params607.h"
69 | #elif MEXP == 1279
70 |   #include "SFMT-params1279.h"
71 | #elif MEXP == 2281
72 |   #include "SFMT-params2281.h"
73 | #elif MEXP == 4253
74 |   #include "SFMT-params4253.h"
75 | #elif MEXP == 11213
76 |   #include "SFMT-params11213.h"
77 | #elif MEXP == 19937
78 |   #include "SFMT-params19937.h"
79 | #elif MEXP == 44497
80 |   #include "SFMT-params44497.h"
81 | #elif MEXP == 86243
82 |   #include "SFMT-params86243.h"
83 | #elif MEXP == 132049
84 |   #include "SFMT-params132049.h"
85 | #elif MEXP == 216091
86 |   #include "SFMT-params216091.h"
87 | #else
88 | #ifdef __GNUC__
89 |   #error "MEXP is not valid."
90 |   #undef MEXP
91 | #else
92 |   #undef MEXP
93 | #endif
94 | 
95 | #endif
96 | 
97 | #endif /* SFMT_PARAMS_H */
98 | 


--------------------------------------------------------------------------------
/operators/loaders/sfmt/SFMT-params19937.h:
--------------------------------------------------------------------------------
 1 | #ifndef SFMT_PARAMS19937_H
 2 | #define SFMT_PARAMS19937_H
 3 | 
 4 | #define POS1	122
 5 | #define SL1	18
 6 | #define SL2	1
 7 | #define SR1	11
 8 | #define SR2	1
 9 | #define MSK1	0xdfffffefU
10 | #define MSK2	0xddfecb7fU
11 | #define MSK3	0xbffaffffU
12 | #define MSK4	0xbffffff6U
13 | #define PARITY1	0x00000001U
14 | #define PARITY2	0x00000000U
15 | #define PARITY3	0x00000000U
16 | #define PARITY4	0x13c9e684U
17 | 
18 | 
19 | /* PARAMETERS FOR ALTIVEC */
20 | #if defined(__APPLE__)	/* For OSX */
21 |     #define ALTI_SL1	(vector unsigned int)(SL1, SL1, SL1, SL1)
22 |     #define ALTI_SR1	(vector unsigned int)(SR1, SR1, SR1, SR1)
23 |     #define ALTI_MSK	(vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
24 |     #define ALTI_MSK64 \
25 | 	(vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
26 |     #define ALTI_SL2_PERM \
27 | 	(vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
28 |     #define ALTI_SL2_PERM64 \
29 | 	(vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
30 |     #define ALTI_SR2_PERM \
31 | 	(vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
32 |     #define ALTI_SR2_PERM64 \
33 | 	(vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
34 | #else	/* For OTHER OSs(Linux?) */
35 |     #define ALTI_SL1	{SL1, SL1, SL1, SL1}
36 |     #define ALTI_SR1	{SR1, SR1, SR1, SR1}
37 |     #define ALTI_MSK	{MSK1, MSK2, MSK3, MSK4}
38 |     #define ALTI_MSK64	{MSK2, MSK1, MSK4, MSK3}
39 |     #define ALTI_SL2_PERM	{1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
40 |     #define ALTI_SL2_PERM64	{1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
41 |     #define ALTI_SR2_PERM	{7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
42 |     #define ALTI_SR2_PERM64	{15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
43 | #endif	/* For OSX */
44 | #define IDSTR	"SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
45 | 
46 | #endif /* SFMT_PARAMS19937_H */
47 | 


--------------------------------------------------------------------------------
/operators/operators_priv.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2014, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | static Operator::Page EmptyPage(static_cast(0), 0, static_cast(0), 0);
35 | 


--------------------------------------------------------------------------------
/operators/printer_tuplecount.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "operators.h"
36 | #include "operators_priv.h"
37 | 
38 | void TupleCountPrinter::init(libconfig::Config& root, libconfig::Setting& node)
39 | {
40 | 	SingleInputOp::init(root, node);
41 | 	schema = nextOp->getOutSchema();
42 | 
43 | 	for (int i=0; igetNext(threadid);
52 | 
53 | 	if (res.first != Operator::Error)
54 | 	{
55 | 		unsigned int count = 0;
56 | 		dbgassert(res.second != NULL);
57 | 		dbgassert(threadid < tuples.size());
58 | 
59 | 		Page::Iterator it = res.second->createIterator();
60 | 		while (it.next())
61 | 			++count;
62 | 
63 | 		tuples[threadid] += count;
64 | 	}
65 | 
66 | 	return res;
67 | }
68 | 


--------------------------------------------------------------------------------
/perfcounters.h:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #ifdef __sparc__
36 | #include 
37 | #endif
38 | 
39 | class PerfCounters {
40 | 	public:
41 | 		void init();
42 | 		void threadinit();
43 | 		void destroy();
44 | 
45 | 		inline void writeCounters(unsigned long long* counter1, unsigned long long* counter2)
46 | 		{
47 | #ifdef PERFCOUNT
48 | #if defined(__i386__) || defined(__x86_64__)
49 | 			*counter1 = readpmc(0);
50 | 			*counter2 = readpmc(1);
51 | #elif defined(__sparc__)
52 | 			unsigned long long val;
53 | 			__asm__ __volatile__ (
54 | 					"rd %%pic, %0"
55 | 					: "=r" (val) /* output */
56 | 					);
57 | 			*counter1 = val >> 32;
58 | 			*counter2 = val & 0xFFFFFFFFull;
59 | #else
60 | #error Performance counters not known for this architecture.
61 | #endif
62 | #endif
63 | 		}
64 | 
65 | 	private:
66 | #if defined(__i386__) || defined(__x86_64__)
67 | 		inline unsigned long long readpmc(unsigned int counterid) {
68 | 			unsigned long hi, lo;
69 | 			__asm__ __volatile__ ("rdpmc"        \
70 | 					: "=d" (hi), "=a" (lo)  \
71 | 					: "c" (counterid)       \
72 | 					);
73 | 			return (((unsigned long long) hi) << 32) | lo;
74 | 		}
75 | 
76 | #elif defined(__sparc__)
77 | 		cpc_t* cpc;
78 | 
79 | #endif
80 | 
81 | };
82 | 


--------------------------------------------------------------------------------
/pre-init.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/bash
 2 | 
 3 | . system.inc
 4 | 
 5 | tar Jxf externals/hdf5-1.8.11.tar.xz
 6 | cd hdf5-1.8.11
 7 | ./configure --prefix $PWD/../dist CFLAGS="$SYSFLAGS -O3" --enable-production
 8 | make -j4 install
 9 | make distclean
10 | cd ..
11 | rm -rf hdf5-1.8.11
12 | 
13 | cd externals/libconfig-1.2/
14 | ./configure --prefix $PWD/../../dist CFLAGS="$SYSFLAGS -O3" CXXFLAGS="$SYSFLAGS -O3"
15 | make -j4 install
16 | make distclean
17 | cd ../../
18 | 
19 | cd externals/bzip2-1.0.5/
20 | make -j4 install PREFIX=$PWD/../../dist CFLAGS="$SYSFLAGS -O3"
21 | make clean
22 | cd ../../
23 | 
24 | #cd externals/fastbit-current/
25 | #./configure --prefix $PWD/../../dist CFLAGS="$SYSFLAGS -O3" CXXFLAGS="$SYSFLAGS -O3"
26 | #make -j4 install
27 | #make distclean
28 | #cd ../../
29 | 


--------------------------------------------------------------------------------
/rdtsc.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2007, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 | 
38 | #if !defined(__i386__) && !defined(__x86_64__) && !defined(__sparc__)
39 | #warning No supported architecture found -- timers will return junk.
40 | #endif
41 | 
42 | static __inline__ unsigned long long curtick() {
43 | 	unsigned long long tick;
44 | #if defined(__i386__)
45 | 	unsigned long lo, hi;
46 | 	__asm__ __volatile__ (".byte 0x0f, 0x31" : "=a" (lo), "=d" (hi));
47 | 	tick = (unsigned long long) hi << 32 | lo;
48 | #elif defined(__x86_64__)
49 | 	unsigned long lo, hi;
50 | 	__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
51 | 	tick = (unsigned long long) hi << 32 | lo;
52 | #elif defined(__sparc__)
53 | 	__asm__ __volatile__ ("rd %%tick, %0" : "=r" (tick));
54 | #endif
55 | 	return tick;
56 | }
57 | 
58 | static __inline__ void startTimer(unsigned long long* t) {
59 | 	*(volatile unsigned long long*)t = curtick();
60 | }
61 | 
62 | static __inline__ void stopTimer(unsigned long long* t) {
63 | 	*(volatile unsigned long long*)t = curtick() - *(volatile unsigned long long*)t;
64 | }
65 | 
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 | 


--------------------------------------------------------------------------------
/system.inc:
--------------------------------------------------------------------------------
 1 | CXX=g++
 2 | CXXFLAGS+=-m64
 3 | 
 4 | ###########################################################
 5 | # Controls sanity-checking level. Enable for debug builds. 
 6 | # DEBUG2 triggers severe performance penalties.
 7 | #
 8 | #CPPFLAGS+=-DDEBUG -DDEBUG2
 9 | 
10 | ###########################################################
11 | # Controls whether to collect and display memory allocation
12 | # statistics.
13 | #
14 | CPPFLAGS+=-DSTATS_ALLOCATE
15 | 
16 | ###########################################################
17 | # Compile with NUMΑ-awareness extensions?
18 | #
19 | #CPPFLAGS+=-DENABLE_NUMA
20 | 
21 | ###########################################################
22 | # Enables bitonic sort. This is an experimental feature. 
23 | # The algorithm that has been implemented is data-size and 
24 | # data-width specific and not generally usable. Bitonic 
25 | # sort needs SSE 4.2 support from the CPU.
26 | #
27 | #CPPFLAGS+=-DBITONIC_SORT
28 | 
29 | ###########################################################
30 | # Controls compiling of HDF5-specific operators
31 | #
32 | CPPFLAGS+=-DENABLE_HDF5
33 | 
34 | ###########################################################
35 | # FastBit source code is not included
36 | # As of Jan 2014, Pythia v0.1 uses pre-release functionality
37 | #
38 | #CPPFLAGS+=-DENABLE_FASTBIT
39 | 


--------------------------------------------------------------------------------
/unit_tests/common.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2014, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | #include 
34 | #include 
35 | #include 
36 | #include 
37 | #include 
38 | #include 
39 | 
40 | #include 
41 | 
42 | class TestFailException { };
43 | 
44 | void fail(const char* explanation) {
45 | 	std::cout << " ** Test FAILED: " << explanation << std::endl;
46 | 	throw TestFailException();
47 | }
48 | 
49 | void assertmsg(bool cond, const char* explanation)
50 | {
51 | 	if (!cond)
52 | 		fail(explanation);
53 | }
54 | 
55 | void createfile(const char* filename, const unsigned int maxnum)
56 | {
57 | 	std::ofstream of(filename);
58 | 	for (unsigned int i=1; i<(maxnum+1); ++i)
59 | 	{
60 | 		of << i << "|" << i << std::endl;
61 | 	}
62 | 	of.close();
63 | }
64 | 
65 | void deletefile(const char* filename)
66 | {
67 | 	remove(filename);
68 | }
69 | 


--------------------------------------------------------------------------------
/unit_tests/data/identity.tbl:
--------------------------------------------------------------------------------
 1 | 1|1
 2 | 2|2
 3 | 3|3
 4 | 4|4
 5 | 5|5
 6 | 6|6
 7 | 7|7
 8 | 8|8
 9 | 9|9
10 | 10|10
11 | 11|11
12 | 12|12
13 | 13|13
14 | 14|14
15 | 15|15
16 | 16|16
17 | 17|17
18 | 18|18
19 | 19|19
20 | 20|20
21 | 


--------------------------------------------------------------------------------
/unit_tests/data/ptf_small.h5.ls.xz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptf_small.h5.ls.xz


--------------------------------------------------------------------------------
/unit_tests/data/ptf_small.h5.xz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptf_small.h5.xz


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/ascii2int.cpp:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2014, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #include 
35 | #include 
36 | #include 
37 | #include 
38 | #include 
39 | #include 
40 | using namespace std;
41 | 
42 | int main()
43 | {
44 | 	vector data;
45 | 	int temp;
46 | 
47 | 	// Read data.
48 | 	//
49 | 	ifstream filein("id.ascii");
50 | 
51 | 	filein >> temp;
52 | 	while (filein)
53 | 	{
54 | 		data.push_back(temp);
55 | 		filein >> temp;
56 | 	}
57 | 	filein.close();
58 | 
59 | 	assert(data.size() == 999);
60 | 
61 | 	// Output data.
62 | 	//
63 | 	ofstream fileout("candidate/id");
64 | 	fileout.write(reinterpret_cast(&data[0]), sizeof(int)*data.size());
65 | 	fileout.close();
66 | 
67 | 	// Output metadata.
68 | 	//
69 | 	ofstream meta("candidate/-part.txt");
70 | 	meta << "BEGIN HEADER" << endl;
71 | 	meta << "DataSet.Name = \"candidate\""<< endl;
72 | 	meta << "DataSet.Description = \"Generated by hand.\"" << endl;
73 | 	meta << "Number_of_columns = 1" << endl;
74 | 	meta << "Number_of_rows = " << data.size() << endl;
75 | 	meta << "Timestamp = " << static_cast(time(0)) << endl;
76 | 	meta << "END HEADER" << endl;
77 | 	meta << endl;
78 | 	meta << "Begin Column" << endl;
79 | 	meta << "name = \"id\"" << endl;
80 | 	meta << "data_type = \"int\"" << endl;
81 | 	meta << "minimum = " << *min_element(data.begin(), data.end()) << endl;
82 | 	meta << "maximum = " << *max_element(data.begin(), data.end()) << endl;
83 | 	meta << "End Column" << endl;
84 | 	meta.close();
85 | 
86 | 	return 0;
87 | }
88 | 


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/buildfastbitindex.sh:
--------------------------------------------------------------------------------
 1 | #!/bin/bash
 2 | #
 3 | # Indexing first column in candidate.first3proj as candidate/id
 4 | 
 5 | mkdir -p candidate
 6 | cut -f1 candidate.first3proj > id.ascii
 7 | g++ ascii2int.cpp -o ascii2int
 8 | ./ascii2int
 9 | rm -f ascii2int
10 | rm -f id.ascii
11 | ../../../dist/bin/ibis -d candidate -s id
12 | ../../../dist/bin/ibis -d candidate -b "" 
13 | 


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/candidate.csv.xz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/candidate.csv.xz


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/candidate/-part.txt:
--------------------------------------------------------------------------------
 1 | # metadata file written by ibis::part::writeMetaData
 2 | # on Thu Nov 21 15:27:58 2013
 3 | 
 4 | BEGIN HEADER
 5 | Name = "candidate"
 6 | Description = "Generated by hand."
 7 | Number_of_columns = 1
 8 | Number_of_rows = 999
 9 | Timestamp = 1385076478
10 | State = 1
11 | index = 
12 | END HEADER
13 | 
14 | Begin Column
15 | name = "id"
16 | data_type = "INT"
17 | minimum = 309
18 | maximum = 2242018
19 | End Column
20 | 


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/candidate/id:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/candidate/id


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/candidate/id.idx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/candidate/id.idx


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/candidate/id.ind:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/candidate/id.ind


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/candidate/id.srt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/candidate/id.srt


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/indexedhashjoin/keys:
--------------------------------------------------------------------------------
  1 | 1032163
  2 | 1034717
  3 | 1030220
  4 | 1029639
  5 | 1027038
  6 | 1032893
  7 | 1034640
  8 | 1033250
  9 | 1028344
 10 | 1030092
 11 | 1298074
 12 | 1033006
 13 | 2242017
 14 | 1033751
 15 | 1031298
 16 | 1033086
 17 | 1029120
 18 | 1034847
 19 | 1027321
 20 | 1027469
 21 | 1033059
 22 | 1091
 23 | 1027803
 24 | 1026975
 25 | 1027044
 26 | 1034310
 27 | 1027181
 28 | 1027043
 29 | 1030981
 30 | 957
 31 | 1035302
 32 | 1034329
 33 | 1027022
 34 | 1030821
 35 | 1033186
 36 | 1027766
 37 | 1035212
 38 | 1034321
 39 | 1298070
 40 | 1032601
 41 | 1030688
 42 | 1032892
 43 | 1034584
 44 | 1028941
 45 | 1033752
 46 | 1028413
 47 | 1035020
 48 | 1031727
 49 | 1031998
 50 | 1298148
 51 | 1033062
 52 | 1029312
 53 | 1034326
 54 | 1028753
 55 | 1028849
 56 | 1033065
 57 | 1033041
 58 | 955
 59 | 1035079
 60 | 1026987
 61 | 1030412
 62 | 1032782
 63 | 1033097
 64 | 1028408
 65 | 1028472
 66 | 1030156
 67 | 1029900
 68 | 1032750
 69 | 2242004
 70 | 1027050
 71 | 1031870
 72 | 1033614
 73 | 1027307
 74 | 1032425
 75 | 1032521
 76 | 1027053
 77 | 1034453
 78 | 1033048
 79 | 1034585
 80 | 1030055
 81 | 1028923
 82 | 1298072
 83 | 1032590
 84 | 1030407
 85 | 1026965
 86 | 1034704
 87 | 1035244
 88 | 1034308
 89 | 1027734
 90 | 1032334
 91 | 1029479
 92 | 1033459
 93 | 1030533
 94 | 1033683
 95 | 1027068
 96 | 1033245
 97 | 1029280
 98 | 1033905
 99 | 1032035
100 | 1026963
101 | 


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/indexedhashjoin/payload:
--------------------------------------------------------------------------------
  1 | 3573	705
  2 | 3579	481
  3 | 3569	573
  4 | 3568	653
  5 | 3563	122
  6 | 3575	2048
  7 | 3579	361
  8 | 3576	469
  9 | 3565	1224
 10 | 3569	92
 11 | 4404	500
 12 | 3576	51
 13 | 6737	1305
 14 | 3577	1336
 15 | 3571	1678
 16 | 3576	202
 17 | 3567	453
 18 | 3579	675
 19 | 3563	1280
 20 | 3563	1923
 21 | 3576	152
 22 | 3	745
 23 | 3564	540
 24 | 3562	1993
 25 | 3563	177
 26 | 3578	1718
 27 | 3563	711
 28 | 3563	171
 29 | 3570	716
 30 | 3	371
 31 | 3580	1562
 32 | 3578	1797
 33 | 3563	15
 34 | 3570	468
 35 | 3576	360
 36 | 3564	468
 37 | 3580	1277
 38 | 3578	1772
 39 | 4404	467
 40 | 3575	93
 41 | 3570	294
 42 | 3575	2041
 43 | 3579	268
 44 | 3567	108
 45 | 3577	1349
 46 | 3565	1449
 47 | 3580	450
 48 | 3572	2045
 49 | 3573	446
 50 | 4404	850
 51 | 3576	156
 52 | 3567	785
 53 | 3578	1789
 54 | 3566	1060
 55 | 3566	1615
 56 | 3576	161
 57 | 3576	115
 58 | 3	369
 59 | 3580	708
 60 | 3562	2034
 61 | 3569	1419
 62 | 3575	1225
 63 | 3576	221
 64 | 3565	1441
 65 | 3565	1669
 66 | 3569	295
 67 | 3568	1489
 68 | 3575	981
 69 | 6737	1278
 70 | 3563	205
 71 | 3573	213
 72 | 3577	754
 73 | 3563	1192
 74 | 3574	821
 75 | 3574	1776
 76 | 3563	213
 77 | 3579	80
 78 | 3576	135
 79 | 3579	272
 80 | 3569	13
 81 | 3567	78
 82 | 4404	491
 83 | 3575	44
 84 | 3569	1397
 85 | 3562	1968
 86 | 3579	456
 87 | 3580	1373
 88 | 3578	1714
 89 | 3564	409
 90 | 3574	19
 91 | 3568	32
 92 | 3577	117
 93 | 3570	57
 94 | 3577	1043
 95 | 3563	282
 96 | 3576	462
 97 | 3567	725
 98 | 3578	24
 99 | 3573	505
100 | 3562	1956
101 | 


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/rb_classifier.csv.xz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/rb_classifier.csv.xz


--------------------------------------------------------------------------------
/unit_tests/data/ptfascii/subtraction.csv.xz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/data/ptfascii/subtraction.csv.xz


--------------------------------------------------------------------------------
/unit_tests/data/toascii.tbl:
--------------------------------------------------------------------------------
 1 | 1|A
 2 | 2|B
 3 | 3|C
 4 | 4|D
 5 | 5|E
 6 | 6|F
 7 | 7|G
 8 | 8|H
 9 | 9|I
10 | 10|J
11 | 11|K
12 | 12|L
13 | 13|M
14 | 14|N
15 | 15|O
16 | 16|P
17 | 17|Q
18 | 18|R
19 | 19|S
20 | 20|T
21 | 


--------------------------------------------------------------------------------
/unit_tests/data/todouble.tbl:
--------------------------------------------------------------------------------
 1 | 1|1.1
 2 | 2|2.1
 3 | 3|3.1
 4 | 4|4.1
 5 | 5|5.1
 6 | 6|6.1
 7 | 7|7.1
 8 | 8|8.1
 9 | 9|9.1
10 | 10|10.1
11 | 11|11.1
12 | 12|12.1
13 | 13|13.1
14 | 14|14.1
15 | 15|15.1
16 | 16|16.1
17 | 17|17.1
18 | 18|18.1
19 | 19|19.1
20 | 20|20.1
21 | 


--------------------------------------------------------------------------------
/unit_tests/loadertest/test.tbl:
--------------------------------------------------------------------------------
 1 | 1|1
 2 | 2|2
 3 | 3|3
 4 | 4|4
 5 | 5|5
 6 | 6|6
 7 | 7|7
 8 | 8|8
 9 | 9|9
10 | 10|10
11 | 11|11
12 | 12|12
13 | 13|13
14 | 14|14
15 | 15|15
16 | 16|16
17 | 17|17
18 | 18|18
19 | 19|19
20 | 20|20
21 | 


--------------------------------------------------------------------------------
/unit_tests/loadertest/test.tbl.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sblanas/pythia/b138eaa0fd5917cb4665094b963abe458bd33d0f/unit_tests/loadertest/test.tbl.bz2


--------------------------------------------------------------------------------
/unit_tests/testcomparator.cpp:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2014, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #include "../schema.h"
35 | #include "../comparator.h"
36 | 
37 | int main() {
38 | 	char tup1a[16];
39 | 	char tup1b[16];
40 | 	char tup2 [16];
41 | 
42 | 	int idummy = 0;
43 | 	int ival1 = 4;
44 | 	int ival2 = 5;
45 | 	double dval = 4.5;
46 | 
47 | 	Schema s1;
48 | 	s1.add(CT_INTEGER);
49 | 	s1.add(CT_INTEGER);
50 | 
51 | 	s1.writeData(tup1a, 0, &idummy);
52 | 	s1.writeData(tup1a, 1, &ival1);
53 | 	s1.writeData(tup1b, 0, &idummy);
54 | 	s1.writeData(tup1b, 1, &ival2);
55 | 
56 | 	Schema s2;
57 | 	s2.add(CT_DECIMAL);
58 | 
59 | 	s2.writeData(tup2, 0, &dval);
60 | 
61 | 	Comparator comp1 = Schema::createComparator(s1, 1, s2, 0, Comparator::Less);
62 | 	Comparator comp2 = Schema::createComparator(s1, 1, s2, 0, Comparator::Greater);
63 | 
64 | 	assert(comp1.eval(tup1a, tup2));
65 | 	assert(comp2.eval(tup1b, tup2));
66 | }
67 | 


--------------------------------------------------------------------------------
/unit_tests/testfastbit.cpp:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * Copyright 2013, Pythia authors (see AUTHORS file).
  3 |  * All rights reserved.
  4 |  * 
  5 |  * Redistribution and use in source and binary forms, with or without
  6 |  * modification, are permitted provided that the following conditions
  7 |  * are met:
  8 |  * 
  9 |  * 1. Redistributions of source code must retain the above copyright
 10 |  * notice, this list of conditions and the following disclaimer.
 11 |  * 
 12 |  * 2. Redistributions in binary form must reproduce the above copyright
 13 |  * notice, this list of conditions and the following disclaimer in the
 14 |  * documentation and/or other materials provided with the distribution.
 15 |  * 
 16 |  * 3. Neither the name of the copyright holder nor the names of its
 17 |  * contributors may be used to endorse or promote products derived from
 18 |  * this software without specific prior written permission.
 19 |  * 
 20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 31 |  * POSSIBILITY OF SUCH DAMAGE.
 32 |  */
 33 | 
 34 | #include 
 35 | #include 
 36 | #include 
 37 | #include 
 38 | using namespace std;
 39 | 
 40 | #include "ibis.h"
 41 | 
 42 | static const char* nullstr = 0;
 43 | 
 44 | const char* DIRECTORY = "unit_tests/data/ptfascii/candidate/";
 45 | const char* DATASET = "id";
 46 | const char* CORRECT = "unit_tests/data/ptfascii/candidate.first3proj";
 47 | 
 48 | int test()
 49 | {
 50 | 	vector correctidxpos;
 51 | 	vector valuespicked;
 52 | 	vector output;
 53 | 
 54 | 	// Scan over CORRECT, and pick lines at random for querying.
 55 | 	// For each line picked, remember line number to compare with index offset.
 56 | 	//
 57 | 	ifstream correct(CORRECT);
 58 | 	int a, b, c;
 59 | 	int line = 0;
 60 | 	correct >> a >> b >> c;
 61 | 	while(correct)
 62 | 	{
 63 | 		if ((lrand48() & 0x3) == 0)
 64 | 		{
 65 | 			valuespicked.push_back(a);
 66 | 			correctidxpos.push_back(line);
 67 | 		}
 68 | 		++line;
 69 | 		correct >> a >> b >> c;
 70 | 	}
 71 | 	correct.close();
 72 | 
 73 | 	// Lookup all values in valuespicked array.
 74 | 	//
 75 | 	ibis::part part(DIRECTORY, nullstr);
 76 | 	ibis::query query(ibis::util::userName(), &part);
 77 | 	ibis::qDiscreteRange where = ibis::qDiscreteRange(DATASET, valuespicked);
 78 | 	query.setWhereClause(&where);
 79 | 
 80 | 	int ret = query.evaluate();
 81 | 	assert(ret > 0);
 82 | 
 83 | 	query.getHitRows(output);
 84 | 
 85 | 	// Make sure output and correctidxpos are the same.
 86 | 	// No need to sort correctidxpos, as we generated it in sorted order.
 87 | 	//
 88 | 	assert(output.size() == correctidxpos.size());
 89 | 	sort(output.begin(), output.end());
 90 | 	for (unsigned int i=0; i
36 | using namespace std;
37 | 
38 | #include "common.h"
39 | 
40 | #include "../operators/loaders/loader.h"
41 | #include "../operators/loaders/table.h"
42 | #include "../schema.h"
43 | 
44 | // #define VERBOSE
45 | 
46 | #ifdef VERBOSE
47 | string formatout(const vector& str) {
48 | 	string ret = "|";
49 | 	for (vector::const_iterator it=str.begin(); it!=str.end(); ++it)
50 | 		ret += *it + '|';
51 | 	return ret;
52 | }
53 | #endif
54 | 
55 | int work(const char* filename)
56 | {
57 | 	Schema s;
58 | 	s.add(CT_INTEGER);
59 | 	s.add(CT_INTEGER);
60 | 
61 | 	PreloadedTextTable out;
62 | 	out.init(&s, 1024);
63 | 
64 | 	Loader l("|");
65 | 	l.load(filename, out, false);
66 | 
67 | 	TupleBuffer* b;
68 | 	void* tuple;
69 | 
70 | 	while ( (b = out.readNext()) ) 
71 | 	{
72 | 		int i = 0;
73 | 		while( (tuple = b->getTupleOffset(i++)) ) 
74 | 		{
75 | #ifdef VERBOSE
76 | 			cout << formatout(out.schema()->outputTuple(tuple)) << endl;
77 | #endif
78 | 			if (s.asInt(tuple, 0) != i)
79 | 				fail("First value in tuple is wrong.");
80 | 			if (s.asInt(tuple, 1) != i)
81 | 				fail("Second value in tuple is wrong.");
82 | 		}
83 | 	}
84 | 
85 | 	return 0;
86 | }
87 | 
88 | int main()
89 | {
90 | 	work("unit_tests/loadertest/test.tbl");
91 | 	work("unit_tests/loadertest/test.tbl.bz2");
92 | 	return 0;
93 | }
94 | 


--------------------------------------------------------------------------------
/util/affinitizer.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 | */
33 | 
34 | #ifndef __MYAFFINITIZER__
35 | #define __MYAFFINITIZER__
36 | 
37 | #include 
38 | using std::vector;
39 | #include "libconfig.h++"
40 | 
41 | /**
42 |  * Affinitizes each caller of affinitize() to a particular logical processor,
43 |  * as specified by the configuration parameter \a affinitize. The operator strives
44 |  * to be topology-aware, transparently converting higher level abstractions
45 |  * like NUMA node and socket into logical processor IDs. It is an error to
46 |  * leave threads unbound and call affinitize().
47 |  *
48 |  * A binding is four numbers, each denoting the numa, socket, core and context.
49 |  *
50 |  * binding := [ , , ,  ] 
51 |  *
52 |  *
53 |  * A thread-spec specifies which thread will be affinitized according to this
54 |  * binding.
55 |  *
56 |  * threadspec := { threadid = , bindto =  }
57 |  *
58 |  *
59 |  * The mapping parameter is simply an array of thread-specs.
60 |  *
61 |  * affinitize := [ , , ... ]
62 |  *
63 |  */
64 | class Affinitizer
65 | {
66 | 	public:
67 | 		void init(libconfig::Setting& node);
68 | 
69 | 		void affinitize(unsigned short threadid);
70 | 
71 | 		/** 
72 | 		 * Mapping from (numa,socket,core) -> logical cpu id.
73 | 		 */
74 | 		typedef vector > > > TopologyT;
75 | 
76 | 		struct Binding
77 | 		{
78 | 			static const unsigned short InvalidBinding = (unsigned short) -1;
79 | 
80 | 			Binding()
81 | 				: numa(InvalidBinding), socket(InvalidBinding),
82 | 				core(InvalidBinding), context(InvalidBinding)
83 | 			{ }
84 | 
85 | 			unsigned short numa;
86 | 			unsigned short socket;
87 | 			unsigned short core;
88 | 			unsigned short context;
89 | 		};
90 | 
91 | 		vector mapping;
92 | 		TopologyT topology;
93 | };
94 | 
95 | #endif 
96 | 


--------------------------------------------------------------------------------
/util/buffer.cpp:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * Copyright 2009, Pythia authors (see AUTHORS file).
  3 |  * All rights reserved.
  4 |  * 
  5 |  * Redistribution and use in source and binary forms, with or without
  6 |  * modification, are permitted provided that the following conditions
  7 |  * are met:
  8 |  * 
  9 |  * 1. Redistributions of source code must retain the above copyright
 10 |  * notice, this list of conditions and the following disclaimer.
 11 |  * 
 12 |  * 2. Redistributions in binary form must reproduce the above copyright
 13 |  * notice, this list of conditions and the following disclaimer in the
 14 |  * documentation and/or other materials provided with the distribution.
 15 |  * 
 16 |  * 3. Neither the name of the copyright holder nor the names of its
 17 |  * contributors may be used to endorse or promote products derived from
 18 |  * this software without specific prior written permission.
 19 |  * 
 20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 31 |  * POSSIBILITY OF SUCH DAMAGE.
 32 |  */
 33 | 
 34 | #include "buffer.h"
 35 | #include "custom_asserts.h"
 36 | 
 37 | #ifdef DEBUG
 38 | #include 
 39 | #endif
 40 | 
 41 | #ifndef NULL
 42 | #define NULL 0
 43 | #endif
 44 | 
 45 | #include "numaallocate.h"
 46 | 
 47 | Buffer::Buffer(void* data, unsigned long long size, void* free)
 48 | 	: data(data), maxsize(size), owner(false), free(free)
 49 | { 
 50 | 	if (free == NULL)
 51 | 		this->free = reinterpret_cast(data)+size;
 52 | }
 53 | 
 54 | Buffer::Buffer(unsigned long long size, void* allocsource, const char tag[4]) 
 55 | 	: maxsize(size), owner(true)
 56 | {
 57 | 	data = numaallocate_local(tag, size, allocsource);
 58 | 	dbgassert(data != NULL);
 59 | #ifdef DEBUG
 60 | 	memset(data, 0xBF, size);
 61 | #endif
 62 | 	free = data;
 63 | }
 64 | 
 65 | Buffer::~Buffer() 
 66 | {
 67 | 	if (owner)
 68 | 		numadeallocate(data);
 69 | 
 70 | 	data = 0;
 71 | 	free = 0;
 72 | 	maxsize = 0;
 73 | 	owner = false;
 74 | }
 75 | 
 76 | TupleBuffer::TupleBuffer(unsigned long long size, unsigned int tuplesize, void* allocsource, const char tag[4])
 77 | 	: Buffer(size, allocsource, tag), tuplesize(tuplesize)
 78 | { 
 79 | 	// Sanity check: Fail if page doesn't fit even a single tuple.
 80 | 	//
 81 | 	dbgassert(size >= tuplesize);
 82 | }
 83 | 
 84 | TupleBuffer::TupleBuffer(void* data, unsigned long long size, void* free, unsigned int tuplesize)
 85 | 	: Buffer(data, size, free), tuplesize(tuplesize)
 86 | { 
 87 | 	// Sanity check: Fail if page doesn't fit even a single tuple.
 88 | 	//
 89 | 	dbgassert(size >= tuplesize);
 90 | }
 91 | 
 92 | #ifdef BITONIC_SORT
 93 | #include "bitonicsort.cpp"
 94 | #endif
 95 | 
 96 | void
 97 | TupleBuffer::bitonicsort()
 98 | {
 99 | 	unsigned long long tuples = getNumTuples();
100 | 
101 | 	assert(tuplesize == 8);
102 | 	assert(tuples > 0x1000);
103 | 	assert(tuples != 0);
104 | 	assert((tuples & (tuples-1)) == 0);
105 | 
106 | #ifdef BITONIC_SORT
107 | 	dobitonicsort((record_t*)data, tuples);
108 | #else
109 | 	throw UnknownAlgorithmException();
110 | #endif
111 | }
112 | 


--------------------------------------------------------------------------------
/util/custom_asserts.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #ifndef __MYCUSTOMASSERTS__
35 | #define __MYCUSTOMASSERTS__
36 | 
37 | #include 
38 | 
39 | inline void dbg2assert(int expression) 
40 | {
41 | #ifdef DEBUG2
42 | 	assert(expression);
43 | #endif
44 | }
45 | 
46 | inline void dbgassert(int expression) 
47 | {
48 | #ifdef DEBUG
49 | 	assert(expression);
50 | #endif
51 | }
52 | 
53 | inline void dbgassertimplies(int condition, int expression) 
54 | {
55 | #ifdef DEBUG
56 | 	if (condition)
57 | 		assert(expression);
58 | #endif
59 | }
60 | 
61 | template 
62 | inline void assertpowerof2(T number)
63 | {
64 | 	assert(((number) & (number-1))==0);
65 | }
66 | 
67 | template 
68 | inline void dbgassertpowerof2(T number)
69 | {
70 | 	dbgassert(((number) & (number-1))==0);
71 | }
72 | 
73 | #endif
74 | 


--------------------------------------------------------------------------------
/util/numaallocate.h:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | void* numaallocate_local(const char tag[4], size_t allocsize, void* source);
36 | void* numaallocate_onnode(const char tag[4], size_t allocsize, int node, void* source);
37 | void numadeallocate(void* space);
38 | 


--------------------------------------------------------------------------------
/util/numaasserts.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 | */
33 | 
34 | void assertaddresslocal(void* address);
35 | bool checkifaddresslocal(void* address);
36 | void assertaddressonnuma(void* address, int numa);
37 | bool checkifaddressonnuma(void* address, int numa);
38 | int numafromaddress(void* p);
39 | int localnumanode();
40 | 


--------------------------------------------------------------------------------
/util/parallelqueue.inl:
--------------------------------------------------------------------------------
  1 | 
  2 | /*
  3 |  * Copyright 2012, Pythia authors (see AUTHORS file).
  4 |  * All rights reserved.
  5 |  * 
  6 |  * Redistribution and use in source and binary forms, with or without
  7 |  * modification, are permitted provided that the following conditions
  8 |  * are met:
  9 |  * 
 10 |  * 1. Redistributions of source code must retain the above copyright
 11 |  * notice, this list of conditions and the following disclaimer.
 12 |  * 
 13 |  * 2. Redistributions in binary form must reproduce the above copyright
 14 |  * notice, this list of conditions and the following disclaimer in the
 15 |  * documentation and/or other materials provided with the distribution.
 16 |  * 
 17 |  * 3. Neither the name of the copyright holder nor the names of its
 18 |  * contributors may be used to endorse or promote products derived from
 19 |  * this software without specific prior written permission.
 20 |  * 
 21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 32 |  * POSSIBILITY OF SUCH DAMAGE.
 33 | */
 34 | 
 35 | template 
 36 | typename ParallelQueue::ResultT  ParallelQueue::push(T* datain)
 37 | {
 38 | 	typename ParallelQueue::ResultT ret = Okay;
 39 | 
 40 | 	pthread_mutex_lock(&lock);
 41 | 
 42 | 	if (rundown)
 43 | 	{
 44 | 		ret = Rundown;
 45 | 		goto unlockandret;
 46 | 	}
 47 | 
 48 | 	while (isFull())
 49 | 	{
 50 | 		pthread_cond_wait(&queuefull, &lock);
 51 | 
 52 | 		if (rundown)
 53 | 		{
 54 | 			ret = Rundown;
 55 | 			goto unlockandret;
 56 | 		}
 57 | 	}
 58 | 
 59 | 	dbgassert(rundown == false);
 60 | 	dbgassert(isFull() == false);
 61 | 
 62 | 	// Queue is not in rundown, or full. 
 63 | 	// Write item, and signal any waiting consumers.
 64 | 	//
 65 | 	queue[prodpointer] = *datain;
 66 | 	incrementProd();
 67 | 
 68 | 	pthread_cond_signal(&queueempty);
 69 | 
 70 | unlockandret:
 71 | 	pthread_mutex_unlock(&lock);
 72 | 	return ret;
 73 | }
 74 | 
 75 | template 
 76 | typename ParallelQueue::ResultT  ParallelQueue::pop(T* dataout)
 77 | {
 78 | 	typename ParallelQueue::ResultT ret = Okay;
 79 | 
 80 | 	pthread_mutex_lock(&lock);
 81 | 
 82 | 	while (isEmpty())
 83 | 	{
 84 | 		if (rundown)
 85 | 		{
 86 | 			ret = Rundown;
 87 | 			goto unlockandret;
 88 | 		}
 89 | 
 90 | 		pthread_cond_wait(&queueempty, &lock);
 91 | 	}
 92 | 
 93 | 	dbgassert(isEmpty() == false);
 94 | 
 95 | 	// Queue is not empty (but might be in rundown). 
 96 | 	// Return item, and signal any waiting producers.
 97 | 	//
 98 | 	*dataout = queue[conspointer];
 99 | 	incrementCons();
100 | 
101 | 	pthread_cond_signal(&queuefull);
102 | 
103 | unlockandret:
104 | 	pthread_mutex_unlock(&lock);
105 | 	return ret;
106 | }
107 | 
108 | template 
109 | void ParallelQueue::signalRundown()
110 | {
111 | 	pthread_mutex_lock(&lock);
112 | 	rundown = true;
113 | 	pthread_cond_broadcast(&queueempty);
114 | 	pthread_cond_broadcast(&queuefull);
115 | 	pthread_mutex_unlock(&lock);
116 | }
117 | 


--------------------------------------------------------------------------------
/util/reentrant_random.h:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2013, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #ifndef __MYREENTRANT_RANDOM__
36 | #define __MYREENTRANT_RANDOM__
37 | 
38 | #include 
39 | 
40 | /**
41 |  * Implemented thread-safe random number generator using random_r.
42 |  */
43 | class ReentrantRandom 
44 | {
45 | 	public:
46 | 		/**
47 | 		 * Initializes using: time() ^ (salt << 4).
48 | 		 */
49 | 		inline void init(unsigned int salt);
50 | 
51 | 		/**
52 | 		 * Returns next random int.
53 | 		 */
54 | 		inline int next();
55 | 
56 | 	private:
57 | 		struct random_data state;
58 | 		char buffer[32*sizeof(int32_t)];
59 | };
60 | 
61 | #include "reentrant_random.inl"
62 | 
63 | #endif
64 | 


--------------------------------------------------------------------------------
/util/reentrant_random.inl:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2013, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include 
36 | #include 
37 | #include "custom_asserts.h"
38 | 
39 | void ReentrantRandom::init(unsigned int salt)
40 | {
41 | 	/*
42 | 	 * Initialization vector lifted from glibc.
43 | 	 */
44 | 	static int32_t const glibcrandtbl[] = 
45 | 	{
46 | 		0,
47 | 		-1726662223, 379960547, 1735697613, 1040273694, 1313901226,
48 | 		1627687941, -179304937, -2073333483, 1780058412, -1989503057,
49 | 		-615974602, 344556628, 939512070, -1249116260, 1507946756,
50 | 		-812545463, 154635395, 1388815473, -1926676823, 525320961,
51 | 		-1009028674, 968117788, -123449607, 1284210865, 435012392,
52 | 		-2017506339, -911064859, -370259173, 1132637927, 1398500161,
53 | 		-205601318,
54 | 	};
55 | 
56 | 	memcpy(buffer, glibcrandtbl, sizeof(glibcrandtbl));
57 | 	memset(&state, 0, sizeof(state));
58 | 	initstate_r(time(NULL) ^ (salt << 4), buffer, sizeof(glibcrandtbl), &state);
59 | }
60 | 
61 | int ReentrantRandom::next()
62 | {
63 | 	int randval;
64 | 	int ret;
65 | 	ret = random_r(&state, &randval);
66 | 	dbgassert(ret == 0);
67 | 	return randval;
68 | }
69 | 


--------------------------------------------------------------------------------
/util/static_assert.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright 2014, Pythia authors (see AUTHORS file).
 3 |  * All rights reserved.
 4 |  * 
 5 |  * Redistribution and use in source and binary forms, with or without
 6 |  * modification, are permitted provided that the following conditions
 7 |  * are met:
 8 |  * 
 9 |  * 1. Redistributions of source code must retain the above copyright
10 |  * notice, this list of conditions and the following disclaimer.
11 |  * 
12 |  * 2. Redistributions in binary form must reproduce the above copyright
13 |  * notice, this list of conditions and the following disclaimer in the
14 |  * documentation and/or other materials provided with the distribution.
15 |  * 
16 |  * 3. Neither the name of the copyright holder nor the names of its
17 |  * contributors may be used to endorse or promote products derived from
18 |  * this software without specific prior written permission.
19 |  * 
20 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 |  * POSSIBILITY OF SUCH DAMAGE.
32 |  */
33 | 
34 | #ifndef __MY_STOLEN_STATIC_ASSERT__
35 | #define __MY_STOLEN_STATIC_ASSERT__
36 | 
37 | template  struct STATIC_ASSERTION_FAILURE;
38 | template <> struct STATIC_ASSERTION_FAILURE { enum { value = 1 }; };
39 | 
40 | #define STATIC_ASSERT_EXPAND(A,B) STATIC_ASSERT_EXPAND2(A,B)
41 | #define STATIC_ASSERT_EXPAND2(A,B) A##B
42 | #define static_assert( B ) \
43 |    enum { STATIC_ASSERT_EXPAND(static_assert_at_line_,__LINE__)  \
44 |       = sizeof(STATIC_ASSERTION_FAILURE< (bool)( B ) >) }
45 | 
46 | #endif // __MY_STOLEN_STATIC_ASSERT__
47 | 


--------------------------------------------------------------------------------
/visitors/recursivedestroy.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  *
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  *
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  *
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  *
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  *
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "../operators/operators.h"
36 | #include "allvisitors.h"
37 | 
38 | void RecursiveDestroyVisitor::simplevisit(SingleInputOp* op)
39 | {
40 | 	op->nextOp->accept(this);
41 | 	op->destroy();
42 | }
43 | 
44 | void RecursiveDestroyVisitor::simplevisit(DualInputOp* op)
45 | {
46 | 	op->buildOp->accept(this);
47 | 	op->probeOp->accept(this);
48 | 	op->destroy();
49 | }
50 | 
51 | void RecursiveDestroyVisitor::simplevisit(ZeroInputOp* op)
52 | {
53 | 	op->destroy();
54 | }
55 | 


--------------------------------------------------------------------------------
/visitors/recursivefree.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2011, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "../operators/operators.h"
36 | #include "allvisitors.h"
37 | 
38 | void RecursiveFreeVisitor::simplevisit(SingleInputOp* op)
39 | {
40 | 	op->nextOp->accept(this);
41 | 	op->nextOp = NULL;
42 | 	delete op;
43 | }
44 | 
45 | void RecursiveFreeVisitor::simplevisit(DualInputOp* op)
46 | {
47 | 	op->buildOp->accept(this);
48 | 	op->buildOp = NULL;
49 | 	op->probeOp->accept(this);
50 | 	op->probeOp = NULL;
51 | 	delete op;
52 | }
53 | 
54 | void RecursiveFreeVisitor::simplevisit(ZeroInputOp* op)
55 | {
56 | 	delete op;
57 | }
58 | 


--------------------------------------------------------------------------------
/visitors/threadclose.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "../operators/operators.h"
36 | #include "allvisitors.h"
37 | 
38 | void ThreadCloseVisitor::simplevisit(SingleInputOp* op)
39 | {
40 | 	op->nextOp->accept(this);
41 | 	op->threadClose(threadid);
42 | }
43 | 
44 | void ThreadCloseVisitor::simplevisit(DualInputOp* op)
45 | {
46 | 	op->buildOp->accept(this);
47 | 	op->probeOp->accept(this);
48 | 	op->threadClose(threadid);
49 | }
50 | 
51 | void ThreadCloseVisitor::simplevisit(ZeroInputOp* op)
52 | {
53 | 	op->threadClose(threadid);
54 | }
55 | 
56 | void ThreadCloseVisitor::visit(MergeOp* op)
57 | {
58 | 	// MergeOp takes care of the worker threads itself, so propagating
59 | 	// threadClose down would result in double-close. 
60 | 	//
61 | 	op->threadClose(threadid);
62 | }
63 | 


--------------------------------------------------------------------------------
/visitors/threadinit.cpp:
--------------------------------------------------------------------------------
 1 | 
 2 | /*
 3 |  * Copyright 2009, Pythia authors (see AUTHORS file).
 4 |  * All rights reserved.
 5 |  * 
 6 |  * Redistribution and use in source and binary forms, with or without
 7 |  * modification, are permitted provided that the following conditions
 8 |  * are met:
 9 |  * 
10 |  * 1. Redistributions of source code must retain the above copyright
11 |  * notice, this list of conditions and the following disclaimer.
12 |  * 
13 |  * 2. Redistributions in binary form must reproduce the above copyright
14 |  * notice, this list of conditions and the following disclaimer in the
15 |  * documentation and/or other materials provided with the distribution.
16 |  * 
17 |  * 3. Neither the name of the copyright holder nor the names of its
18 |  * contributors may be used to endorse or promote products derived from
19 |  * this software without specific prior written permission.
20 |  * 
21 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 |  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 |  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 |  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 |  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 |  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 |  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 |  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 |  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 |  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 |  * POSSIBILITY OF SUCH DAMAGE.
33 |  */
34 | 
35 | #include "../operators/operators.h"
36 | #include "allvisitors.h"
37 | 
38 | void ThreadInitVisitor::simplevisit(SingleInputOp* op)
39 | {
40 | 	op->threadInit(threadid);
41 | 	op->nextOp->accept(this);
42 | }
43 | 
44 | void ThreadInitVisitor::simplevisit(DualInputOp* op)
45 | {
46 | 	op->threadInit(threadid);
47 | 	op->buildOp->accept(this);
48 | 	op->probeOp->accept(this);
49 | }
50 | 
51 | void ThreadInitVisitor::simplevisit(ZeroInputOp* op)
52 | {
53 | 	op->threadInit(threadid);
54 | }
55 | 
56 | void ThreadInitVisitor::visit(MergeOp* op)
57 | {
58 | 	// MergeOp takes care of the worker threads itself, so propagating
59 | 	// threadInit down would result in double-init. 
60 | 	//
61 | 	op->threadInit(threadid);
62 | }
63 | 


--------------------------------------------------------------------------------