Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.
Commit message: Mostly removal of unused files. Requested reviews: Paul J. Lucas (paul-lucas) For more details, see: https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/147825 Mostly removal of unused files. -- https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/147825 Your team Zorba Coders is subscribed to branch lp:zorba.
=== removed file 'src/util/empty.h' --- src/util/empty.h 2012-09-19 21:16:15 +0000 +++ src/util/empty.h 1970-01-01 00:00:00 +0000 @@ -1,16 +0,0 @@ -/* - * Copyright 2006-2008 The FLWOR Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* vim:set et sw=2 ts=2: */ === removed file 'src/util/list_test.cpp' --- src/util/list_test.cpp 2012-09-19 21:16:15 +0000 +++ src/util/list_test.cpp 1970-01-01 00:00:00 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2006-2008 The FLWOR Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "util/list.h" - -#include <iostream> - -using namespace std; -using namespace zorba; - -int main(int argc, char* argv[]) -{ - - list<int>* l_p = new list<int>; - for (uint32_t i = 0; i<50; ++i) { - l_p->push_back(2*i); - } - - cout << "l_p->size() = " << l_p->size() << endl; - list_iterator<int> it = l_p->begin(); - list_iterator<int> end = l_p->end(); - for ( ; it!=end; ++it) { cout << *it << endl; } - - it = l_p->begin(); - end = l_p->end(); - for (uint32_t i = 0; i<50 && it!=end; ++i,++it,++it) { - l_p->insert_after(it.get_curr(), new list_node<int>(2*i+1,NULL,NULL)); - } - - cout << "l_p->size() = " << l_p->size() << endl; - it = l_p->begin(); - end = l_p->end(); - for ( ; it!=end; ++it) { cout << *it << endl; } - - for (uint32_t i = 0; i<50; ++i) { - l_p->push_front(3*i); - } - - cout << "l_p->size() = " << l_p->size() << endl; - it = l_p->begin(); - end = l_p->end(); - for ( ; it!=end; ++it) { cout << *it << endl; } - - list_reverse_iterator<int> r_it = l_p->rbegin(); - list_reverse_iterator<int> r_end = l_p->rend(); - for ( ; r_it!=r_end; ++r_it) { cout << *r_it << endl; } - - for (int i=0; i<150; ++i) { - cout << "l["<<i<<"] = " << (*l_p)[i] << endl; - } - - delete l_p; - - l_p = new list<int>; - l_p->push_front(10); - cout << "l[0] = " << (*l_p)[0] << endl; - - delete l_p; - -} - -/* vim:set et sw=2 ts=2: */ === modified file 'src/util/mem_sizeof.h' --- src/util/mem_sizeof.h 2013-02-07 02:42:49 +0000 +++ src/util/mem_sizeof.h 2013-02-12 03:57:23 +0000 @@ -109,7 +109,7 @@ * dynamically allocated by some implementations of \c std::string. * Some implementations use an additional "rep" object. * There's no way to determine whether a given implemenation uses one - * much less how much memory it uses programatically, + * much less how much memory it uses programmatically, * but it's the best that can be done. * * An example of adding an \c alloc_size() member function is: === removed file 'src/util/sorter.h' --- src/util/sorter.h 2012-09-19 21:16:15 +0000 +++ src/util/sorter.h 1970-01-01 00:00:00 +0000 @@ -1,122 +0,0 @@ -/* - * Copyright 2006-2008 The FLWOR Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once -#ifndef ZORBA_SORTER_H -#define ZORBA_SORTER_H - -#include <utility> -#include <iostream> -#include <vector> - - -namespace zorba { - -/*______________________________________________________________________ -| Template sorting: | -| | -| quicksort implemetation uses median-of-three pivot | -| See, (e.g.) Section 8.1 in 'Algorithms': | -| Cormen, Leiserson, Rivest, McGraw Hill (1992) | -| | -| The template parameter class T is assumed to satisfy: | -| (1) operator< is defined and used for ordering | -| (2) the public field 'key' is defined | -| | -|_______________________________________________________________________*/ - - -template<class T> -void isort( - std::vector<T>& v, - uint32_t low, - uint32_t high, - bool ascending = false) -{ - for (uint32_t i=low+1; i<=high; ++i) { - if (ascending) { - for (uint32_t j=i; j>low && v[j].key < v[j-1].key; --j) { - swap(v[j], v[j-1]); - } - } - else { - for (uint32_t j=i; j>low && v[j].key > v[j-1].key; --j) { - swap(v[j], v[j-1]); - } - } - } -} - - -template<class T> -T pivot( - std::vector<T>& v, - uint32_t low, - uint32_t high) -{ - uint32_t i = (low+high)/2; - if (v[i].key < v[low].key) swap(v[low], v[i]); - if (v[high].key < v[low].key) swap(v[low], v[high]); - if (v[high].key < v[i].key) swap(v[i], v[high]); - return v[i]; -} - - -template<class T> -void qsort( - std::vector<T>& v, - uint32_t low, - uint32_t high, - bool ascending = false) -{ - if (v.size()==0) return; - if ((high-low)<8) { - isort(v, low, high, ascending); - return; - } - T u = pivot(v, low, high); - - // divide - uint32_t i = low-1; - uint32_t j = high+1; - for (;;) { - if (ascending) { - do { ++i; } while (v[i].key < u.key); - } - else { /* descending */ - do { ++i; } while (v[i].key > u.key); - } - if (ascending) { - do { --j; } while (u.key < v[j].key); - } - else { /* descending */ - do { --j; } while (u.key > v[j].key); - } - - if (j<=i) break; - swap(v[i], v[j]); - } - - // and conquer - swap(v[i], v[high]); - qsort(v,low, j, ascending); - qsort(v, j+1, high, ascending); - -} - -} /* namespace zorba */ -#endif /* ZORBA_SORTER_H */ - -/* vim:set et sw=2 ts=2: */ === removed file 'src/util/sorter_test.cpp' --- src/util/sorter_test.cpp 2012-09-19 21:16:15 +0000 +++ src/util/sorter_test.cpp 1970-01-01 00:00:00 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright 2006-2008 The FLWOR Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "util/sorter.h" - -#include <iostream> - -using namespace std; -using namespace zorba; - -struct key_struct1 -{ - uint32_t key; - uint32_t val; - - key_struct1( - uint32_t _key, - uint32_t _val) - : - key(_key), - val(_val) - { - } - ~key_struct1() {} -}; - - -struct key_struct2 -{ - float key; - uint32_t val; - - key_struct2( - float _key, - uint32_t _val) - : - key(_key), - val(_val) - { - } - ~key_struct2() {} -}; - - -int main(int argc, char* argv[]) -{ - try { - vector<key_struct1> v; - cout << "INPUT:\n"; - for (int k=1; k<=1111; ++k) { - uint32_t key = k*67 % 1111; // not quite random.. - cout << "(key,val) = (" << key << ',' << k << ")\n"; - v.push_back(key_struct1(key, k)); - } - xqp::qsort(v,0,1110); - cout << "\nOUTPUT:\n"; - vector<key_struct1>::const_iterator it1 = v.begin(); - for ( ; it1!=v.end(); ++it1) { - cout << "(key,val) = (" << it1->key << ',' << it1->val << ")\n"; - } - cout << "===========================================\n"; - - - vector<key_struct2> w; - cout << "INPUT:\n"; - for (int k=0; k<1090; ++k) { - uint32_t key = k*67 % 1090; // not quite random.. - cout << "(key,val) = (" << key << ',' << k << ")\n"; - w.push_back(key_struct2((float)key/1000.0f, k)); - } - xqp::qsort(w,0,1089); - cout << "\nOUTPUT:\n"; - uint32_t minval = 1090; - uint32_t maxval = 0; - vector<key_struct2>::const_iterator it2 = w.begin(); - for ( ; it2!=w.end(); ++it2) { - float key = it2->key; - uint32_t val = it2->val; - cout << "(key,val) = (" << key << ',' << val << ")\n"; - if (val < minval) minval = val; - if (val > maxval) maxval = val; - } - cout << "Min val = " << minval << endl; - cout << "Max val = " << maxval << endl; - - } catch (exception& e) { - cout << "System exception: " << e.what() << endl; - } catch (...) { - cout << "Unhandled exception\n"; - } -} -/* vim:set et sw=2 ts=2: */ === removed file 'src/util/triple.h' --- src/util/triple.h 2012-09-19 21:16:15 +0000 +++ src/util/triple.h 1970-01-01 00:00:00 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright 2006-2008 The FLWOR Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once -#ifndef ZORBA_TRIPLE_H -#define ZORBA_TRIPLE_H - -namespace zorba { - -template<class _T1, class _T2, class _T3> -class triple -{ -public: - _T1 first; - _T2 second; - _T3 third; - -public: - triple() : first(), second(), third() { } - - triple(const _T1& _a, const _T2& _b, const _T3& _c) - : first(_a), second(_b), third(_c) { } - - template<class _U1, class _U2, class _U3> - triple(const triple<_U1, _U2, _U3>& _p) - : first(_p.first), second(_p.second), third(_p.third) { } -}; - -template<class _T1, class _T2, class _T3> -inline bool operator==( - const triple<_T1, _T2, _T3>& _x, - const triple<_T1, _T2, _T3>& _y) -{ - return _x.first == _y.first - && _x.second == _y.second - && _x.third == _y.third; -} - -template<class _T1, class _T2, class _T3> -inline bool operator<( - const triple<_T1, _T2, _T3>& _x, - const triple<_T1, _T2, _T3>& _y) -{ - return (_x.first < _y.first) - || ((_y.first == _x.first) && (_x.second < _y.second)) - || ((_y.first == _x.first) && (_y.second == _x.second) && (_x.third < _y.third)); -} - -template<class _T1, class _T2, class _T3> -inline bool operator!=( - const triple<_T1, _T2, _T3>& _x, - const triple<_T1, _T2, _T3>& _y) -{ - return !(_x == _y); -} - -template<class _T1, class _T2, class _T3> -inline bool operator>( - const triple<_T1, _T2, _T3>& _x, - const triple<_T1, _T2, _T3>& _y) -{ - return _y < _x; -} - -template<class _T1, class _T2, class _T3> -inline bool operator<=( - const triple<_T1, _T2, _T3>& _x, - const triple<_T1, _T2, _T3>& _y) -{ - return !(_y < _x); -} - -template<class _T1, class _T2, class _T3> -inline bool operator>=( - const triple<_T1, _T2, _T3>& _x, - const triple<_T1, _T2, _T3>& _y) -{ - return !(_x < _y); -} - -template<class _T1, class _T2, class _T3> -inline triple<_T1, _T2, _T3> -make_triple(_T1 _x, _T2 _y, _T3 _z) -{ - return triple<_T1, _T2, _T3>(_x, _y, _z); -} - -} /* namespace zorba */ -#endif /* ZORBA_TRIPLE_H */ - -/* vim:set et sw=2 ts=2: */
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp