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: Dejan L. <de...@us...> - 2004-06-11 16:55:26
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20056/rtk Modified Files: IO.h Log Message: Added comment for class IO . Index: IO.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/IO.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IO.h 7 Jun 2004 22:00:57 -0000 1.5 --- IO.h 11 Jun 2004 16:55:18 -0000 1.6 *************** *** 52,55 **** --- 52,56 ---- /** * Base IO class. + * @note This class shouldn't be used directly. */ class RTK_API IO |
From: Dejan L. <de...@us...> - 2004-06-11 16:51:08
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16186/rtk Modified Files: Buffer.h Log Message: Few new methods added. Index: Buffer.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Buffer.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Buffer.h 11 Jun 2004 15:35:53 -0000 1.5 --- Buffer.h 11 Jun 2004 16:50:58 -0000 1.6 *************** *** 51,54 **** --- 51,58 ---- #include <rtk/rtkdef.h> + #if _DEBUG + #include <rtk/String.h> + #endif + namespace Rtk { *************** *** 58,64 **** class RTK_API Buffer { ! uchar* _data; ! uint _allocated; ! uint _size; /** --- 62,68 ---- class RTK_API Buffer { ! uchar* _data; /// Internal pointer to Buffer memory-block. ! uint _allocated; /// Size of Buffer object in bytes. ! uint _size; /// Number of data-bytes in Buffer object. /** *************** *** 74,78 **** Buffer():_size(0) { ! _data = new uchar[_allocated = RTK_BUFFER_SIZE]; } --- 78,83 ---- Buffer():_size(0) { ! _data = (uchar*) malloc(_allocated = RTK_BUFFER_SIZE); ! Fill('\0'); } *************** *** 105,108 **** --- 110,120 ---- */ void Write(const uchar* arg_byte_array, uint arg_num); + + void Buffer::Fill(uchar arg_char); + + #if _DEBUG + void FromFile(const String& arg_fname); + void ToFile(const String& arg_fname) const; + #endif }; // Buffer }; // Rtk namespace |
From: Dejan L. <de...@us...> - 2004-06-11 15:52:33
|
Update of /cvsroot/rtk/rtk/ide/devcxx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27334/ide/devcxx Modified Files: librtk.dev librtk_private.h librtk_private.rc Log Message: Latest Dev-C++ RTK files, with added PriorityQueue. Index: librtk_private.h =================================================================== RCS file: /cvsroot/rtk/rtk/ide/devcxx/librtk_private.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** librtk_private.h 1 Apr 2004 09:58:18 -0000 1.12 --- librtk_private.h 11 Jun 2004 15:52:23 -0000 1.13 *************** *** 6,14 **** // VERSION DEFINITIONS ! #define VER_STRING "0.1.1.69" #define VER_MAJOR 0 #define VER_MINOR 1 #define VER_RELEASE 1 ! #define VER_BUILD 69 #define COMPANY_NAME "" #define FILE_VERSION "" --- 6,14 ---- // VERSION DEFINITIONS ! #define VER_STRING "0.1.1.72" #define VER_MAJOR 0 #define VER_MINOR 1 #define VER_RELEASE 1 ! #define VER_BUILD 72 #define COMPANY_NAME "" #define FILE_VERSION "" Index: librtk_private.rc =================================================================== RCS file: /cvsroot/rtk/rtk/ide/devcxx/librtk_private.rc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** librtk_private.rc 1 Apr 2004 09:58:18 -0000 1.12 --- librtk_private.rc 11 Jun 2004 15:52:23 -0000 1.13 *************** *** 9,14 **** // 1 VERSIONINFO ! FILEVERSION 0,1,1,69 ! PRODUCTVERSION 0,1,1,69 FILETYPE VFT_DLL { --- 9,14 ---- // 1 VERSIONINFO ! FILEVERSION 0,1,1,72 ! PRODUCTVERSION 0,1,1,72 FILETYPE VFT_DLL { Index: librtk.dev =================================================================== RCS file: /cvsroot/rtk/rtk/ide/devcxx/librtk.dev,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** librtk.dev 8 Mar 2004 19:55:22 -0000 1.11 --- librtk.dev 11 Jun 2004 15:52:23 -0000 1.12 *************** *** 2,6 **** FileName=librtk.dev Name=librtk ! UnitCount=36 Type=3 Ver=1 --- 2,6 ---- FileName=librtk.dev Name=librtk ! UnitCount=38 Type=3 Ver=1 *************** *** 19,23 **** ObjectOutput=..\..\obj OverrideOutput=0 ! OverrideOutputName=librtk.dll HostApplication= Folders= --- 19,23 ---- ObjectOutput=..\..\obj OverrideOutput=0 ! OverrideOutputName=rtk.dll HostApplication= Folders= *************** *** 28,32 **** SupportXPThemes=0 CompilerSet=0 ! CompilerSettings=000000000000100000 [Unit2] --- 28,32 ---- SupportXPThemes=0 CompilerSet=0 ! CompilerSettings=0000000000001000000000 [Unit2] *************** *** 47,51 **** Build=35 ======= ! Build=68 >>>>>>> 1.8 LanguageID=1033 --- 47,51 ---- Build=35 ======= ! Build=71 >>>>>>> 1.8 LanguageID=1033 *************** *** 412,413 **** --- 412,433 ---- BuildCmd= + [Unit37] + FileName=..\..\src\core\Buffer.cpp + CompileCpp=1 + Folder=librtk + Compile=1 + Link=1 + Priority=1000 + OverrideBuildCmd=0 + BuildCmd= + + [Unit38] + FileName=..\..\rtk\PriorityQueue.h + CompileCpp=1 + Folder=librtk + Compile=1 + Link=1 + Priority=1000 + OverrideBuildCmd=0 + BuildCmd= + |
From: Dejan L. <de...@us...> - 2004-06-11 15:43:07
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18315/src/core Modified Files: String.cpp Variant.cpp Vector.cpp Log Message: Added header/footer to these files. Index: Vector.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/Vector.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Vector.cpp 26 Feb 2004 21:52:28 -0000 1.1 --- Vector.cpp 11 Jun 2004 15:42:58 -0000 1.2 *************** *** 1,2 **** --- 1,43 ---- + /** + * + * 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$ + ***** + * Authors (chronological order): + * Pal Szasz, sp...@at... (sp...@rt...) + * Contributors (chronological order): + * $fname $lname, $email + ***** + * T0D0 List: + * - + ***************************************************************************/ + #include <rtk/Vector.h> *************** *** 152,153 **** --- 193,198 ---- } // namespace Rtk + + /** + * $Id$ + ***************************************************************************/ Index: String.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/String.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** String.cpp 17 Mar 2004 19:37:09 -0000 1.6 --- String.cpp 11 Jun 2004 15:42:58 -0000 1.7 *************** *** 1,2 **** --- 1,43 ---- + /** + * + * 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$ + ***** + * Authors (chronological order): + * Mikko Lahteenmaki, mikko§rtk.cx + * Contributors (chronological order): + * $fname $lname, $email + ***** + * T0D0 List: + * - + ***************************************************************************/ + #include <rtk/String.h> *************** *** 585,586 **** --- 626,631 ---- }; /* namespace Rtk */ + + /** + * $Id$ + ***************************************************************************/ Index: Variant.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/Variant.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Variant.cpp 18 Jan 2004 20:17:07 -0000 1.2 --- Variant.cpp 11 Jun 2004 15:42:58 -0000 1.3 *************** *** 118,120 **** } ! } // namespace Rtk --- 118,124 ---- } ! }; // namespace Rtk ! ! /** ! * $Id$ ! ***************************************************************************/ |
From: Dejan L. <de...@us...> - 2004-06-11 15:38:04
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14004/src/core Modified Files: Buffer.cpp Log Message: New implementation of Buffer. Index: Buffer.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/Buffer.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Buffer.cpp 7 Jun 2004 17:09:54 -0000 1.3 --- Buffer.cpp 11 Jun 2004 15:37:46 -0000 1.4 *************** *** 32,36 **** ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejanrtk.cx) * Contributors (chronological order): * $fname $lname, $email --- 32,36 ---- ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (de...@rt...) * Contributors (chronological order): * $fname $lname, $email *************** *** 44,49 **** namespace Rtk { ! ! // Nothing here for now... }; // Rtk --- 44,68 ---- namespace Rtk { ! uchar* Buffer::Allocate(uint arg_num) ! { ! uint newsize = _size + arg_num; ! if (newsize > _allocated) ! { ! _allocated *= 2; ! if (_allocated < newsize) ! _allocated = newsize; ! uchar *newdata = new unsigned char[_allocated]; ! memcpy(newdata, _data, _size); ! delete[] _data; ! _data = newdata; ! } // if ! return _data + _size; ! } ! ! void Buffer::Write(const uchar* arg_byte_array, uint arg_num) ! { ! memcpy(Allocate(arg_num), arg_byte_array, arg_num); ! _size += arg_num; ! } // Write() }; // Rtk |
From: Dejan L. <de...@us...> - 2004-06-11 15:36:12
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12629/rtk Modified Files: Buffer.h rtkdef.h Log Message: New implementation of Buffer. Added RTK_BUFFER_SIZE definition to rtkdef.h . Index: rtkdef.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/rtkdef.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** rtkdef.h 9 Mar 2004 17:01:27 -0000 1.10 --- rtkdef.h 11 Jun 2004 15:35:53 -0000 1.11 *************** *** 104,107 **** --- 104,109 ---- typedef unsigned short ushort; + #define RTK_BUFFER_SIZE 1024; /// Default size of RTK Buffer object. + #endif Index: Buffer.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Buffer.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Buffer.h 6 Jun 2004 20:54:07 -0000 1.4 --- Buffer.h 11 Jun 2004 15:35:53 -0000 1.5 *************** *** 53,101 **** namespace Rtk { ! /** Buffer implementation. ! * T0D0: Description for Buffer class */ class RTK_API Buffer { ! public: ! /** ! * Default Buffer constructor. ! */ ! Buffer() : _size(0), _data(0) {} /** ! * Another Buffer constructor. */ ! Buffer(const uchar* data, uint size) ! : _size(size), _data(new uchar[_size]) ! { memcpy(_data, data, _size); } /** ! * Buffer's copy constructor. */ ! Buffer(const Buffer& buf) : _size(buf._size), _data(new char[_size]) ! { memcpy(_data, buf._data, _size); } ! /** ! * Buffer's destructor */ ! ~Buffer() { delete[] _data; } ! void operator=(const Buffer& buf) ! { ! delete[] _data; ! _size = buf._size; ! _data = new char[_size]; ! memcpy(_data, buf._data, _size); ! } /** ! * Returns pointer to Buffer's data. */ ! const uchar* Data() const { return _data; } ! ! private: ! uint _size; /// Number of elements in Buffer ! uchar* _data; /// Data }; // Buffer }; // Rtk namespace --- 53,108 ---- namespace Rtk { ! /** Dynamic Buffer implementation. ! * @author de...@rt... */ class RTK_API Buffer { ! uchar* _data; ! uint _allocated; ! uint _size; /** ! * Allocates arg_num bytes and returns pointer to new memory block. ! * @returns uchar* pointer to new memory block. */ ! uchar* Allocate(uint arg_num); ! ! public: ! /** ! * Default Buffer constructor. ! */ ! Buffer():_size(0) ! { ! _data = new uchar[_allocated = RTK_BUFFER_SIZE]; ! } ! ! ~Buffer() { delete[] _data; } /** ! * Returns pointer to internal data memory-block. ! * @returns pointer to the data buffer. */ ! const uchar* Data() ! { ! if (_size == _allocated) ! Allocate(1); ! _data[_size] = '\0'; // i think this would be usefull ! return _data; ! } // Data() ! /** Returns current size of Buffer. ! * @returns uint current size of Buffer. */ ! uint GetSize() const { return _size; } ! /** Writes one single byte to the Buffer object ! * @param c uchar Byte to be written. ! */ ! void Write(uchar c) { *Allocate(1) = c; ++_size; } /** ! * Writes arbitrary number of bytes to the Buffer object. */ ! void Write(const uchar* arg_byte_array, uint arg_num); }; // Buffer }; // Rtk namespace |
From: Dejan L. <le...@us...> - 2004-06-11 13:15:19
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27723 Modified Files: CMakeLists.txt Log Message: Added PriorityQueue to build system. Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/CMakeLists.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CMakeLists.txt 10 Jun 2004 16:28:29 -0000 1.13 --- CMakeLists.txt 11 Jun 2004 13:15:08 -0000 1.14 *************** *** 45,48 **** --- 45,49 ---- error.cpp String.cpp Array.cpp rchar.cpp Vector.cpp Variant.cpp + PriorityQueue.cpp ) |
From: Dejan L. <dlo...@us...> - 2004-06-10 22:10:53
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv697/src/core Modified Files: PriorityQueue.cpp Log Message: Index: PriorityQueue.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/PriorityQueue.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PriorityQueue.cpp 10 Jun 2004 22:01:02 -0000 1.1 --- PriorityQueue.cpp 10 Jun 2004 22:10:35 -0000 1.2 *************** *** 40,44 **** // We don't want precompiled headers in Borland C++ Builder... ! #if defined(__BORLANDC__) # pragma hdrstop #endif --- 40,44 ---- // We don't want precompiled headers in Borland C++ Builder... ! #if defined (_BORLANDC__) # pragma hdrstop #endif *************** *** 194,195 **** --- 194,197 ---- return data; } + + }; |
From: Dejan L. <dlo...@us...> - 2004-06-10 22:09:14
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32082/rtk Modified Files: PriorityQueue.h Log Message: Index: PriorityQueue.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/PriorityQueue.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PriorityQueue.h 10 Jun 2004 21:59:24 -0000 1.2 --- PriorityQueue.h 10 Jun 2004 22:09:03 -0000 1.3 *************** *** 177,181 **** --- 177,183 ---- bool _sort; /// How priority queue is sorted QueueNode* _head; /// Pointer to _head element of the List. + QueueNode* _tail; /// Pointer to _tail element of the List. PriorityNode* _priority_head; /// Pointer to priority head_element of the list + FreeDataFunc _free_func; /// Free data function Mutex* _mutex; |
From: Dejan L. <dlo...@us...> - 2004-06-10 22:01:11
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25466/src/core Added Files: PriorityQueue.cpp Log Message: --- NEW FILE: PriorityQueue.cpp --- /** * * 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... ***************************************************************************/ /** * PriorityQueue.cpp * $description * Authors (chronological order): * Dejan Lozanovic, null§rtk.cx * Contributors (chronological order): * $fname $lname, $email ***************************************************************************/ // includes for this file... // We don't want precompiled headers in Borland C++ Builder... #if defined(__BORLANDC__) # pragma hdrstop #endif #include <rtk/PriorityQueue.h> #include <stdlib.h> // package also #if defined(__BORLANDC__) # pragma package(smart_init) #endif namespace Rtk { #define CALL_FREE_DATA(d) if(_free_func) (*_free_func)((d)) bool PriorityQueue::Enqueue(void *data, unsigned char priority ) { if(_mutex) _mutex->Lock(); // Allocate space for new element QueueNode* new_element = (QueueNode*)malloc(sizeof(QueueNode)); PriorityNode* priority_element=_priority_head; PriorityNode* old_element=_priority_head; if (new_element == (QueueNode*)0) // NULL return false; new_element->data = (void *)data; if ( _priority_head == (PriorityNode*)0) // Queue is empty { _priority_head = (PriorityNode*)malloc(sizeof(PriorityNode)); if ( _priority_head == (PriorityNode*)0)// malloc error return false; new_element->next=(QueueNode*)0; _priority_head->element=_head=new_element; _count++; return true; } // move throught priority list until we find right place to // insert element or until we reach the end of priority list( // if new element has the lowest priority) while (((priority_element->priority < priority ) ^ _sort) && priority_element->next !=(PriorityNode*)0 ) { // here is the speedup since between // priority_element->element and // priority_element->next->element can be many elements old_element=priority_element; priority_element=priority_element->next; } if (priority_element->priority == priority) { //inserting new_element into a list new_element->next=priority_element->element->next; priority_element->element->next=new_element; priority_element->element=new_element; } else { //we need new priority node priority_element=(PriorityNode*)malloc(sizeof(PriorityNode)); if ( priority_element == (PriorityNode*)0)// malloc error return false; priority_element->priority=priority; //seting priority priority_element->element=new_element; //seting QueueNode //insert node into priority list priority_element->next=old_element->next; old_element->next=priority_element; //insert node into element list new_element->next=old_element->element->next; old_element->element->next=new_element; } _count++; if(_mutex) _mutex->Unlock(); return true; } // Push(void *data, int priority) //--------------------------------------------------------------------------- PriorityQueue::~PriorityQueue() { Clear(); } // ~List() //--------------------------------------------------------------------------- void PriorityQueue::Clear() { // Remove each element. QueueNode* element_node; PriorityNode* priority_node; if(_mutex) _mutex->Lock(); element_node = _head; while (element_node) { QueueNode* element_next = element_node->next; CALL_FREE_DATA(element_node->data); free(element_node); element_node = element_next; } while (priority_node) { PriorityNode* priority_next = priority_node->next; free(priority_node); priority_node = priority_next; } _priority_head = 0; _head = 0; _count = 0; if(_mutex) _mutex->Unlock(); } //--------------------------------------------------------------------------- void *PriorityQueue::Dequeue() { void *data = NULL; PriorityNode *node; QueueNode *element_node; if (_count == 0) return data; // We cannot remove element from an EMPTY list object! if(_mutex) _mutex->Lock(); if(_head == _priority_head->element) // last element with same priority { node=_priority_head->next; free(_priority_head); _priority_head=node; } element_node=_head->next; data=_head->data; free(_head); _head=element_node; // Adjust the _count of the PriorityQueue _count--; if(_mutex) _mutex->Unlock(); // Everything is OK, return data return data; } |
From: Dejan L. <dlo...@us...> - 2004-06-10 21:59:32
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23066/rtk Modified Files: PriorityQueue.h Log Message: Index: PriorityQueue.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/PriorityQueue.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PriorityQueue.h 6 Jun 2004 15:57:38 -0000 1.1 --- PriorityQueue.h 10 Jun 2004 21:59:24 -0000 1.2 *************** *** 45,49 **** #include "Mutex.h" ! #include "Slist.h" // for SLNode struct //--------------------------------------------------------------------------- --- 45,49 ---- #include "Mutex.h" ! #include "SList.h" // for SLNode struct //--------------------------------------------------------------------------- *************** *** 59,63 **** struct _PriorityNode *next; /// Pointer to next node QueueNode *element; /// Element to last QueueNode with given priority ! int priority; /// Priority of given node } PriorityNode; --- 59,63 ---- struct _PriorityNode *next; /// Pointer to next node QueueNode *element; /// Element to last QueueNode with given priority ! unsigned char priority; /// Priority of given node } PriorityNode; *************** *** 82,86 **** * @param sort is order ascendencig or descendencing */ ! PriorityQueue(bool sort=SORT_ASC): _sort(sort),_count(0), _head(0), _tail(0), _free_func(0) { } // --------- DESTRUCTORS ----------------------------------- --- 82,87 ---- * @param sort is order ascendencig or descendencing */ ! PriorityQueue(bool sort=SORT_ASC): _sort(sort),_priority_head(0) ! ,_count(0), _head(0), _tail(0), _free_func(0), _mutex(0) { } // --------- DESTRUCTORS ----------------------------------- *************** *** 108,111 **** --- 109,117 ---- FreeDataFunc GetFreeDataFunc() { return _free_func; } + /** + * Get Mutex from PriorityQueue + */ + + Mutex* GetMutex() { return _mutex; } // --------- SET METHODS ----------------------------------- *************** *** 116,123 **** void SetFreeDataFunc(FreeDataFunc func) { _free_func = func; } // --------- OTHER METHODS --------------------------------- /** ! * Clears the PriorityQueue. This will call 'Free Data Handler' */ void Clear(); --- 122,135 ---- void SetFreeDataFunc(FreeDataFunc func) { _free_func = func; } + /** + * Set mutex for PriorityQueue, if mutex is NULL then mutex is disabled + */ + void SetMutex(Mutex* mutex) { _mutex = mutex; } + // --------- OTHER METHODS --------------------------------- /** ! * Clears the PriorityQueue. This wi ! ll call 'Free Data Handler' */ void Clear(); *************** *** 130,134 **** * number with SORT_ASC will have the higest priority) */ ! bool Push(void *data, int priority); /** --- 142,146 ---- * number with SORT_ASC will have the higest priority) */ ! bool Enqueue(void *data, unsigned char priority); /** *************** *** 137,141 **** * @return Data assigned to removed element, or NULL on error */ ! void *Pop(); /** --- 149,153 ---- * @return Data assigned to removed element, or NULL on error */ ! void *Dequeue(); /** *************** *** 165,172 **** bool _sort; /// How priority queue is sorted QueueNode* _head; /// Pointer to _head element of the List. ! QueueNode* _tail; /// Pointer to _tail element of the List. ! PriorityNode _priority_head; /// ! FreeDataFunc _free_func; /// Free data function }; // Queue --- 177,183 ---- bool _sort; /// How priority queue is sorted QueueNode* _head; /// Pointer to _head element of the List. ! PriorityNode* _priority_head; /// Pointer to priority head_element of the list FreeDataFunc _free_func; /// Free data function + Mutex* _mutex; }; // Queue |
From: Dejan L. <de...@us...> - 2004-06-10 16:28:38
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31913/src/core Modified Files: CMakeLists.txt Log Message: Fixed few SET_SOURCE_FILES_PROPERTIES lines . Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/CMakeLists.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CMakeLists.txt 10 Mar 2004 12:42:47 -0000 1.12 --- CMakeLists.txt 10 Jun 2004 16:28:29 -0000 1.13 *************** *** 70,74 **** MESSAGE("Files: ${RTK_CORE_SFILES}\n") ## 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 --- 70,74 ---- MESSAGE("Files: ${RTK_CORE_SFILES}\n") ## FLAGS ! # How each, separate file in CORE RTK library should be compiled. # ie. which flags should be used. # T0D0: See if there is option for separate CXX and C flags, and use *************** *** 77,83 **** IF (RTK_OPT_DEBUG) SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} ! COMPILE_FLAGS -D_DEBUG ! COMPILE_FLAGS -DDEBUG ! COMPILE_FLAGS ${CMAKE_THREAD_LIBS_INIT} ) ENDIF (RTK_OPT_DEBUG) --- 77,81 ---- IF (RTK_OPT_DEBUG) SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} ! PROPERTIES COMPILE_FLAGS "-D_DEBUG -DDEBUG ${CMAKE_THREAD_LIBS_INIT}" ) ENDIF (RTK_OPT_DEBUG) *************** *** 85,94 **** # Threads SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} ! COMPILE_FLAGS ${CMAKE_THREAD_LIBS_INIT} ) IF (RTK_OPT_UNICODE) SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} ! COMPILE_FLAGS -DUNICODE=1 ) ENDIF (RTK_OPT_UNICODE) --- 83,92 ---- # Threads SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} ! PROPERTIES COMPILE_FLAGS "${CMAKE_THREAD_LIBS_INIT}" ) IF (RTK_OPT_UNICODE) SET_SOURCE_FILES_PROPERTIES(${RTK_CORE_SFILES} ! PROPERTIES COMPILE_FLAGS "-DUNICODE=1" ) ENDIF (RTK_OPT_UNICODE) |
From: Dejan L. <le...@us...> - 2004-06-07 22:01:36
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26649 Modified Files: IO.h Log Message: Small fix in SetMutex() . Index: IO.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/IO.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IO.h 7 Jun 2004 18:01:34 -0000 1.4 --- IO.h 7 Jun 2004 22:00:57 -0000 1.5 *************** *** 115,119 **** /** Sets Mutex object for IO */ ! void SetMutex(const Mutex& arg_mutex) { _mutex = arg_mutex; } /** Gets Mutex object from IO */ --- 115,119 ---- /** Sets Mutex object for IO */ ! void SetMutex(const Mutex* arg_mutex) { _mutex = arg_mutex; } /** Gets Mutex object from IO */ |
From: Dejan L. <le...@us...> - 2004-06-07 18:01:56
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6007 Modified Files: IO.h Log Message: Lock(), Unloc(), SetMutex() and GetMutex() methods added, as well as private _mutex member. Index: IO.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/IO.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IO.h 22 Feb 2004 10:21:29 -0000 1.3 --- IO.h 7 Jun 2004 18:01:34 -0000 1.4 *************** *** 32,37 **** ***** * Authors (chronological order): ! * Mikko Lahteenmaki, mikko§rtk.cx ! * Dejan Lekic, dejan§rtk.cx * Contributors (chronological order): * $fname $lname, $email --- 32,37 ---- ***** * Authors (chronological order): ! * Mikko Lahteenmaki, mikkortk.cx ! * Dejan Lekic, dejanrtk.cx * Contributors (chronological order): * $fname $lname, $email *************** *** 45,48 **** --- 45,49 ---- #include "rtkdef.h" + #include <rtk/Mutex.h> namespace Rtk *************** *** 112,123 **** /** Flushes the buffer. Return -1 on error */ virtual bool Flush() { return 0; } protected: ! IO() : _flags(0) { } /** Set access flags. */ void flags(uint f) { _flags = f; } uint _flags; }; // IO class --- 113,139 ---- /** Flushes the buffer. Return -1 on error */ virtual bool Flush() { return 0; } + + /** Sets Mutex object for IO */ + void SetMutex(const Mutex& arg_mutex) { _mutex = arg_mutex; } + + /** Gets Mutex object from IO */ + Mutex* GetMutex() const { return _mutex; } protected: ! IO() : _flags(0), _mutex(0) { } /** Set access flags. */ void flags(uint f) { _flags = f; } + + /** Locks Mutex (if set) */ + void Lock() { if (_mutex) _mutex->Lock(); } + /** Unlocks Mutex (if set) */ + void Unlock() { if (_mutex) _mutex->Unlock(); } + uint _flags; + + private: + Mutex* _mutex; /// Mutex - by default not set }; // IO class |
From: Dejan L. <le...@us...> - 2004-06-07 17:10:17
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27974/src/core Modified Files: Buffer.cpp Log Message: Removed old code to avoid confusion. Index: Buffer.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/Buffer.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Buffer.cpp 8 May 2004 15:08:53 -0000 1.2 --- Buffer.cpp 7 Jun 2004 17:09:54 -0000 1.3 *************** *** 32,36 **** ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejan§rtk.cx) * Contributors (chronological order): * $fname $lname, $email --- 32,36 ---- ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejanrtk.cx) * Contributors (chronological order): * $fname $lname, $email *************** *** 44,59 **** namespace Rtk { - Buffer::Buffer(uint element_size, uint size) - { - _buffer = new Array(element_size); - _buffer->SetCount(size); - _size = size; - _pos = 0; - } // Buffer() constructor ! Buffer::~Buffer() ! { ! delete _buffer; ! } // ~Buffer() descructor }; // Rtk --- 44,49 ---- namespace Rtk { ! // Nothing here for now... }; // Rtk *************** *** 62,64 **** * $Id$ ***************************************************************************/ - --- 52,53 ---- |
From: Dejan L. <le...@us...> - 2004-06-06 20:54:16
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20076 Modified Files: Buffer.h Log Message: Added few constructors and methods. Previous Buffer.h version is completely removed. Index: Buffer.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Buffer.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Buffer.h 19 Apr 2004 22:53:44 -0000 1.3 --- Buffer.h 6 Jun 2004 20:54:07 -0000 1.4 *************** *** 32,36 **** ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejan§rtk.cx) * Contributors (chronological order): * $fname $lname, $email --- 32,36 ---- ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejanrtk.cx) * Contributors (chronological order): * $fname $lname, $email *************** *** 59,112 **** { public: ! ! // CONSTRUCTORS ! ! /** ! * Default constructor. ! * @param element_size uint Size of buffer's element (in bytes). ! * @param size uint Initial size of buffer. ! */ ! Buffer(uint element_size=sizeof(uchar), uint size=128); ! ! // DESTRUCTORS ! ! /** ! * Default destructor. ! */ ! ~Buffer(); ! ! // SET METHODS ! ! /** ! * Sets new size of buffer to 'size'. ! * @param size uint New size of buffer. ! */ ! void SetSize(uint size) { _buffer->SetCount(size); } ! ! // GET METHODS ! ! /** ! * Returns storage size of buffer. In short - the maximum number ! * of elements that could be stored in buffer without new ! * allocation(s). ! * @return uint Number of elements buffer can hold without new allocation(s). ! */ ! uint GetSize() const { return _buffer->GetCount(); } ! ! // OTHER METHODS ! ! /** ! * Reads one single element (object) from buffer. ! * @return void* Pointer to value. ! */ ! void* Read(); ! ! bool Write(void* data); ! ! protected: ! uint _size; /// Buffer size ! Array* _buffer; /// Buffer data ! uint _pos; /// Current position in buffer private: }; // Buffer }; // Rtk namespace --- 59,101 ---- { public: ! /** ! * Default Buffer constructor. ! */ ! Buffer() : _size(0), _data(0) {} ! ! /** ! * Another Buffer constructor. ! */ ! Buffer(const uchar* data, uint size) ! : _size(size), _data(new uchar[_size]) ! { memcpy(_data, data, _size); } ! ! /** ! * Buffer's copy constructor. ! */ ! Buffer(const Buffer& buf) : _size(buf._size), _data(new char[_size]) ! { memcpy(_data, buf._data, _size); } ! ! /** ! * Buffer's destructor ! */ ! ~Buffer() { delete[] _data; } ! ! void operator=(const Buffer& buf) ! { ! delete[] _data; ! _size = buf._size; ! _data = new char[_size]; ! memcpy(_data, buf._data, _size); ! } ! ! /** ! * Returns pointer to Buffer's data. ! */ ! const uchar* Data() const { return _data; } ! private: + uint _size; /// Number of elements in Buffer + uchar* _data; /// Data }; // Buffer }; // Rtk namespace |
From: Dejan L. <dlo...@us...> - 2004-06-06 15:57:47
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27576/rtk Added Files: PriorityQueue.h Log Message: --- NEW FILE: PriorityQueue.h --- #ifndef _RTK_PRIORITYQUEUE_H_ #define _RTK_PRIORITYQUEUE_H_ 1 /** * * 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... ***************************************************************************/ /** * $filename.$ext * $description * Authors (chronological order): * Dejan Lozanovic, null§rtk.cx * Contributors (chronological order): * $fname $lname, $email ***************************************************************************/ //--------------------------------------------------------------------------- #include "Export.h" #include "Mutex.h" #include "Slist.h" // for SLNode struct //--------------------------------------------------------------------------- namespace Rtk { // Single-List Element type #define QueueNode SLNode // Priority-List Element type typedef struct _PriorityNode { struct _PriorityNode *next; /// Pointer to next node QueueNode *element; /// Element to last QueueNode with given priority int priority; /// Priority of given node } PriorityNode; #define SORT_ASC false #define SORT_DES true /// S free data handler /// Called whenever element is removed from list. /// Parameter 'data' is pointer to data of removed element. typedef void (*FreeDataFunc)(void *data); /** * Queue or FIFO(first in, first out) class */ class RTK_API PriorityQueue { public: // --------- CONSTRUCTORS ---------------------------------- /** * Default constructor. * @param sort is order ascendencig or descendencing */ PriorityQueue(bool sort=SORT_ASC): _sort(sort),_count(0), _head(0), _tail(0), _free_func(0) { } // --------- DESTRUCTORS ----------------------------------- /** * Default destructor. */ ~PriorityQueue(); // --------- GET METHODS ----------------------------------- /** * Returns number of items in the list. */ int GetCount() const { return this->_count; } /** * Returns pointer to _head node in Queue. * @return QueueNode pointer to first node in Queue. */ QueueNode* GetFirst() const { return this->_head; } /** * Get free data function. */ FreeDataFunc GetFreeDataFunc() { return _free_func; } // --------- SET METHODS ----------------------------------- /** * Set function to free content of element. * Function is called whenever element is removed from list. */ void SetFreeDataFunc(FreeDataFunc func) { _free_func = func; } // --------- OTHER METHODS --------------------------------- /** * Clears the PriorityQueue. This will call 'Free Data Handler' */ void Clear(); /** * Insert new element to PriorityQueue, element would be * placed to the last position of elements with same priority * @param data Data to insert * @param priority Priority of given element(eg. the smalest * number with SORT_ASC will have the higest priority) */ bool Push(void *data, int priority); /** * Remove first element from PriorityQueue * This will call 'Free Data Handler' * @return Data assigned to removed element, or NULL on error */ void *Pop(); /** * Get number of items containing given data. * @param data Search for this data * @return Number of elements found, that contains given data. */ int Contains(void *data) const; /** * Returns TRUE if given node is _head node in Queue. * @param element QueueNode* Node that should be checked. * @return TRUE if given node is _head node in Queue, FALSE otherwize. */ bool IsFirst(const QueueNode* element) const { return ((element == this->_head) ? true : false); } /** * Returns TRUE if given node is _tail node in Queue. * @param element QueueNode* Node that should be checked. * @return TRUE if given node oElement is _tail node in Queue, FALSE otherwize. */ bool IsLast(const QueueNode* element) const { return ((element->next == 0) ? true : false); } protected: // Members int _count; /// Size of the list object (how many elements are stored inside) bool _sort; /// How priority queue is sorted QueueNode* _head; /// Pointer to _head element of the List. QueueNode* _tail; /// Pointer to _tail element of the List. PriorityNode _priority_head; /// FreeDataFunc _free_func; /// Free data function }; // Queue }; // Rtk namespace /** * $Id: PriorityQueue.h,v 1.1 2004/06/06 15:57:38 dlozanovic Exp $ ***************************************************************************/ #endif |
From: Dejan L. <le...@us...> - 2004-05-27 14:17:10
|
Update of /cvsroot/rtk/rtk/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7666/doc Modified Files: CMakeLists.txt Log Message: Small fix... Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/rtk/rtk/doc/CMakeLists.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CMakeLists.txt 26 Feb 2004 20:13:15 -0000 1.1 --- CMakeLists.txt 27 May 2004 14:16:58 -0000 1.2 *************** *** 1 **** ! ADD_CUSTOM_TARGET(docs (cd .. && doxygen rtk.doxygen)) \ No newline at end of file --- 1 ---- ! ADD_CUSTOM_TARGET(docs "cd .. && doxygen rtk.doxygen") |
From: Dejan L. <de...@us...> - 2004-05-08 15:09:02
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15876/src/core Modified Files: Buffer.cpp Log Message: Very small change. Index: Buffer.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/Buffer.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Buffer.cpp 3 Mar 2004 15:31:09 -0000 1.1 --- Buffer.cpp 8 May 2004 15:08:53 -0000 1.2 *************** *** 32,36 **** ***** * Authors (chronological order): ! * $fname $lname, $email * Contributors (chronological order): * $fname $lname, $email --- 32,36 ---- ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejan§rtk.cx) * Contributors (chronological order): * $fname $lname, $email *************** *** 44,48 **** namespace Rtk { ! // C/C++ code here }; // Rtk --- 44,60 ---- namespace Rtk { ! Buffer::Buffer(uint element_size, uint size) ! { ! _buffer = new Array(element_size); ! _buffer->SetCount(size); ! _size = size; ! _pos = 0; ! } // Buffer() constructor ! ! Buffer::~Buffer() ! { ! delete _buffer; ! } // ~Buffer() descructor ! }; // Rtk |
From: Dejan L. <de...@us...> - 2004-04-20 18:54:10
|
Update of /cvsroot/rtk/rtk/src/core/platform/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28961/src/core/platform/linux Added Files: Mmap.cpp Log Message: Mmap.cpp added to /src/core/platform/linux --- NEW FILE: Mmap.cpp --- /** * * 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/src/core/platform/linux/Mmap.cpp,v $ ***** * Authors (chronological order): * Dejan Lekic, de...@nu... (dejan§rtk.cx) * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #include <rtk/Mmap.h> namespace Rtk { Mmap::Mmap() { _file_opened = false; _filename = 0; _len = 0; _fd = -1; _prot = PROT_READ|PROT_WRITE; _shared = MAP_SHARED; _mmapAddress = (caddr_t) -1; } // Mmap() constructor Mmap::Mmap(const String& fname, bool bc) { if (SetFilename(fname.c_str(), bc)) _file_opened = true; else _file_opened = false; _len = 0; _fd = -1; _prot = PROT_READ|PROT_WRITE; _shared = MAP_SHARED; _mmapAddress = (caddr_t) -1; } // Mmap() constructor Mmap::~Mmap() { // free filename if (_filename) delete _filename; // close file if (_fd >= 0) close(_fd); // unmap file if (_mmap_address) munmap(_mmap_address, _len); } // ~Mmap() destructor bool Mmap::SetFilename(const char *filename, bool create) { int len = strlen(filename)+1; _filename = new RCHAR [len]; strcpy(_filename, filename); struct stat statbuf; if (!create) { _fd = open(_filename, O_RDWR) ; } else { _fd = open(_filename, O_RDWR|O_CREAT, 00600); } // Return -1 as result if opening went wrong if (_fd < 0) return false; int rc = stat(_filename, &statbuf); if (rc < 0) { return false; } _len = (size_t) statbuf.st_size; return true; } // SetFilename() void Mmap::SetSize(uint size) { if (_len != size) { lseek(_fd, (off_t) size, SEEK_SET); write(_fd, "", 1); ftruncate(_fd, size); } _len = size; } void* Mmap::Map() { _mmap_address = (void*)mmap(0, _len, _prot, _shared, _fd, 0); return _mmap_address; } // Map() void Mmap::Bzero() { if (_mmap_address != (void*)-1) memset(_mmap_address, 0, _len); } // Bzero() }; // Rtk /** * $Id: Mmap.cpp,v 1.1 2004/04/20 18:54:00 dejan Exp $ ***************************************************************************/ |
From: Dejan L. <de...@us...> - 2004-04-20 18:52:23
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28609/src/core Removed Files: Mmap.cpp Log Message: Mmap removed from src/core --- Mmap.cpp DELETED --- |
From: Mikko L. <laz...@us...> - 2004-04-20 18:40:16
|
Update of /cvsroot/rtk/rtk/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25821 Modified Files: test.h Log Message: Made work in vcpp Index: test.h =================================================================== RCS file: /cvsroot/rtk/rtk/test/test.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test.h 20 Apr 2004 18:17:32 -0000 1.13 --- test.h 20 Apr 2004 18:40:07 -0000 1.14 *************** *** 34,40 **** #define OUT(msg, val) \ {IncStep(); \ ! typeof(val) tmp = val; \ ! rprintf(_R("> ") _R(msg) _R("\n"), tmp); \ ! rfprintf(f_out, _R("> ") _R(msg) _R("\n"), tmp); \ fflush(f_out);} --- 34,40 ---- #define OUT(msg, val) \ {IncStep(); \ ! RCHAR buf[1024]; rsprintf(buf, _R("> ") _R(msg) _R("\n"), val); \ ! rprintf(buf); \ ! rfprintf(f_out, buf); \ fflush(f_out);} |
From: Dejan L. <de...@us...> - 2004-04-20 18:18:00
|
Update of /cvsroot/rtk/rtk/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21849/test Modified Files: test.h Log Message: Added CVS ID at the end of the file. Index: test.h =================================================================== RCS file: /cvsroot/rtk/rtk/test/test.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test.h 19 Mar 2004 21:11:18 -0000 1.12 --- test.h 20 Apr 2004 18:17:32 -0000 1.13 *************** *** 85,86 **** --- 85,90 ---- #endif + + /** + * $Id$ + ***************************************************************************/ |
From: Dejan L. <de...@us...> - 2004-04-19 22:53:52
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2655/rtk Modified Files: Buffer.h Log Message: CVS test... Index: Buffer.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Buffer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Buffer.h 14 Mar 2004 12:03:54 -0000 1.2 --- Buffer.h 19 Apr 2004 22:53:44 -0000 1.3 *************** *** 94,100 **** uint GetSize() const { return _buffer->GetCount(); } protected: ! uint _size; /// Buffer size Array* _buffer; /// Buffer data private: }; // Buffer --- 94,111 ---- uint GetSize() const { return _buffer->GetCount(); } + // OTHER METHODS + + /** + * Reads one single element (object) from buffer. + * @return void* Pointer to value. + */ + void* Read(); + + bool Write(void* data); + protected: ! uint _size; /// Buffer size Array* _buffer; /// Buffer data + uint _pos; /// Current position in buffer private: }; // Buffer |
From: Dejan L. <de...@us...> - 2004-04-19 21:56:20
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21683/rtk Added Files: Mmap.h Log Message: I thought Mmap.h was already in CVS. Sorry. :( --- NEW FILE: Mmap.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/Mmap.h,v $ ***** * Authors (chronological order): * Dejan Lekic, de...@nu... (dejan§rtk.cx) * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #ifndef _RTK_MMAP_H_ #define _RTK_MMAP_H_ 1 #include <unistd.h> #include <sys/mman.h> #include <sys/types.h> #include <fcntl.h> #include <sys/stat.h> #include <string.h> #include <rtk/Export.h> #include <rtk/rtkdef.h> #include <rtk/String.h> namespace Rtk { /** Simple wrapper class around *map() and related functions. * Simple wrapper class around *map() and related functions. */ class RTK_API Mmap { public: // CONSTRUCTORS /** * Default constructor - note that You have to use SetFilename * when You use this constructor. */ Mmap(); /** * Another Mmap constructor, with filename and bc flag which * determines wheather file should be created or not. * @param fname String Name of file * @param bc bool Create flag TRUE or FALSE (default). */ Mmap::Mmap(const String& fname, bool bc = false); // DESTRUCTORS ~Mmap(); // SET METHODS bool SetFilename(const RCHAR *filename, bool create = false); void SetSize(uint size); void SetShared(int shared) { _shared = shared; } void SetProt(int prot) { _prot = prot; } // GET METHODS uint GetSize() const { return _len; } const RCHAR *GetFilename() const { return _filename; } // OTHER METHODS void Bzero(); void *Map(); private: RCHAR *_filename; /// Name of file to be memory-mapped uint _len; uint _file_size; int _shared; int _prot; int _fd; /// Mmap file's file descriptor void *_mmap_address; /// Addres where file is mapped bool _file_opened; /// Indicates wheather file is opened or not }; // Mmap }; // Rtk namespace #endif /** * $Id: Mmap.h,v 1.1 2004/04/19 21:56:05 dejan Exp $ ***************************************************************************/ |