Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11066
Merged at revision: 11233
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 456 lines (+1/-420)
6 files modified
src/util/empty.h (+0/-16)
src/util/list_test.cpp (+0/-74)
src/util/mem_sizeof.h (+1/-1)
src/util/sorter.h (+0/-122)
src/util/sorter_test.cpp (+0/-104)
src/util/triple.h (+0/-103)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+147825@code.launchpad.net

Commit message

Mostly removal of unused files.

Description of the change

Mostly removal of unused files.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-02-12T15-57-47.246Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'src/util/empty.h'
2--- src/util/empty.h 2012-09-19 21:16:15 +0000
3+++ src/util/empty.h 1970-01-01 00:00:00 +0000
4@@ -1,16 +0,0 @@
5-/*
6- * Copyright 2006-2008 The FLWOR Foundation.
7- *
8- * Licensed under the Apache License, Version 2.0 (the "License");
9- * you may not use this file except in compliance with the License.
10- * You may obtain a copy of the License at
11- *
12- * http://www.apache.org/licenses/LICENSE-2.0
13- *
14- * Unless required by applicable law or agreed to in writing, software
15- * distributed under the License is distributed on an "AS IS" BASIS,
16- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17- * See the License for the specific language governing permissions and
18- * limitations under the License.
19- */
20-/* vim:set et sw=2 ts=2: */
21
22=== removed file 'src/util/list_test.cpp'
23--- src/util/list_test.cpp 2012-09-19 21:16:15 +0000
24+++ src/util/list_test.cpp 1970-01-01 00:00:00 +0000
25@@ -1,74 +0,0 @@
26-/*
27- * Copyright 2006-2008 The FLWOR Foundation.
28- *
29- * Licensed under the Apache License, Version 2.0 (the "License");
30- * you may not use this file except in compliance with the License.
31- * You may obtain a copy of the License at
32- *
33- * http://www.apache.org/licenses/LICENSE-2.0
34- *
35- * Unless required by applicable law or agreed to in writing, software
36- * distributed under the License is distributed on an "AS IS" BASIS,
37- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38- * See the License for the specific language governing permissions and
39- * limitations under the License.
40- */
41-#include "util/list.h"
42-
43-#include <iostream>
44-
45-using namespace std;
46-using namespace zorba;
47-
48-int main(int argc, char* argv[])
49-{
50-
51- list<int>* l_p = new list<int>;
52- for (uint32_t i = 0; i<50; ++i) {
53- l_p->push_back(2*i);
54- }
55-
56- cout << "l_p->size() = " << l_p->size() << endl;
57- list_iterator<int> it = l_p->begin();
58- list_iterator<int> end = l_p->end();
59- for ( ; it!=end; ++it) { cout << *it << endl; }
60-
61- it = l_p->begin();
62- end = l_p->end();
63- for (uint32_t i = 0; i<50 && it!=end; ++i,++it,++it) {
64- l_p->insert_after(it.get_curr(), new list_node<int>(2*i+1,NULL,NULL));
65- }
66-
67- cout << "l_p->size() = " << l_p->size() << endl;
68- it = l_p->begin();
69- end = l_p->end();
70- for ( ; it!=end; ++it) { cout << *it << endl; }
71-
72- for (uint32_t i = 0; i<50; ++i) {
73- l_p->push_front(3*i);
74- }
75-
76- cout << "l_p->size() = " << l_p->size() << endl;
77- it = l_p->begin();
78- end = l_p->end();
79- for ( ; it!=end; ++it) { cout << *it << endl; }
80-
81- list_reverse_iterator<int> r_it = l_p->rbegin();
82- list_reverse_iterator<int> r_end = l_p->rend();
83- for ( ; r_it!=r_end; ++r_it) { cout << *r_it << endl; }
84-
85- for (int i=0; i<150; ++i) {
86- cout << "l["<<i<<"] = " << (*l_p)[i] << endl;
87- }
88-
89- delete l_p;
90-
91- l_p = new list<int>;
92- l_p->push_front(10);
93- cout << "l[0] = " << (*l_p)[0] << endl;
94-
95- delete l_p;
96-
97-}
98-
99-/* vim:set et sw=2 ts=2: */
100
101=== modified file 'src/util/mem_sizeof.h'
102--- src/util/mem_sizeof.h 2013-02-07 02:42:49 +0000
103+++ src/util/mem_sizeof.h 2013-02-12 03:57:23 +0000
104@@ -109,7 +109,7 @@
105 * dynamically allocated by some implementations of \c std::string.
106 * Some implementations use an additional "rep" object.
107 * There's no way to determine whether a given implemenation uses one
108- * much less how much memory it uses programatically,
109+ * much less how much memory it uses programmatically,
110 * but it's the best that can be done.
111 *
112 * An example of adding an \c alloc_size() member function is:
113
114=== removed file 'src/util/sorter.h'
115--- src/util/sorter.h 2012-09-19 21:16:15 +0000
116+++ src/util/sorter.h 1970-01-01 00:00:00 +0000
117@@ -1,122 +0,0 @@
118-/*
119- * Copyright 2006-2008 The FLWOR Foundation.
120- *
121- * Licensed under the Apache License, Version 2.0 (the "License");
122- * you may not use this file except in compliance with the License.
123- * You may obtain a copy of the License at
124- *
125- * http://www.apache.org/licenses/LICENSE-2.0
126- *
127- * Unless required by applicable law or agreed to in writing, software
128- * distributed under the License is distributed on an "AS IS" BASIS,
129- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130- * See the License for the specific language governing permissions and
131- * limitations under the License.
132- */
133-#pragma once
134-#ifndef ZORBA_SORTER_H
135-#define ZORBA_SORTER_H
136-
137-#include <utility>
138-#include <iostream>
139-#include <vector>
140-
141-
142-namespace zorba {
143-
144-/*______________________________________________________________________
145-| Template sorting: |
146-| |
147-| quicksort implemetation uses median-of-three pivot |
148-| See, (e.g.) Section 8.1 in 'Algorithms': |
149-| Cormen, Leiserson, Rivest, McGraw Hill (1992) |
150-| |
151-| The template parameter class T is assumed to satisfy: |
152-| (1) operator< is defined and used for ordering |
153-| (2) the public field 'key' is defined |
154-| |
155-|_______________________________________________________________________*/
156-
157-
158-template<class T>
159-void isort(
160- std::vector<T>& v,
161- uint32_t low,
162- uint32_t high,
163- bool ascending = false)
164-{
165- for (uint32_t i=low+1; i<=high; ++i) {
166- if (ascending) {
167- for (uint32_t j=i; j>low && v[j].key < v[j-1].key; --j) {
168- swap(v[j], v[j-1]);
169- }
170- }
171- else {
172- for (uint32_t j=i; j>low && v[j].key > v[j-1].key; --j) {
173- swap(v[j], v[j-1]);
174- }
175- }
176- }
177-}
178-
179-
180-template<class T>
181-T pivot(
182- std::vector<T>& v,
183- uint32_t low,
184- uint32_t high)
185-{
186- uint32_t i = (low+high)/2;
187- if (v[i].key < v[low].key) swap(v[low], v[i]);
188- if (v[high].key < v[low].key) swap(v[low], v[high]);
189- if (v[high].key < v[i].key) swap(v[i], v[high]);
190- return v[i];
191-}
192-
193-
194-template<class T>
195-void qsort(
196- std::vector<T>& v,
197- uint32_t low,
198- uint32_t high,
199- bool ascending = false)
200-{
201- if (v.size()==0) return;
202- if ((high-low)<8) {
203- isort(v, low, high, ascending);
204- return;
205- }
206- T u = pivot(v, low, high);
207-
208- // divide
209- uint32_t i = low-1;
210- uint32_t j = high+1;
211- for (;;) {
212- if (ascending) {
213- do { ++i; } while (v[i].key < u.key);
214- }
215- else { /* descending */
216- do { ++i; } while (v[i].key > u.key);
217- }
218- if (ascending) {
219- do { --j; } while (u.key < v[j].key);
220- }
221- else { /* descending */
222- do { --j; } while (u.key > v[j].key);
223- }
224-
225- if (j<=i) break;
226- swap(v[i], v[j]);
227- }
228-
229- // and conquer
230- swap(v[i], v[high]);
231- qsort(v,low, j, ascending);
232- qsort(v, j+1, high, ascending);
233-
234-}
235-
236-} /* namespace zorba */
237-#endif /* ZORBA_SORTER_H */
238-
239-/* vim:set et sw=2 ts=2: */
240
241=== removed file 'src/util/sorter_test.cpp'
242--- src/util/sorter_test.cpp 2012-09-19 21:16:15 +0000
243+++ src/util/sorter_test.cpp 1970-01-01 00:00:00 +0000
244@@ -1,104 +0,0 @@
245-/*
246- * Copyright 2006-2008 The FLWOR Foundation.
247- *
248- * Licensed under the Apache License, Version 2.0 (the "License");
249- * you may not use this file except in compliance with the License.
250- * You may obtain a copy of the License at
251- *
252- * http://www.apache.org/licenses/LICENSE-2.0
253- *
254- * Unless required by applicable law or agreed to in writing, software
255- * distributed under the License is distributed on an "AS IS" BASIS,
256- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
257- * See the License for the specific language governing permissions and
258- * limitations under the License.
259- */
260-#include "util/sorter.h"
261-
262-#include <iostream>
263-
264-using namespace std;
265-using namespace zorba;
266-
267-struct key_struct1
268-{
269- uint32_t key;
270- uint32_t val;
271-
272- key_struct1(
273- uint32_t _key,
274- uint32_t _val)
275- :
276- key(_key),
277- val(_val)
278- {
279- }
280- ~key_struct1() {}
281-};
282-
283-
284-struct key_struct2
285-{
286- float key;
287- uint32_t val;
288-
289- key_struct2(
290- float _key,
291- uint32_t _val)
292- :
293- key(_key),
294- val(_val)
295- {
296- }
297- ~key_struct2() {}
298-};
299-
300-
301-int main(int argc, char* argv[])
302-{
303- try {
304- vector<key_struct1> v;
305- cout << "INPUT:\n";
306- for (int k=1; k<=1111; ++k) {
307- uint32_t key = k*67 % 1111; // not quite random..
308- cout << "(key,val) = (" << key << ',' << k << ")\n";
309- v.push_back(key_struct1(key, k));
310- }
311- xqp::qsort(v,0,1110);
312- cout << "\nOUTPUT:\n";
313- vector<key_struct1>::const_iterator it1 = v.begin();
314- for ( ; it1!=v.end(); ++it1) {
315- cout << "(key,val) = (" << it1->key << ',' << it1->val << ")\n";
316- }
317- cout << "===========================================\n";
318-
319-
320- vector<key_struct2> w;
321- cout << "INPUT:\n";
322- for (int k=0; k<1090; ++k) {
323- uint32_t key = k*67 % 1090; // not quite random..
324- cout << "(key,val) = (" << key << ',' << k << ")\n";
325- w.push_back(key_struct2((float)key/1000.0f, k));
326- }
327- xqp::qsort(w,0,1089);
328- cout << "\nOUTPUT:\n";
329- uint32_t minval = 1090;
330- uint32_t maxval = 0;
331- vector<key_struct2>::const_iterator it2 = w.begin();
332- for ( ; it2!=w.end(); ++it2) {
333- float key = it2->key;
334- uint32_t val = it2->val;
335- cout << "(key,val) = (" << key << ',' << val << ")\n";
336- if (val < minval) minval = val;
337- if (val > maxval) maxval = val;
338- }
339- cout << "Min val = " << minval << endl;
340- cout << "Max val = " << maxval << endl;
341-
342- } catch (exception& e) {
343- cout << "System exception: " << e.what() << endl;
344- } catch (...) {
345- cout << "Unhandled exception\n";
346- }
347-}
348-/* vim:set et sw=2 ts=2: */
349
350=== removed file 'src/util/triple.h'
351--- src/util/triple.h 2012-09-19 21:16:15 +0000
352+++ src/util/triple.h 1970-01-01 00:00:00 +0000
353@@ -1,103 +0,0 @@
354-/*
355- * Copyright 2006-2008 The FLWOR Foundation.
356- *
357- * Licensed under the Apache License, Version 2.0 (the "License");
358- * you may not use this file except in compliance with the License.
359- * You may obtain a copy of the License at
360- *
361- * http://www.apache.org/licenses/LICENSE-2.0
362- *
363- * Unless required by applicable law or agreed to in writing, software
364- * distributed under the License is distributed on an "AS IS" BASIS,
365- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
366- * See the License for the specific language governing permissions and
367- * limitations under the License.
368- */
369-#pragma once
370-#ifndef ZORBA_TRIPLE_H
371-#define ZORBA_TRIPLE_H
372-
373-namespace zorba {
374-
375-template<class _T1, class _T2, class _T3>
376-class triple
377-{
378-public:
379- _T1 first;
380- _T2 second;
381- _T3 third;
382-
383-public:
384- triple() : first(), second(), third() { }
385-
386- triple(const _T1& _a, const _T2& _b, const _T3& _c)
387- : first(_a), second(_b), third(_c) { }
388-
389- template<class _U1, class _U2, class _U3>
390- triple(const triple<_U1, _U2, _U3>& _p)
391- : first(_p.first), second(_p.second), third(_p.third) { }
392-};
393-
394-template<class _T1, class _T2, class _T3>
395-inline bool operator==(
396- const triple<_T1, _T2, _T3>& _x,
397- const triple<_T1, _T2, _T3>& _y)
398-{
399- return _x.first == _y.first
400- && _x.second == _y.second
401- && _x.third == _y.third;
402-}
403-
404-template<class _T1, class _T2, class _T3>
405-inline bool operator<(
406- const triple<_T1, _T2, _T3>& _x,
407- const triple<_T1, _T2, _T3>& _y)
408-{
409- return (_x.first < _y.first)
410- || ((_y.first == _x.first) && (_x.second < _y.second))
411- || ((_y.first == _x.first) && (_y.second == _x.second) && (_x.third < _y.third));
412-}
413-
414-template<class _T1, class _T2, class _T3>
415-inline bool operator!=(
416- const triple<_T1, _T2, _T3>& _x,
417- const triple<_T1, _T2, _T3>& _y)
418-{
419- return !(_x == _y);
420-}
421-
422-template<class _T1, class _T2, class _T3>
423-inline bool operator>(
424- const triple<_T1, _T2, _T3>& _x,
425- const triple<_T1, _T2, _T3>& _y)
426-{
427- return _y < _x;
428-}
429-
430-template<class _T1, class _T2, class _T3>
431-inline bool operator<=(
432- const triple<_T1, _T2, _T3>& _x,
433- const triple<_T1, _T2, _T3>& _y)
434-{
435- return !(_y < _x);
436-}
437-
438-template<class _T1, class _T2, class _T3>
439-inline bool operator>=(
440- const triple<_T1, _T2, _T3>& _x,
441- const triple<_T1, _T2, _T3>& _y)
442-{
443- return !(_x < _y);
444-}
445-
446-template<class _T1, class _T2, class _T3>
447-inline triple<_T1, _T2, _T3>
448-make_triple(_T1 _x, _T2 _y, _T3 _z)
449-{
450- return triple<_T1, _T2, _T3>(_x, _y, _z);
451-}
452-
453-} /* namespace zorba */
454-#endif /* ZORBA_TRIPLE_H */
455-
456-/* vim:set et sw=2 ts=2: */

Subscribers

People subscribed via source and target branches