You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(622) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(303) |
Feb
(64) |
Mar
(5) |
Apr
(63) |
May
(82) |
Jun
(53) |
Jul
(50) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: stephan b. <sg...@us...> - 2005-03-06 15:19:43
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26531 Modified Files: PropertyMap.h Log Message: corrected a missing return value. Index: PropertyMap.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/PropertyMap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PropertyMap.h 28 Jan 2005 11:32:58 -0000 1.2 +++ PropertyMap.h 6 Mar 2005 15:19:33 -0000 1.3 @@ -50,7 +50,11 @@ } bool remove(const KeyType& key) - { _fields.erase(key); } + { + if( ! this->isset( key ) ) return false; + _fields.erase(key); + return true; + } bool isset(const KeyType& key) const { return _fields.find(key) != _fields.end(); } |
From: stephan b. <sg...@us...> - 2005-03-06 15:18:44
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26280 Modified Files: reg_map_specializations.h reg_list_specializations.h Log Message: gcc 3.4 compile fixes from Mike Raford Index: reg_map_specializations.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/reg_map_specializations.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- reg_map_specializations.h 26 Dec 2004 04:09:28 -0000 1.5 +++ reg_map_specializations.h 6 Mar 2005 15:18:35 -0000 1.6 @@ -50,8 +50,14 @@ typedef PS11N_MAP_TYPE_PROXY serialize_functor; typedef serialize_functor deserialize_functor; typedef ::P::s11n::cl::factory_create_functor<serializable_type> factory_type; - static const bool cl_reg_placeholder = (::classname<serializable_type>(),true) ; + static const bool cl_reg_placeholder; }; + template < + typename KT, + typename VT + > const bool s11n_traits< + PS11N_MAP_TYPE< KT, VT > + >::cl_reg_placeholder = ( ::classname< PS11N_MAP_TYPE< KT, VT > >(),true); Index: reg_list_specializations.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/reg_list_specializations.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- reg_list_specializations.h 26 Dec 2004 04:09:28 -0000 1.4 +++ reg_list_specializations.h 6 Mar 2005 15:18:35 -0000 1.5 @@ -66,8 +66,13 @@ typedef PS11N_LIST_TYPE_PROXY serialize_functor; typedef serialize_functor deserialize_functor; typedef ::P::s11n::cl::factory_create_functor<serializable_type> factory_type; - static const bool cl_reg_placeholder = (::classname<serializable_type>(),true) ; + static const bool cl_reg_placeholder; }; + template <typename VT > + const bool s11n_traits< + PS11N_LIST_TYPE< VT > + >::cl_reg_placeholder = + (::classname< PS11N_LIST_TYPE< VT > >(),true) ; } } // namespace P::s11n |
From: stephan b. <sg...@us...> - 2005-03-05 22:47:05
|
Update of /cvsroot/pclasses/pclasses2/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24121 Modified Files: Makefile.toc Log Message: added a -f to ln -s to avoid errors when overwriting symlinks Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/lib/Makefile.toc,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.toc 12 Jan 2005 11:59:52 -0000 1.7 +++ Makefile.toc 5 Mar 2005 22:46:39 -0000 1.8 @@ -31,7 +31,7 @@ test -L $$fn -a $$rn -ef "$$fn" && continue; \ test -L $$fn && rm $$fn; \ echo "Symlinking $$rn..."; \ - ln -s $$rn .; \ + ln -fs $$rn .; \ done CLEAN_FILES += $(shell for i in *; do test -L $$i || continue; echo $$i; done) |
From: stephan b. <sg...@us...> - 2005-02-27 17:25:11
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25412 Modified Files: Makefile.toc Log Message: added missing sources. test apps now link Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.toc,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Makefile.toc 26 Feb 2005 16:53:35 -0000 1.20 +++ Makefile.toc 27 Feb 2005 17:25:03 -0000 1.21 @@ -12,15 +12,19 @@ SOURCES_COMMON = \ CriticalSection.cpp \ CriticalSection.generic.cpp \ + EventQueue.cpp \ + File.common.cpp \ FileInfo.common.cpp \ Mime.cpp \ Mutex.cpp \ PathFinder.cpp \ + Pipe.common.cpp \ Process.common.cpp \ ProcessIO.cpp \ SystemError.cpp \ timeout.cpp \ - SharedLib.common.cpp + SharedLib.common.cpp \ + StorageDevice.common.cpp SOURCES_SO_LIBDL = \ SharedLib.dl.cpp @@ -71,6 +75,7 @@ SOURCES_WIN32 = Condition.win32.cpp \ CriticalSection.win32.cpp \ + FileInfo.win32.cpp \ Mutex.win32.cpp \ Semaphore.win32.cpp \ SharedLib.win32.cpp \ |
From: stephan b. <sg...@us...> - 2005-02-27 17:19:19
|
Update of /cvsroot/pclasses/pclasses2/src/App In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23594 Modified Files: SimpleApp.cpp Log Message: commented out 2 unused vars Index: SimpleApp.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/App/SimpleApp.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SimpleApp.cpp 11 Feb 2005 12:24:20 -0000 1.4 +++ SimpleApp.cpp 27 Feb 2005 17:19:10 -0000 1.5 @@ -74,8 +74,8 @@ } #endif - System::EventQueue& evq = System::EventQueue::instance(); - System::FdListenerList& lst = System::FdListenerList::instance(evq); +// System::EventQueue& evq = System::EventQueue::instance(); +// System::FdListenerList& lst = System::FdListenerList::instance(evq); #ifdef SIGTERM ::signal(SIGTERM, &signalHandler); |
From: Christian P. <cp...@us...> - 2005-02-27 12:44:51
|
Update of /cvsroot/pclasses/pclasses2/src/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14199/src/IO Modified Files: URL.cpp Log Message: Avoid warning in charNeedEncode() Index: URL.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/IO/URL.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- URL.cpp 27 Jan 2005 10:41:37 -0000 1.3 +++ URL.cpp 27 Feb 2005 12:44:36 -0000 1.4 @@ -573,7 +573,7 @@ bool ret = false; if((ch <= 0x1f) || (ch == 0x7f) || // ASCII control characters... - (ch >= 0x80 && ch <= 0xff) || // non-ASCII characters ... + (ch >= 0x80) || // non-ASCII characters ... (ch == 0x24) || (ch == 0x26) || // reserved characters... (ch == 0x2b) || (ch == 0x2c) || (ch == 0x2f) || (ch == 0x3a) || |
From: stephan b. <sg...@us...> - 2005-02-26 16:53:46
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22307 Modified Files: Makefile.toc Log Message: brought in sync with Makefile.am Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.toc,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Makefile.toc 18 Jan 2005 18:04:17 -0000 1.19 +++ Makefile.toc 26 Feb 2005 16:53:35 -0000 1.20 @@ -51,17 +51,24 @@ SOURCES_POSIX = \ Condition.posix.cpp \ Directory.posix.cpp \ + FdListener.posix.cpp \ File.posix.cpp \ FileInfo.posix.cpp \ + IOHandle.posix.cpp \ Mutex.posix.cpp \ Pipe.posix.cpp \ Process.posix.cpp \ Semaphore.posix.cpp \ SharedMemory.posix.cpp \ + SignalListener.posix.cpp \ SystemClock.posix.cpp \ Thread.posix.cpp \ ThreadKey.posix.cpp +SOURCES_LINUX = CdRomDevice.linux.cpp \ + Ps2Device.linux.cpp \ + SerialDevice.linux.cpp + SOURCES_WIN32 = Condition.win32.cpp \ CriticalSection.win32.cpp \ Mutex.win32.cpp \ @@ -75,6 +82,7 @@ BUILD_SOURCES = $(SOURCES_COMMON) BUILD_SOURCES += $(SOURCES_$(SOURCES_PLATFORM)) BUILD_SOURCES += $(SOURCES_SHAREDLIB) +BUILD_SOURCES += $(SOURCES_LINUX) ############################################## DIST_FILES += $(wildcard *.cpp *.h) |
From: stephan b. <sg...@us...> - 2005-02-26 16:50:08
|
Update of /cvsroot/pclasses/pclasses2/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21464 Modified Files: Makefile.toc Log Message: added missing subdir traversal Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/Makefile.toc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.toc 24 Dec 2004 12:44:00 -0000 1.2 +++ Makefile.toc 26 Feb 2005 16:49:58 -0000 1.3 @@ -1,16 +1,7 @@ #!/usr/bin/make -f -################################################### -# AUTO-GENERATED guess at a toc-aware Makefile, -# based off of the contents of directory: -# ./include -# Created by ./toc/bin/create_makefile_stubs.sh -# Thu Dec 23 01:31:56 CET 2004 -# It must be tweaked to suit your needs. -################################################### + include toc.make + SUBDIRS = pclasses -all: -################################################### -# end auto-generated rules -################################################### +all: subdirs |
From: stephan b. <sg...@us...> - 2005-02-26 16:50:00
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21423 Modified Files: SerialDevice.linux.cpp Log Message: corrected a malformed case statement for DefaultCharSize Index: SerialDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SerialDevice.linux.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SerialDevice.linux.cpp 15 Feb 2005 19:03:56 -0000 1.4 +++ SerialDevice.linux.cpp 26 Feb 2005 16:49:50 -0000 1.5 @@ -136,11 +136,12 @@ void SerialDevice::setCharSize(SerialDevice::CharSize csize) throw(IO::IOError) { int size; switch(csize) { - case CharSize5 : size = CS5; - case CharSize6 : size = CS6; - case CharSize7 : size = CS7; - case CharSize8 : size = CS8; - default: DefaultCharSize : size = CS7; + case CharSize5 : size = CS5; break; + case CharSize6 : size = CS6; break; + case CharSize7 : size = CS7; break; + case CharSize8 : size = CS8; break; + case DefaultCharSize: + default: size = CS7; break; } struct termios ios; |
From: stephan b. <sg...@us...> - 2005-02-26 16:48:23
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21022 Modified Files: SignalListener.posix.cpp Log Message: removed unused var (breaks -Wall) Index: SignalListener.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SignalListener.posix.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SignalListener.posix.cpp 22 Feb 2005 13:20:32 -0000 1.2 +++ SignalListener.posix.cpp 26 Feb 2005 16:48:13 -0000 1.3 @@ -58,7 +58,9 @@ { if(!_instance) { - int ret = ::pipe(_signalPipe); + //int ret = /* unused var */ + ::pipe(_signalPipe); + // ^^^ todo??? check for error // make pipe nonblocking ... ::fcntl(_signalPipe[0], F_SETFL, O_NONBLOCK); |
From: stephan b. <sg...@us...> - 2005-02-26 16:03:56
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9196 Modified Files: Makefile.toc Log Message: added rules to gen/clean CallbackN.h Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Makefile.toc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.toc 29 Dec 2004 20:19:57 -0000 1.5 +++ Makefile.toc 26 Feb 2005 16:03:41 -0000 1.6 @@ -16,4 +16,11 @@ DIST_FILES += $(DIST_HEADERS) $(CONF_H_IN) DISTCLEAN_FILES += $(CONF_H) -all: subdirs +CALLBACKS_SH = CallbackN.sh +CALLBACKS = $(addsuffix .h,$(addprefix CallbackN,1 2 3 4)) +DIST_FILES += $(CALLBACKS_SH) +$(CALLBACKS): $(CALLBACKS_SH) + bash $(CALLBACKS_SH) +CLEAN_FILES += $(CALLBACKS) + +all: $(CALLBACKS) subdirs |
From: stephan b. <sg...@us...> - 2005-02-25 23:54:03
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27746 Modified Files: data_node_serialize.h Log Message: gcc 3.4 compile patches from Mike Radford. Index: data_node_serialize.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/data_node_serialize.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- data_node_serialize.h 6 Jan 2005 17:06:30 -0000 1.5 +++ data_node_serialize.h 25 Feb 2005 23:53:52 -0000 1.6 @@ -102,7 +102,8 @@ typedef s11n::node_traits<NodeType> NTR; typedef s11n::s11n_traits<serializable_type> STR; NTR::class_name( dest, ::classname<serializable_type>() ); // only good for monomorphs - return STR::serialize_functor()( dest, src ); + typename STR::serialize_functor func; + return func( dest, src ); } /** @@ -112,7 +113,8 @@ static bool deserialize( const NodeType & src, serializable_type & dest ) { typedef s11n::s11n_traits<serializable_type> STR; - return STR::deserialize_functor()( src, dest ); + typename STR::deserialize_functor func; + return func( src, dest ); } }; |
From: Christian P. <cp...@us...> - 2005-02-22 13:23:16
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24707/src/System Modified Files: Makefile.am Log Message: Commented out IdeDevice.cpp: does not compile. Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Makefile.am 17 Feb 2005 14:17:48 -0000 1.17 +++ Makefile.am 22 Feb 2005 13:23:02 -0000 1.18 @@ -73,8 +73,9 @@ Time_Sources = SystemClock.win32.cpp endif -System_Sources = CdRomDevice.linux.cpp IdeDevice.linux.cpp Ps2Device.linux.cpp \ +System_Sources = CdRomDevice.linux.cpp Ps2Device.linux.cpp \ SerialDevice.linux.cpp +# IdeDevice.linux.cpp EXTRA_DIST = CriticalSection.generic.cpp CriticalSection.win32.cpp \ Mutex.solaris.cpp Mutex.posix.cpp Mutex.win32.cpp SharedMemory.sysv.cpp \ |
From: Christian P. <cp...@us...> - 2005-02-22 13:22:10
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24363/src/System Modified Files: Process.posix.cpp Log Message: Added ProcessListener Index: Process.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Process.posix.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Process.posix.cpp 31 Dec 2004 03:22:57 -0000 1.1 +++ Process.posix.cpp 22 Feb 2005 13:21:49 -0000 1.2 @@ -31,11 +31,80 @@ #include <errno.h> #include <string> +#include <list> + +#include "../System/FdListener.h" +#include "../System/SignalListener.h" namespace P { namespace System { +class ChildSignalHandler: public System::SignalListener { + public: + ChildSignalHandler() + : SignalListener(SIGCHLD) { } + + void onSignal() + { + ProcessListener* proc = 0; + int exitCode = 0; + + std::list<ProcessListener*>::iterator i = _procs.begin(); + while(i != _procs.end()) + { + proc = *i; + if(proc->process().tryWait(exitCode)) + { + // we post this Event since signals are always handled by the + // main-thread, and the EventListener may use a EventQueue + // that runs in another thread... + proc->eventQueue().post(Event(proc->sender(), exitCode)); + } + + ++i; + } + } + + void add(ProcessListener* proc) + { + _procs.push_back(proc); + } + + void remove(ProcessListener* proc) + { + std::list<ProcessListener*>::iterator i = _procs.begin(); + while(i != _procs.end()) + { + if(*i == proc) + { + _procs.erase(i); + break; + } + + ++i; + } + } + + static ChildSignalHandler& instance() + { + if(!_instance) + { + static CriticalSection cs; + CriticalSection::ScopedLock lck(cs); + _instance = new ChildSignalHandler(); + } + + return *_instance; + } + + private: + std::list<ProcessListener*> _procs; + static ChildSignalHandler* _instance; +}; + +ChildSignalHandler* ChildSignalHandler::_instance = 0; + void Process::start(int mode) throw(IO::IOError,SystemError,LogicError) { @@ -83,15 +152,16 @@ throw IO::IOError(errno, "Could not create pipe", P_SOURCEINFO); } } - + pid_t child = fork(); - + // fork failed if(child == -1) { close(infds[0]); close(infds[1]); close(outfds[0]); close(outfds[1]); close(errfds[0]); close(errfds[1]); + throw SystemError(errno, "Could not start process", P_SOURCEINFO); } // child process @@ -244,6 +314,36 @@ return WIFEXITED(status) ? WEXITSTATUS(status) : 127; } +ProcessListener::ProcessListener(Process& proc) +: EventListener(&proc), _proc(proc) +{ + ChildSignalHandler& childSigHandler = ChildSignalHandler::instance(); + childSigHandler.add(this); +} + +ProcessListener::ProcessListener(EventQueue& evq, Process& proc) +: EventListener(evq, &proc), _proc(proc) +{ + ChildSignalHandler& childSigHandler = ChildSignalHandler::instance(); + childSigHandler.add(this); +} + +ProcessListener::~ProcessListener() +{ + ChildSignalHandler& childSigHandler = ChildSignalHandler::instance(); + childSigHandler.remove(this); +} + +Process& ProcessListener::process() const throw() +{ + return _proc; +} + +void ProcessListener::signaled(const Event& ev) +{ + sigExited.fire(*this, ev.id()); +} + } // !namespace System } // !namespace P |
From: Christian P. <cp...@us...> - 2005-02-22 13:22:10
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24363/include/pclasses/System Modified Files: Process.h Log Message: Added ProcessListener Index: Process.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Process.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Process.h 31 Dec 2004 03:22:58 -0000 1.1 +++ Process.h 22 Feb 2005 13:21:49 -0000 1.2 @@ -21,10 +21,13 @@ #ifndef P_System_Process_h #define P_System_Process_h +#include <pclasses/Export.h> +#include <pclasses/Signal.h> #include <pclasses/Unicode/String.h> #include <pclasses/IO/IOError.h> #include <pclasses/System/SystemError.h> #include <pclasses/System/ProcessIO.h> +#include <pclasses/System/EventQueue.h> #include <list> namespace P { @@ -36,7 +39,7 @@ This class is used to concurrently execute child processes. \author Christian Prochnow <cp...@se...> */ -class Process { +class PSYSTEM_EXPORT Process { public: //! Child process state @@ -108,7 +111,7 @@ //! Return the process i/o object ProcessIO& processIO() const throw(LogicError); - private: + private: unsigned long _handle; ProcessIO* _procIO; State _state; @@ -117,6 +120,22 @@ ArgList _args; }; +class PSYSTEM_EXPORT ProcessListener: public EventListener { + public: + ProcessListener(Process& proc); + ProcessListener(EventQueue& evq, Process& proc); + ~ProcessListener(); + + Process& process() const throw(); + + Signal2<void, ProcessListener&, int> sigExited; + + private: + void signaled(const Event& ev); + Process& _proc; +}; + + } // !namespace System } // !namespace P |
From: Christian P. <cp...@us...> - 2005-02-22 13:20:55
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24090/src/System Modified Files: SignalListener.posix.cpp Log Message: Finished SignalListener implementation. Index: SignalListener.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SignalListener.posix.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SignalListener.posix.cpp 17 Feb 2005 14:15:18 -0000 1.1 +++ SignalListener.posix.cpp 22 Feb 2005 13:20:32 -0000 1.2 @@ -34,8 +34,11 @@ SignalFdListener(int handle) : FdListener(handle, FdListener::Read) { - for(int i = 0; i < sizeof(_listeners) / sizeof(SignalListener*); i++) + for(unsigned int i = 0; + i < sizeof(_listeners) / sizeof(SignalListener*); i++) + { _listeners[i] = 0; + } System::FdListenerList& lst = System::FdListenerList::instance(EventQueue::instance()); @@ -74,6 +77,12 @@ void removeListener(SignalListener& l) { + for(unsigned int i = 0; + i < sizeof(_listeners) / sizeof(SignalListener*); i++) + { + if(_listeners[i] == &l) + _listeners[i] = 0; + } } void writeSignal(int sig) |
From: Christian P. <cp...@us...> - 2005-02-17 14:28:29
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23674/include/pclasses/System Modified Files: CdRomDevice.h Log Message: Cleanup of CdRomDevice and TrackInfo. Index: CdRomDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/CdRomDevice.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CdRomDevice.h 14 Feb 2005 16:46:46 -0000 1.5 +++ CdRomDevice.h 17 Feb 2005 14:28:07 -0000 1.6 @@ -58,11 +58,11 @@ DiscMixed }; - //! TOC-Entry - class Track; + //! Track-info + class TrackInfo; //! Track-list (the TOC) - typedef std::list<Track> TrackList; + typedef std::list<TrackInfo> TrackList; CdRomDevice(const std::string& path, AccessMode access, ShareMode share) throw(IO::IOError); @@ -82,8 +82,11 @@ void closeTray() throw (IO::IOError); - //! Read TOC (track-list) - TrackList readTOC() throw(IO::IOError); + //! Read track-info + TrackInfo trackInfo(unsigned int trackNum) const throw(IO::IOError); + + //! Read infos for all tracks + TrackList readTracks() throw(IO::IOError); //! Start audio playback void play(uint8_t startMin, uint8_t startSec, uint8_t startFrame, @@ -91,7 +94,8 @@ throw(IO::IOError); //! Play audio tracks - void play(const Track& from, const Track& to) throw(IO::IOError); + void play(const TrackInfo& from, const TrackInfo& to) + throw(IO::IOError); //! Stop audio playback void stop() throw(IO::IOError); @@ -101,47 +105,46 @@ //! Resume audio playback void resume() throw(IO::IOError); + + private: + void* _private; }; //! CD-ROM Trackinfo -class PSYSTEM_EXPORT CdRomDevice::Track { +class PSYSTEM_EXPORT CdRomDevice::TrackInfo { public: - //! Type of Track - enum Type { + //! Format of Track + enum Format { + Unknown, + Audio, + CDI, + XA, Data, - Audio + PSX }; - Track(unsigned int num, Type type, - size_t lba, size_t size); + TrackInfo(unsigned int num, Format f, + size_t lba, size_t length); - ~Track(); + ~TrackInfo(); //! Returns the track-number unsigned int num() const throw(); - //! Returns the track-type - Type type() const throw(); + //! Returns the track-format + Format format() const throw(); //! Returns the LBA of this track size_t lba() const throw(); - size_t size() const throw(); - - uint8_t startMinute() const throw(); - uint8_t startSecond() const throw(); - uint8_t startFrame() const throw(); - uint8_t endMinute() const throw(); - uint8_t endSecond() const throw(); - uint8_t endFrame() const throw(); + //! Returns the LBA length + size_t length() const throw(); private: unsigned int _num; - Type _type; + Format _format; size_t _lba; - size_t _size; - uint8_t _startMsf[3]; - uint8_t _endMsf[3]; + size_t _length; }; } // !namespace System |
From: Christian P. <cp...@us...> - 2005-02-17 14:28:23
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23674/src/System Modified Files: CdRomDevice.linux.cpp Log Message: Cleanup of CdRomDevice and TrackInfo. Index: CdRomDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/CdRomDevice.linux.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CdRomDevice.linux.cpp 14 Feb 2005 16:46:46 -0000 1.5 +++ CdRomDevice.linux.cpp 17 Feb 2005 14:28:08 -0000 1.6 @@ -27,6 +27,20 @@ namespace System { +void lba2msf(size_t lba, uint8_t *msf) +{ +#ifndef CD_MSF_OFFSET +# define CD_MSF_OFFSET 150 +#endif + + lba += CD_MSF_OFFSET; // msf addressing starts a lba=150 + lba &= 0xffffff; // only 24bit ... + msf[0] = lba / (CD_SECS*CD_FRAMES); + lba %= CD_SECS*CD_FRAMES; + msf[1] = lba / CD_FRAMES; + msf[2] = lba % CD_FRAMES; +} + CdRomDevice::CdRomDevice(const std::string& path, AccessMode access, ShareMode share) throw(IO::IOError) : StorageDevice(path, access, share) @@ -87,7 +101,7 @@ status = DiscOk; break; case CDS_NO_INFO: - /* fall through */ + // fall through default: status = NoInfo; } @@ -124,7 +138,7 @@ break; case CDS_NO_DISC: case CDS_NO_INFO: - /* fall through */ + // fall through default: status = DiscUnknown; } @@ -149,10 +163,16 @@ throw IO::IOError(errno, "ioctl error on device", P_SOURCEINFO); } -void CdRomDevice::play(const Track& from, const Track& to) throw(IO::IOError) +void CdRomDevice::play(const TrackInfo& from, const TrackInfo& to) throw(IO::IOError) { - play(from.startMinute(), from.startSecond(), from.startFrame(), - to.endMinute(), to.endSecond(), to.endFrame()); + uint8_t startMsf[3]; + uint8_t endMsf[3]; + + lba2msf(from.lba(), startMsf); + lba2msf(to.lba(), endMsf); + + play(startMsf[0], startMsf[1], startMsf[2], + endMsf[0], endMsf[1], endMsf[2]); } void CdRomDevice::stop() throw(IO::IOError) @@ -198,7 +218,7 @@ throw IO::IOError(errno, "ioctl error on device", P_SOURCEINFO); } -CdRomDevice::TrackList CdRomDevice::readTOC() throw(IO::IOError) +CdRomDevice::TrackList CdRomDevice::readTracks() throw(IO::IOError) { struct cdrom_tochdr hdr; @@ -233,89 +253,45 @@ for(i = 1; i < ti; ++i); { int length = toc_entries[i].cdte_addr.lba - toc_entries[i-1].cdte_addr.lba; - toc.push_back(Track(i, - toc_entries[i-1].cdte_ctrl & CDROM_DATA_TRACK ? Track::Data : Track::Audio, + toc.push_back(TrackInfo(i, + toc_entries[i-1].cdte_ctrl & CDROM_DATA_TRACK ? + TrackInfo::Data : TrackInfo::Audio, toc_entries[i-1].cdte_addr.lba, length)); } return toc; } -void lba2msf(size_t lba, uint8_t *msf) -{ -#ifndef CD_MSF_OFFSET -# define CD_MSF_OFFSET 150 -#endif - - lba += CD_MSF_OFFSET; // msf addressing starts a lba=150 - lba &= 0xffffff; // only 24bit ... - msf[0] = lba / (CD_SECS*CD_FRAMES); - lba %= CD_SECS*CD_FRAMES; - msf[1] = lba / CD_FRAMES; - msf[2] = lba % CD_FRAMES; -} - -CdRomDevice::Track::Track(unsigned int num, Type type, size_t lba, size_t size) -: _num(num), _type(type), _lba(lba), _size(size) +CdRomDevice::TrackInfo::TrackInfo(unsigned int num, Format f, size_t lba, size_t length) +: _num(num), _format(f), _lba(lba), _length(length) { - lba2msf(lba, _startMsf); - lba2msf(lba + size, _endMsf); } -CdRomDevice::Track::~Track() +CdRomDevice::TrackInfo::~TrackInfo() { } -unsigned int CdRomDevice::Track::num() const throw() +unsigned int CdRomDevice::TrackInfo::num() const throw() { return _num; } -CdRomDevice::Track::Type CdRomDevice::Track::type() const +CdRomDevice::TrackInfo::Format CdRomDevice::TrackInfo::format() const throw() { - return _type; + return _format; } -size_t CdRomDevice::Track::lba() const throw() +size_t CdRomDevice::TrackInfo::lba() const throw() { return _lba; } -size_t CdRomDevice::Track::size() const throw() -{ - return _size; -} - -uint8_t CdRomDevice::Track::startMinute() const throw() -{ - return _startMsf[0]; -} - -uint8_t CdRomDevice::Track::startSecond() const throw() -{ - return _startMsf[1]; -} - -uint8_t CdRomDevice::Track::startFrame() const throw() -{ - return _startMsf[2]; -} - -uint8_t CdRomDevice::Track::endMinute() const throw() -{ - return _endMsf[0]; -} - -uint8_t CdRomDevice::Track::endSecond() const throw() +size_t CdRomDevice::TrackInfo::length() const throw() { - return _endMsf[1]; + return _length; } -uint8_t CdRomDevice::Track::endFrame() const throw() -{ - return _endMsf[2]; -} } // !namespace System |
From: Christian P. <cp...@us...> - 2005-02-17 14:17:59
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21579/src/System Modified Files: Makefile.am Log Message: Added SignalListener.h, SignalListener.posix.cpp Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile.am 14 Feb 2005 20:26:00 -0000 1.16 +++ Makefile.am 17 Feb 2005 14:17:48 -0000 1.17 @@ -56,7 +56,7 @@ if WITH_POSIX_IO IO_Sources = IOHandle.posix.cpp Pipe.posix.cpp File.posix.cpp \ FileInfo.posix.cpp Directory.posix.cpp Process.posix.cpp \ - FdListener.posix.cpp + FdListener.posix.cpp SignalListener.posix.cpp endif if WITH_WIN32_IO @@ -101,4 +101,4 @@ $(top_builddir)/src/IO/libpclasses_io.la \ $(DL_LIBS) -noinst_HEADERS = timeout.h SharedLibCache.h IOHandle.h +noinst_HEADERS = timeout.h SharedLibCache.h IOHandle.h SignalListener.h |
From: Christian P. <cp...@us...> - 2005-02-17 14:16:39
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21343/src/System Modified Files: FdListener.posix.cpp Log Message: Added restart of select() if errno==EINTR. Index: FdListener.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/FdListener.posix.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FdListener.posix.cpp 11 Feb 2005 12:00:09 -0000 1.3 +++ FdListener.posix.cpp 17 Feb 2005 14:16:29 -0000 1.4 @@ -209,6 +209,7 @@ populate_fd_sets(&read_fds, &write_fds, &error_fds, _listeners); } + _select_loop: Private::get_timeout(&timeout, timeout_ms, Private::TIMEOUT_RELATIVE); int ret = ::select(highest_fd + 1, &read_fds, &write_fds, &error_fds, @@ -216,6 +217,9 @@ if(ret == -1) { + if(errno == EINTR) + goto _select_loop; + //@@fixme ... we don't want to throw from Thread::main() !!! throw SystemError(errno, "Could not select() for events", P_SOURCEINFO); } |
From: Christian P. <cp...@us...> - 2005-02-17 14:15:28
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20972/src/System Added Files: SignalListener.h SignalListener.posix.cpp Log Message: Added signal listener. --- NEW FILE: SignalListener.posix.cpp --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/System/EventQueue.h" #include "SignalListener.h" #include "FdListener.h" #include <signal.h> #include <unistd.h> #include <fcntl.h> namespace P { namespace System { class SignalFdListener: public FdListener { public: SignalFdListener(int handle) : FdListener(handle, FdListener::Read) { for(int i = 0; i < sizeof(_listeners) / sizeof(SignalListener*); i++) _listeners[i] = 0; System::FdListenerList& lst = System::FdListenerList::instance(EventQueue::instance()); lst.addListener(this); } ~SignalFdListener() { System::FdListenerList& lst = System::FdListenerList::instance(EventQueue::instance()); lst.removeListener(this); } static SignalFdListener& instance() { if(!_instance) { int ret = ::pipe(_signalPipe); // make pipe nonblocking ... ::fcntl(_signalPipe[0], F_SETFL, O_NONBLOCK); ::fcntl(_signalPipe[1], F_SETFL, O_NONBLOCK); _instance = new SignalFdListener(_signalPipe[0]); } return *_instance; } void addListener(int sig, SignalListener& l) { _listeners[sig] = &l; } void removeListener(SignalListener& l) { } void writeSignal(int sig) { // read current pending signals ... sigset_t sigSet; int ret = ::read(_signalPipe[0], &sigSet, sizeof(sigset_t)); if(ret != sizeof(sigset_t)) sigemptyset(&sigSet); // add pending signal to set and write back to pipe sigaddset(&sigSet, sig); ::write(_signalPipe[1], &sigSet, sizeof(sigset_t)); } protected: void onRead() { sigset_t blockedSet, oldSet; sigfillset(&blockedSet); sigprocmask(SIG_SETMASK, &blockedSet, &oldSet); sigset_t sigSet; int ret = ::read(fd(), &sigSet, sizeof(sigset_t)); if(ret == sizeof(sigset_t)) { for(int i = 0; i < 64; i++) { if(sigismember(&sigSet, i) == 1 && _listeners[i]) _listeners[i]->onSignal(); } } sigprocmask(SIG_SETMASK, &oldSet, 0); } private: SignalListener* _listeners[64]; static int _signalPipe[2]; static SignalFdListener* _instance; }; int SignalFdListener::_signalPipe[2]; SignalFdListener* SignalFdListener::_instance = 0; void signal_handler(int sig) { SignalFdListener& l = SignalFdListener::instance(); l.writeSignal(sig); } SignalListener::SignalListener(int sig) { struct sigaction sa; sa.sa_handler = &signal_handler; sigfillset(&sa.sa_mask); // block all signals during signal handler's execution sa.sa_flags = SA_RESTART; // restart system calls SignalFdListener& l = SignalFdListener::instance(); l.addListener(sig, *this); sigaction(sig, &sa, 0); } SignalListener::~SignalListener() { SignalFdListener& l = SignalFdListener::instance(); l.removeListener(*this); } } } --- NEW FILE: SignalListener.h --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_System_SignalListener #define P_System_SignalListener #include "pclasses/Export.h" namespace P { namespace System { class PSYSTEM_EXPORT SignalListener { public: SignalListener(int sig); virtual ~SignalListener(); virtual void onSignal() = 0; }; } // !namespace System } // !namespace P #endif |
From: Marc D. <ma...@us...> - 2005-02-15 19:04:39
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20751/src/System Modified Files: SerialDevice.linux.cpp Log Message: get and set control and local flags Index: SerialDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SerialDevice.linux.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SerialDevice.linux.cpp 14 Feb 2005 22:53:15 -0000 1.3 +++ SerialDevice.linux.cpp 15 Feb 2005 19:03:56 -0000 1.4 @@ -190,7 +190,7 @@ switch( parity ) { case SerialDevice::ParityEven: ios.c_cflag |= PARENB ; - ios.c_cflag &= ~PARODD ; + ios.c_cflag &= ~PARODD ; // unset odd break ; case SerialDevice::ParityOdd: ios.c_cflag |= PARENB ; @@ -234,7 +234,7 @@ } if ( SerialDevice::FlowControlHard == fcontrol ) { - ios.c_iflag &= ~(IXON|IXOFF); + ios.c_iflag &= ~(IXON|IXOFF); //unset software ios.c_cflag |= CRTSCTS; ios.c_cc[VSTART] = _POSIX_VDISABLE; ios.c_cc[VSTOP] = _POSIX_VDISABLE; @@ -257,8 +257,7 @@ throw IO::IOError(errno, "Could not get flow control", P_SOURCEINFO); } - if( (ios.c_iflag & IXON) && - (ios.c_iflag & IXOFF) && + if( ( (ios.c_iflag & IXON) || (ios.c_iflag & IXOFF) ) && (CTRL_Q == ios.c_cc[VSTART]) && (CTRL_S == ios.c_cc[VSTOP]) ) { return SerialDevice::FlowControlSoft; @@ -269,13 +268,12 @@ } SerialDevice::InputFlags SerialDevice::inputFlags() throw(IO::IOError) { - InputFlags flags; - struct termios ios; if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { throw IO::IOError(errno, "Could not get input mode", P_SOURCEINFO); } - + + InputFlags flags; if(ios.c_iflag & IGNBRK) flags = static_cast<InputFlags>(flags | IgnoreBreak); if(ios.c_iflag & IGNPAR) flags = static_cast<InputFlags>(flags | IgnoreParityError); if(ios.c_iflag & BRKINT) flags = static_cast<InputFlags>(flags | BreakInt); @@ -324,6 +322,82 @@ } } +SerialDevice::OutputFlags SerialDevice::outputFlags() throw(IO::IOError) { + struct termios ios ; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not get output mode", P_SOURCEINFO); + } + + OutputFlags flags; + if(ios.c_oflag & OPOST) flags = static_cast<OutputFlags>(flags | Post); + if(ios.c_oflag & OLCUC) flags = static_cast<OutputFlags>(flags | LowerToUpper); + if(ios.c_oflag & ONLCR) flags = static_cast<OutputFlags>(flags | ONlToCr); + if(ios.c_oflag & OCRNL) flags = static_cast<OutputFlags>(flags | OCrToNl); + if(ios.c_oflag & ONOCR) flags = static_cast<OutputFlags>(flags | NoCrCol0); + if(ios.c_oflag & ONLRET) flags = static_cast<OutputFlags>(flags | NoCr); + if(ios.c_oflag & OFILL) flags = static_cast<OutputFlags>(flags | Fill); + if(ios.c_oflag & OFDEL) flags = static_cast<OutputFlags>(flags | FillDel); + return flags; +} + +void SerialDevice::setOutputFlags(SerialDevice::OutputFlags flags) throw(IO::IOError) { + int oflags = 0; + if(flags & Post) oflags |= OPOST; + if(flags & LowerToUpper) oflags |= OLCUC; + if(flags & ONlToCr) oflags |= ONLCR; + if(flags & OCrToNl) oflags |= OCRNL; + if(flags & NoCrCol0) oflags |= ONOCR; + if(flags & NoCr) oflags |= ONLRET; + if(flags & Fill) oflags |= OFILL; + if(flags & FillDel) oflags |= OFDEL; + + struct termios ios ; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not set output mode", P_SOURCEINFO); + } + + ios.c_oflag = oflags; + + if( ::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1) { + throw IO::IOError(errno, "Could not set output mode", P_SOURCEINFO); + } +} + +SerialDevice::ControlFlags SerialDevice::controlFlags() throw(IO::IOError) { + struct termios ios; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not get control mode", P_SOURCEINFO); + } + + ControlFlags flags; + if(ios.c_cflag & CSTOPB) flags = static_cast<ControlFlags>(flags | StopBits); + if(ios.c_cflag & CREAD) flags = static_cast<ControlFlags>(flags | Read); + if(ios.c_cflag & HUPCL) flags = static_cast<ControlFlags>(flags | HangUp); + if(ios.c_cflag & CLOCAL) flags = static_cast<ControlFlags>(flags | Local); + //if(ios.c_cflag & LOBLK) flags = static_cast<ControlFlags>(flags | BlockShell); + return flags; +} + +void SerialDevice::setControlFlags(SerialDevice::ControlFlags flags) throw(IO::IOError) { + int cflags = 0; + if(flags & StopBits) cflags |= CSTOPB; + if(flags & Read) cflags |= CREAD; + if(flags & HangUp) cflags |= HUPCL; + if(flags & Local) cflags |= CLOCAL; + //if(flags & BlockShell) cflags |= LOBLK; + + struct termios ios ; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not set control mode", P_SOURCEINFO); + } + + ios.c_cflag |= (tcflag_t)cflags; + + if( ::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1) { + throw IO::IOError(errno, "Could not set control mode", P_SOURCEINFO); + } +} + void SerialDevice::put(const UInt8& byte) throw(IO::IOError) { this->write((const char*)(&byte), 1); } @@ -338,8 +412,8 @@ int mode; switch(fmode) { - case FlushInput: mode = TCIFLUSH; break; - case FlushOutput: mode = TCOFLUSH; break; + case Input: mode = TCIFLUSH; break; + case Output: mode = TCOFLUSH; break; default: mode = TCIOFLUSH; // FlushAll }; |
From: Marc D. <ma...@us...> - 2005-02-15 19:04:12
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20751/include/pclasses/System Modified Files: SerialDevice.h Log Message: get and set control and local flags Index: SerialDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SerialDevice.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SerialDevice.h 14 Feb 2005 22:53:14 -0000 1.3 +++ SerialDevice.h 15 Feb 2005 19:03:53 -0000 1.4 @@ -95,27 +95,110 @@ SignalFullQueque }; - enum OutputMode { - CRtoNL, - IgnoreNL, - IgnoreCR - }; - - enum ControlMode { - EnableReceiver, - LocalLine, - HangupLine + enum OutputFlags { + // Enable implementation-defined output processing.(OPOST) + Post, + // Map lowercase characters to uppercase on output. (OLCUC) (not in POSIX) + LowerToUpper, + // (XSI) Map NL to CR-NL on output. (ONLCR) + ONlToCr, + // Map CR to NL on output. (OCRNL) + OCrToNl, + // Don't output CR at column 0. (ONOCR) + NoCrCol0, + // Don't output CR. (ONLRET) + NoCr, + //Send fill characters for a delay, rather than using a timed delay. (OFILL) + Fill, + // Fill character is ASCII DEL (0177). If unset, fill character is ASCII NUL. (OFDEL) + FillDel + //NLDLY Newline delay mask. Values are NL0 and NL1. + //CRDLY Carriage return delay mask. Values are CR0, CR1, CR2, or CR3. + //TABDLY Horizontal tab delay mask. + //BSDLY Backspace delay mask. + //VTDLY Vertical tab delay mask. Values are VT0 or VT1. + //FFDLY Form feed delay mask. Values are FF0 or FF1. }; - enum LocalMode { + enum ControlFlags { + // Set two stop bits, rather than one. (CSTOPB) + StopBits, + // Enable receiver. (CREAD) + Read, + // Lower modem control lines after last process closes the device(hang up). (HUPCL) + HangUp, + // Ignore modem control lines. (CLOCAL) + Local, + // (not in POSIX) Block output from a noncurrent shell layer. (LOBLK) + BlockShell + //CIBAUD + }; + + enum Localflags { + //ISIG When any of the characters INTR, QUIT, SUSP, or DSUSP are + //received, generate the corresponding signal. + Signal, + //ICANON Enable canonical mode. This enables the special characters EOF, + //EOL, EOL2, ERASE, KILL, LNEXT, REPRINT, STATUS, and WERASE, and + //buffers by lines. + Canonical, + //XCASE (not in POSIX; not supported under Linux) If ICANON is also set, + //terminal is uppercase only. Input is converted to lowercase, + //except for characters preceded by \. On output, uppercase char- + //acters are preceded by \ and lowercase characters are converted + //to uppercase. + XCase, + //ECHO Echo input characters. Echo, - NoFlush + //ECHOE If ICANON is also set, the ERASE character erases the preceding + //input character, and WERASE erases the preceding word. + EchoErase, + //ECHOK If ICANON is also set, the KILL character erases the current + //line. + EchoKill, + //ECHONL If ICANON is also set, echo the NL character even if ECHO is not + //set. + EchoNl, + //ECHOCTL + //(not in POSIX) If ECHO is also set, ASCII control signals other + //than TAB, NL, START, and STOP are echoed as ^X, where X is the + //character with ASCII code 0x40 greater than the control signal. + //For example, character 0x08 (BS) is echoed as ^H. + EchoCtl, + //ECHOPRT + //(not in POSIX) If ICANON and IECHO are also set, characters are + //printed as they are being erased. + EchoPrint, + //ECHOKE (not in POSIX) If ICANON is also set, KILL is echoed by erasing + //each character on the line, as specified by ECHOE and ECHOPRT. + EchoKillErase, + //DEFECHO + //(not in POSIX) Echo only when a process is reading. + DefEcho, + //FLUSHO (not in POSIX; not supported under Linux) Output is being + //flushed. This flag is toggled by typing the DISCARD character. + FlushOutput, + //NOFLSH Disable flushing the input and output queues when generating the + //SIGINT, SIGQUIT and SIGSUSP signals. + NoFlush, + //TOSTOP Send the SIGTTOU signal to the process group of a background + //process which tries to write to its controlling terminal. + ToStop, + //PENDIN (not in POSIX; not supported under Linux) All characters in the + //input queue are reprinted when the next character is read. + //(bash handles typeahead this way.) + ReprintOnRead, + //IEXTEN Enable implementation-defined input processing. This flag, as + //well as ICANON must be enabled for the special characters EOL2, + //LNEXT, REPRINT, WERASE to be interpreted, and for the IUCLC flag + //to be effective. + EnableInputProcessing }; enum FlushMode { - FlushInput, - FlushOutput, - FlushAll + Input, + Output, + All }; public: @@ -146,6 +229,14 @@ InputFlags inputFlags() throw(IO::IOError); void setInputFlags(InputFlags mode) throw(IO::IOError); + + OutputFlags outputFlags() throw(IO::IOError); + + void setOutputFlags(OutputFlags mode) throw(IO::IOError); + + ControlFlags controlFlags() throw(IO::IOError); + + void setControlFlags(ControlFlags mode) throw(IO::IOError); void put(const UInt8& byte) throw(IO::IOError); |
From: Marc D. <ma...@us...> - 2005-02-14 22:53:29
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3075/include/pclasses/System Modified Files: SerialDevice.h Log Message: added input control Index: SerialDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SerialDevice.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SerialDevice.h 14 Feb 2005 20:58:05 -0000 1.2 +++ SerialDevice.h 14 Feb 2005 22:53:14 -0000 1.3 @@ -78,9 +78,21 @@ FlowControlSoft }; - enum InputMode { + enum InputFlags { IgnoreBreak, - IgnoreParityError + BreakInt, + IgnoreParityError, + ParityMark, + EnableParityCheck, + StripBit8, + NlToCr, + IgnoreCr, + CrToNl, + MapUpperToLower, + EnableXON, + EnableXOFF, + EnableAny, + SignalFullQueque }; enum OutputMode { @@ -121,7 +133,19 @@ void setCharSize(CharSize csize) throw(IO::IOError); - CharSize charSize() throw(IO::IOError); + CharSize charSize() throw(IO::IOError); + + void setParity(Parity p) throw(IO::IOError); + + Parity parity() throw(IO::IOError); + + void setFlowControl(FlowControl fcontrol) throw(IO::IOError); + + FlowControl flowControl() throw(IO::IOError); + + InputFlags inputFlags() throw(IO::IOError); + + void setInputFlags(InputFlags mode) throw(IO::IOError); void put(const UInt8& byte) throw(IO::IOError); |
From: Marc D. <ma...@us...> - 2005-02-14 22:53:29
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3075/src/System Modified Files: SerialDevice.linux.cpp Log Message: added input control Index: SerialDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SerialDevice.linux.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SerialDevice.linux.cpp 14 Feb 2005 20:58:06 -0000 1.2 +++ SerialDevice.linux.cpp 14 Feb 2005 22:53:15 -0000 1.3 @@ -145,26 +145,28 @@ struct termios ios; if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { - throw IO::IOError(errno, "Could not set char size", P_SOURCEINFO); + throw IO::IOError(errno, "Could not set char size.", P_SOURCEINFO); } if( size == SerialDevice::CharSize8 ) { - ios.c_iflag &= ~ISTRIP; - } else { - ios.c_iflag |= ISTRIP; + ios.c_iflag &= ~ISTRIP; + } + else { + ios.c_iflag |= ISTRIP; } + ios.c_cflag &= ~CSIZE; ios.c_cflag |= size; if( ::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1) { - throw IO::IOError(errno, "Could not set char size", P_SOURCEINFO); + throw IO::IOError(errno, "Could not set char size.", P_SOURCEINFO); } } SerialDevice::CharSize SerialDevice::charSize() throw(IO::IOError) { struct termios ios; if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { - throw IO::IOError(errno, "Could not get char size", P_SOURCEINFO); + throw IO::IOError(errno, "Could not get char size.", P_SOURCEINFO); } int size = (ios.c_cflag & CSIZE); @@ -173,12 +175,155 @@ case CS6 : return CharSize6; case CS7 : return CharSize7; case CS8 : return CharSize8; - default: return DefaultCharSize; + default: throw IO::IOError(errno, "Could not get char size.", P_SOURCEINFO); } return CharSize7; } +void SerialDevice::setParity(Parity parity) throw(IO::IOError) { + struct termios ios; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not set parity.", P_SOURCEINFO); + } + + switch( parity ) { + case SerialDevice::ParityEven: + ios.c_cflag |= PARENB ; + ios.c_cflag &= ~PARODD ; + break ; + case SerialDevice::ParityOdd: + ios.c_cflag |= PARENB ; + ios.c_cflag |= PARODD ; + break ; + case SerialDevice::ParityNone: + ios.c_cflag &= ~PARENB ; + break ; + default: + throw IO::IOError(errno, "Could not set parity", P_SOURCEINFO); + } + + if( ::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1 ) { + throw IO::IOError(errno, "Could not set parity", P_SOURCEINFO); + } +} + +SerialDevice::Parity SerialDevice::parity() throw(IO::IOError) { + struct termios ios; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not get parity", P_SOURCEINFO); + } + + if( ios.c_cflag & PARENB ) { + if( ios.c_cflag & PARODD ) { + return SerialDevice::ParityOdd ; + } + else { + return SerialDevice::ParityEven ; + } + } + else { + return SerialDevice::ParityNone; + } +} + +void SerialDevice::setFlowControl(FlowControl fcontrol) throw(IO::IOError) { + struct termios ios; + if (::tcgetattr(this->nosHandle(), &ios) == -1) { + throw IO::IOError(errno, "Could not set flow control", P_SOURCEINFO); + } + + if ( SerialDevice::FlowControlHard == fcontrol ) { + ios.c_iflag &= ~(IXON|IXOFF); + ios.c_cflag |= CRTSCTS; + ios.c_cc[VSTART] = _POSIX_VDISABLE; + ios.c_cc[VSTOP] = _POSIX_VDISABLE; + } + else { + ios.c_iflag |= IXON|IXOFF; + ios.c_cflag &= ~CRTSCTS; + ios.c_cc[VSTART] = CTRL_Q ; + ios.c_cc[VSTOP] = CTRL_S ; + } + + if (::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1) { + throw IO::IOError(errno, "Could not set flow control", P_SOURCEINFO); + } +} + +SerialDevice::FlowControl SerialDevice::flowControl() throw(IO::IOError) { + struct termios ios ; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not get flow control", P_SOURCEINFO); + } + + if( (ios.c_iflag & IXON) && + (ios.c_iflag & IXOFF) && + (CTRL_Q == ios.c_cc[VSTART]) && + (CTRL_S == ios.c_cc[VSTOP]) ) { + return SerialDevice::FlowControlSoft; + } + else {//if ( !((ios.c_iflag & IXON) || (ios.c_iflag & IXOFF)) ) { + return SerialDevice::FlowControlHard; + } +} + +SerialDevice::InputFlags SerialDevice::inputFlags() throw(IO::IOError) { + InputFlags flags; + + struct termios ios; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not get input mode", P_SOURCEINFO); + } + + if(ios.c_iflag & IGNBRK) flags = static_cast<InputFlags>(flags | IgnoreBreak); + if(ios.c_iflag & IGNPAR) flags = static_cast<InputFlags>(flags | IgnoreParityError); + if(ios.c_iflag & BRKINT) flags = static_cast<InputFlags>(flags | BreakInt); + if(ios.c_iflag & PARMRK) flags = static_cast<InputFlags>(flags | ParityMark); + if(ios.c_iflag & INPCK) flags = static_cast<InputFlags>(flags | EnableParityCheck); + if(ios.c_iflag & ISTRIP) flags = static_cast<InputFlags>(flags | StripBit8); + if(ios.c_iflag & INLCR) flags = static_cast<InputFlags>(flags | NlToCr); + if(ios.c_iflag & IGNCR) flags = static_cast<InputFlags>(flags | IgnoreCr); + if(ios.c_iflag & ICRNL) flags = static_cast<InputFlags>(flags | CrToNl); + if(ios.c_iflag & IUCLC) flags = static_cast<InputFlags>(flags | MapUpperToLower); + if(ios.c_iflag & IXON) flags = static_cast<InputFlags>(flags | EnableXON); + if(ios.c_iflag & IXOFF) flags = static_cast<InputFlags>(flags | EnableXOFF); + if(ios.c_iflag & IXANY) flags = static_cast<InputFlags>(flags | EnableAny); + if(ios.c_iflag & IMAXBEL) flags = static_cast<InputFlags>(flags | SignalFullQueque); + + return flags; +} + +void SerialDevice::setInputFlags(InputFlags flags) throw(IO::IOError) { + int iflags = 0; + + if(flags & IgnoreBreak) iflags |= IGNBRK; + if(flags & IgnoreParityError) iflags |= IGNPAR; + if(flags & BreakInt) iflags |= BRKINT; + if(flags & ParityMark) iflags |= PARMRK; + if(flags & EnableParityCheck) iflags |= INPCK; + if(flags & StripBit8) iflags |= ISTRIP; + if(flags & NlToCr) iflags |= INLCR; + if(flags & IgnoreCr) iflags |= IGNCR; + if(flags & CrToNl) iflags |= ICRNL; + if(flags & MapUpperToLower) iflags |= IUCLC; + if(flags & EnableXON) iflags |= IXON; + if(flags & EnableXOFF) iflags |= IXOFF; + if(flags & EnableAny) iflags |= IXANY; + if(flags & SignalFullQueque) iflags |= IMAXBEL; + + struct termios ios ; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not set input flags", P_SOURCEINFO); + } + + ios.c_iflag = flags; + + if( ::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1) { + throw IO::IOError(errno, "Could not set input flags", P_SOURCEINFO); + } +} + void SerialDevice::put(const UInt8& byte) throw(IO::IOError) { this->write((const char*)(&byte), 1); } |