]> git.lyx.org Git - features.git/commitdiff
Remove lyxerr call from FormInclude.
authorAngus Leeming <leeming@lyx.org>
Wed, 11 Sep 2002 16:48:07 +0000 (16:48 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 11 Sep 2002 16:48:07 +0000 (16:48 +0000)
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
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormInclude.C
src/lyxserver.C
src/mathed/ChangeLog
src/mathed/preview.C [deleted file]
src/mathed/preview.h [deleted file]

index 1b5f3d18786b51c8b78f5e55db3c3fc9b796dfc9..07577f27654c62782e92531a2c70a4cfe77f9a0d 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-11  Angus Leeming  <leeming@lyx.org>
+
+       * 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 <poenitz@gmx.net>
 
        * commandtags.h:
index ec8e9c272be5c62b7c8c6531fa0c087fc1ffbb76..b33097ed2fa94116051c9f34d9eb3a23184c6eae 100644 (file)
@@ -1,3 +1,7 @@
+2002-09-11  Angus Leeming  <leeming@lyx.org>
+
+       * FormInclude.C (update): remove lyxerr call.
+
 2002-09-09  John Levon  <levon@movementarian.org>
 
        * FormInclude.C:
index 8eb2329feee499ff6ca6e0a4b321b38615eff077..cc5c82d0299195d24190c97a60935ad96ea34932 100644 (file)
@@ -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()));
index 0c4e152e1e20969c82cf649911afa26deb132db7..b6c3e96d28a06ac8e085fe3701900406e0386ee7 100644 (file)
@@ -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;
 }
 
 
index 63c5e5b92f6fa042d9edcec9c34da26daf4d3842..17f4e214036019dcc438065ee816e5df40cdb885 100644 (file)
@@ -1,3 +1,6 @@
+2002-09-11  Angus Leeming  <leeming@lyx.org>
+
+       * preview.[Ch]: cruft. Removed.
 
 2002-08-29  André Pönitz <poenitz@gmx.net>
 
diff --git a/src/mathed/preview.C b/src/mathed/preview.C
deleted file mode 100644 (file)
index bb404fc..0000000
+++ /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 (file)
index a753649..0000000
+++ /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