From: Christian P. <cp...@us...> - 2004-12-23 04:32:32
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/System Modified Files: File.posix.cpp Makefile.am Pipe.posix.cpp SharedLib.dl.cpp SystemError.cpp Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: File.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/File.posix.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- File.posix.cpp 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ File.posix.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -35,18 +35,18 @@ { } -File::File(const File& f) throw(IOError) +File::File(const File& f) throw(IO::IOError) : IODevice(f), _handle(0) { int handle = ::dup((int)f._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); _handle = (Handle*)handle; } File::File(const char* name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(IOError) + ShareMode smode) throw(IO::IOError) : _handle(0) { open(name,omode,amode,smode); @@ -61,7 +61,7 @@ } void File::open(const char* name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(LogicError, IOError) + ShareMode smode) throw(LogicError, IO::IOError) { if(!valid()) { @@ -100,7 +100,7 @@ int handle = ::open(name, flags); if(handle == -1) - throw IOError(errno, "Could not open file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not open file", P_SOURCEINFO); _handle = (Handle*)handle; IODevice::setAccess(amode); @@ -111,12 +111,12 @@ throw LogicError("File is already open", P_SOURCEINFO); } -void File::close() throw(LogicError, IOError) +void File::close() throw(LogicError, IO::IOError) { if(valid()) { if(::close((int)_handle) == -1) - throw IOError(errno, "Could not close file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not close file", P_SOURCEINFO); IODevice::setAccess(None); IODevice::setValid(false); @@ -125,7 +125,7 @@ throw LogicError("File is not open", P_SOURCEINFO); } -size_t File::read(char* buffer, size_t count) throw(IOError) +size_t File::read(char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -137,7 +137,7 @@ if(errno == EINTR) goto File_read; - throw IOError(errno, "Could not read from file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from file", P_SOURCEINFO); } else if(ret == 0 && !eof()) setEof(true); @@ -145,7 +145,7 @@ return ret; } -size_t File::peek(char* buffer, size_t count) throw(IOError) +size_t File::peek(char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -157,14 +157,14 @@ if(errno == EINTR) goto File_peek; - throw IOError(errno, "Could not read from file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from file", P_SOURCEINFO); } seek(-count, SeekCurrent); return ret; } -size_t File::write(const char* buffer, size_t count) throw(IOError) +size_t File::write(const char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -176,13 +176,13 @@ if(errno == EINTR) goto File_write; - throw IOError(errno, "Could not read from file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from file", P_SOURCEINFO); } return ret; } -offset_t File::seek(offset_t offset, SeekMode mode) throw(IOError) +offset_t File::seek(offset_t offset, SeekMode mode) throw(IO::IOError) { int whence; switch(mode) @@ -202,7 +202,7 @@ off_t ret = lseek((int)_handle, offset, whence); if(ret == (off_t)-1) - throw IOError(errno, "Could not seek on file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not seek on file", P_SOURCEINFO); return ret; } @@ -220,28 +220,28 @@ return false; } -void File::commit() const throw(IOError) +void File::commit() const throw(IO::IOError) { int ret = fsync((int)_handle); if(ret == -1) - throw IOError(errno, "Could not commit file to disk", P_SOURCEINFO); + throw IO::IOError(errno, "Could not commit file to disk", P_SOURCEINFO); } -offset_t File::size() const throw(IOError) +offset_t File::size() const throw(IO::IOError) { struct stat buff; int ret = fstat((int)_handle, &buff); if(ret == -1) - throw IOError(errno, "Could not stat file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not stat file", P_SOURCEINFO); return buff.st_size; } -File& File::operator=(const File& f) throw(IOError) +File& File::operator=(const File& f) throw(IO::IOError) { int handle = ::dup((int)f._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); if(valid()) { Index: SharedLib.dl.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.dl.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedLib.dl.cpp 22 Dec 2004 17:54:37 -0000 1.1.1.1 +++ SharedLib.dl.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -30,7 +30,7 @@ struct SharedLib::Handle {}; -SharedLib::SharedLib(const String& name, BindMode mode) throw(SystemError) +SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) { int flags = 0; switch(mode) @@ -44,7 +44,7 @@ } //flags |= RTLD_GLOBAL; this causes a SIGSEGV when loading multiple plugins with same exported vars - String so_name = name; + Unicode::String so_name = name; so_name.append(".so"); //_handle = (Handle*)dlopen(name.utf8(), flags); Index: Pipe.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Pipe.posix.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Pipe.posix.cpp 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ Pipe.posix.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -37,12 +37,12 @@ IODevice::setEof(false); } -Pipe::Pipe(const Pipe& p) throw(IOError) +Pipe::Pipe(const Pipe& p) throw(IO::IOError) : IODevice(p), _handle(0) { int handle = ::dup((int)p._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); _handle = (Handle*)handle; } @@ -55,12 +55,12 @@ } } -Pipe::Pair Pipe::create() throw(IOError) +Pipe::Pair Pipe::create() throw(IO::IOError) { int fds[2]; if(pipe(fds) == -1) - throw IOError(errno, "Could not create pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not create pipe", P_SOURCEINFO); Pipe readPipe((Handle*)fds[0], true); Pipe writePipe((Handle*)fds[1], false); @@ -68,12 +68,12 @@ return Pair(readPipe, writePipe); } -void Pipe::close() throw(LogicError, IOError) +void Pipe::close() throw(LogicError, IO::IOError) { if(valid()) { if(::close((int)_handle) == -1) - throw IOError(errno, "Could not close pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not close pipe", P_SOURCEINFO); IODevice::setAccess(None); IODevice::setValid(false); @@ -82,7 +82,7 @@ throw LogicError("Pipe is not open", P_SOURCEINFO); } -size_t Pipe::read(char* buffer, size_t count) throw(IOError) +size_t Pipe::read(char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -94,7 +94,7 @@ if(errno == EINTR) goto Pipe_read; - throw IOError(errno, "Could not read from pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from pipe", P_SOURCEINFO); } else if(ret == 0 && !eof()) setEof(true); @@ -102,7 +102,7 @@ return ret; } -size_t Pipe::write(const char* buffer, size_t count) throw(IOError) +size_t Pipe::write(const char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -116,24 +116,24 @@ if(errno == EINTR) goto Pipe_write; - throw IOError(errno, "Could not read from pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from pipe", P_SOURCEINFO); } return ret; } -void Pipe::commit() const throw(IOError) +void Pipe::commit() const throw(IO::IOError) { int ret = fsync((int)_handle); if(ret == -1) - throw IOError(errno, "Could not commit to pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not commit to pipe", P_SOURCEINFO); } -Pipe& Pipe::operator=(const Pipe& p) throw(IOError) +Pipe& Pipe::operator=(const Pipe& p) throw(IO::IOError) { int handle = ::dup((int)p._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); if(valid()) { Index: SystemError.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SystemError.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SystemError.cpp 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ SystemError.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -23,7 +23,7 @@ namespace P { namespace System { - + SystemError::SystemError(long errorNo, const char* what, const SourceInfo& si) throw() : RuntimeError(what, si), _errorNo(errorNo) @@ -44,10 +44,10 @@ return _errorNo; } -String SystemError::text() const throw() +Unicode::String SystemError::text() const throw() { //@todo return the real system error text - return String(); + return Unicode::String(); } } // !namespace System Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ Makefile.am 23 Dec 2004 04:32:18 -0000 1.2 @@ -76,6 +76,9 @@ $(IO_Sources) libpclasses_system_la_LDFLAGS = -no-undefined -libpclasses_system_la_LIBADD = $(top_builddir)/src/libpclasses.la $(DL_LIBS) +libpclasses_system_la_LIBADD = $(top_builddir)/src/libpclasses.la \ + $(top_builddir)/src/Unicode/libpclasses_unicode.la \ + $(top_builddir)/src/IO/libpclasses_io.la \ + $(DL_LIBS) noinst_HEADERS = timeout.h |