You can subscribe to this list here.
2004 |
Jan
|
Feb
(48) |
Mar
(80) |
Apr
(9) |
May
(2) |
Jun
(91) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <laz...@us...> - 2004-02-28 07:56:52
|
Update of /cvsroot/rtk/rtk/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17692/test Modified Files: test.h Log Message: - Fixed string stuff for W32..... - printf convert defined as macro and uses alloca now PLEASE do not ANY GNU GCC specific code, e.g. in test.h PRINTF macro.. There's no way in this world compile vector test.. So, I changed PRINTF macro to what MS VCPP support, though no idea about gcc... Index: test.h =================================================================== RCS file: /cvsroot/rtk/rtk/test/test.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test.h 26 Feb 2004 20:01:16 -0000 1.5 --- test.h 28 Feb 2004 07:39:44 -0000 1.6 *************** *** 26,30 **** } ! #define PRINTF(fmt,rest...) rprintf(_R(" ") fmt, #rest) #endif --- 26,31 ---- } ! /*#define PRINTF(fmt,rest...) rprintf(_R(" ") fmt, #rest)*/ ! #define PRINTF(printf_exp) rprintf printf_exp #endif |
From: <de...@us...> - 2004-02-27 07:51:53
|
Update of /cvsroot/rtk/rtk/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18345/doc Modified Files: CONTRIBUTORS Log Message: Pal removed from CONTRIBUTORS. Index: CONTRIBUTORS =================================================================== RCS file: /cvsroot/rtk/rtk/doc/CONTRIBUTORS,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CONTRIBUTORS 2 Feb 2004 15:19:20 -0000 1.1 --- CONTRIBUTORS 27 Feb 2004 07:35:31 -0000 1.2 *************** *** 4,9 **** Note: because of SPAM "#" == "@" - Pal Szasz, (space2#atlastelecom.ro | space#rtk.cx) - ........................................................ $Id$ \ No newline at end of file --- 4,7 ---- |
From: <de...@us...> - 2004-02-27 07:44:57
|
Update of /cvsroot/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17398 Modified Files: AUTHORS Log Message: Pali moved from CONTRIBUTORS to AUTHORS. Index: AUTHORS =================================================================== RCS file: /cvsroot/rtk/rtk/AUTHORS,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AUTHORS 2 Feb 2004 15:19:58 -0000 1.3 --- AUTHORS 27 Feb 2004 07:28:34 -0000 1.4 *************** *** 4,7 **** --- 4,8 ---- Dejan Lekic, dejan§nu6.org (dejan§rtk.cx) Mikko Lahteenmaki, mikko.lahteenmaki§nordcid.com (mikko§rtk.cx) + Pal Szasz, space2§atlastelecom.ro (space§rtk.cx) --------------------------------------------------------------- |
From: <sp...@us...> - 2004-02-26 22:09:03
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6611/src/core Modified Files: CMakeLists.txt Added Files: Vector.cpp Log Message: Made non template based vector and template based vector by subclassing the first one --- NEW FILE: Vector.cpp --- #include <rtk/Vector.h> #include <stdlib.h> // malloc, realloc, free namespace Rtk { /////////////////////////////////////////////////////////////// // Protected stuff /////////////////////////////////////////////////////////////// void Vector::_Resize(int new_size) { _data = (void**)realloc(_data, new_size*sizeof(void*)); } /////////////////////////////////////////////////////////////// // Constructor/Destructor & misc stuff /////////////////////////////////////////////////////////////// Vector::Vector(int def_size) :_dealloc(false), _size(def_size), _count(0) { _data = (void**)malloc(_size * sizeof(void*)); } Vector::~Vector() { Clear(); free(_data); } bool Vector::SetSize(int new_size) { if (new_size < _count) return false; _Resize(new_size); return true; } /////////////////////////////////////////////////////////////// // Add/Delete objects /////////////////////////////////////////////////////////////// void Vector::Clear() { if (_dealloc) { for(int i = 0; i < _count; i++) _Delete(i); } _count = 0; } bool Vector::Remove(int idx) { if (idx < 0 || idx >= _count) return false; // invalid index if (_dealloc) _Delete(idx); _count--; while (idx < _count) { _data[idx] = _data[idx+1]; idx++; } if (_count*4 < _size) _Resize(_size/2); return true; } int Vector::Add(void* obj) { if (_count == _size) _Resize(_size*2); _data[_count++] = obj; return _count-1; } bool Vector::Add(void* obj, int idx) { if (idx < 0) idx = 0; if (idx > _count) idx = _count; if (_count == _size) _Resize(_size*2); for(int i = _count; i > idx; i--) _data[i] = _data[i-1]; _data[idx] = obj; _count++; return true; } int Vector::Find(const void* obj, int* idx) const { int first = (idx == NULL) ? 0 : *idx; for(int i = first; i < _count; i++) if (obj == _data[i]) { if (idx) *idx = i+1; return i; } return -1; } int Vector::Find(bool (*fn)(const void* obj, void* obj2), void* param, int* idx) { int first = (idx == NULL) ? 0 : *idx; for(int i = first; i < _count; i++) if (fn(_data[i], param)) { if (idx) *idx = i+1; return i; } return -1; } void* Vector::Get(int idx) { if (idx < 0 || idx >= _count) return (void*)0; return _data[idx]; } const void* Vector::Get(int idx) const { if (idx < 0 || idx >= _count) return (void*)0; return _data[idx]; } /////////////////////////////////////////////////////////////// // Search iterator /////////////////////////////////////////////////////////////// void* Vector::SearchIterator::Next() { int pos = _v.Find(_fn, _param, &_idx); if (pos < 0) return (void*)0; return _v.At(pos); } Vector::SearchIterator* Vector::Search(bool (*fn)(const void* obj, void* obj2), void* param) { return new SearchIterator(*this, fn, param); } /////////////////////////////////////////////////////////////// // Simulate a queue /////////////////////////////////////////////////////////////// void* Vector::Dequeue() { void* ret = _data[0]; _count--; for(int i = 0; i < _count; i++) _data[i] = _data[i+1]; return ret; } } // namespace Rtk Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/CMakeLists.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CMakeLists.txt 23 Feb 2004 22:36:09 -0000 1.9 --- CMakeLists.txt 26 Feb 2004 21:52:28 -0000 1.10 *************** *** 36,40 **** SList.cpp Dict.cpp debug.cpp error.cpp String.cpp Array.cpp ! rchar.cpp ) --- 36,40 ---- SList.cpp Dict.cpp debug.cpp error.cpp String.cpp Array.cpp ! rchar.cpp Vector.cpp ) |
From: <sp...@us...> - 2004-02-26 22:09:01
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6611/test/core Modified Files: vector0.cpp Log Message: Made non template based vector and template based vector by subclassing the first one Index: vector0.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/test/core/vector0.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vector0.cpp 26 Feb 2004 20:05:32 -0000 1.1 --- vector0.cpp 26 Feb 2004 21:52:27 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- #include <rtk/Vector.h> + #include <rtk/TVector.h> #include "../test.h" *************** *** 16,20 **** }; ! typedef VectorP<A*> VectorA; // A simple function to search a substring --- 17,21 ---- }; ! typedef TVectorP<A*> VectorA; // A simple function to search a substring *************** *** 24,32 **** } ! typedef Vector<RCHAR*>::SearchIterator<RCHAR*> Iter; int main(int argc, char* argv[]) { ! TITLE(_R("Test for the Vector template")); rprintf(_R("### Int vector ###\n")); --- 25,33 ---- } ! typedef RCharVector::TSearchIterator<RCHAR*> Iter; int main(int argc, char* argv[]) { ! TITLE(_R("Test for the Vector and TVector")); rprintf(_R("### Int vector ###\n")); |
From: <sp...@us...> - 2004-02-26 22:08:42
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6611/rtk Modified Files: Vector.h Added Files: TVector.h Log Message: Made non template based vector and template based vector by subclassing the first one --- NEW FILE: TVector.h --- /** * * RTK * Fast and easy cross-platform GUI ToolKit. * * Copyright (C) 2001-200x RTK Development Team * * This library is free software; you can redistribute it and/or modify it * under the terms of the slightly modified (see the "EXCEPTION NOTICE" part * of RTK Library License) GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * and along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA . * * Also you should have received a copy of RTK Library License, if not please * write an e-mail to some of RTK authors (listed in file AUTHORS). * * Bug reports: bu...@rt... * Suggestions: rf...@rt... ***************************************************************************/ /** * $Source: /cvsroot/rtk/rtk/rtk/TVector.h,v $ ***** * Authors (chronological order): * Pal Szasz, sp...@at... * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #ifndef _RTK_TVECTOR_H_ #define _RTK_TVECTOR_H_ 1 #include <rtk/rchar.h> namespace Rtk { #if USE_TEMPLATES template <class T> class TVector : public Vector { public: TVector(int def_size = 4) : Vector(def_size) {} int Add(T obj) { return Vector::Add((void*)obj); } bool Add(T obj, int idx) { return Vector::Add((void*)obj, idx); } int Find(const T obj, int* idx = (int*)0) const { return Vector::Find((void*)obj, idx); } template <class T2> int Find(bool (*fn)(const T obj, T2 obj2), T2 param, int* idx = (int*)0) { return Vector::Find((bool(*)(const void*,void*))fn, (void*)param, idx); } template <class T2> class TSearchIterator : public SearchIterator { public: TSearchIterator(TVector<T>& v, bool (*fn)(const T obj, T2 obj2), T2 param) :SearchIterator(v,(bool(*)(const void*,void*))fn, param) {} T Next() { return (T) SearchIterator::Next(); } }; template <class T2> TSearchIterator<T2>* Search(bool (*fn)(const T obj, T2 obj2), T2 param) { return new TSearchIterator<T2>(*this, fn, param); } T Get(int idx) { return (T)Vector::Get(idx); } const T Get(int idx) const { return (T)Vector::Get(idx); } T& At(int idx) { return (T&)Vector::At(idx); } inline T& operator[](int idx) { return (T&)Vector::At(idx); } inline void Push(T obj) { Vector::Push((void*)obj); } inline T Pop() { return (T)Vector::Pop(); } inline T Top() { return (T)Vector::Top(); } inline void Queue(T obj) { Vector::Queue((void*)obj); } T Dequeue() { return (T)Vector::Dequeue(); } }; template <class T> class TVectorP : public TVector<T> { protected: void _Delete(int idx) { delete (T)(_data[idx]); } public: TVectorP(int def_size = 4) : TVector<T>(def_size) { _dealloc = true; } ~TVectorP() { Clear(); } }; typedef TVector<int> IntVector; typedef TVector<RCHAR*> RCharVector; #endif // USE_TEMPLATES }; // namespace Rtk #endif // _RTK_TVECTOR_H_ /** * $Id: TVector.h,v 1.1 2004/02/26 21:52:36 space2 Exp $ ***************************************************************************/ Index: Vector.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Vector.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Vector.h 26 Feb 2004 20:05:32 -0000 1.1 --- Vector.h 26 Feb 2004 21:52:29 -0000 1.2 *************** *** 43,64 **** #define _RTK_VECTOR_H_ 1 - #include <stdlib.h> // malloc, realloc, free - - #include "rchar.h" - namespace Rtk { - #if USE_TEMPLATES - /** A (bit more) complex Array Class. Currently the resize policy is follows: when the array is full, the size is doubled. Should we implement that the use can select another policy? - - This class's Delete methoed does NOTHING. In order to really delete objects - use the VectorP class (P stands for Pointer). */ - template <class T> class Vector { --- 43,54 ---- *************** *** 67,76 **** int _size; ///< The number of allocated cells int _count; ///< The number of objects ! T* _data; ///< The stored objects ! void _Resize(int new_size) ! { ! _data = (T*)realloc(_data, new_size*sizeof(T)); ! } /** This method deletes a given item. --- 57,63 ---- int _size; ///< The number of allocated cells int _count; ///< The number of objects ! void** _data; ///< The stored objects ! void _Resize(int new_size); /** This method deletes a given item. *************** *** 83,99 **** @param def_size the default size of the array */ ! Vector(int def_size = 4) ! :_dealloc(false), _size(def_size), _count(0) ! { ! _data = (T*)malloc(_size * sizeof(T)); ! } /** Free the memory. If dealloc is true, each object is deleted with delete. */ ! virtual ~Vector() ! { ! free(_data); ! } /** Returns the number of elements */ --- 70,79 ---- @param def_size the default size of the array */ ! Vector(int def_size = 4); /** Free the memory. If dealloc is true, each object is deleted with delete. */ ! virtual ~Vector(); /** Returns the number of elements */ *************** *** 107,116 **** so the resize operation cannot be done. */ ! bool SetSize(int new_size) ! { ! if (new_size < _count) return false; ! _Resize(new_size); ! return true; ! } /////////////////////////////////////////////////////////////// --- 87,91 ---- so the resize operation cannot be done. */ ! bool SetSize(int new_size); /////////////////////////////////////////////////////////////// *************** *** 119,130 **** /** Removes all elements */ ! void Clear() ! { ! if (_dealloc) { ! for(int i = 0; i < _count; i++) ! _Delete(i); ! } ! _count = 0; ! } /** Removes the n-th element. --- 94,98 ---- /** Removes all elements */ ! void Clear(); /** Removes the n-th element. *************** *** 132,148 **** @return true if it was successfull */ ! bool Remove(int idx) ! { ! if (idx < 0 || idx >= _count) return false; // invalid index ! if (_dealloc) _Delete(idx); ! _count--; ! while (idx < _count) { ! _data[idx] = _data[idx+1]; ! idx++; ! } ! if (_count*4 < _size) ! _Resize(_size/2); ! return true; ! } /** Adds a new object the end of the array --- 100,104 ---- @return true if it was successfull */ ! bool Remove(int idx); /** Adds a new object the end of the array *************** *** 150,160 **** @return the index where it was added */ ! int Add(T obj) ! { ! if (_count == _size) ! _Resize(_size*2); ! _data[_count++] = obj; ! return _count-1; ! } /** Adds a new object at the given position --- 106,110 ---- @return the index where it was added */ ! int Add(void* obj); /** Adds a new object at the given position *************** *** 163,178 **** @return true if it was successfull */ ! bool Add(T obj, int idx) ! { ! if (idx < 0) idx = 0; ! if (idx > _count) idx = _count; ! if (_count == _size) ! _Resize(_size*2); ! for(int i = _count; i > idx; i--) ! _data[i] = _data[i-1]; ! _data[idx] = obj; ! _count++; ! return true; ! } /** Find the position of the given element. --- 113,117 ---- @return true if it was successfull */ ! bool Add(void* obj, int idx); /** Find the position of the given element. *************** *** 185,198 **** @return the index or -1 if not found */ ! int Find(const T obj, int* idx = NULL) const ! { ! int first = (idx == NULL) ? 0 : *idx; ! for(int i = first; i < _count; i++) ! if (obj == _data[i]) { ! if (idx) *idx = i+1; ! return i; ! } ! return -1; ! } /** Find the object using a function. --- 124,128 ---- @return the index or -1 if not found */ ! int Find(const void* obj, int* idx = (int*)0) const; /** Find the object using a function. *************** *** 204,218 **** @return the index of the object or -1 if not found */ ! template <class T2> ! int Find(bool (*fn)(const T obj, T2 obj2), T2 param, int* idx = NULL) ! { ! int first = (idx == NULL) ? 0 : *idx; ! for(int i = first; i < _count; i++) ! if (fn(_data[i], param)) { ! if (idx) *idx = i+1; ! return i; ! } ! return -1; ! } /** A search iterator. --- 134,138 ---- @return the index of the object or -1 if not found */ ! int Find(bool (*fn)(const void* obj, void* obj2), void* param, int* idx = (int*)0); /** A search iterator. *************** *** 220,277 **** Just call the Next() method to get the next object. */ - template <class T2> class SearchIterator { ! protected: ! int _idx; ! Vector<T>& _v; ! bool (*_fn)(const T obj, T2 obj2); ! T2 _param; ! public: ! SearchIterator(Vector<T>& v, bool (*fn)(const T obj, T2 obj2), T2 param) ! :_idx(0), _v(v), _fn(fn), _param(param) ! {} ! ! T Next() ! { ! int pos = _v.Find(_fn, _param, &_idx); ! if (pos < 0) return (T)0; ! return _v.At(pos); ! } ! ! const T Next() const ! { ! int pos = _v.Find(_fn, _param, &_idx); ! if (pos < 0) return (T)0; ! return _v.At(pos); ! } }; // SearchIterator /** Create a search iterator */ ! template <class T2> ! SearchIterator<T2>* Search(bool (*fn)(const T obj, T2 obj2), T2 param) ! { ! return new SearchIterator<T2>(*this, fn, param); ! } /** Returns the n-th item. @param idx the position of the item ! @return 0 typecasted to T if index is out of bounds, otherwise the item */ ! T Get(int idx) ! { ! if (idx < 0 || idx >= _count) return (T)0; ! return _data[idx]; ! } /** Returns the n-th item. @param idx the position of the item ! @return 0 typecasted to T if index is out of bounds, otherwise the item */ ! const T Get(int idx) const ! { ! if (idx < 0 || idx >= _count) return (T)0; ! return _data[idx]; ! } /** Returns a reference to the n-th item. --- 140,170 ---- Just call the Next() method to get the next object. */ class SearchIterator { ! protected: ! int _idx; ! Vector& _v; ! bool (*_fn)(const void* obj, void* obj2); ! void* _param; ! public: ! SearchIterator(Vector& v, bool (*fn)(const void* obj, void* obj2), void* param) ! :_idx(0), _v(v), _fn(fn), _param(param) {} ! void* Next(); }; // SearchIterator /** Create a search iterator */ ! SearchIterator* Search(bool (*fn)(const void* obj, void* obj2), void* param); /** Returns the n-th item. @param idx the position of the item ! @return 0 typecasted to void* if index is out of bounds, otherwise the item */ ! void* Get(int idx); /** Returns the n-th item. @param idx the position of the item ! @return 0 typecasted to void* if index is out of bounds, otherwise the item */ ! const void* Get(int idx) const; /** Returns a reference to the n-th item. *************** *** 279,295 **** @return the reference to the item, no range checking is done */ ! T& At(int idx) ! { ! return _data[idx]; ! } ! ! /** Returns a constant reference to the n-th item. ! @param idx the position of the item ! @return the reference to the item, no range checking is done ! */ ! const T& At(int idx) const ! { ! return _data[idx]; ! } /** Returns a reference to the n-th item. --- 172,176 ---- @return the reference to the item, no range checking is done */ ! void*& At(int idx) { return _data[idx]; } /** Returns a reference to the n-th item. *************** *** 297,313 **** @return the reference to the item, no range checking is done */ ! inline T& operator[](int idx) ! { ! return _data[idx]; ! } - /** Returns a constant reference to the n-th item. - @param idx the position of the item - @return the reference to the item, no range checking is done - */ - inline const T& operator[](int idx) const - { - return _data[idx]; - } /////////////////////////////////////////////////////////////// // Simulate a stack --- 178,183 ---- @return the reference to the item, no range checking is done */ ! inline void*& operator[](int idx) { return _data[idx]; } /////////////////////////////////////////////////////////////// // Simulate a stack *************** *** 315,337 **** /** Simulate a stack push */ ! inline void Push(T obj) ! { ! Add(obj); ! } /** Simulate a stack pop. ! When the stack is empty returns 0 typecasted to T */ ! inline T Pop() ! { ! if (_count == 0) return (T)0; return _data[--_count]; } /** Returns the top of the stack */ ! inline T Top() const ! { ! return _data[_count-1]; ! } /////////////////////////////////////////////////////////////// --- 185,200 ---- /** Simulate a stack push */ ! inline void Push(void* obj) { Add(obj); } /** Simulate a stack pop. ! When the stack is empty returns 0 typecasted to void* */ ! inline void* Pop() { ! if (_count == 0) return (void*)0; return _data[--_count]; } /** Returns the top of the stack */ ! inline void* Top() const { return _data[_count-1]; } /////////////////////////////////////////////////////////////// *************** *** 340,389 **** /** Adds an item to the end of the queue */ ! inline void Queue(T obj) ! { ! Add(obj); ! } /** Removes and returns the item from the head of the queue */ ! T Dequeue() ! { ! T ret = _data[0]; ! _count--; ! for(int i = 0; i < _count; i++) ! _data[i] = _data[i+1]; ! return ret; ! } ! ! }; // class Vector ! ! /** ! This version of Vector deletes object in the Delete method (if dealloc == true). ! */ ! template <class T> ! class VectorP: public Vector<T> ! { ! protected: ! void _Delete(int idx) ! { ! delete _data[idx]; ! } ! ! public: ! VectorP(int def_size = 4) ! :Vector<T>(def_size) ! { ! _dealloc = true; ! } ! ! ~VectorP() ! { ! Clear(); ! } ! }; ! ! typedef Vector<int> IntVector; ! typedef Vector<RCHAR*> RCharVector; ! #endif // USE_TEMPLATES }; // namespace Rtk --- 203,212 ---- /** Adds an item to the end of the queue */ ! inline void Queue(void* obj) { Add(obj); } /** Removes and returns the item from the head of the queue */ ! void* Dequeue(); ! }; // class Vector }; // namespace Rtk |
From: <laz...@us...> - 2004-02-26 20:47:01
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20352 Added Files: TArray.h Log Message: Added TArray :) --- NEW FILE: TArray.h --- /** * * RTK * Fast and easy cross-platform GUI ToolKit. * * Copyright (C) 2001-200x RTK Development Team * * This library is free software; you can redistribute it and/or modify it * under the terms of the slightly modified (see the "EXCEPTION NOTICE" part * of RTK Library License) GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * and along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA . * * Also you should have received a copy of RTK Library License, if not please * write an e-mail to some of RTK authors (listed in file AUTHORS). * * Bug reports: bu...@rt... * Suggestions: rf...@rt... ***************************************************************************/ /** * $Source: /cvsroot/rtk/rtk/rtk/TArray.h,v $ ***** * Authors (chronological order): * Mikko Lahteenmaki, mikko§rtk.cx * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #ifndef _RTK_TARRAY_H_ #define _RTK_TARRAY_H_ 1 #include "Array.h" namespace Rtk { /** Template based array around Rtk::Array */ template <class T> class RTK_API TArray : public Array { public: typedef T type; TArray() : Array(sizeof(type)) { } const type *bsearch(const type *key, CmpFunction cmpfunc) { Array::bsearch(ARRAY_DATA(key), cmpfunc); } const type *lfind(const type *key, CmpFunction cmpfunc) { Array::lfind(ARRAY_DATA(key), cmpfunc); } void Append(const type &item) { Array::Append(ARRAY_DATA(&item), 1); } void Append(const type *item, uint elements = 1) { Array::Append(ARRAY_DATA(item), elements); } void Prepend(const type &item) { Array::Prepend(ARRAY_DATA(&item), 1); } void Prepend(const type *item, uint elements=1) { Array::Prepend(ARRAY_DATA(item), elements); } void Insert(uint index, const type &item) { Array::Insert(index, ARRAY_DATA(&item), 1); } void Insert(uint index, const type *item, uint elements = 1) { Array::Insert(index, ARRAY_DATA(item), elements); } void Replace(uint index, const type &item) { Array::Replace(index, ARRAY_DATA(&item), 1); } void Replace(uint index, const type *item, uint elements = 1) { Array::Replace(index, ARRAY_DATA(item), elements); } int Contains(const type &item) const { return Array::Contains(ARRAY_DATA(&item)); } int IndexOf(const type &item) const { return Array::IndexOf(ARRAY_DATA(&item)); } type *Data() { return (type*)Array::Data(); } const type *Data() const { return (const type*)Array::Data(); } type &GetAt(uint index) { return *(type*)Array::GetAt(index); } const type &GetAt(uint index) const { return *(const type*)Array::GetAt(index); } type &operator [](unsigned ind) { return GetAt(ind); } const type &operator [](unsigned ind) const { return GetAt(ind); } }; }; // Rtk namespace #endif /** * $Id: TArray.h,v 1.1 2004/02/26 20:31:01 laza2000 Exp $ ***************************************************************************/ |
From: <sp...@us...> - 2004-02-26 20:29:49
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16258/test/core Modified Files: CMakeLists.txt Log Message: Added docs target in makefiles, added new tests to makefiles Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/test/core/CMakeLists.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CMakeLists.txt 23 Feb 2004 22:36:09 -0000 1.5 --- CMakeLists.txt 26 Feb 2004 20:13:15 -0000 1.6 *************** *** 40,48 **** LINK_DIRECTORIES(${RTK_SOURCE_DIR}/lib ${RTK_SOURCE_DIR}/src/core/lib ${RTK_SOURCE_DIR}/src/core) ! FOREACH(NAME debug0 list0 variant0 array0 dict0 error0 string0) ADD_EXECUTABLE(test_core_${NAME} ${NAME}.cpp) TARGET_LINK_LIBRARIES(test_core_${NAME} ${RTK_LIBRTK}) ENDFOREACH(NAME) # T0D0: debug test #ADD_EXECUTABLE(test_core_debug0 debug0.cpp) --- 40,50 ---- LINK_DIRECTORIES(${RTK_SOURCE_DIR}/lib ${RTK_SOURCE_DIR}/src/core/lib ${RTK_SOURCE_DIR}/src/core) ! FOREACH(NAME vector0 dlist0 debug0 list0 variant0 array0 dict0 error0 string0) ADD_EXECUTABLE(test_core_${NAME} ${NAME}.cpp) TARGET_LINK_LIBRARIES(test_core_${NAME} ${RTK_LIBRTK}) ENDFOREACH(NAME) + # vv--- ??? ---^^ !!! + # T0D0: debug test #ADD_EXECUTABLE(test_core_debug0 debug0.cpp) |
From: <sp...@us...> - 2004-02-26 20:29:28
|
Update of /cvsroot/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16258 Modified Files: CMakeLists.txt Log Message: Added docs target in makefiles, added new tests to makefiles Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/CMakeLists.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CMakeLists.txt 23 Feb 2004 22:36:09 -0000 1.9 --- CMakeLists.txt 26 Feb 2004 20:13:15 -0000 1.10 *************** *** 33,37 **** CMAKE_MINIMUM_REQUIRED(VERSION 1.8) ! SUBDIRS(src test) INCLUDE_DIRECTORIES(${RTK_SOURCE_DIR} ${RTK_SOURCE_DIR}/rtk . ..) --- 33,37 ---- CMAKE_MINIMUM_REQUIRED(VERSION 1.8) ! SUBDIRS(src test doc) INCLUDE_DIRECTORIES(${RTK_SOURCE_DIR} ${RTK_SOURCE_DIR}/rtk . ..) *************** *** 56,59 **** --- 56,64 ---- ON) + # Do we use templates + OPTION(RTK_OPT_TEMPLATES + "Build RTK with TEMPLATE support" + ON) + ## # Various tests *************** *** 79,82 **** --- 84,91 ---- ENDIF (RTK_OPT_UNICODE) + IF (RTK_OPT_TEMPLATES) + ADD_DEFINITIONS(-DUSE_TEMPLATES=1) + ENDIF (RTK_OPT_TEMPLATES) + # g++ is default C++ compiler SET(CMAKE_CXX_COMPILER g++) *************** *** 125,128 **** --- 134,143 ---- ## + # Docs + #################################################################### + + ADD_CUSTOM_TARGET(docs ${CMAKE_MAKE_PROGRAM} -C doc docs) + + ## # $Id$ #################################################################### |
From: <sp...@us...> - 2004-02-26 20:29:16
|
Update of /cvsroot/rtk/rtk/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16258/doc Added Files: CMakeLists.txt Log Message: Added docs target in makefiles, added new tests to makefiles --- NEW FILE: CMakeLists.txt --- ADD_CUSTOM_TARGET(docs (cd .. && doxygen rtk.doxygen)) |
From: <sp...@us...> - 2004-02-26 20:23:41
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14933/rtk Added Files: DList.h Log Message: Added tamplate based double linked list --- NEW FILE: DList.h --- /** * * RTK * Fast and easy cross-platform GUI ToolKit. * * Copyright (C) 2001-200x RTK Development Team * * This library is free software; you can redistribute it and/or modify it * under the terms of the slightly modified (see the "EXCEPTION NOTICE" part * of RTK Library License) GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * and along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA . * * Also you should have received a copy of RTK Library License, if not please * write an e-mail to some of RTK authors (listed in file AUTHORS). * * Bug reports: bu...@rt... * Suggestions: rf...@rt... ***************************************************************************/ /** * $Source: /cvsroot/rtk/rtk/rtk/DList.h,v $ ***** * Authors (chronological order): * Pal Szasz, sp...@at... * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #ifndef _RTK_DLIST_H_ #define _RTK_DLIST_H_ 1 #include "rchar.h" namespace Rtk { #if USE_TEMPLATES /** Double linked list */ template <class T> class DList { protected: /** Internal class to represent a node */ class Node { public: Node* prev; Node* next; T value; Node(Node* p, Node* n, T v) :prev(p), next(n), value(v) {} Node(T v) :prev(NULL), next(NULL), value(v) {} }; // Node Node* _head; ///< Head of the list Node* _tail; ///< End of the list /** In subclassess this method can perform aditional memory deallocation */ virtual void _Delete(Node* node) { // NOP } public: DList() :_head(NULL), _tail(NULL) {} virtual ~DList() { Clear(); } /////////////////////////////////////////////////////////////// // Standard list operations /////////////////////////////////////////////////////////////// void AddFront(T obj) { Node* node = new Node(NULL, _head, obj); if (_head == NULL) { _tail = node; } else { _head->prev = node; } _head = node; } T RemoveFront() { if (_head == NULL) return (T)0; T ret = _head->value; Node* nhead = _head->next; _Delete(_head); _head = nhead; _head->prev = NULL; return ret; } void AddTail(T obj) { Node* node = new Node(_tail, NULL, obj); if (_head == NULL) { _head = node; } else { _tail->next = node; } _tail = node; } T RemoveTail() { if (_tail == NULL) return (T)0; T ret = _tail->value; Node* ntail = _tail->prev; _Delete(_tail); _tail = ntail; _tail->next = NULL; return ret; } void Clear() { while (_head) { Node* tmp = _head; _head = _head->next; _Delete(tmp); } } /////////////////////////////////////////////////////////////// // A few special things: add&sort, find, etc /////////////////////////////////////////////////////////////// /** Adds an object to the list to the corresponding position. @param obj the object @param fn_less a function which returns true if arg1 < arg2 */ void Add(T obj, bool (*fn_less)(T obj1, T obj2)) { if (_head == NULL) { _head = _tail = new Node(obj); } else { Node* cur = _head; while (cur && fn_less(cur->value, obj)) cur = cur->next; if (cur == NULL) { AddTail(obj); } else { Node* node = new Node(cur->prev, cur, obj); if (node->prev) node->prev->next = node; else _head = node; if (node->next) node->next->prev = node; else _tail = node; } } } /////////////////////////////////////////////////////////////// // Stack simulation /////////////////////////////////////////////////////////////// inline void Push(T obj) { AddTail(obj); } inline T Pop() { return RemoveTail(); } /////////////////////////////////////////////////////////////// // Queue simulation /////////////////////////////////////////////////////////////// inline void Queue(T obj) { AddTail(obj); } inline T Dequeue() { return RemoveFront(); } /////////////////////////////////////////////////////////////// // Iterators /////////////////////////////////////////////////////////////// /** Forward/Backward iterator */ class Iterator { protected: Node* _cur; bool _fwd; public: Iterator(Node* start, bool fwd = true) :_cur(start), _fwd(fwd) {} T Next() { T ret = (T)0; if (_cur) { ret = _cur->value; _cur = _fwd ? _cur->next : _cur->prev; } return ret; } const T Next() const { T ret = (T)0; if (_cur) { ret = _cur->value; _cur = _fwd ? _cur->next : _cur->prev; } return ret; } }; // Iterator /** Creates a forward iterator */ Iterator* GetIterator() { Iterator* iter = new Iterator(_head); return iter; } /** Creates a backward iterator */ Iterator* GetBackIterator() { Iterator* iter = new Iterator(_head, false); return iter; } /////////////////////////////////////////////////////////////// // Filters (special iterators) /////////////////////////////////////////////////////////////// /** Forward/Backward iterator */ template <class T2> class Filter { protected: Node* _cur; bool _fwd; bool (*_fn)(T, T2); T2 _param; public: Filter(Node* start, bool (*fn)(T, T2), T2 param = (T2)0, bool fwd = true) :_cur(start), _fwd(fwd), _fn(fn), _param(param) {} T Next() { T ret; do { if (!_cur) return (T)0; ret = _cur->value; _cur = _fwd ? _cur->next : _cur->prev; } while (!_fn(ret, _param)); return ret; } }; // Iterator /** Creates a filter */ template <class T2> Filter<T2>* GetFilter(bool (*fn)(T, T2), T2 param = (T2)0, bool fwd = true) { Filter<T2>* filter = new Filter<T2>(fwd ? _head : _tail, fn, param); return filter; } }; // DList /** Double linked lists which deletes objects */ template <class T> class DListP : public DList<T> { protected: // class Node : public DList<T>::Node {}; void _Delete(typename DList<T>::Node* node) { delete node->value; } public: ~DListP() { Clear(); } }; typedef DList<int> IntDList; typedef DList<RCHAR*> RCharDList; #endif // USE_TEMPLATES }; // namespace Rtk #endif // _RTK_DLIST_H_ /** * $Id: DList.h,v 1.1 2004/02/26 20:07:41 space2 Exp $ ***************************************************************************/ |
From: <sp...@us...> - 2004-02-26 20:23:41
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14933/test/core Added Files: dlist0.cpp Log Message: Added tamplate based double linked list --- NEW FILE: dlist0.cpp --- #include <rtk/DList.h> #include "../test.h" typedef IntDList::Iterator IntIter; typedef IntDList::Filter<int> IntFilter; // a function which prints an int list void print(IntDList& list) { PRINTF(_R("list = ")); IntIter* iter = list.GetIterator(); int v; while (v = iter->Next()) rprintf(_R(" %d"), v); rprintf(_R("\n")); delete iter; } bool is_odd(int num, int) { return (num & 1); } // a function which prints odd numbers void print_odd(IntDList& list) { PRINTF(_R("odds = ")); IntFilter* iter = list.GetFilter<int>(is_odd); int v; while (v = iter->Next()) rprintf(_R(" %d"), v); rprintf(_R("\n")); delete iter; } // A simple class to track (de)allocations class A { public: A() { PRINTF(_R("A::A\n")); } ~A() { PRINTF(_R("A::~A\n")); } }; typedef DListP<A*> DListA; // A simple function to search a substring static bool FindSubStr(RCHAR* str, RCHAR* sub) { return (rstrstr(str, sub) != NULL); } static bool fn_less(int a, int b) { return a < b; } int main(int argc, char* argv[]) { TITLE(_R("Test for the DList template")); rprintf(_R("### Int list ###\n")); STEP(IntDList li); STEP(li.Push(1)); STEP(li.Push(2)); STEP(li.Push(3)); STEP(li.Push(4)); STEP(print(li)); OUT("Pop: %d", li.Pop()); OUT("Pop: %d", li.Pop()); STEP(li.Queue(11)); STEP(li.Queue(12)); OUT("Dequeue: %d", li.Dequeue()); OUT("Dequeue: %d", li.Dequeue()); STEP(print(li)); STEP(li.Add(5, fn_less)); STEP(li.Add(21, fn_less)); STEP(li.Add(17, fn_less)); STEP(li.Add(8, fn_less)); STEP(print(li)); STEP(print_odd(li)); rprintf(_R("### Object list ###\n")); DListA* la = new DListA(); STEP(la->Push(new A())); STEP(la->Push(new A())); STEP(la->Push(new A())); STEP(A* tmp = la->Pop()); STEP(delete la); STEP(delete tmp); return 1; } |
From: <sp...@us...> - 2004-02-26 20:21:31
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14368/test/core Added Files: vector0.cpp Log Message: Added tamplate based Vector class --- NEW FILE: vector0.cpp --- #include <rtk/Vector.h> #include "../test.h" #define PRINT(v,fmt) \ PRINTF(_R(#v " =")); \ for(int i = 0; i < v.GetCount(); i++) \ rprintf(_R(" '" fmt "'"), v[i]); \ rprintf(_R("\n")); // A simple class to track (de)allocations class A { public: A() { PRINTF(_R("A::A\n")); } ~A() { PRINTF(_R("A::~A\n")); } }; typedef VectorP<A*> VectorA; // A simple function to search a substring bool FindSubStr(RCHAR* str, RCHAR* sub) { return (rstrstr(str, sub) != NULL); } typedef Vector<RCHAR*>::SearchIterator<RCHAR*> Iter; int main(int argc, char* argv[]) { TITLE(_R("Test for the Vector template")); rprintf(_R("### Int vector ###\n")); STEP(IntVector v); STEP(v.Add(1)); STEP(v.Add(2)); STEP(v.Add(3)); STEP(v.Add(10, 1)); STEP(v.Remove(0)); STEP(PRINT(v, "%d")); STEP(v.Push(11)); STEP(v.Push(12)); STEP(v.Push(13)); STEP(PRINT(v, "%d")); OUT("Pop: %d", v.Pop()); OUT("Pop: %d", v.Pop()); OUT("Pop: %d", v.Pop()); STEP(PRINT(v, "%d")); STEP(v.Queue(21)); STEP(v.Queue(22)); STEP(PRINT(v, "%d")); OUT("Dequeue: %d", v.Dequeue()); OUT("Dequeue: %d", v.Dequeue()); STEP(PRINT(v, "%d")); rprintf(_R("### RCHAR* vector ###\n")); STEP(RCharVector vc); STEP(vc.Add(_R("Hi"))); STEP(vc.Add(_R("Everybody"))); STEP(vc.Add(_R("Out"))); STEP(vc.Add(_R("There"))); STEP(vc.Add(_R("Where"))); STEP(vc.Add(_R("Merely"))); STEP(vc.Add(_R("Erethnech"))); STEP(PRINT(vc, "%s")); OUT("Find first occurence of the substring 'ere': %d", vc.Find<RCHAR*>(FindSubStr, _R("ere"))); STEP(Iter* iter = vc.Search<RCHAR*>(FindSubStr, _R("ere"))); STEP(RCHAR* found); STEP(while (found = iter->Next()) rprintf(_R(" Found: %s\n"), found)); rprintf(_R("### Object vector ###\n")); STEP(VectorA * va = new VectorA()); STEP(va->Push(new A())); // A::A STEP(va->Push(new A())); // A::A STEP(va->Push(new A())); // A::A STEP(va->Remove(-1)); // NOP: idx out of range STEP(va->Remove(0)); // A::~A STEP(A* tmp = va->Pop()); // NOP: object is popped, but not deleted OUT("va->GetCount() = %d", va->GetCount()); STEP(delete va); // 1x A::~A (1 removed, 1 popped => 1 remained) STEP(delete tmp); // A::~A - let's not leave garbage return 0; } |
From: <sp...@us...> - 2004-02-26 20:21:31
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14368/rtk Added Files: Vector.h Log Message: Added tamplate based Vector class --- NEW FILE: Vector.h --- /** * * RTK * Fast and easy cross-platform GUI ToolKit. * * Copyright (C) 2001-200x RTK Development Team * * This library is free software; you can redistribute it and/or modify it * under the terms of the slightly modified (see the "EXCEPTION NOTICE" part * of RTK Library License) GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * and along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA . * * Also you should have received a copy of RTK Library License, if not please * write an e-mail to some of RTK authors (listed in file AUTHORS). * * Bug reports: bu...@rt... * Suggestions: rf...@rt... ***************************************************************************/ /** * $Source: /cvsroot/rtk/rtk/rtk/Vector.h,v $ ***** * Authors (chronological order): * Pal Szasz, sp...@at... * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #ifndef _RTK_VECTOR_H_ #define _RTK_VECTOR_H_ 1 #include <stdlib.h> // malloc, realloc, free #include "rchar.h" namespace Rtk { #if USE_TEMPLATES /** A (bit more) complex Array Class. Currently the resize policy is follows: when the array is full, the size is doubled. Should we implement that the use can select another policy? This class's Delete methoed does NOTHING. In order to really delete objects use the VectorP class (P stands for Pointer). */ template <class T> class Vector { protected: bool _dealloc; ///< Should we deallocate objects int _size; ///< The number of allocated cells int _count; ///< The number of objects T* _data; ///< The stored objects void _Resize(int new_size) { _data = (T*)realloc(_data, new_size*sizeof(T)); } /** This method deletes a given item. In the base class nothing is done */ virtual void _Delete(int idx) { /* NOP */ } public: /** Constructs the Vector object allocating a predefined number of cells/slots @param def_size the default size of the array */ Vector(int def_size = 4) :_dealloc(false), _size(def_size), _count(0) { _data = (T*)malloc(_size * sizeof(T)); } /** Free the memory. If dealloc is true, each object is deleted with delete. */ virtual ~Vector() { free(_data); } /** Returns the number of elements */ int GetCount() const { return _count; } /** Returns the number of allocated cells */ int GetSize() const { return _size; } /** Allocated the given number of cells. @return false if there are more elements then the given number of cells, so the resize operation cannot be done. */ bool SetSize(int new_size) { if (new_size < _count) return false; _Resize(new_size); return true; } /////////////////////////////////////////////////////////////// // Standard Vector operations (add/delete/find) /////////////////////////////////////////////////////////////// /** Removes all elements */ void Clear() { if (_dealloc) { for(int i = 0; i < _count; i++) _Delete(i); } _count = 0; } /** Removes the n-th element. @param idx the position of the element @return true if it was successfull */ bool Remove(int idx) { if (idx < 0 || idx >= _count) return false; // invalid index if (_dealloc) _Delete(idx); _count--; while (idx < _count) { _data[idx] = _data[idx+1]; idx++; } if (_count*4 < _size) _Resize(_size/2); return true; } /** Adds a new object the end of the array @param obj the object to add @return the index where it was added */ int Add(T obj) { if (_count == _size) _Resize(_size*2); _data[_count++] = obj; return _count-1; } /** Adds a new object at the given position @param obj the object to add @param idx the position where to add @return true if it was successfull */ bool Add(T obj, int idx) { if (idx < 0) idx = 0; if (idx > _count) idx = _count; if (_count == _size) _Resize(_size*2); for(int i = _count; i > idx; i--) _data[i] = _data[i-1]; _data[idx] = obj; _count++; return true; } /** Find the position of the given element. It supports multiple searches: declare an integer variable, set it to 0 and give a pointer to this integer as second argument. The function will store the index where he can continue searching in thi value. @param obj the object to look up @param idx where to start/continue @return the index or -1 if not found */ int Find(const T obj, int* idx = NULL) const { int first = (idx == NULL) ? 0 : *idx; for(int i = first; i < _count; i++) if (obj == _data[i]) { if (idx) *idx = i+1; return i; } return -1; } /** Find the object using a function. The function has two parameters, the first will be the items in the array, the second is a user specified value. @param fn the comparision function @param param the second parameter to the comparision function @param idx where to start/continue @return the index of the object or -1 if not found */ template <class T2> int Find(bool (*fn)(const T obj, T2 obj2), T2 param, int* idx = NULL) { int first = (idx == NULL) ? 0 : *idx; for(int i = first; i < _count; i++) if (fn(_data[i], param)) { if (idx) *idx = i+1; return i; } return -1; } /** A search iterator. This iterator can be usefull to easily search the Vector. Just call the Next() method to get the next object. */ template <class T2> class SearchIterator { protected: int _idx; Vector<T>& _v; bool (*_fn)(const T obj, T2 obj2); T2 _param; public: SearchIterator(Vector<T>& v, bool (*fn)(const T obj, T2 obj2), T2 param) :_idx(0), _v(v), _fn(fn), _param(param) {} T Next() { int pos = _v.Find(_fn, _param, &_idx); if (pos < 0) return (T)0; return _v.At(pos); } const T Next() const { int pos = _v.Find(_fn, _param, &_idx); if (pos < 0) return (T)0; return _v.At(pos); } }; // SearchIterator /** Create a search iterator */ template <class T2> SearchIterator<T2>* Search(bool (*fn)(const T obj, T2 obj2), T2 param) { return new SearchIterator<T2>(*this, fn, param); } /** Returns the n-th item. @param idx the position of the item @return 0 typecasted to T if index is out of bounds, otherwise the item */ T Get(int idx) { if (idx < 0 || idx >= _count) return (T)0; return _data[idx]; } /** Returns the n-th item. @param idx the position of the item @return 0 typecasted to T if index is out of bounds, otherwise the item */ const T Get(int idx) const { if (idx < 0 || idx >= _count) return (T)0; return _data[idx]; } /** Returns a reference to the n-th item. @param idx the position of the item @return the reference to the item, no range checking is done */ T& At(int idx) { return _data[idx]; } /** Returns a constant reference to the n-th item. @param idx the position of the item @return the reference to the item, no range checking is done */ const T& At(int idx) const { return _data[idx]; } /** Returns a reference to the n-th item. @param idx the position of the item @return the reference to the item, no range checking is done */ inline T& operator[](int idx) { return _data[idx]; } /** Returns a constant reference to the n-th item. @param idx the position of the item @return the reference to the item, no range checking is done */ inline const T& operator[](int idx) const { return _data[idx]; } /////////////////////////////////////////////////////////////// // Simulate a stack /////////////////////////////////////////////////////////////// /** Simulate a stack push */ inline void Push(T obj) { Add(obj); } /** Simulate a stack pop. When the stack is empty returns 0 typecasted to T */ inline T Pop() { if (_count == 0) return (T)0; return _data[--_count]; } /** Returns the top of the stack */ inline T Top() const { return _data[_count-1]; } /////////////////////////////////////////////////////////////// // Simulate a queue /////////////////////////////////////////////////////////////// /** Adds an item to the end of the queue */ inline void Queue(T obj) { Add(obj); } /** Removes and returns the item from the head of the queue */ T Dequeue() { T ret = _data[0]; _count--; for(int i = 0; i < _count; i++) _data[i] = _data[i+1]; return ret; } }; // class Vector /** This version of Vector deletes object in the Delete method (if dealloc == true). */ template <class T> class VectorP: public Vector<T> { protected: void _Delete(int idx) { delete _data[idx]; } public: VectorP(int def_size = 4) :Vector<T>(def_size) { _dealloc = true; } ~VectorP() { Clear(); } }; typedef Vector<int> IntVector; typedef Vector<RCHAR*> RCharVector; #endif // USE_TEMPLATES }; // namespace Rtk #endif // _RTK_VECTOR_H_ /** * $Id: Vector.h,v 1.1 2004/02/26 20:05:32 space2 Exp $ ***************************************************************************/ |
From: <sp...@us...> - 2004-02-26 20:18:16
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13628/test/core Modified Files: dict0.cpp Log Message: Minor fixes (eg namespace) Index: dict0.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/test/core/dict0.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dict0.cpp 23 Feb 2004 18:13:36 -0000 1.6 --- dict0.cpp 26 Feb 2004 20:02:16 -0000 1.7 *************** *** 45,48 **** --- 45,50 ---- #include <rtk/Thread.h> + using namespace Rtk; + void DictPrint(const RCHAR* oString, void* oData,void *userData) { *************** *** 50,55 **** } - using namespace Rtk; - int main(int argc, char** argv) { --- 52,55 ---- |
From: <sp...@us...> - 2004-02-26 20:18:16
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13628/rtk Modified Files: rchar_ascii.h rchar.h Log Message: Minor fixes (eg namespace) Index: rchar_ascii.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/rchar_ascii.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rchar_ascii.h 23 Feb 2004 20:16:43 -0000 1.3 --- rchar_ascii.h 26 Feb 2004 20:02:16 -0000 1.4 *************** *** 1,8 **** ! #ifndef INCLUDE_FROM_RCHAR # error "This file must be included from rchar.h" #endif // using 8 bit ASCII characters ! #include <time.h> #define RCHAR char --- 1,9 ---- ! #ifndef INCLUDED_FROM_RCHAR # error "This file must be included from rchar.h" #endif // using 8 bit ASCII characters ! #include <time.h> ! #include <ctype.h> #define RCHAR char *************** *** 55,58 **** --- 56,62 ---- #define rsscanf sscanf #define rscanf scanf + #define rvfscanf vfscanf + #define rvsscanf vsscanf + #define rvscanf vscanf // File *************** *** 86,90 **** // is* ! #define risascii iswascii #define riscntrl iswcntrl #define risgraph iswgraph --- 90,94 ---- // is* ! #define risascii isascii #define riscntrl iswcntrl #define risgraph iswgraph Index: rchar.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/rchar.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** rchar.h 23 Feb 2004 20:16:43 -0000 1.9 --- rchar.h 26 Feb 2004 20:02:16 -0000 1.10 *************** *** 10,13 **** --- 10,15 ---- #include <stdarg.h> + namespace Rtk { + /***************************************************************************** RCHAR - 8 bit or 16 bit character *************** *** 25,27 **** --- 27,31 ---- RCHAR* rstrupr(const RCHAR* str); + } // namespace Rtk + #endif /* _RTK_RCHAR_H_ */ |
From: <sp...@us...> - 2004-02-26 20:18:15
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13628/src/core Modified Files: rchar.cpp Log Message: Minor fixes (eg namespace) Index: rchar.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/rchar.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rchar.cpp 23 Feb 2004 20:16:43 -0000 1.1 --- rchar.cpp 26 Feb 2004 20:02:16 -0000 1.2 *************** *** 4,25 **** #include <stdlib.h> RCHAR* rstrlwr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtolower(*str++); ! } ! return ret; } RCHAR* rstrupr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtoupper(*str++); ! } ! return ret; } --- 4,27 ---- #include <stdlib.h> + namespace Rtk { + RCHAR* rstrlwr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtolower(*str++); ! } ! return ret; } RCHAR* rstrupr(const RCHAR* str) { ! RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); ! RCHAR* ptr = ret; ! while (*str) { *ptr++ = rtoupper(*str++); ! } ! return ret; } *************** *** 28,42 **** static RCHAR* convert(const RCHAR* fmt) { ! RCHAR* fmt2 = rstrdup(fmt); ! RCHAR* ptr = fmt2; ! while (*ptr) { ! if (ptr[0] == '%' && ptr[1] == 's') { ! ptr[1] = 'S'; ! ptr+=2; ! } else { ! ptr++; } ! } ! return fmt2; } --- 30,44 ---- static RCHAR* convert(const RCHAR* fmt) { ! RCHAR* fmt2 = rstrdup(fmt); ! RCHAR* ptr = fmt2; ! while (*ptr) { ! if (ptr[0] == '%' && ptr[1] == 's') { ! ptr[1] = 'S'; ! ptr+=2; ! } else { ! ptr++; ! } } ! return fmt2; } *************** *** 45,95 **** int rvsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswprintf(dst, max_len, fmt2, args); ! free(fmt2); ! return ret; } int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvprintf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(stdout, fmt2, args); ! free(fmt2); ! return ret; } int rsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsnprintf(dst, max_len, fmt, args); ! va_end(args); ! return ret; } int rfprintf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(f, fmt, args); ! va_end(args); ! return ret; } int rprintf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(stdout, fmt, args); ! va_end(args); ! return ret; } --- 47,97 ---- int rvsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswprintf(dst, max_len, fmt2, args); ! free(fmt2); ! return ret; } int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvprintf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwprintf(stdout, fmt2, args); ! free(fmt2); ! return ret; } int rsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsnprintf(dst, max_len, fmt, args); ! va_end(args); ! return ret; } int rfprintf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(f, fmt, args); ! va_end(args); ! return ret; } int rprintf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfprintf(stdout, fmt, args); ! va_end(args); ! return ret; } *************** *** 98,148 **** int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswscanf(src, fmt2, args); ! free(fmt2); ! return ret; } int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvscanf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(stdin, fmt2, args); ! free(fmt2); ! return ret; } int rsscanf(const RCHAR* src, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsscanf(src, fmt, args); ! va_end(args); ! return ret; } int rfscanf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(f, fmt, args); ! va_end(args); ! return ret; } int rscanf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(stdin, fmt, args); ! va_end(args); ! return ret; } --- 100,150 ---- int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vswscanf(src, fmt2, args); ! free(fmt2); ! return ret; } int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(f, fmt2, args); ! free(fmt2); ! return ret; } int rvscanf(const RCHAR* fmt, va_list args) { ! RCHAR* fmt2 = convert(fmt); ! int ret = vfwscanf(stdin, fmt2, args); ! free(fmt2); ! return ret; } int rsscanf(const RCHAR* src, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvsscanf(src, fmt, args); ! va_end(args); ! return ret; } int rfscanf(FILE* f, const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(f, fmt, args); ! va_end(args); ! return ret; } int rscanf(const RCHAR* fmt, ...) { ! va_list args; ! va_start(args, fmt); ! int ret = rvfscanf(stdin, fmt, args); ! va_end(args); ! return ret; } *************** *** 150,151 **** --- 152,155 ---- #endif /* !UNICODE */ + + } // namespace Rtk |
From: <sp...@us...> - 2004-02-26 20:17:16
|
Update of /cvsroot/rtk/rtk/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13417/test Modified Files: test.h Log Message: Changed the output of the tests Index: test.h =================================================================== RCS file: /cvsroot/rtk/rtk/test/test.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test.h 22 Feb 2004 11:50:15 -0000 1.4 --- test.h 26 Feb 2004 20:01:16 -0000 1.5 *************** *** 9,14 **** #include <rtk/rchar.h> ! #define STEP(x) rprintf(_R("$ %s\n"), _R(#x));x ! #define OUT(msg,val) rprintf(_R("> ") _R(msg) _R("\n"), val) #define TITLE(x) \ --- 9,14 ---- #include <rtk/rchar.h> ! #define STEP(x) IncStep();rprintf(_R("$ %s\n"), _R(#x));x ! #define OUT(msg,val) IncStep();rprintf(_R("> ") _R(msg) _R("\n"), val) #define TITLE(x) \ *************** *** 19,21 **** --- 19,30 ---- using namespace Rtk; + static int step_counter = 0; + + static void IncStep() + { + rprintf(_R("[%03d] "), step_counter++); + } + + #define PRINTF(fmt,rest...) rprintf(_R(" ") fmt, #rest) + #endif |
From: <de...@us...> - 2004-02-24 13:36:04
|
Update of /cvsroot/rtk/rtk/ide/devcxx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9843/ide/devcxx Modified Files: librtk.dev librtk_private.h librtk_private.rc Log Message: Latest Dev-C++ project files with File (IO), Array, etc Index: librtk.dev =================================================================== RCS file: /cvsroot/rtk/rtk/ide/devcxx/librtk.dev,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** librtk.dev 22 Feb 2004 10:21:27 -0000 1.8 --- librtk.dev 24 Feb 2004 13:21:40 -0000 1.9 *************** *** 2,6 **** FileName=librtk.dev Name=librtk ! UnitCount=24 Type=3 Ver=1 --- 2,6 ---- FileName=librtk.dev Name=librtk ! UnitCount=27 Type=3 Ver=1 *************** *** 44,48 **** Minor=1 Release=1 ! Build=44 LanguageID=1033 CharsetID=1252 --- 44,52 ---- Minor=1 Release=1 ! <<<<<<< librtk.dev ! Build=35 ! ======= ! Build=47 ! >>>>>>> 1.8 LanguageID=1033 CharsetID=1252 *************** *** 288,289 **** --- 292,323 ---- BuildCmd= + [Unit25] + FileName=..\..\rtk\File.h + CompileCpp=1 + Folder=librtk + Compile=1 + Link=1 + Priority=1000 + OverrideBuildCmd=0 + BuildCmd= + + [Unit26] + FileName=..\..\rtk\IO.h + CompileCpp=1 + Folder=librtk + Compile=1 + Link=1 + Priority=1000 + OverrideBuildCmd=0 + BuildCmd= + + [Unit27] + FileName=..\..\src\core\platform\win32\File.cpp + CompileCpp=1 + Folder=librtk + Compile=1 + Link=1 + Priority=1000 + OverrideBuildCmd=0 + BuildCmd= + Index: librtk_private.h =================================================================== RCS file: /cvsroot/rtk/rtk/ide/devcxx/librtk_private.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** librtk_private.h 22 Feb 2004 10:21:27 -0000 1.8 --- librtk_private.h 24 Feb 2004 13:21:41 -0000 1.9 *************** *** 6,14 **** // VERSION DEFINITIONS ! #define VER_STRING "0.1.1.44" #define VER_MAJOR 0 #define VER_MINOR 1 #define VER_RELEASE 1 ! #define VER_BUILD 44 #define COMPANY_NAME "" #define FILE_VERSION "" --- 6,14 ---- // VERSION DEFINITIONS ! #define VER_STRING "0.1.1.47" #define VER_MAJOR 0 #define VER_MINOR 1 #define VER_RELEASE 1 ! #define VER_BUILD 47 #define COMPANY_NAME "" #define FILE_VERSION "" Index: librtk_private.rc =================================================================== RCS file: /cvsroot/rtk/rtk/ide/devcxx/librtk_private.rc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** librtk_private.rc 22 Feb 2004 10:21:27 -0000 1.8 --- librtk_private.rc 24 Feb 2004 13:21:41 -0000 1.9 *************** *** 9,14 **** // 1 VERSIONINFO ! FILEVERSION 0,1,1,44 ! PRODUCTVERSION 0,1,1,44 FILETYPE VFT_DLL { --- 9,14 ---- // 1 VERSIONINFO ! FILEVERSION 0,1,1,47 ! PRODUCTVERSION 0,1,1,47 FILETYPE VFT_DLL { *************** *** 28,30 **** --- 28,34 ---- } } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0409, 1252 + } } |
From: <de...@us...> - 2004-02-23 22:50:25
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9383/src/core Modified Files: CMakeLists.txt Log Message: Improved CMakeLists.txt files ... :) Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/CMakeLists.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CMakeLists.txt 23 Feb 2004 20:16:43 -0000 1.8 --- CMakeLists.txt 23 Feb 2004 22:36:09 -0000 1.9 *************** *** 45,50 **** --- 45,59 ---- ENDIF(NOT CMAKE_COMPILER_IS_MINGW) + # This is good for VisualStudio ... + SOURCE_GROUP(librtk FILES ${RTK_CORE_SFILES}) + ADD_LIBRARY(${RTK_LIBRTK} STATIC ${RTK_CORE_SFILES}) + ## FLAGS + # How each, separate file in CORE RTK library should be compiles. + # ie. which flags should be used. + # T0D0: See if there is option for separate CXX and C flags, and use + # CXX flags instead. + #################################################################### IF (RTK_OPT_DEBUG) SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} *************** *** 59,70 **** ) ENDIF (RTK_OPT_UNICODE) ! ! IF (NOT WIN32) ! INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) ! CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) ! IF (HAVE_UNISTD_H) ! ADD_DEFINITIONS(-DHAVE_UNISTD_H) ! ENDIF (HAVE_UNISTD_H) ! ENDIF (NOT WIN32) ## --- 68,81 ---- ) ENDIF (RTK_OPT_UNICODE) ! ############################################################ FLAGS ## ! ######### ! ! ######### ! ## LOG ############################################################ ! IF (RTK_OPT_BCLOG) ! FILE(APPEND ${RTK_BC_LOGFILE} "Files that go into ${RTK_LIBRTK}.a: ${RTK_CORE_SFILES}\n") ! ENDIF (RTK_OPT_BCLOG) ! ############################################################ LOG ## ! ######### ## |
From: <de...@us...> - 2004-02-23 22:50:24
|
Update of /cvsroot/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9383 Modified Files: CMakeLists.txt Log Message: Improved CMakeLists.txt files ... :) Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/CMakeLists.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CMakeLists.txt 21 Feb 2004 23:49:04 -0000 1.8 --- CMakeLists.txt 23 Feb 2004 22:36:09 -0000 1.9 *************** *** 30,36 **** PROJECT(RTK C++) SUBDIRS(src test) INCLUDE_DIRECTORIES(${RTK_SOURCE_DIR} ${RTK_SOURCE_DIR}/rtk . ..) - MESSAGE("Root of RTK source tree: ${RTK_SOURCE_DIR}") ## --- 30,39 ---- PROJECT(RTK C++) + # We will INSIST on CMake version 1.8 and higher... + CMAKE_MINIMUM_REQUIRED(VERSION 1.8) + SUBDIRS(src test) + INCLUDE_DIRECTORIES(${RTK_SOURCE_DIR} ${RTK_SOURCE_DIR}/rtk . ..) ## *************** *** 38,48 **** #################################################################### OPTION(RTK_OPT_DEBUG ! "Builder RTK using debugging code" ! ON) OPTION(RTK_OPT_UNICODE ! "Build RTK with UNICODE support" ! ON) ## --- 41,58 ---- #################################################################### + # Shall Debug symbols be in produced libraries/executables? OPTION(RTK_OPT_DEBUG ! "Build RTK using debugging code" ! ON) + # Determines whather RTK will be built with or without UNICODE support OPTION(RTK_OPT_UNICODE ! "Build RTK with UNICODE support" ! ON) ! ! # Create LOG file ! OPTION(RTK_OPT_BCLOG ! "Create LOG file during the build process" ! ON) ## *************** *** 61,73 **** #################################################################### ! IF(RTK_OPT_UNICODE) ADD_DEFINITIONS(-DUNICODE=1) ! SET(BUILD_CONF_UNICODE 1) SET(RTK_LIB_SUFFIX _u) ! ELSE(RTK_OPT_UNICODE) SET(RTK_LIB_SUFFIX ) ! ENDIF(RTK_OPT_UNICODE) ! IF(WIN32) IF(CMAKE_COMPILER_IS_MINGW) SET(CMAKE_CXX_COMPILER mingw32-g++.exe) --- 71,86 ---- #################################################################### ! IF (RTK_OPT_UNICODE) ADD_DEFINITIONS(-DUNICODE=1) ! SET(RTK_BC_UNICODE 1) SET(RTK_LIB_SUFFIX _u) ! ELSE (RTK_OPT_UNICODE) SET(RTK_LIB_SUFFIX ) ! ENDIF (RTK_OPT_UNICODE) ! # g++ is default C++ compiler ! SET(CMAKE_CXX_COMPILER g++) ! ! IF (WIN32) IF(CMAKE_COMPILER_IS_MINGW) SET(CMAKE_CXX_COMPILER mingw32-g++.exe) *************** *** 83,89 **** ADD_DEFINITIONS(-D_UNICODE) # Needed for Windows UNICODE support ENDIF(BUILD_CONF_UNICODE) - ELSE(WIN32) SET(CMAKE_CXX_COMPILER g++) ! ENDIF(WIN32) ADD_DEFINITIONS(-D_RTK_HAVE_CONF_H_) --- 96,101 ---- ADD_DEFINITIONS(-D_UNICODE) # Needed for Windows UNICODE support ENDIF(BUILD_CONF_UNICODE) SET(CMAKE_CXX_COMPILER g++) ! ENDIF (WIN32) ADD_DEFINITIONS(-D_RTK_HAVE_CONF_H_) *************** *** 99,103 **** --- 111,127 ---- SET(RTK_LIBRTK rtk${RTK_LIB_SUFFIX}) + FILE(APPEND filename "message to write"... ) + + ## + # Log + #################################################################### + IF (RTK_OPT_BCLOG) + SET(RTK_BC_LOGFILE ${RTK_SOURCE_DIR}/doc/rtk_bc_log.txt) + # Note: This must be THE FIRST WRITE to logfile! :) + FILE(WRITE ${RTK_BC_LOGFILE} "Root of RTK source tree: ${RTK_SOURCE_DIR}\n") + FILE(APPEND ${RTK_BC_LOGFILE} "Static RTK CORE library: ${RTK_LIBRTK}.a\n") + ENDIF (RTK_OPT_BCLOG) + ## # $Id$ |
From: <de...@us...> - 2004-02-23 22:50:09
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9383/test/core Modified Files: CMakeLists.txt Log Message: Improved CMakeLists.txt files ... :) Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/test/core/CMakeLists.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CMakeLists.txt 23 Feb 2004 20:16:43 -0000 1.4 --- CMakeLists.txt 23 Feb 2004 22:36:09 -0000 1.5 *************** *** 41,48 **** FOREACH(NAME debug0 list0 variant0 array0 dict0 error0 string0) ! ADD_EXECUTABLE(test_core_${NAME} ${NAME}.cpp) ! TARGET_LINK_LIBRARIES(test_core_${NAME} ${RTK_LIBRTK}) ENDFOREACH(NAME) ## # $Id$ --- 41,71 ---- FOREACH(NAME debug0 list0 variant0 array0 dict0 error0 string0) ! ADD_EXECUTABLE(test_core_${NAME} ${NAME}.cpp) ! TARGET_LINK_LIBRARIES(test_core_${NAME} ${RTK_LIBRTK}) ENDFOREACH(NAME) + # T0D0: debug test + #ADD_EXECUTABLE(test_core_debug0 debug0.cpp) + #TARGET_LINK_LIBRARIES(test_core_debug0 rtk) + + # T0D0: flags test + # ADD_EXECUTABLE(test_core_flags0 flags0.cpp) + # TARGET_LINK_LIBRARIES(test_core_flags0 rtk) + + # T0D0: error test + #ADD_EXECUTABLE(test_core_error0 error0.cpp) + #TARGET_LINK_LIBRARIES(test_core_error0 rtk) + + # Dict test + #ADD_EXECUTABLE(test_core_dict0 dict0.cpp) + #TARGET_LINK_LIBRARIES(test_core_dict0 ${RTK_LIBRTK}) + + ######### + ## LOG ############################################################ + IF (RTK_OPT_BCLOG) + FILE(APPEND ${RTK_BC_LOGFILE} "Test ${RTK_LIBRTK}.a again...\n") + ENDIF (RTK_OPT_BCLOG) + ############################################################ LOG ## + ######### ## # $Id$ |
From: <sp...@us...> - 2004-02-23 20:30:25
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7855/rtk Modified Files: rchar.h rchar_ascii.h rchar_unicode.h Log Message: Made a temporary solution for the printf problemt It now converts %s to %S, its good until we get a better one Index: rchar.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/rchar.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rchar.h 22 Feb 2004 10:21:29 -0000 1.8 --- rchar.h 23 Feb 2004 20:16:43 -0000 1.9 *************** *** 8,11 **** --- 8,12 ---- #include <wchar.h> #include <wctype.h> + #include <stdarg.h> /***************************************************************************** *************** *** 13,16 **** --- 14,18 ---- *****************************************************************************/ + #define INCLUDED_FROM_RCHAR 1 #ifdef UNICODE # include "rchar_unicode.h" *************** *** 18,21 **** --- 20,27 ---- # include "rchar_ascii.h" #endif /* UNICODE */ + #undef INCLUDED_FROM_RCHAR + + RCHAR* rstrlwr(const RCHAR* str); + RCHAR* rstrupr(const RCHAR* str); #endif /* _RTK_RCHAR_H_ */ Index: rchar_ascii.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/rchar_ascii.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rchar_ascii.h 22 Feb 2004 11:50:15 -0000 1.2 --- rchar_ascii.h 23 Feb 2004 20:16:43 -0000 1.3 *************** *** 1,2 **** --- 1,5 ---- + #ifndef INCLUDE_FROM_RCHAR + # error "This file must be included from rchar.h" + #endif // using 8 bit ASCII characters *************** *** 17,20 **** --- 20,24 ---- // Get #define rfgets fgets + // Not recomended #define rgets gets #define rgetchar getchar *************** *** 40,48 **** #define rfprintf fprintf #define rsnprintf snprintf ! #define rsprintf sprintf #define rprintf printf #define rvfprintf vfprintf #define rvsnprintf vsnprintf ! #define rvsprintf vsprintf #define rvprintf vprintf --- 44,52 ---- #define rfprintf fprintf #define rsnprintf snprintf ! //#define rsprintf sprintf #define rprintf printf #define rvfprintf vfprintf #define rvsnprintf vsnprintf ! //#define rvsprintf vsprintf #define rvprintf vprintf *************** *** 95,100 **** #define rtolower towlower #define rtoupper towupper ! #define rstrlwr strlwr ! #define rstrupr strupr #define REOF EOF --- 99,104 ---- #define rtolower towlower #define rtoupper towupper ! //#define rstrlwr strlwr ! //#define rstrupr strupr #define REOF EOF Index: rchar_unicode.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/rchar_unicode.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rchar_unicode.h 22 Feb 2004 11:50:15 -0000 1.2 --- rchar_unicode.h 23 Feb 2004 20:16:43 -0000 1.3 *************** *** 1,2 **** --- 1,5 ---- + #ifndef INCLUDED_FROM_RCHAR + # error "This file must be included from rchar.h" + #endif // using 16 bit (usually) unicode characters *************** *** 35,39 **** // Get #define rfgets fgetws ! #define rgets getws #define rgetchar getwchar #define rungetc ungetwc --- 38,43 ---- // Get #define rfgets fgetws ! //not recomended! ! //#define rgets getws #define rgetchar getwchar #define rungetc ungetwc *************** *** 43,53 **** #define rfputs fputws #define rputtchar putwchar ! #define rputs putws // str <-> number conversions #define ritoa _itow #define rltoa _ltow #define ratoi _wtoi #define ratol _wtol #define rultoa _ultow #define rstrtod wcstod --- 47,60 ---- #define rfputs fputws #define rputtchar putwchar ! //#define rputs putws ! inline int rputs(const RCHAR* str) { fputws(str, stdout); } // str <-> number conversions + // todo: what about linux? #define ritoa _itow #define rltoa _ltow #define ratoi _wtoi #define ratol _wtol + #define rultoa _ultow #define rstrtod wcstod *************** *** 56,69 **** // printf like ! #define rfprintf fwprintf ! #define rsnprintf snwprintf ! #define rsprintf swprintf ! #define rprintf wprintf ! #define rvfprintf vfwprintf ! #define rvsnprintf vsnwprintf ! #define rvsprintf vswprintf ! #define rvprintf vwprintf // scanf's #define rfscanf fwscanf #define rsscanf swscanf --- 63,81 ---- // printf like ! //the s version without n is not recomended! ! int rvsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, va_list args); ! int rvfprintf(FILE* f, const RCHAR* fmt, va_list args); ! int rvprintf(const RCHAR* fmt, va_list args); ! int rsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, ...); ! int rfprintf(FILE* f, const RCHAR* fmt, ...); ! int rprintf(const RCHAR* fmt, ...); // scanf's + int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args); + int rvfscanf(FILE* f, const RCHAR* fmt, va_list args); + int rvscanf(const RCHAR* fmt, va_list args); + int rsscanf(const RCHAR* src, const RCHAR* fmt, ...); + int rfscanf(FILE* f, const RCHAR* fmt, ...); + int rscanf(const RCHAR* fmt, ...); #define rfscanf fwscanf #define rsscanf swscanf *************** *** 71,74 **** --- 83,87 ---- // File + // todo: what about linux? #define rfdopen _wfdopen #define rfopen _wfopen *************** *** 90,98 **** #define rstrncmp wcsncmp #define rstrncpy wcsncpy ! #define rstrnset wcsnset #define rstrpbrk wcspbrk #define rstrrchr wcsrchr #define rstrrev wcsrev ! #define rstrset wcsset #define rstrspn wcsspn #define rstrstr wcsstr --- 103,111 ---- #define rstrncmp wcsncmp #define rstrncpy wcsncpy ! #define rstrnset wmemset #define rstrpbrk wcspbrk #define rstrrchr wcsrchr #define rstrrev wcsrev ! #define rstrset wmemset #define rstrspn wcsspn #define rstrstr wcsstr *************** *** 100,104 **** // is* ! #define risascii iswascii #define riscntrl iswcntrl #define risgraph iswgraph --- 113,118 ---- // is* ! //#define risascii iswascii ! inline int risascii(RCHAR c) { return !(c & 0x7f); } #define riscntrl iswcntrl #define risgraph iswgraph *************** *** 113,118 **** #define rtolower towlower #define rtoupper towupper ! #define rstrlwr _wcslwr ! #define rstrupr _wcsupr #define REOF WEOF --- 127,132 ---- #define rtolower towlower #define rtoupper towupper ! //#define rstrlwr _wcslwr ! //#define rstrupr _wcsupr #define REOF WEOF |
From: <sp...@us...> - 2004-02-23 20:30:25
|
Update of /cvsroot/rtk/rtk/test/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7855/test/core Modified Files: CMakeLists.txt string0.cpp Log Message: Made a temporary solution for the printf problemt It now converts %s to %S, its good until we get a better one Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/test/core/CMakeLists.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CMakeLists.txt 23 Feb 2004 18:13:36 -0000 1.3 --- CMakeLists.txt 23 Feb 2004 20:16:43 -0000 1.4 *************** *** 40,44 **** LINK_DIRECTORIES(${RTK_SOURCE_DIR}/lib ${RTK_SOURCE_DIR}/src/core/lib ${RTK_SOURCE_DIR}/src/core) ! FOREACH(NAME debug0 list0 variant0 array0 dict0 error0) ADD_EXECUTABLE(test_core_${NAME} ${NAME}.cpp) TARGET_LINK_LIBRARIES(test_core_${NAME} ${RTK_LIBRTK}) --- 40,44 ---- LINK_DIRECTORIES(${RTK_SOURCE_DIR}/lib ${RTK_SOURCE_DIR}/src/core/lib ${RTK_SOURCE_DIR}/src/core) ! FOREACH(NAME debug0 list0 variant0 array0 dict0 error0 string0) ADD_EXECUTABLE(test_core_${NAME} ${NAME}.cpp) TARGET_LINK_LIBRARIES(test_core_${NAME} ${RTK_LIBRTK}) Index: string0.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/test/core/string0.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** string0.cpp 23 Feb 2004 18:13:36 -0000 1.9 --- string0.cpp 23 Feb 2004 20:16:43 -0000 1.10 *************** *** 123,127 **** // Get rfgets(0,0,0); - rgets(0); rgetchar(); rungetc(0,0); --- 123,126 ---- *************** *** 134,142 **** // str <-> number conversions ! ritoa(0,0,0); ! rltoa(0,0,0); ! rultoa(0,0,0); ! ratoi(0); ! ratol(0); rstrtod(0,0); rstrtol(0,0,0); --- 133,141 ---- // str <-> number conversions ! // ritoa(0,0,0); ! // rltoa(0,0,0); ! // rultoa(0,0,0); ! // ratoi(0); ! // ratol(0); rstrtod(0,0); rstrtol(0,0,0); *************** *** 146,154 **** rfprintf(0,0); rsnprintf(0,0,0); - rsprintf(0,0); rprintf(0); rvfprintf(0,0,0); rvsnprintf(0,0,0,0); - rvsprintf(0,0,0); rvprintf(0,0); --- 145,151 ---- *************** *** 157,165 **** rsscanf(0,0); rscanf(0,0); // File ! rfdopen(0,0); ! rfopen(0,0); ! rfreopen(0,0,0); // str --- 154,165 ---- rsscanf(0,0); rscanf(0,0); + rvfscanf(0,0,0); + rvsscanf(0,0,0); + rvscanf(0,0); // File ! // rfdopen(0,0); ! // rfopen(0,0); ! // rfreopen(0,0,0); // str *************** *** 178,189 **** rstrncmp(0,0,0); rstrncpy(0,0,0); ! rstrnset(0,0,0); rstrpbrk(_R(""),0); rstrrchr(_R(""),0); ! rstrrev(0); ! rstrset(0,0); rstrspn(0,0); rstrstr(_R(""), _R("")); ! rstrtok(0,0); // is* --- 178,189 ---- rstrncmp(0,0,0); rstrncpy(0,0,0); ! // rstrnset(0,0,0); ??? rstrpbrk(_R(""),0); rstrrchr(_R(""),0); ! // rstrrev(0); ??? ! // rstrset(0,0); ??? rstrspn(0,0); rstrstr(_R(""), _R("")); ! // rstrtok(0,0); <- multi-thread safe version is needed!!! // is* |
From: <sp...@us...> - 2004-02-23 20:30:24
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7855/src/core Modified Files: CMakeLists.txt Added Files: rchar.cpp Log Message: Made a temporary solution for the printf problemt It now converts %s to %S, its good until we get a better one --- NEW FILE: rchar.cpp --- #include <rtk/rchar.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> RCHAR* rstrlwr(const RCHAR* str) { RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); RCHAR* ptr = ret; while (*str) { *ptr++ = rtolower(*str++); } return ret; } RCHAR* rstrupr(const RCHAR* str) { RCHAR* ret = (RCHAR*)malloc(sizeof(RCHAR)*rstrlen(str)); RCHAR* ptr = ret; while (*str) { *ptr++ = rtoupper(*str++); } return ret; } #if UNICODE static RCHAR* convert(const RCHAR* fmt) { RCHAR* fmt2 = rstrdup(fmt); RCHAR* ptr = fmt2; while (*ptr) { if (ptr[0] == '%' && ptr[1] == 's') { ptr[1] = 'S'; ptr+=2; } else { ptr++; } } return fmt2; } // printf int rvsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, va_list args) { RCHAR* fmt2 = convert(fmt); int ret = vswprintf(dst, max_len, fmt2, args); free(fmt2); return ret; } int rvfprintf(FILE* f, const RCHAR* fmt, va_list args) { RCHAR* fmt2 = convert(fmt); int ret = vfwprintf(f, fmt2, args); free(fmt2); return ret; } int rvprintf(const RCHAR* fmt, va_list args) { RCHAR* fmt2 = convert(fmt); int ret = vfwprintf(stdout, fmt2, args); free(fmt2); return ret; } int rsnprintf(RCHAR* dst, int max_len, const RCHAR* fmt, ...) { va_list args; va_start(args, fmt); int ret = rvsnprintf(dst, max_len, fmt, args); va_end(args); return ret; } int rfprintf(FILE* f, const RCHAR* fmt, ...) { va_list args; va_start(args, fmt); int ret = rvfprintf(f, fmt, args); va_end(args); return ret; } int rprintf(const RCHAR* fmt, ...) { va_list args; va_start(args, fmt); int ret = rvfprintf(stdout, fmt, args); va_end(args); return ret; } // scanf int rvsscanf(const RCHAR* src, const RCHAR* fmt, va_list args) { RCHAR* fmt2 = convert(fmt); int ret = vswscanf(src, fmt2, args); free(fmt2); return ret; } int rvfscanf(FILE* f, const RCHAR* fmt, va_list args) { RCHAR* fmt2 = convert(fmt); int ret = vfwscanf(f, fmt2, args); free(fmt2); return ret; } int rvscanf(const RCHAR* fmt, va_list args) { RCHAR* fmt2 = convert(fmt); int ret = vfwscanf(stdin, fmt2, args); free(fmt2); return ret; } int rsscanf(const RCHAR* src, const RCHAR* fmt, ...) { va_list args; va_start(args, fmt); int ret = rvsscanf(src, fmt, args); va_end(args); return ret; } int rfscanf(FILE* f, const RCHAR* fmt, ...) { va_list args; va_start(args, fmt); int ret = rvfscanf(f, fmt, args); va_end(args); return ret; } int rscanf(const RCHAR* fmt, ...) { va_list args; va_start(args, fmt); int ret = rvfscanf(stdin, fmt, args); va_end(args); return ret; } #else /* !UNICODE */ #endif /* !UNICODE */ Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/CMakeLists.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CMakeLists.txt 22 Feb 2004 19:02:06 -0000 1.7 --- CMakeLists.txt 23 Feb 2004 20:16:43 -0000 1.8 *************** *** 36,39 **** --- 36,40 ---- SList.cpp Dict.cpp debug.cpp error.cpp String.cpp Array.cpp + rchar.cpp ) |