2004-09-04 12:13:50 +00:00
|
|
|
|
/**
|
2007-04-26 04:50:23 +00:00
|
|
|
|
* \file client.cpp
|
2004-09-04 12:13:50 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Jo<EFBFBD>o Luis M. Assirati
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/debug.h"
|
Rename files in src/support, step one.
src/support/package.h src/support/Package.h Package
src/support/package.C.in src/support/Package.C.in Package
src/support/path.h src/support/Path.h Path
src/support/fs_extras.h src/support/fs_extras.h NOCLASSES
src/support/RandomAccessList.h src/support/RandomAccessList.h RandomAccessList
src/support/lyxmanip.h src/support/lyxmanip.h NOCLASSES
src/support/rename.C src/support/rename.cpp NOCLASSES
src/support/abort.C src/support/abort.cpp NOCLASSES
src/support/lyxlib.h src/support/lyxlib.h NOCLASSES
src/support/ExceptionMessage.h src/support/ExceptionMessage.h ExceptionMessage
src/support/copy.C src/support/copy.cpp NOCLASSES
src/support/limited_stack.h src/support/limited_stack.h limited_stack
src/support/filefilterlist.C src/support/FileFilterList.cpp ['FileFilterList', 'Filter']
src/support/cow_ptr.h src/support/cow_ptr.h cow_ptr
src/support/os_unix.C src/support/os_unix.cpp NOCLASSES
src/support/socktools.h src/support/socktools.h NOCLASSES
src/support/forkedcontr.h src/support/ForkedcallsController.h ForkedcallsController
src/support/os.h src/support/os.h NOCLASSES
src/support/FileMonitor.h src/support/FileMonitor.h FileMonitor
src/support/copied_ptr.h src/support/copied_ptr.h copied_ptr
src/support/translator.h src/support/Translator.h Translator
src/support/filetools.C src/support/filetools.cpp NOCLASSES
src/support/unlink.C src/support/unlink.cpp NOCLASSES
src/support/os_win32.C src/support/os_win32.cpp GetFolderPath
src/support/lstrings.C src/support/lstrings.cpp NOCLASSES
src/support/qstring_helpers.C src/support/qstring_helpers.cpp NOCLASSES
src/support/getcwd.C src/support/getcwd.cpp NOCLASSES
src/support/systemcall.C src/support/Systemcall.cpp Systemcall
src/support/lyxalgo.h src/support/lyxalgo.h NOCLASSES
src/support/filefilterlist.h src/support/FileFilterList.h ['FileFilterList', 'Filter']
src/support/unicode.C src/support/unicode.cpp IconvProcessor
src/support/userinfo.C src/support/userinfo.cpp NOCLASSES
src/support/lyxtime.C src/support/lyxtime.cpp NOCLASSES
src/support/kill.C src/support/kill.cpp NOCLASSES
src/support/docstring.C src/support/docstring.cpp to_local8bit_failure
src/support/os_cygwin.C src/support/os_cygwin.cpp NOCLASSES
src/support/lyxsum.C src/support/lyxsum.cpp NOCLASSES
src/support/environment.C src/support/environment.cpp NOCLASSES
src/support/filetools.h src/support/filetools.h NOCLASSES
src/support/textutils.C src/support/textutils.cpp NOCLASSES
src/support/mkdir.C src/support/mkdir.cpp NOCLASSES
src/support/forkedcall.C src/support/Forkedcall.cpp ['ForkedProcess', 'Forkedcall']
src/support/tempname.C src/support/tempname.cpp NOCLASSES
src/support/os_win32.h src/support/os_win32.h GetFolderPath
src/support/types.h src/support/types.h NOCLASSES
src/support/lstrings.h src/support/lstrings.h NOCLASSES
src/support/forkedcallqueue.C src/support/ForkedCallQueue.cpp ForkedCallQueue
src/support/qstring_helpers.h src/support/qstring_helpers.h NOCLASSES
src/support/convert.C src/support/convert.cpp NOCLASSES
src/support/filename.C src/support/FileName.cpp ['FileName', 'DocFileName']
src/support/tests/convert.C src/support/tests/convert.cpp NOCLASSES
src/support/tests/filetools.C src/support/tests/filetools.cpp NOCLASSES
src/support/tests/lstrings.C src/support/tests/lstrings.cpp NOCLASSES
src/support/tests/boost.C src/support/tests/boost.cpp NOCLASSES
src/support/docstream.C src/support/docstream.cpp ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/std_istream.h src/support/std_istream.h NOCLASSES
src/support/systemcall.h src/support/Systemcall.h Systemcall
src/support/chdir.C src/support/chdir.cpp NOCLASSES
src/support/std_ostream.h src/support/std_ostream.h NOCLASSES
src/support/unicode.h src/support/unicode.h IconvProcessor
src/support/path.C src/support/Path.cpp Path
src/support/fs_extras.C src/support/fs_extras.cpp NOCLASSES
src/support/userinfo.h src/support/userinfo.h NOCLASSES
src/support/lyxtime.h src/support/lyxtime.h NOCLASSES
src/support/docstring.h src/support/docstring.h to_local8bit_failure
src/support/debugstream.h src/support/debugstream.h basic_debugstream
src/support/environment.h src/support/environment.h NOCLASSES
src/support/textutils.h src/support/textutils.h NOCLASSES
src/support/forkedcall.h src/support/Forkedcall.h ['ForkedProcess', 'Forkedcall']
src/support/socktools.C src/support/socktools.cpp NOCLASSES
src/support/forkedcallqueue.h src/support/ForkedCallQueue.h ForkedCallQueue
src/support/forkedcontr.C src/support/ForkedcallsController.cpp ForkedcallsController
src/support/os.C src/support/os.cpp NOCLASSES
src/support/convert.h src/support/convert.h NOCLASSES
src/support/filename.h src/support/FileName.h ['FileName', 'DocFileName']
src/support/docstream.h src/support/docstream.h ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/FileMonitor.C src/support/FileMonitor.cpp FileMonitor
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18024 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 05:12:52 +00:00
|
|
|
|
#include "support/FileName.h"
|
2006-11-18 20:24:47 +00:00
|
|
|
|
#include "support/unicode.h"
|
2004-09-04 12:13:50 +00:00
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
|
|
#include <boost/filesystem/operations.hpp>
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
|
|
|
|
|
// getpid(), getppid()
|
2005-04-26 10:30:24 +00:00
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
# include <sys/types.h>
|
|
|
|
|
#endif
|
2005-01-19 15:26:41 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-01-20 15:38:14 +00:00
|
|
|
|
# include <unistd.h>
|
2005-01-19 15:26:41 +00:00
|
|
|
|
#endif
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
2006-04-12 09:58:09 +00:00
|
|
|
|
// struct timeval
|
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
|
# include <sys/time.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-09-04 12:13:50 +00:00
|
|
|
|
// select()
|
2005-04-26 10:30:24 +00:00
|
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
|
# include <sys/select.h>
|
|
|
|
|
#endif
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
|
|
|
|
// socket(), connect()
|
2005-04-26 10:30:24 +00:00
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
|
# include <sys/socket.h>
|
|
|
|
|
#endif
|
2004-09-04 12:13:50 +00:00
|
|
|
|
#include <sys/un.h>
|
|
|
|
|
|
|
|
|
|
// fcntl()
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
2004-09-17 08:26:41 +00:00
|
|
|
|
#include <cerrno>
|
2004-09-04 12:13:50 +00:00
|
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
|
using namespace lyx::support;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
2007-08-19 09:44:34 +00:00
|
|
|
|
using ::boost::scoped_ptr;
|
|
|
|
|
namespace fs = ::boost::filesystem;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
namespace lyx {
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
|
|
|
|
namespace support {
|
|
|
|
|
|
|
|
|
|
string itoa(unsigned int i)
|
|
|
|
|
{
|
2007-11-27 19:30:59 +00:00
|
|
|
|
char buf[20];
|
|
|
|
|
sprintf(buf, "%d", i);
|
|
|
|
|
return buf;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-12-21 13:01:47 +00:00
|
|
|
|
/// Returns the absolute pathnames of all lyx local sockets in
|
|
|
|
|
/// file system encoding.
|
|
|
|
|
/// Parts stolen from lyx::support::DirList().
|
2007-11-30 09:34:08 +00:00
|
|
|
|
vector<fs::path> lyxSockets(string const & dir, string const & pid)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
2007-11-30 09:34:08 +00:00
|
|
|
|
vector<fs::path> dirlist;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
2007-11-30 09:34:08 +00:00
|
|
|
|
fs::path dirpath(dir);
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
2007-11-30 09:34:08 +00:00
|
|
|
|
if (!fs::exists(dirpath) || !fs::is_directory(dirpath)) {
|
|
|
|
|
lyxerr << dir << " does not exist or is not a directory."
|
|
|
|
|
<< endl;
|
|
|
|
|
return dirlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fs::directory_iterator beg((fs::path(dir)));
|
|
|
|
|
fs::directory_iterator end;
|
|
|
|
|
|
|
|
|
|
for (; beg != end; ++beg) {
|
|
|
|
|
if (prefixIs(beg->leaf(), "lyx_tmpdir" + pid)) {
|
|
|
|
|
fs::path lyxsocket = beg->path() / "lyxsocket";
|
2004-09-04 12:13:50 +00:00
|
|
|
|
if (fs::exists(lyxsocket)) {
|
|
|
|
|
dirlist.push_back(lyxsocket);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dirlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace socktools {
|
|
|
|
|
|
|
|
|
|
|
2006-12-21 13:01:47 +00:00
|
|
|
|
/// Connect to the socket \p name.
|
2007-04-06 17:38:11 +00:00
|
|
|
|
int connect(FileName const & name)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
int fd; // File descriptor for the socket
|
|
|
|
|
sockaddr_un addr; // Structure that hold the socket address
|
|
|
|
|
|
2007-04-06 17:38:11 +00:00
|
|
|
|
string const encoded = name.toFilesystemEncoding();
|
2004-09-04 12:13:50 +00:00
|
|
|
|
// char sun_path[108]
|
2007-04-06 17:38:11 +00:00
|
|
|
|
string::size_type len = encoded.size();
|
2004-09-04 12:13:50 +00:00
|
|
|
|
if (len > 107) {
|
|
|
|
|
cerr << "lyxclient: Socket address '" << name
|
|
|
|
|
<< "' too long." << endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// Synonims for AF_UNIX are AF_LOCAL and AF_FILE
|
|
|
|
|
addr.sun_family = AF_UNIX;
|
2007-04-06 17:38:11 +00:00
|
|
|
|
encoded.copy(addr.sun_path, 107);
|
2004-09-04 12:13:50 +00:00
|
|
|
|
addr.sun_path[len] = '\0';
|
|
|
|
|
|
|
|
|
|
if ((fd = ::socket(PF_UNIX, SOCK_STREAM, 0))== -1) {
|
|
|
|
|
cerr << "lyxclient: Could not create socket descriptor: "
|
|
|
|
|
<< strerror(errno) << endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2004-09-17 08:26:41 +00:00
|
|
|
|
if (::connect(fd,
|
|
|
|
|
reinterpret_cast<struct sockaddr *>(&addr),
|
|
|
|
|
sizeof(addr)) == -1) {
|
2007-04-06 17:38:11 +00:00
|
|
|
|
cerr << "lyxclient: Could not connect to socket " << name.absFilename()
|
2004-09-04 12:13:50 +00:00
|
|
|
|
<< ": " << strerror(errno) << endl;
|
|
|
|
|
::close(fd);
|
|
|
|
|
return -1;
|
2004-10-05 10:11:42 +00:00
|
|
|
|
}
|
2004-09-04 12:13:50 +00:00
|
|
|
|
if (::fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
|
|
|
|
|
cerr << "lyxclient: Could not set O_NONBLOCK for socket: "
|
|
|
|
|
<< strerror(errno) << endl;
|
|
|
|
|
::close(fd);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return fd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace socktools
|
|
|
|
|
} // namespace support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-27 19:30:59 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// IOWatch
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2004-09-04 12:13:50 +00:00
|
|
|
|
class IOWatch {
|
|
|
|
|
public:
|
|
|
|
|
IOWatch();
|
|
|
|
|
void clear();
|
|
|
|
|
void addfd(int);
|
|
|
|
|
bool wait(double);
|
|
|
|
|
bool wait();
|
|
|
|
|
bool isset(int fd);
|
|
|
|
|
private:
|
|
|
|
|
fd_set des;
|
|
|
|
|
fd_set act;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IOWatch::IOWatch()
|
|
|
|
|
{
|
|
|
|
|
clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IOWatch::clear()
|
|
|
|
|
{
|
|
|
|
|
FD_ZERO(&des);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void IOWatch::addfd(int fd)
|
|
|
|
|
{
|
|
|
|
|
FD_SET(fd, &des);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool IOWatch::wait(double timeout)
|
|
|
|
|
{
|
|
|
|
|
timeval to;
|
|
|
|
|
to.tv_sec = static_cast<long int>(timeout);
|
|
|
|
|
to.tv_usec = static_cast<long int>((timeout - to.tv_sec)*1E6);
|
|
|
|
|
act = des;
|
|
|
|
|
return select(FD_SETSIZE, &act,
|
|
|
|
|
(fd_set *)0, (fd_set *)0, &to);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool IOWatch::wait()
|
|
|
|
|
{
|
|
|
|
|
act = des;
|
|
|
|
|
return select(FD_SETSIZE, &act,
|
|
|
|
|
(fd_set *)0, (fd_set *)0, (timeval *)0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-11-27 19:30:59 +00:00
|
|
|
|
bool IOWatch::isset(int fd)
|
|
|
|
|
{
|
2004-09-04 12:13:50 +00:00
|
|
|
|
return FD_ISSET(fd, &act);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-11-27 19:30:59 +00:00
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// LyXDataSocket
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2004-09-04 12:13:50 +00:00
|
|
|
|
// Modified LyXDataSocket class for use with the client
|
|
|
|
|
class LyXDataSocket {
|
|
|
|
|
public:
|
2007-04-06 17:38:11 +00:00
|
|
|
|
LyXDataSocket(FileName const &);
|
2004-09-04 12:13:50 +00:00
|
|
|
|
~LyXDataSocket();
|
|
|
|
|
// File descriptor of the connection
|
|
|
|
|
int fd() const;
|
|
|
|
|
// Connection status
|
|
|
|
|
bool connected() const;
|
|
|
|
|
// Line buffered input from the socket
|
|
|
|
|
bool readln(string &);
|
|
|
|
|
// Write the string + '\n' to the socket
|
|
|
|
|
void writeln(string const &);
|
|
|
|
|
private:
|
|
|
|
|
// File descriptor for the data socket
|
|
|
|
|
int fd_;
|
|
|
|
|
// True if the connection is up
|
|
|
|
|
bool connected_;
|
|
|
|
|
// buffer for input data
|
|
|
|
|
string buffer;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-04-06 17:38:11 +00:00
|
|
|
|
LyXDataSocket::LyXDataSocket(FileName const & address)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if ((fd_ = support::socktools::connect(address)) == -1) {
|
|
|
|
|
connected_ = false;
|
|
|
|
|
} else {
|
|
|
|
|
connected_ = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LyXDataSocket::~LyXDataSocket()
|
|
|
|
|
{
|
|
|
|
|
::close(fd_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int LyXDataSocket::fd() const
|
|
|
|
|
{
|
|
|
|
|
return fd_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool LyXDataSocket::connected() const
|
|
|
|
|
{
|
|
|
|
|
return connected_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Returns true if there was a complete line to input
|
|
|
|
|
// A line is of the form <key>:<value>
|
|
|
|
|
// A line not of this form will not be passed
|
|
|
|
|
// The line read is splitted and stored in 'key' and 'value'
|
|
|
|
|
bool LyXDataSocket::readln(string & line)
|
|
|
|
|
{
|
|
|
|
|
int const charbuf_size = 100;
|
2004-10-05 10:11:42 +00:00
|
|
|
|
char charbuf[charbuf_size]; // buffer for the ::read() system call
|
2004-09-04 12:13:50 +00:00
|
|
|
|
int count;
|
|
|
|
|
string::size_type pos;
|
|
|
|
|
|
|
|
|
|
// read and store characters in buffer
|
|
|
|
|
while ((count = ::read(fd_, charbuf, charbuf_size - 1)) > 0) {
|
|
|
|
|
charbuf[count] = '\0'; // turn it into a c string
|
|
|
|
|
buffer += charbuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Error conditions. The buffer must still be
|
|
|
|
|
// processed for lines read
|
|
|
|
|
if (count == 0) { // EOF -- connection closed
|
|
|
|
|
connected_ = false;
|
|
|
|
|
} else if ((count == -1) && (errno != EAGAIN)) { // IO error
|
|
|
|
|
cerr << "lyxclient: IO error." << endl;
|
|
|
|
|
connected_ = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cut a line from buffer
|
|
|
|
|
if ((pos = buffer.find('\n')) == string::npos)
|
|
|
|
|
return false; // No complete line stored
|
|
|
|
|
line = buffer.substr(0, pos);
|
|
|
|
|
buffer = buffer.substr(pos + 1);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Write a line of the form <key>:<value> to the socket
|
|
|
|
|
void LyXDataSocket::writeln(string const & line)
|
|
|
|
|
{
|
|
|
|
|
string linen(line + '\n');
|
|
|
|
|
int size = linen.size();
|
|
|
|
|
int written = ::write(fd_, linen.c_str(), size);
|
|
|
|
|
if (written < size) { // Allways mean end of connection.
|
|
|
|
|
if ((written == -1) && (errno == EPIPE)) {
|
|
|
|
|
// The program will also receive a SIGPIPE
|
|
|
|
|
// that must be catched
|
|
|
|
|
cerr << "lyxclient: connection closed while writing."
|
|
|
|
|
<< endl;
|
|
|
|
|
} else {
|
|
|
|
|
// Anything else, including errno == EAGAIN, must be
|
|
|
|
|
// considered IO error. EAGAIN should never happen
|
|
|
|
|
// when line is small
|
|
|
|
|
cerr << "lyxclient: IO error: " << strerror(errno);
|
|
|
|
|
}
|
|
|
|
|
connected_ = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-11-27 19:30:59 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// CmdLineParser
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2004-09-04 12:13:50 +00:00
|
|
|
|
class CmdLineParser {
|
|
|
|
|
public:
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
typedef int (*optfunc)(vector<docstring> const & args);
|
2004-09-04 12:13:50 +00:00
|
|
|
|
std::map<string, optfunc> helper;
|
|
|
|
|
std::map<string, bool> isset;
|
|
|
|
|
bool parse(int, char * []);
|
|
|
|
|
vector<char *> nonopt;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CmdLineParser::parse(int argc, char * argv[])
|
|
|
|
|
{
|
|
|
|
|
int opt = 1;
|
|
|
|
|
while (opt < argc) {
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
vector<docstring> args;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
if (helper[argv[opt]]) {
|
|
|
|
|
isset[argv[opt]] = true;
|
|
|
|
|
int arg = opt + 1;
|
|
|
|
|
while ((arg < argc) && (!helper[argv[arg]])) {
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
args.push_back(from_local8bit(argv[arg]));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
++arg;
|
|
|
|
|
}
|
|
|
|
|
int taken = helper[argv[opt]](args);
|
|
|
|
|
if (taken == -1)
|
|
|
|
|
return false;
|
|
|
|
|
opt += 1 + taken;
|
|
|
|
|
} else {
|
|
|
|
|
if (argv[opt][0] == '-') {
|
|
|
|
|
if ((argv[opt][1] == '-')
|
|
|
|
|
&& (argv[opt][2]== '\0')) {
|
|
|
|
|
++opt;
|
|
|
|
|
while (opt < argc) {
|
|
|
|
|
nonopt.push_back(argv[opt]);
|
|
|
|
|
++opt;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
cerr << "lyxclient: unknown option "
|
|
|
|
|
<< argv[opt] << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
nonopt.push_back(argv[opt]);
|
|
|
|
|
++opt;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// ~Class CmdLineParser -------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace cmdline {
|
|
|
|
|
|
|
|
|
|
void usage()
|
|
|
|
|
{
|
2007-11-27 19:30:59 +00:00
|
|
|
|
cerr <<
|
|
|
|
|
"Usage: lyxclient [options]\n"
|
|
|
|
|
"Options are:\n"
|
|
|
|
|
" -a address set address of the lyx socket\n"
|
|
|
|
|
" -t directory set system temporary directory\n"
|
|
|
|
|
" -p pid select a running lyx by pidi\n"
|
|
|
|
|
" -c command send a single command and quit\n"
|
|
|
|
|
" -g file row send a command to go to file and row\n"
|
|
|
|
|
" -n name set client name\n"
|
|
|
|
|
" -h name display this help end exit\n"
|
|
|
|
|
"If -a is not used, lyxclient will use the arguments of -t and -p to look for\n"
|
|
|
|
|
"a running lyx. If -t is not set, 'directory' defaults to /tmp. If -p is set,\n"
|
|
|
|
|
"lyxclient will connect only to a lyx with the specified pid. Options -c and -g\n"
|
|
|
|
|
"cannot be set simultaneoulsly. If no -c or -g options are given, lyxclient\n"
|
|
|
|
|
"will read commands from standard input and disconnect when command read is BYE:"
|
|
|
|
|
<< endl;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int h(vector<docstring> const &)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
usage();
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-11-27 19:30:59 +00:00
|
|
|
|
docstring clientName =
|
|
|
|
|
from_ascii(support::itoa(::getppid()) + ">" + support::itoa(::getpid()));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int n(vector<docstring> const & arg)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (arg.size() < 1) {
|
|
|
|
|
cerr << "lyxclient: The option -n requires 1 argument."
|
|
|
|
|
<< endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
clientName = arg[0];
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
docstring singleCommand;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int c(vector<docstring> const & arg)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (arg.size() < 1) {
|
|
|
|
|
cerr << "lyxclient: The option -c requires 1 argument."
|
|
|
|
|
<< endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
singleCommand = arg[0];
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int g(vector<docstring> const & arg)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (arg.size() < 2) {
|
|
|
|
|
cerr << "lyxclient: The option -g requires 2 arguments."
|
|
|
|
|
<< endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
singleCommand = "LYXCMD:server-goto-file-row "
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
+ arg[0] + ' '
|
|
|
|
|
+ arg[1];
|
2004-09-04 12:13:50 +00:00
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
// empty if LYXSOCKET is not set in the environment
|
|
|
|
|
docstring serverAddress;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int a(vector<docstring> const & arg)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (arg.size() < 1) {
|
|
|
|
|
cerr << "lyxclient: The option -a requires 1 argument."
|
|
|
|
|
<< endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// -a supercedes LYXSOCKET environment variable
|
|
|
|
|
serverAddress = arg[0];
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
docstring mainTmp(from_ascii("/tmp"));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int t(vector<docstring> const & arg)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (arg.size() < 1) {
|
|
|
|
|
cerr << "lyxclient: The option -t requires 1 argument."
|
|
|
|
|
<< endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
mainTmp = arg[0];
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string serverPid; // Init to empty string
|
|
|
|
|
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
int p(vector<docstring> const & arg)
|
2004-09-04 12:13:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (arg.size() < 1) {
|
|
|
|
|
cerr << "lyxclient: The option -p requires 1 argument."
|
|
|
|
|
<< endl;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
serverPid = to_ascii(arg[0]);
|
2004-09-04 12:13:50 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace cmdline
|
2006-10-21 07:31:57 +00:00
|
|
|
|
} // namespace lyx
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char * argv[])
|
|
|
|
|
{
|
2006-10-21 07:31:57 +00:00
|
|
|
|
using namespace lyx;
|
2007-11-28 22:12:03 +00:00
|
|
|
|
lyxerr.setStream(cerr);
|
2004-09-04 12:13:50 +00:00
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
char const * const lyxsocket = getenv("LYXSOCKET");
|
|
|
|
|
if (lyxsocket)
|
|
|
|
|
cmdline::serverAddress = from_local8bit(lyxsocket);
|
|
|
|
|
|
2004-09-04 12:13:50 +00:00
|
|
|
|
CmdLineParser args;
|
|
|
|
|
args.helper["-h"] = cmdline::h;
|
|
|
|
|
args.helper["-c"] = cmdline::c;
|
|
|
|
|
args.helper["-g"] = cmdline::g;
|
|
|
|
|
args.helper["-n"] = cmdline::n;
|
|
|
|
|
args.helper["-a"] = cmdline::a;
|
|
|
|
|
args.helper["-t"] = cmdline::t;
|
|
|
|
|
args.helper["-p"] = cmdline::p;
|
|
|
|
|
|
|
|
|
|
// Command line failure conditions:
|
|
|
|
|
if ((!args.parse(argc, argv))
|
|
|
|
|
|| (args.isset["-c"] && args.isset["-g"])
|
|
|
|
|
|| (args.isset["-a"] && args.isset["-p"])) {
|
|
|
|
|
cmdline::usage();
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scoped_ptr<LyXDataSocket> server;
|
|
|
|
|
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
if (!cmdline::serverAddress.empty()) {
|
2007-04-06 17:38:11 +00:00
|
|
|
|
server.reset(new LyXDataSocket(FileName(to_utf8(cmdline::serverAddress))));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
if (!server->connected()) {
|
|
|
|
|
cerr << "lyxclient: " << "Could not connect to "
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
<< to_utf8(cmdline::serverAddress) << endl;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// We have to look for an address.
|
|
|
|
|
// serverPid can be empty.
|
2007-11-30 09:34:08 +00:00
|
|
|
|
vector<fs::path> addrs = support::lyxSockets(to_filesystem8bit(cmdline::mainTmp), cmdline::serverPid);
|
|
|
|
|
vector<fs::path>::const_iterator addr = addrs.begin();
|
|
|
|
|
vector<fs::path>::const_iterator end = addrs.end();
|
2004-09-04 12:13:50 +00:00
|
|
|
|
for (; addr != end; ++addr) {
|
2006-12-21 13:01:47 +00:00
|
|
|
|
// Caution: addr->string() is in filesystem encoding
|
2007-11-30 09:34:08 +00:00
|
|
|
|
server.reset(new LyXDataSocket(FileName(to_utf8(from_filesystem8bit(addr->string())))));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
if (server->connected())
|
|
|
|
|
break;
|
|
|
|
|
lyxerr << "lyxclient: " << "Could not connect to "
|
2007-11-30 09:34:08 +00:00
|
|
|
|
<< addr->string() << endl;
|
2004-09-04 12:13:50 +00:00
|
|
|
|
}
|
|
|
|
|
if (addr == end) {
|
|
|
|
|
lyxerr << "lyxclient: No suitable server found."
|
|
|
|
|
<< endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
cerr << "lyxclient: " << "Connected to " << addr->string() << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int const serverfd = server->fd();
|
|
|
|
|
|
|
|
|
|
IOWatch iowatch;
|
|
|
|
|
iowatch.addfd(serverfd);
|
|
|
|
|
|
|
|
|
|
// Used to read from server
|
|
|
|
|
string answer;
|
|
|
|
|
|
|
|
|
|
// Send greeting
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
server->writeln("HELLO:" + to_utf8(cmdline::clientName));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
// wait at most 2 seconds until server responds
|
|
|
|
|
iowatch.wait(2.0);
|
|
|
|
|
if (iowatch.isset(serverfd) && server->readln(answer)) {
|
|
|
|
|
if (prefixIs(answer, "BYE:")) {
|
|
|
|
|
cerr << "lyxclient: Server disconnected." << endl;
|
|
|
|
|
cout << answer << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cerr << "lyxclient: No answer from server." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (args.isset["-g"] || args.isset["-c"]) {
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
|
server->writeln(to_utf8(cmdline::singleCommand));
|
2004-09-04 12:13:50 +00:00
|
|
|
|
iowatch.wait(2.0);
|
|
|
|
|
if (iowatch.isset(serverfd) && server->readln(answer)) {
|
|
|
|
|
cout << answer;
|
|
|
|
|
if (prefixIs(answer, "ERROR:"))
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
} else {
|
|
|
|
|
cerr << "lyxclient: No answer from server." << endl;
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Take commands from stdin
|
|
|
|
|
iowatch.addfd(0); // stdin
|
|
|
|
|
bool saidbye = false;
|
|
|
|
|
while ((!saidbye) && server->connected()) {
|
|
|
|
|
iowatch.wait();
|
|
|
|
|
if (iowatch.isset(0)) {
|
|
|
|
|
string command;
|
|
|
|
|
cin >> command;
|
|
|
|
|
if (command == "BYE:") {
|
|
|
|
|
server->writeln("BYE:");
|
|
|
|
|
saidbye = true;
|
|
|
|
|
} else {
|
|
|
|
|
server->writeln("LYXCMD:" + command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (iowatch.isset(serverfd)) {
|
|
|
|
|
while(server->readln(answer))
|
|
|
|
|
cout << answer << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-21 07:31:57 +00:00
|
|
|
|
namespace boost {
|
|
|
|
|
|
|
|
|
|
void assertion_failed(char const* a, char const* b, char const* c, long d)
|
|
|
|
|
{
|
|
|
|
|
lyx::lyxerr << "Assertion failed: " << a << ' ' << b << ' ' << c << ' '
|
|
|
|
|
<< d << '\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace boost
|