From c4be10e3ce3d338462dcca49aad510860e68f0f0 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 11 Sep 2002 16:48:07 +0000 Subject: [PATCH] Remove lyxerr call from FormInclude. Fix the lyxserver with Try64 unix. Remove mathed/preview.[Ch] as they're no longer used. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5268 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 ++ src/frontends/xforms/ChangeLog | 4 ++ src/frontends/xforms/FormInclude.C | 1 - src/lyxserver.C | 78 +++++++++++++++--------------- src/mathed/ChangeLog | 3 ++ src/mathed/preview.C | 1 - src/mathed/preview.h | 12 ----- 7 files changed, 50 insertions(+), 54 deletions(-) delete mode 100644 src/mathed/preview.C delete mode 100644 src/mathed/preview.h diff --git a/src/ChangeLog b/src/ChangeLog index 1b5f3d1878..07577f2765 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-09-11 Angus Leeming + + * lyxserver.C (read_ready): re-write to make it more transparent + and to make it work in coherent fashion under Tru64 Unix. + 2002-09-11 André Pönitz * commandtags.h: diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index ec8e9c272b..b33097ed2f 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-09-11 Angus Leeming + + * FormInclude.C (update): remove lyxerr call. + 2002-09-09 John Levon * FormInclude.C: diff --git a/src/frontends/xforms/FormInclude.C b/src/frontends/xforms/FormInclude.C index 8eb2329fee..cc5c82d029 100644 --- a/src/frontends/xforms/FormInclude.C +++ b/src/frontends/xforms/FormInclude.C @@ -60,7 +60,6 @@ void FormInclude::update() string const cmdname = controller().params().cparams.getCmdName(); - lyxerr << cmdname << endl; if (cmdname == "input") fl_set_button(dialog_->check_preview, int(controller().params().cparams.preview())); diff --git a/src/lyxserver.C b/src/lyxserver.C index 0c4e152e1e..b6c3e96d28 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -257,56 +257,54 @@ void LyXComm::emergencyCleanup() // Receives messages and sends then to client void LyXComm::read_ready() { - if (lyxerr.debugging(Debug::LYXSERVER)) { - lyxerr << "LyXComm: Receiving from fd " << infd << endl; - } + // nb! make read_buffer_ a class-member for multiple sessions + static string read_buffer_; + read_buffer_.erase(); - int const CMDBUFLEN = 100; - char charbuf[CMDBUFLEN]; - string cmd; -// nb! make lsbuf a class-member for multiple sessions - static string lsbuf; + int const charbuf_size = 100; + char charbuf[charbuf_size]; errno = 0; int status; // the single = is intended here. - while ((status = read(infd, charbuf, CMDBUFLEN - 1))) { - int rerrno = errno; - + while ((status = ::read(infd, charbuf, charbuf_size - 1))) { + if (status > 0) { - charbuf[status]= '\0'; // turn it into a c string - lsbuf += rtrim(charbuf, "\r"); - // commit any commands read - while (lsbuf.find('\n') != string::npos) { - // split() grabs the entire string if - // the delim /wasn't/ found. ?:-P - lsbuf= split(lsbuf, cmd,'\n'); - lyxerr[Debug::LYXSERVER] - << "LyXComm: status:" << status - << ", lsbuf:" << lsbuf - << ", cmd:" << cmd << endl; - if (!cmd.empty()) - clientcb(client, cmd); - //\n or not \n? - } - } - if (rerrno == EAGAIN) { - errno = 0; - return; - } - if (rerrno != 0) { - lyxerr << "LyXComm: " << strerror(rerrno) << endl; - if (!lsbuf.empty()) { + charbuf[status] = '\0'; // turn it into a c string + read_buffer_ += rtrim(charbuf, "\r"); + + } else if (errno != EAGAIN) { + if (!read_buffer_.empty()) { lyxerr << "LyXComm: truncated command: " - << lsbuf << endl; - lsbuf.erase(); + << read_buffer_ << '\n' + << "Resetting connection" << endl; + read_buffer_.erase(); } - break; // reset connection + + // reset connection + closeConnection(); + openConnection(); + break; + + } else { + // errno == EAGAIN + // Nothing new has arrived, so now's the time + // to tell the outside world if there's anything + // in the read buffer. + break; } } - closeConnection(); - openConnection(); - errno= 0; + + if (!read_buffer_.empty()) { + read_buffer_ = rtrim(read_buffer_, "\n"); + lyxerr[Debug::LYXSERVER] + << "LyXComm: Received from fd " + << infd << '\n' + << '\"' << read_buffer_ << '\"' << endl; + clientcb(client, read_buffer_); + } + + errno = 0; } diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 63c5e5b92f..17f4e21403 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,6 @@ +2002-09-11 Angus Leeming + + * preview.[Ch]: cruft. Removed. 2002-08-29 André Pönitz diff --git a/src/mathed/preview.C b/src/mathed/preview.C deleted file mode 100644 index bb404fc79b..0000000000 --- a/src/mathed/preview.C +++ /dev/null @@ -1 +0,0 @@ -// code is currently directly inside InsetFormula diff --git a/src/mathed/preview.h b/src/mathed/preview.h deleted file mode 100644 index a753649935..0000000000 --- a/src/mathed/preview.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef PREVIEW_H -#define PREVIEW_H - -#ifdef __GNUG__ -#pragma interface -#endif - -#include "LString.h" - -bool preview(string const & str); - -#endif -- 2.39.5