typedef RandomAccessList<some_class> MyContainer;
-Then you can use MyContainer as if it was a standard
+Then you can use MyContainer as if it was a standard
std::vector<some_class> for operator[] access and as if it was a
standard std::list for iterator access. The main difference with
std::vector is that insertion of elements is much less costly. Compared
s << counter++ << mname;
mname = s.str();
- // MiKTeX's YAP (version 2.4.1803) crashes if the file name
+ // MiKTeX's YAP (version 2.4.1803) crashes if the file name
// is longer than about 160 characters. MiKTeX's pdflatex
// is even pickier. A maximum length of 100 has been proven to work.
// If dir.size() > max length, all bets are off for YAP. We truncate
if (!npath.is_complete())
return "./" + npath.string() + '/';
-
+
return npath.string() + '/';
}
Will overwrite an already existing unzipped file without warning.
*/
std::string const unzipFile(std::string const & zipped_file,
- std::string const & unzipped_file = std::string());
+ std::string const & unzipped_file = std::string());
/// Returns true is path is absolute
bool AbsolutePath(std::string const & path);
pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND,
argv[0], &*argv.begin());
#elif defined (_WIN32)
- pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin());
+ pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin());
#else // POSIX
pid_t const cpid = ::fork();
if (cpid == 0) {
public:
/// A process in the queue
typedef std::pair<std::string, Forkedcall::SignalTypePtr> Process;
- /** Add a process to the queue. Processes are forked sequentially
- * only one is running at a time.
- * Connect to the returned signal and you'll be informed when
- * the process has ended.
- */
+ /** Add a process to the queue. Processes are forked sequentially
+ * only one is running at a time.
+ * Connect to the returned signal and you'll be informed when
+ * the process has ended.
+ */
Forkedcall::SignalTypePtr add(std::string const & process);
- /// Query whether the queue is running a forked process now.
+ /// Query whether the queue is running a forked process now.
bool running() const;
/// Get the and only instance of the class
static ForkedCallQueue & get();
#endif
#ifdef BOOST_WINDOWS
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
- return (attr != INVALID_FILE_ATTRIBUTES
- && (attr & FILE_ATTRIBUTE_READONLY));
+ return (attr != INVALID_FILE_ATTRIBUTES
+ && (attr & FILE_ATTRIBUTE_READONLY));
#endif
}
#ifdef BOOST_POSIX
int const infile = ::open(source.string().c_str(), O_RDONLY);
- if (infile == -1) {
+ if (infile == -1) {
boost::throw_exception(
filesystem_error(
"boost::filesystem::copy_file",
fs::detail::system_error_code()));
}
- struct stat source_stat;
- int const ret = ::fstat(infile, &source_stat);
- if (ret == -1) {
- ::close(infile);
+ struct stat source_stat;
+ int const ret = ::fstat(infile, &source_stat);
+ if (ret == -1) {
+ ::close(infile);
boost::throw_exception(
filesystem_error(
"boost::filesystem::copy_file",
source, target,
fs::detail::system_error_code()));
- }
+ }
- int const flags = O_WRONLY | O_CREAT | (noclobber ? O_EXCL : O_TRUNC);
+ int const flags = O_WRONLY | O_CREAT | (noclobber ? O_EXCL : O_TRUNC);
- int const outfile = ::open(target.string().c_str(), flags, source_stat.st_mode);
- if (outfile == -1) {
- ::close(infile);
+ int const outfile = ::open(target.string().c_str(), flags, source_stat.st_mode);
+ if (outfile == -1) {
+ ::close(infile);
boost::throw_exception(
filesystem_error(
"boost::filesystem::copy_file",
source, target,
fs::detail::system_error_code()));
- }
-
- std::size_t const buf_sz = 32768;
- char buf[buf_sz];
- ssize_t in = -1;
- ssize_t out = -1;
-
- while (true) {
- in = ::read(infile, buf, buf_sz);
- if (in == -1) {
- break;
- } else if (in == 0) {
- break;
- } else {
- out = ::write(outfile, buf, in);
- if (out == -1) {
- break;
- }
- }
- }
-
- ::close(infile);
- ::close(outfile);
-
- if (in == -1 || out == -1)
+ }
+
+ std::size_t const buf_sz = 32768;
+ char buf[buf_sz];
+ ssize_t in = -1;
+ ssize_t out = -1;
+
+ while (true) {
+ in = ::read(infile, buf, buf_sz);
+ if (in == -1) {
+ break;
+ } else if (in == 0) {
+ break;
+ } else {
+ out = ::write(outfile, buf, in);
+ if (out == -1) {
+ break;
+ }
+ }
+ }
+
+ ::close(infile);
+ ::close(outfile);
+
+ if (in == -1 || out == -1)
boost::throw_exception(
filesystem_error(
"boost::filesystem::copy_file",
gzstreambuf* gzstreambuf::open( const char* name, int open_mode) {
if ( is_open())
- return (gzstreambuf*)0;
+ return (gzstreambuf*)0;
mode = open_mode;
// no append nor read/write mode
if ((mode & std::ios::ate) || (mode & std::ios::app)
- || ((mode & std::ios::in) && (mode & std::ios::out)))
- return (gzstreambuf*)0;
+ || ((mode & std::ios::in) && (mode & std::ios::out)))
+ return (gzstreambuf*)0;
char fmode[10];
char* fmodeptr = fmode;
if ( mode & std::ios::in)
- *fmodeptr++ = 'r';
+ *fmodeptr++ = 'r';
else if ( mode & std::ios::out)
- *fmodeptr++ = 'w';
+ *fmodeptr++ = 'w';
*fmodeptr++ = 'b';
*fmodeptr = '\0';
file = gzopen( name, fmode);
if (file == 0)
- return (gzstreambuf*)0;
+ return (gzstreambuf*)0;
opened = 1;
return this;
}
gzstreambuf * gzstreambuf::close() {
if ( is_open()) {
- sync();
- opened = 0;
- if ( gzclose( file) == Z_OK)
- return this;
+ sync();
+ opened = 0;
+ if ( gzclose( file) == Z_OK)
+ return this;
}
return (gzstreambuf*)0;
}
int gzstreambuf::underflow() { // used for input buffer only
if ( gptr() && ( gptr() < egptr()))
- return * reinterpret_cast<unsigned char *>( gptr());
+ return * reinterpret_cast<unsigned char *>( gptr());
if ( ! (mode & std::ios::in) || ! opened)
- return EOF;
+ return EOF;
// Josuttis' implementation of inbuf
int n_putback = gptr() - eback();
if ( n_putback > 4)
- n_putback = 4;
+ n_putback = 4;
memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback);
int num = gzread( file, buffer+4, bufferSize-4);
if (num <= 0) // ERROR or EOF
- return EOF;
+ return EOF;
// reset buffer pointers
setg( buffer + (4 - n_putback), // beginning of putback area
- buffer + 4, // read position
- buffer + 4 + num); // end of buffer
+ buffer + 4, // read position
+ buffer + 4 + num); // end of buffer
// return next character
return * reinterpret_cast<unsigned char *>( gptr());
// sync() operation.
int w = pptr() - pbase();
if ( gzwrite( file, pbase(), w) != w)
- return EOF;
+ return EOF;
pbump( -w);
return w;
}
int gzstreambuf::overflow( int c) { // used for output buffer only
if ( ! ( mode & std::ios::out) || ! opened)
- return EOF;
+ return EOF;
if (c != EOF) {
- *pptr() = c;
- pbump(1);
+ *pptr() = c;
+ pbump(1);
}
if ( flush_buffer() == EOF)
- return EOF;
+ return EOF;
return c;
}
// which caused improper behavior with std::endl and flush(),
// bug reported by Vincent Ricard.
if ( pptr() && pptr() > pbase()) {
- if ( flush_buffer() == EOF)
- return -1;
+ if ( flush_buffer() == EOF)
+ return -1;
}
return 0;
}
void gzstreambase::open( const char* name, int open_mode) {
if ( ! buf.open( name, open_mode))
- clear( rdstate() | std::ios::badbit);
+ clear( rdstate() | std::ios::badbit);
}
void gzstreambase::close() {
if ( buf.is_open())
- if ( ! buf.close())
- clear( rdstate() | std::ios::badbit);
+ if ( ! buf.close())
+ clear( rdstate() | std::ios::badbit);
}
#ifdef GZSTREAM_NAMESPACE
int flush_buffer();
public:
gzstreambuf() : opened(0) {
- setp( buffer, buffer + (bufferSize-1));
- setg( buffer + 4, // beginning of putback area
- buffer + 4, // read position
- buffer + 4); // end position
- // ASSERT: both input & output capabilities will not be used together
+ setp( buffer, buffer + (bufferSize-1));
+ setg( buffer + 4, // beginning of putback area
+ buffer + 4, // read position
+ buffer + 4); // end position
+ // ASSERT: both input & output capabilities will not be used together
}
int is_open() { return opened; }
gzstreambuf* open( const char* name, int open_mode);
public:
igzstream() : std::istream( &buf) {}
igzstream( const char* name, int open_mode = std::ios::in)
- : gzstreambase( name, open_mode), std::istream( &buf) {}
+ : gzstreambase( name, open_mode), std::istream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const char* name, int open_mode = std::ios::in) {
- gzstreambase::open( name, open_mode);
+ gzstreambase::open( name, open_mode);
}
};
public:
ogzstream() : std::ostream( &buf) {}
ogzstream( const char* name, int mode = std::ios::out)
- : gzstreambase( name, mode), std::ostream( &buf) {}
+ : gzstreambase( name, mode), std::ostream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const char* name, int open_mode = std::ios::out) {
- gzstreambase::open( name, open_mode);
+ gzstreambase::open( name, open_mode);
}
};
// plain Windows 32
return CreateDirectory(pathname.c_str(), 0) != 0 ? 0 : -1;
#elif HAVE__MKDIR
- return ::_mkdir(pathname.c_str());
+ return ::_mkdir(pathname.c_str());
#else
# error "Don't know how to create a directory on this system."
#endif
folder_path_func_ = reinterpret_cast<function_pointer>(::GetProcAddress(folder_module_, "SHGetFolderPathA"));
if (folder_path_func_ == 0) {
lyxerr << "Unable to find SHGetFolderPathA in shfolder.dll\n"
- "Don't know how to proceed. Sorry."
+ "Don't know how to proceed. Sorry."
<< std::endl;
bail_out();
}
#include <config.h>
-/* $Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $ */
+/* $Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $ */
#if !defined(lint) && !defined(WITH_WARNINGS)
static char vcid[] = "$Id: strerror.c,v 1.3 2000/08/04 13:12:30 lasgouttes Exp $";
#endif /* lint */
-extern int sys_nerr ;
+extern int sys_nerr ;
extern char * sys_errlist [] ;
char * strerror (int errnum)
return ::open(templ, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
# elif defined (HAVE__OPEN)
return ::_open(templ,
- _O_RDWR | _O_CREAT | _O_EXCL,
- _S_IREAD | _S_IWRITE);
+ _O_RDWR | _O_CREAT | _O_EXCL,
+ _S_IREAD | _S_IWRITE);
# else
# error No open() function.
# endif