]> git.lyx.org Git - features.git/commitdiff
Replace Asger's huge patch with the kludges needed to compile LyX with MSVC.
authorAngus Leeming <leeming@lyx.org>
Mon, 31 Jan 2005 16:35:16 +0000 (16:35 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 31 Jan 2005 16:35:16 +0000 (16:35 +0000)
The good stuff is in the repository already.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9559 a592a061-630c-0410-9148-cb99ea01b6c8

development/Win32/lyx-devel.patch [deleted file]
development/Win32/readme.txt
development/Win32/win32_kludge.diff [new file with mode: 0644]

diff --git a/development/Win32/lyx-devel.patch b/development/Win32/lyx-devel.patch
deleted file mode 100644 (file)
index d2f76ed..0000000
+++ /dev/null
@@ -1,2219 +0,0 @@
-Index: src/BufferView.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
-retrieving revision 1.256
-diff -u -r1.256 BufferView.C
---- src/BufferView.C   30 Nov 2004 01:59:29 -0000      1.256
-+++ src/BufferView.C   31 Jan 2005 11:19:24 -0000
-@@ -290,10 +290,17 @@
-       screen().hideCursor();
- }
--
--LyXText * BufferView::getLyXText() const
-+LyXText * BufferView::getLyXText()
- {
-       LyXText * text = cursor().innerText();
-+      BOOST_ASSERT(text);
-+      return text;
-+}
-+
-+
-+LyXText const * BufferView::getLyXText() const
-+{
-+      LyXText const * text = cursor().innerText();
-       BOOST_ASSERT(text);
-       return text;
- }
-Index: src/BufferView.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v
-retrieving revision 1.183
-diff -u -r1.183 BufferView.h
---- src/BufferView.h   19 Jan 2005 15:03:26 -0000      1.183
-+++ src/BufferView.h   31 Jan 2005 11:15:54 -0000
-@@ -102,7 +102,10 @@
-       Change const getCurrentChange();
-       /// return the lyxtext we are using
--      LyXText * getLyXText() const;
-+      LyXText * getLyXText();
-+
-+      /// return the lyxtext we are using
-+      LyXText const * getLyXText() const;
-       /// simple replacing. Use the font of the first selected character
-       void replaceSelectionWithString(std::string const & str);
-Index: src/BufferView_pimpl.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
-retrieving revision 1.569
-diff -u -r1.569 BufferView_pimpl.C
---- src/BufferView_pimpl.C     27 Jan 2005 21:05:30 -0000      1.569
-+++ src/BufferView_pimpl.C     31 Jan 2005 12:25:38 -0000
-@@ -445,7 +445,6 @@
-       t.redoParagraph(anchor_ref_);
-       int const h = t.getPar(anchor_ref_).height();
-       offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
--      lyxerr << "scrolling: " << value << std::endl;
-       update();
-       if (!lyxrc.cursor_follows_scrollbar)
-@@ -612,6 +611,7 @@
-               CoordCache backup;
-               std::swap(theCoords, backup);
-+              theCoords.startUpdating();
-               //
-               ViewMetricsInfo vi = metrics();
-@@ -622,8 +622,11 @@
-               if (forceupdate) {
-                       // second drawing step
-                       screen().redraw(*bv_, vi);
--              } else
-+                      theCoords.doneUpdating();
-+              } else {
-+                      // Abort updating of the coord cache - just restore the old one
-                       std::swap(theCoords, backup);
-+              }
-       } else
-               screen().greyOut();
-@@ -743,7 +746,7 @@
- void BufferView::Pimpl::center()
- {
--      CursorSlice const & bot = bv_->cursor().bottom();
-+      CursorSlice & bot = bv_->cursor().bottom();
-       lyx::pit_type const pit = bot.pit();
-       bot.text()->redoParagraph(pit);
-       Paragraph const & par = bot.text()->paragraphs()[pit];
-@@ -1247,7 +1250,7 @@
-       int y = y1;
-       for (lyx::pit_type pit = pit1; pit <= pit2; ++pit) {
-               y += text->getPar(pit).ascent();
--              theCoords.pars_[text][pit] = Point(0, y);
-+              theCoords.parPos()[text][pit] = Point(0, y);
-               y += text->getPar(pit).descent();
-       }
-Index: src/DepTable.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/DepTable.C,v
-retrieving revision 1.41
-diff -u -r1.41 DepTable.C
---- src/DepTable.C     13 Oct 2003 01:01:33 -0000      1.41
-+++ src/DepTable.C     19 Jan 2005 10:35:54 -0000
-@@ -26,7 +26,9 @@
- #include <fstream>
- #ifndef CXX_GLOBAL_CSTD
-+# ifndef _WIN32
- using std::time;
-+# endif
- #endif
- using lyx::support::ltrim;
-Index: src/RowList_fwd.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/RowList_fwd.h,v
-retrieving revision 1.5
-diff -u -r1.5 RowList_fwd.h
---- src/RowList_fwd.h  16 Nov 2004 20:41:37 -0000      1.5
-+++ src/RowList_fwd.h  27 Jan 2005 10:58:08 -0000
-@@ -16,6 +16,11 @@
- #include <vector>
-+/**
-+ * Each paragraph is broken up into a number of rows on the screen.
-+ * This is a list of such on-screen rows, ordered from the top row
-+ * downwards.
-+ */
- typedef std::vector<Row> RowList;
- #endif
-Index: src/buffer.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
-retrieving revision 1.609
-diff -u -r1.609 buffer.C
---- src/buffer.C       31 Jan 2005 10:42:17 -0000      1.609
-+++ src/buffer.C       31 Jan 2005 11:08:10 -0000
-@@ -77,7 +77,11 @@
- #include <boost/bind.hpp>
- #include <boost/filesystem/operations.hpp>
--#include <utime.h>
-+#ifdef _WIN32
-+# include <windows.h>
-+#else
-+# include <utime.h>
-+#endif
- #include <iomanip>
- #include <stack>
-Index: src/buffer.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.h,v
-retrieving revision 1.189
-diff -u -r1.189 buffer.h
---- src/buffer.h       17 Dec 2004 16:27:07 -0000      1.189
-+++ src/buffer.h       31 Jan 2005 09:58:01 -0000
-@@ -49,10 +49,15 @@
- /** The buffer object.
--  This is the buffer object. It contains all the informations about
--  a document loaded into LyX. I am not sure if the class is complete or
--  minimal, probably not.
--  \author Lars Gullik Bjønnes
-+ * This is the buffer object. It contains all the informations about
-+ * a document loaded into LyX.
-+ * The buffer object owns the LyXText (wrapped in an InsetText), which 
-+ * contains the individual paragraphs of the document.
-+ *
-+ * 
-+ * I am not sure if the class is complete or
-+ * minimal, probably not.
-+ * \author Lars Gullik Bjønnes
-   */
- class Buffer {
- public:
-Index: src/bufferview_funcs.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferview_funcs.C,v
-retrieving revision 1.146
-diff -u -r1.146 bufferview_funcs.C
---- src/bufferview_funcs.C     6 Jan 2005 16:39:21 -0000       1.146
-+++ src/bufferview_funcs.C     31 Jan 2005 11:54:25 -0000
-@@ -180,8 +180,8 @@
- Point getPos(DocIterator const & dit)
- {
-       CursorSlice const & bot = dit.bottom();
--      CoordCache::InnerParPosCache & cache = theCoords.pars_[bot.text()];
--      CoordCache::InnerParPosCache::iterator it = cache.find(bot.pit());
-+      CoordCache::InnerParPosCache const & cache = theCoords.getParPos().find(bot.text())->second;
-+      CoordCache::InnerParPosCache::const_iterator it = cache.find(bot.pit());
-       if (it == cache.end()) {
-               //lyxerr << "cursor out of view" << std::endl;
-               return Point(-1,-1);
-@@ -195,7 +195,7 @@
- // this could be used elsewhere as well?
- CurStatus status(BufferView const * bv, DocIterator const & dit)
- {
--      CoordCache::InnerParPosCache & cache = theCoords.pars_[dit.bottom().text()];
-+      CoordCache::InnerParPosCache const & cache = theCoords.getParPos().find(dit.bottom().text())->second;
-       if (cache.find(dit.bottom().pit()) != cache.end())
-               return CUR_INSIDE;
-Index: src/coordcache.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/coordcache.C,v
-retrieving revision 1.5
-diff -u -r1.5 coordcache.C
---- src/coordcache.C   12 Jan 2005 10:30:44 -0000      1.5
-+++ src/coordcache.C   31 Jan 2005 10:20:07 -0000
-@@ -21,20 +21,24 @@
- }
--void lyxaborter(int x, int y)
--{
--      lyxerr << "abort on x: " << x << " y: " << y << std::endl;
--      BOOST_ASSERT(false);
--}
--
--
- void CoordCache::clear()
- {
-+      BOOST_ASSERT(updating);
-       arrays_.clear();
-       insets_.clear();
-       pars_.clear();
- }
-+void CoordCache::startUpdating() {
-+      BOOST_ASSERT(!updating);
-+      updating = true;
-+}
-+
-+
-+void CoordCache::doneUpdating() {
-+      BOOST_ASSERT(updating);
-+      updating = false;
-+}
- Point CoordCache::get(LyXText const * text, lyx::pit_type pit)
- {
-Index: src/coordcache.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/coordcache.h,v
-retrieving revision 1.6
-diff -u -r1.6 coordcache.h
---- src/coordcache.h   19 Jan 2005 15:03:29 -0000      1.6
-+++ src/coordcache.h   31 Jan 2005 12:23:49 -0000
-@@ -12,13 +12,7 @@
- #include <map>
--
--// All positions cached in this cache are only valid between subsequent
--// updated. (x,y) == (0,0) is the upper left screen corner, x increases
--// to the right, y increases downwords.
--
- void lyxbreaker(void const * data, const char * hint, int size);
--void lyxaborter(int x, int y);
- class Point {
- public:
-@@ -92,21 +86,55 @@
-       cache_type data_;
- };
--
-+/**
-+ * A global cache that allows us to come from a paragraph in a document
-+ * to a position point on the screen.
-+ * All points cached in this cache are only valid between subsequent
-+ * updated. (x,y) == (0,0) is the upper left screen corner, x increases
-+ * to the right, y increases downwords.
-+ * The cache is built in BufferView::Pimpl::metrics which is called
-+ * from BufferView::Pimpl::update. The individual points are added
-+ * while we paint them. See for instance paintPar in RowPainter.C.
-+ */
- class CoordCache {
- public:
-+      CoordCache() : updating(false) { }
-+      /// In order to find bugs, we record when we start updating the cache
-+      void startUpdating();
-+      /// When we are done, we record that to help find bugs
-+      void doneUpdating();
-+
-       void clear();
-       Point get(LyXText const *, lyx::pit_type);
-+      /// A map from paragraph index number to screen point
-+      typedef std::map<lyx::pit_type, Point> InnerParPosCache;
-+      /// A map from a LyXText to the map of paragraphs to screen points
-+      typedef std::map<LyXText const *, InnerParPosCache> ParPosCache;
-+
-+      /// A map from MathArray to position on the screen
-+      CoordCacheBase<MathArray> & arrays() { BOOST_ASSERT(updating); return arrays_; }
-+      CoordCacheBase<MathArray> const & getArrays() const { return arrays_; }
-+      /// A map from insets to positions on the screen
-+      CoordCacheBase<InsetBase> & insets() { BOOST_ASSERT(updating); return insets_; }
-+      CoordCacheBase<InsetBase> const & getInsets() const { return insets_; }
-+      /// A map from (LyXText, paragraph) pair to screen positions
-+      ParPosCache & parPos() { BOOST_ASSERT(updating); return pars_; }
-+      ParPosCache const & getParPos() const { return pars_; }
-+private:
-       CoordCacheBase<MathArray> arrays_;
-       
-       // all insets
-       CoordCacheBase<InsetBase> insets_;
-       // paragraph grouped by owning text
--      typedef std::map<lyx::pit_type, Point> InnerParPosCache;
--      typedef std::map<LyXText const *, InnerParPosCache> ParPosCache;
-       ParPosCache pars_;
-+
-+      /**
-+       * Debugging flag only: Set to true while the cache is being built.
-+       * No changes to the structure are allowed unless we are updating.
-+       */
-+      bool updating;
- };
- extern CoordCache theCoords;
-Index: src/cursor.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
-retrieving revision 1.119
-diff -u -r1.119 cursor.C
---- src/cursor.C       18 Jan 2005 14:15:55 -0000      1.119
-+++ src/cursor.C       31 Jan 2005 11:08:09 -0000
-@@ -58,7 +58,9 @@
- using std::vector;
- using std::endl;
- #ifndef CXX_GLOBAL_CSTD
-+# ifndef _WIN32
- using std::isalpha;
-+# endif
- #endif
- using std::min;
- using std::swap;
-@@ -1086,7 +1088,7 @@
-               if (operator[](s).text())
-                       break;
-       CursorSlice const & sl = operator[](s);
--      LyXText & text = *sl.text();
-+      LyXText const & text = *sl.text();
-       LyXFont font = text.getPar(sl.pit()).getFont(
-               bv().buffer()->params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
-       return font.language()->encoding();
-@@ -1127,7 +1129,7 @@
-               if (operator[](s).text())
-                       break;
-       CursorSlice const & sl = operator[](s);
--      LyXText & text = *sl.text();
-+      LyXText const & text = *sl.text();
-       LyXFont font = text.getPar(sl.pit()).getFont(
-               bv().buffer()->params(),
-               sl.pos(),
-Index: src/cursor_slice.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor_slice.C,v
-retrieving revision 1.26
-diff -u -r1.26 cursor_slice.C
---- src/cursor_slice.C 24 Nov 2004 21:53:38 -0000      1.26
-+++ src/cursor_slice.C 31 Jan 2005 11:01:13 -0000
-@@ -104,7 +104,13 @@
- }
--LyXText * CursorSlice::text() const
-+LyXText * CursorSlice::text()
-+{
-+      BOOST_ASSERT(inset_);
-+      return inset_->getText(idx_);
-+}
-+
-+LyXText const * CursorSlice::text() const
- {
-       BOOST_ASSERT(inset_);
-       return inset_->getText(idx_);
-Index: src/cursor_slice.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor_slice.h,v
-retrieving revision 1.20
-diff -u -r1.20 cursor_slice.h
---- src/cursor_slice.h 30 Nov 2004 01:59:33 -0000      1.20
-+++ src/cursor_slice.h 31 Jan 2005 11:01:13 -0000
-@@ -97,7 +97,9 @@
-       /// see comment for the member
-       bool & boundary() { return boundary_; }
-       ///
--      LyXText * text() const;
-+      LyXText * text();
-+      ///
-+      LyXText const * text() const;
-       ///
-       UpdatableInset * asUpdatableInset() const;
-       ///
-Index: src/dociterator.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/dociterator.C,v
-retrieving revision 1.21
-diff -u -r1.21 dociterator.C
---- src/dociterator.C  30 Nov 2004 01:59:33 -0000      1.21
-+++ src/dociterator.C  31 Jan 2005 11:11:59 -0000
-@@ -123,7 +123,13 @@
- }
--LyXText * DocIterator::text() const
-+LyXText * DocIterator::text()
-+{
-+      BOOST_ASSERT(!empty());
-+      return top().text();
-+}
-+
-+LyXText const * DocIterator::text() const
- {
-       BOOST_ASSERT(!empty());
-       return top().text();
-@@ -146,12 +152,14 @@
- Row & DocIterator::textRow()
- {
-+      BOOST_ASSERT(!paragraph().rows().empty());
-       return paragraph().getRow(pos());
- }
- Row const & DocIterator::textRow() const
- {
-+      BOOST_ASSERT(!paragraph().rows().empty());
-       return paragraph().getRow(pos());
- }
-@@ -233,7 +241,18 @@
- }
--LyXText * DocIterator::innerText() const
-+LyXText * DocIterator::innerText()
-+{
-+      BOOST_ASSERT(!empty());
-+      // go up until first non-0 text is hit
-+      // (innermost text is 0 in mathed)
-+      for (int i = size() - 1; i >= 0; --i)
-+              if (operator[](i).text())
-+                      return operator[](i).text();
-+      return 0;
-+}
-+
-+LyXText const * DocIterator::innerText() const
- {
-       BOOST_ASSERT(!empty());
-       // go up until first non-0 text is hit
-Index: src/dociterator.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/dociterator.h,v
-retrieving revision 1.14
-diff -u -r1.14 dociterator.h
---- src/dociterator.h  30 Nov 2004 01:59:33 -0000      1.14
-+++ src/dociterator.h  31 Jan 2005 11:11:59 -0000
-@@ -151,11 +151,15 @@
-       /// the row in the paragraph we're in
-       Row const & textRow() const;
-       ///
--      LyXText * text() const;
-+      LyXText * text();
-+      ///
-+      LyXText const * text() const;
-       ///
-       InsetBase * innerInsetOfType(int code) const;
-       ///
--      LyXText * innerText() const;
-+      LyXText * innerText();
-+      ///
-+      LyXText const * innerText() const;
-       //
-       // elementary moving
-Index: src/ispell.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ispell.C,v
-retrieving revision 1.25
-diff -u -r1.25 ispell.C
---- src/ispell.C       20 Jan 2005 16:17:36 -0000      1.25
-+++ src/ispell.C       23 Jan 2005 12:09:37 -0000
-@@ -24,11 +24,17 @@
- #include "support/forkedcall.h"
-+#ifdef _WIN32
-+# include "support/os_win32.h"
-+#endif
-+
- // HP-UX 11.x doesn't have this header
- #ifdef HAVE_SYS_SELECT_H
- #include <sys/select.h>
- #endif
--#include <sys/time.h>
-+#ifndef _WIN32
-+# include <sys/time.h>
-+#endif
- using boost::shared_ptr;
-@@ -88,6 +94,7 @@
-       }
-       // child process
-+#ifndef _WIN32
-       dup2(pipein[0], STDIN_FILENO);
-       dup2(pipeout[1], STDOUT_FILENO);
-       dup2(pipeerr[1], STDERR_FILENO);
-@@ -180,6 +187,7 @@
-       lyxerr << "LyX: Failed to start ispell!" << endl;
-       _exit(0);
-+#endif
- }
-@@ -191,6 +199,7 @@
- {
-       lyxerr[Debug::GUI] << "Created ispell" << endl;
-+#ifndef _WIN32
-       // static due to the setvbuf. Ugly.
-       static char o_buf[BUFSIZ];
-@@ -275,6 +284,7 @@
-       close(pipeerr[1]);
-       child_->kill();
-       child_.reset(0);
-+#endif
- }
-@@ -295,18 +305,23 @@
-               fclose(out);
-       }
-+#ifndef _WIN32
-       close(pipein[0]);
-       close(pipein[1]);
-       close(pipeout[0]);
-       close(pipeout[1]);
-       close(pipeerr[0]);
-       close(pipeerr[1]);
-+#endif
-       delete [] str;
- }
- bool ISpell::select(bool & err_read)
- {
-+#ifdef _WIN32
-+      return false;
-+#else
-       fd_set infds;
-       struct timeval tv;
-       int retval = 0;
-@@ -316,11 +331,15 @@
-       tv.tv_sec = 2;
-       tv.tv_usec = 0;
-+#ifdef HAVE_SELECT
-       retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1),
-                       SELECT_TYPE_ARG234 (&infds),
-                       0,
-                       0,
-                       SELECT_TYPE_ARG5 (&tv));
-+#else
-+      retval = -1;
-+#endif
-       // error
-       if (retval <= 0)
-@@ -335,6 +354,7 @@
-       fgets(buf, BUFSIZ, in);
-       err_read = false;
-       return false;
-+#endif
- }
-Index: src/lyx_cb.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
-retrieving revision 1.247
-diff -u -r1.247 lyx_cb.C
---- src/lyx_cb.C       31 Jan 2005 10:42:18 -0000      1.247
-+++ src/lyx_cb.C       31 Jan 2005 10:57:53 -0000
-@@ -44,6 +44,10 @@
- #include "support/path.h"
- #include "support/systemcall.h"
-+#ifdef _WIN32
-+# include "support/os_win32.h" // fork()
-+#endif
-+
- #include <boost/shared_ptr.hpp>
- #include <boost/filesystem/operations.hpp>
-Index: src/lyxlex_pimpl.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlex_pimpl.h,v
-retrieving revision 1.22
-diff -u -r1.22 lyxlex_pimpl.h
---- src/lyxlex_pimpl.h 21 Jan 2005 08:39:13 -0000      1.22
-+++ src/lyxlex_pimpl.h 25 Jan 2005 12:40:01 -0000
-@@ -23,6 +23,7 @@
- #include <istream>
- #include <stack>
- #include <vector>
-+#include <fstream> // for std::filebuf
- ///
- class LyXLex::Pimpl : boost::noncopyable {
-Index: src/lyxrow.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.h,v
-retrieving revision 1.42
-diff -u -r1.42 lyxrow.h
---- src/lyxrow.h       30 Nov 2004 01:59:34 -0000      1.42
-+++ src/lyxrow.h       27 Jan 2005 10:55:12 -0000
-@@ -17,7 +17,11 @@
- #include "support/types.h"
--///
-+/**
-+ * An on-screen row of text. A paragraph is broken into a 
-+ * RowList for display. Each Row contains position pointers
-+ * into the first and last character positions of that row.
-+ */
- class Row {
- public:
-       ///
-Index: src/lyxserver.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxserver.C,v
-retrieving revision 1.59
-diff -u -r1.59 lyxserver.C
---- src/lyxserver.C    20 Jan 2005 15:07:36 -0000      1.59
-+++ src/lyxserver.C    21 Jan 2005 09:47:31 -0000
-@@ -54,6 +54,10 @@
- #include <sys/stat.h>
- #include <fcntl.h>
-+#ifdef _WIN32
-+# include "support/os_win32.h" // F_SETFL, O_NONBLOCK, fcntl
-+#endif
-+
- #ifdef __EMX__
- #include <cstdlib>
- #include <io.h>
-@@ -182,6 +186,8 @@
-       // Imported handles can be used both with OS/2 APIs and emx
-       // library functions.
-       fd = _imphandle(os2fd);
-+#elif defined(_WIN32)
-+
- #else
-       if (::access(filename.c_str(), F_OK) == 0) {
-               lyxerr << "LyXComm: Pipe " << filename << " already exists.\n"
-@@ -236,10 +242,12 @@
-       }
- #endif
-+#ifndef _WIN32
-       if (::close(fd) < 0) {
-               lyxerr << "LyXComm: Could not close pipe " << filename
-                      << '\n' << strerror(errno) << endl;
-       }
-+#endif
- // OS/2 pipes are deleted automatically
- #ifndef __EMX__
-@@ -275,7 +283,13 @@
-       errno = 0;
-       int status;
-       // the single = is intended here.
--      while ((status = ::read(infd, charbuf, charbuf_size - 1))) {
-+      while ((status = 
-+#ifndef _WIN32
-+              ::read(infd, charbuf, charbuf_size - 1)
-+#else
-+              -1
-+#endif
-+              )) {
-               if (status > 0) {
-                       charbuf[status] = '\0'; // turn it into a c string
-@@ -332,6 +346,9 @@
-       if (pipename.empty()) return;
-+#ifdef _WIN32
-+      return;
-+#else
-       if (!ready) {
-               lyxerr << "LyXComm: Pipes are closed. Could not send "
-                      << msg << endl;
-@@ -342,6 +359,7 @@
-               closeConnection();
-               openConnection();
-       }
-+#endif
- #ifdef __EMX__
-       APIRET rc;
-       int errnum;
-Index: src/lyxsocket.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxsocket.C,v
-retrieving revision 1.6
-diff -u -r1.6 lyxsocket.C
---- src/lyxsocket.C    23 Jul 2004 19:01:48 -0000      1.6
-+++ src/lyxsocket.C    19 Jan 2005 11:18:01 -0000
-@@ -68,7 +68,9 @@
- LyXServerSocket::~LyXServerSocket()
- {
-       lyx_gui::unregister_socket_callback(fd_);
-+#ifndef _WIN32
-       ::close(fd_);
-+#endif
-       lyx::support::unlink(address_);
-       lyxerr[Debug::LYXSERVER] << "lyx: Server socket quitting" << endl;
- }
-@@ -155,7 +157,11 @@
- {
-       string const linen(line + '\n');
-       int const size = linen.size();
-+#ifndef _WIN32
-       int const written = ::write(fd_, linen.c_str(), size);
-+#else
-+      int const written = -1;
-+#endif
-       if (written < size) { // Allways mean end of connection.
-               if ((written == -1) && (errno == EPIPE)) {
-                       // The program will also receive a SIGPIPE
-@@ -194,7 +200,9 @@
- LyXDataSocket::~LyXDataSocket()
- {
-+#ifndef _WIN32
-       ::close(fd_);
-+#endif
-       lyx_gui::unregister_socket_callback(fd_);
-       lyxerr[Debug::LYXSERVER] << "lyx: Data socket " << fd_ << " quitting."
-@@ -216,7 +224,13 @@
-       int count;
-       // read and store characters in buffer
--      while ((count = ::read(fd_, charbuf, charbuf_size - 1)) > 0) {
-+      while ((count = 
-+#ifndef _WIN32
-+              ::read(fd_, charbuf, charbuf_size - 1)
-+#else
-+              0
-+#endif
-+              ) > 0) {
-               buffer_.append(charbuf, charbuf + count);
-       }
-@@ -250,7 +264,11 @@
- {
-       string const linen(line + '\n');
-       int const size = linen.size();
-+#ifndef _WIN32
-       int const written = ::write(fd_, linen.c_str(), size);
-+#else
-+      int const written = -1;
-+#endif
-       if (written < size) { // Allways mean end of connection.
-               if ((written == -1) && (errno == EPIPE)) {
-                       // The program will also receive a SIGPIPE
-Index: src/lyxtext.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
-retrieving revision 1.316
-diff -u -r1.316 lyxtext.h
---- src/lyxtext.h      17 Dec 2004 16:27:07 -0000      1.316
-+++ src/lyxtext.h      31 Jan 2005 09:58:00 -0000
-@@ -70,7 +70,7 @@
-               bool toggleall);
-       /// what you expect when pressing <enter> at cursor position
--      void breakParagraph(LCursor & cur, char keep_layout = 0);
-+      void breakParagraph(LCursor & cur, bool keep_layout = false);
-       /// set layout over selection
-       pit_type setLayout(pit_type start, pit_type end,
-@@ -124,7 +124,7 @@
-               FuncStatus & status) const;
-       /// access to out BufferView. This should go...
--      BufferView * bv();
-+//    BufferView * bv();
-       /// access to out BufferView. This should go...
-       BufferView * bv() const;
-Index: src/paragraph.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
-retrieving revision 1.400
-diff -u -r1.400 paragraph.C
---- src/paragraph.C    24 Jan 2005 17:12:18 -0000      1.400
-+++ src/paragraph.C    27 Jan 2005 12:17:23 -0000
-@@ -1795,6 +1795,8 @@
- Row & Paragraph::getRow(pos_type pos)
- {
-+      BOOST_ASSERT(!rows().empty());
-+
-       RowList::iterator rit = rows_.end();
-       RowList::iterator const begin = rows_.begin();
-@@ -1807,6 +1809,8 @@
- Row const & Paragraph::getRow(pos_type pos) const
- {
-+      BOOST_ASSERT(!rows().empty());
-+
-       RowList::const_iterator rit = rows_.end();
-       RowList::const_iterator const begin = rows_.begin();
-@@ -1819,6 +1823,8 @@
- size_t Paragraph::pos2row(pos_type pos) const
- {
-+      BOOST_ASSERT(!rows().empty());
-+
-       RowList::const_iterator rit = rows_.end();
-       RowList::const_iterator const begin = rows_.begin();
-@@ -1873,11 +1879,3 @@
-       }
- }
--//void Paragraph::metrics(MetricsInfo & mi, Dimension & dim, LyXText & text)
--//{
--//}
--//
--//
--//void draw(PainterInfo & pi, int x, int y, LyXText & text) const
--//{
--//}
-Index: src/paragraph.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v
-retrieving revision 1.146
-diff -u -r1.146 paragraph.h
---- src/paragraph.h    19 Jan 2005 15:03:29 -0000      1.146
-+++ src/paragraph.h    27 Jan 2005 12:58:12 -0000
-@@ -134,7 +134,7 @@
-                                 lyx::depth_type depth) const;
-       /// Can we drop the standard paragraph wrapper?
--      bool Paragraph::emptyTag() const;
-+      bool emptyTag() const;
-       /// Get the id of the paragraph, usefull for docbook and linuxdoc
-       std::string getID(Buffer const & buf,
-@@ -293,7 +293,7 @@
-               BOOST_ASSERT(pos < int(text_.size()));
-               return text_[pos];
-       }
--      ///
-+      /// Get the char, but mirror all bracket characters if it is right-to-left
-       value_type getUChar(BufferParams const &, lyx::pos_type pos) const;
-       /// The position must already exist.
-       void setChar(lyx::pos_type pos, value_type c);
-@@ -326,6 +326,9 @@
-       InsetBase * getInset(lyx::pos_type pos);
-       ///
-       InsetBase const * getInset(lyx::pos_type pos) const;
-+      ///
-+      InsetList insetlist;
-+
-       ///
-       bool isHfill(lyx::pos_type pos) const;
-@@ -344,7 +347,7 @@
-       /// returns -1 if inset not found
-       int getPositionOfInset(InsetBase const * inset) const;
--      ///
-+      /// Returns the number of line breaks and white-space stripped at the start
-       int stripLeadingSpaces();
-       /// return true if we allow multiple spaces
-@@ -352,7 +355,7 @@
-       /// return true if we allow this par to stay empty
-       bool allowEmpty() const;
--      ////
-+      /// 
-       unsigned char transformChar(unsigned char c, lyx::pos_type pos) const;
-       ///
-       ParagraphParameters & params();
-@@ -366,37 +369,34 @@
-       ///
-       size_t pos2row(lyx::pos_type pos) const;
--      ///
--      InsetList insetlist;
--
-       /// total height of paragraph
-       unsigned int height() const { return dim_.height(); }
-       /// total width of paragraph, may differ from workwidth
-       unsigned int width() const { return dim_.width(); }
-       unsigned int ascent() const { return dim_.ascent(); }
-       unsigned int descent() const { return dim_.descent(); }
--      ///
-+      /// LyXText updates the rows using this access point
-       RowList & rows() { return rows_; }
--      ///
-+      /// The painter and others use this
-       RowList const & rows() const { return rows_; }
--      // compute paragraph metrics    
--      void metrics(MetricsInfo & mi, Dimension & dim, LyXText & text);
--      // draw paragraph
--      void draw(PainterInfo & pi, int x, int y, LyXText & text) const;
--      /// dump some information
--      void dump() const;
-+      /// LyXText::redoParagraph updates this
-+      Dimension & dim() { return dim_; }
-+      /// dump some information to lyxerr
-+      void dump() const;
-+private:
-       /// cached dimensions of paragraph
-       Dimension dim_;
--private:
-       ///
-       mutable RowList rows_;
-       ///
-       LyXLayout_ptr layout_;
--      /// keeping this here instead of in the pimpl makes LyX >10% faster
--      // for average tasks as buffer loading/switching etc.
-+      /**
-+       * Keeping this here instead of in the pimpl makes LyX >10% faster
-+       * for average tasks as buffer loading/switching etc.
-+       */
-       TextContainer text_;
-       /// end of label
-       lyx::pos_type begin_of_body_;
-@@ -406,7 +406,6 @@
-       friend class Paragraph::Pimpl;
-       ///
-       Pimpl * pimpl_;
--
- };
-Index: src/paragraph_funcs.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.h,v
-retrieving revision 1.46
-diff -u -r1.46 paragraph_funcs.h
---- src/paragraph_funcs.h      30 Nov 2004 01:59:36 -0000      1.46
-+++ src/paragraph_funcs.h      27 Jan 2005 13:19:36 -0000
-@@ -21,8 +21,15 @@
- class Paragraph;
- class ParagraphList;
--
--///
-+/**
-+ * This breaks a paragraph at the specified position.
-+ * The new paragraph will:
-+ * get the default layout, when flag == 0
-+ * will inherit the existing one, except for depth, when flag == 1
-+ * will inherit the existing one, including depth, when flag == 2
-+ * Be aware that the old or new paragraph does not contain any rows
-+ * after this.
-+ */
- void breakParagraph(BufferParams const & bparams,
-                   ParagraphList & paragraphs,
-                   lyx::pit_type par,
-Index: src/rowpainter.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
-retrieving revision 1.140
-diff -u -r1.140 rowpainter.C
---- src/rowpainter.C   18 Jan 2005 14:15:55 -0000      1.140
-+++ src/rowpainter.C   31 Jan 2005 11:59:07 -0000
-@@ -58,7 +58,7 @@
- public:
-       /// initialise and run painter
-       RowPainter(PainterInfo & pi, LyXText const & text,
--              pit_type pit, Row & row, int x, int y);
-+              pit_type pit, Row const & row, int x, int y);
-       // paint various parts
-       void paintAppendix();
-@@ -101,7 +101,7 @@
-       ParagraphList & pars_;
-       /// The row to paint
--      Row & row_;
-+      Row const & row_;
-       /// Row's paragraph
-       pit_type const pit_;
-@@ -119,7 +119,7 @@
- RowPainter::RowPainter(PainterInfo & pi,
--      LyXText const & text, pit_type pit, Row & row, int x, int y)
-+      LyXText const & text, pit_type pit, Row const & row, int x, int y)
-       : bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
-         row_(row), pit_(pit), par_(text.paragraphs()[pit]),
-         xo_(x), yo_(y), width_(text_.width())
-@@ -178,7 +178,7 @@
-       PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
-       pi.base.font = getFont(pos);
-       pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
--      theCoords.insets_.add(inset, int(x_), yo_);
-+      theCoords.insets().add(inset, int(x_), yo_);
-       inset->drawSelection(pi, int(x_), yo_);
-       inset->draw(pi, int(x_), yo_);
-       x_ += inset->width();
-@@ -738,12 +738,12 @@
-       Paragraph & par = text.paragraphs()[pit];
--      RowList::iterator const rb = par.rows().begin();
--      RowList::iterator const re = par.rows().end();
--      theCoords.pars_[&text][pit] = Point(x, y);
-+      RowList::const_iterator const rb = par.rows().begin();
-+      RowList::const_iterator const re = par.rows().end();
-+      theCoords.parPos()[&text][pit] = Point(x, y);
-       y -= rb->ascent();
--      for (RowList::iterator rit = rb; rit != re; ++rit) {
-+      for (RowList::const_iterator rit = rb; rit != re; ++rit) {
-               y += rit->ascent();
-               bool const inside = (y + rit->descent() >= 0
-                                      && y - rit->ascent() < ww);
-@@ -801,12 +801,12 @@
-       }
-       // and grey out above (should not happen later)
--      lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
-+//    lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
-       if (vi.y1 > 0)
-               pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, LColor::bottomarea);
-       // and possibly grey out below
--      lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
-+//    lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
-       if (vi.y2 < bv.workHeight())
-               pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, LColor::bottomarea);
- }
-Index: src/text.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
-retrieving revision 1.592
-diff -u -r1.592 text.C
---- src/text.C 19 Jan 2005 08:42:32 -0000      1.592
-+++ src/text.C 31 Jan 2005 10:05:42 -0000
-@@ -376,12 +376,6 @@
- } // namespace anon
--BufferView * LyXText::bv()
--{
--      BOOST_ASSERT(bv_owner != 0);
--      return bv_owner;
--}
--
- BufferView * LyXText::bv() const
- {
-@@ -1017,7 +1011,7 @@
- }
--void LyXText::breakParagraph(LCursor & cur, char keep_layout)
-+void LyXText::breakParagraph(LCursor & cur, bool keep_layout)
- {
-       BOOST_ASSERT(this == cur.text());
-       // allow only if at start or end, or all previous is new text
-@@ -1045,25 +1039,30 @@
-       if (cur.pos() != cur.lastpos() && cpar.isLineSeparator(cur.pos()))
-               cpar.erase(cur.pos());
--      // break the paragraph
-+      // How should the layout for the new paragraph be?
-+      int preserve_layout = 0;
-       if (keep_layout)
--              keep_layout = 2;
-+              preserve_layout = 2;
-       else
--              keep_layout = layout->isEnvironment();
-+              preserve_layout = layout->isEnvironment();
-+
-+      // We need to remember this before we break the paragraph, because
-+      // that invalidates the layout variable
-+      bool sensitive = layout->labeltype == LABEL_SENSITIVE;
--      // we need to set this before we insert the paragraph. IMO the
--      // breakParagraph call should return a bool if it inserts the
--      // paragraph before or behind and we should react on that one
--      // but we can fix this in 1.3.0 (Jug 20020509)
-+      // we need to set this before we insert the paragraph.
-       bool const isempty = cpar.allowEmpty() && cpar.empty();
-+
-       ::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
--                       cur.pos(), keep_layout);
-+                       cur.pos(), preserve_layout);
-+
-+      // After this, neither paragraph contains any rows!
-       cpit = cur.pit();
-       pit_type next_par = cpit + 1;
-       // well this is the caption hack since one caption is really enough
--      if (layout->labeltype == LABEL_SENSITIVE) {
-+      if (sensitive) {
-               if (cur.pos() == 0)
-                       // set to standard-layout
-                       pars_[cpit].applyLayout(tclass.defaultLayout());
-@@ -1072,16 +1071,6 @@
-                       pars_[next_par].applyLayout(tclass.defaultLayout());
-       }
--      // if the cursor is at the beginning of a row without prior newline,
--      // move one row up!
--      // This touches only the screen-update. Otherwise we would may have
--      // an empty row on the screen
--      if (cur.pos() != 0 && cur.textRow().pos() == cur.pos()
--          && !pars_[cpit].isNewline(cur.pos() - 1))
--      {
--              cursorLeft(cur);
--      }
--
-       while (!pars_[next_par].empty() && pars_[next_par].isNewline(0))
-               pars_[next_par].erase(0);
-@@ -1172,8 +1161,8 @@
-                               cur.message(_("You cannot insert a space at the "
-                                       "beginning of a paragraph. Please read the Tutorial."));
-                               sent_space_message = true;
--                              return;
-                       }
-+                      return;
-               }
-               BOOST_ASSERT(cur.pos() > 0);
-               if (par.isLineSeparator(cur.pos() - 1)
-@@ -1686,7 +1675,7 @@
-       dim.asc += par.rows()[0].ascent();
-       dim.des -= par.rows()[0].ascent();
--      par.dim_ = dim;
-+      par.dim() = dim;
-       //lyxerr << "redoParagraph: " << par.rows().size() << " rows\n";
- }
-Index: src/text2.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
-retrieving revision 1.594
-diff -u -r1.594 text2.C
---- src/text2.C        6 Jan 2005 16:39:30 -0000       1.594
-+++ src/text2.C        31 Jan 2005 12:01:19 -0000
-@@ -119,7 +119,7 @@
-               InsetBase * inset = iit->inset;
- #if 1
-               lyxerr << "examining inset " << inset << endl;
--              if (theCoords.insets_.has(inset))
-+              if (theCoords.getInsets().has(inset))
-                       lyxerr
-                               << " xo: " << inset->xo() << "..."
-                               << inset->xo() + inset->width()
-@@ -1122,8 +1122,8 @@
- pit_type LyXText::getPitNearY(int y) const
- {
-       BOOST_ASSERT(!paragraphs().empty());
--      BOOST_ASSERT(theCoords.pars_.find(this) != theCoords.pars_.end());
--      CoordCache::InnerParPosCache const & cc = theCoords.pars_[this];
-+      BOOST_ASSERT(theCoords.getParPos().find(this) != theCoords.getParPos().end());
-+      CoordCache::InnerParPosCache const & cc = theCoords.getParPos().find(this)->second;
-       lyxerr << "LyXText::getPitNearY: y: " << y << " cache size: "
-               << cc.size() << endl;
-@@ -1282,8 +1282,6 @@
- void LyXText::cursorDown(LCursor & cur)
- {
--
--
-       Paragraph const & par = cur.paragraph();
-       int const row = par.pos2row(cur.pos());
-       int const x = cur.targetX();
-Index: src/text3.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
-retrieving revision 1.280
-diff -u -r1.280 text3.C
---- src/text3.C        27 Jan 2005 21:05:34 -0000      1.280
-+++ src/text3.C        31 Jan 2005 12:11:17 -0000
-@@ -353,7 +353,7 @@
- void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
- {
-       lyxerr[Debug::ACTION] << "LyXText::dispatch: cmd: " << cmd << endl;
--      //lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
-+      lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
-       BOOST_ASSERT(cur.text() == this);
-       BufferView * bv = &cur.bv();
-Index: src/client/client.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/client.C,v
-retrieving revision 1.7
-diff -u -r1.7 client.C
---- src/client/client.C        20 Jan 2005 15:38:13 -0000      1.7
-+++ src/client/client.C        21 Jan 2005 09:43:09 -0000
-@@ -25,12 +25,14 @@
- # include <unistd.h>
- #endif
-+#ifndef _WIN32
- // select()
--#include <sys/select.h>
-+# include <sys/select.h>
- // socket(), connect()
--#include <sys/socket.h>
--#include <sys/un.h>
-+# include <sys/socket.h>
-+# include <sys/un.h>
-+#endif
- // fcntl()
- #include <fcntl.h>
-Index: src/frontends/LyXView.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXView.C,v
-retrieving revision 1.49
-diff -u -r1.49 LyXView.C
---- src/frontends/LyXView.C    20 Jan 2005 15:38:14 -0000      1.49
-+++ src/frontends/LyXView.C    21 Jan 2005 09:43:10 -0000
-@@ -39,7 +39,9 @@
- #include <boost/bind.hpp>
--#include <sys/time.h>
-+#ifndef _WIN32
-+# include <sys/time.h>
-+#endif
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
-Index: src/frontends/qt2/QDialogView.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QDialogView.h,v
-retrieving revision 1.10
-diff -u -r1.10 QDialogView.h
---- src/frontends/qt2/QDialogView.h    19 May 2004 15:11:33 -0000      1.10
-+++ src/frontends/qt2/QDialogView.h    25 Jan 2005 12:45:06 -0000
-@@ -13,6 +13,7 @@
- #define QDIALOGVIEW_H
- #include "Dialog.h"
-+
- #include <boost/scoped_ptr.hpp>
- #include <qapplication.h>
-@@ -110,7 +111,11 @@
- template <class GUIDialog>
- QDialog * QView<GUIDialog>::form() const
- {
--      return dialog_.get();
-+      /* Brain dead MSVC compiler wants to know the class hierarchy at the
-+         definition site of the template, rather than the instantation point
-+         to downcast correctly. So, rather than including all dialogs to 
-+         provide that, we just cast it with the ugly hammer. */
-+      return (QDialog *) dialog_.get();
- }
-Index: src/frontends/qt2/QLPainter.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPainter.C,v
-retrieving revision 1.34
-diff -u -r1.34 QLPainter.C
---- src/frontends/qt2/QLPainter.C      20 May 2004 09:36:27 -0000      1.34
-+++ src/frontends/qt2/QLPainter.C      31 Jan 2005 12:29:53 -0000
-@@ -202,8 +202,9 @@
-       int tmpx = x;
-       size_t ls = s.length();
-       for (size_t i = 0; i < ls; ++i) {
--              QChar const c = s[i].upper();
--              if (c != s[i]) {
-+              // Brain-dead MSVC wants at(i) rather than operator[]
-+              QChar const c = s.at(i).upper();
-+              if (c != s.at(i)) {
-                       qp_->setFont(qsmallfont);
-                       qp_->drawText(tmpx, y, c);
-                       tmpx += qsmallfontm.width(c);
-@@ -229,7 +230,8 @@
- #if QT_VERSION >= 300
-       str.setLength(ls);
-       for (size_t i = 0; i < ls; ++i)
--              str[i] = QChar(encoding->ucs(s[i]));
-+              // Brain-dead MSVC wants at(i) rather than operator[]
-+              str.at(i) = QChar(encoding->ucs(s[i]));
-       // HACK: QT3 refuses to show single compose characters
-       if (ls == 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2)
-               str = ' ' + str;
-Index: src/frontends/qt2/lengthvalidator.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lengthvalidator.h,v
-retrieving revision 1.4
-diff -u -r1.4 lengthvalidator.h
---- src/frontends/qt2/lengthvalidator.h        22 Nov 2004 12:22:19 -0000      1.4
-+++ src/frontends/qt2/lengthvalidator.h        23 Jan 2005 09:47:57 -0000
-@@ -19,7 +19,7 @@
- class QWidget;
--class Q_EXPORT LengthValidator : public QValidator
-+class LengthValidator : public QValidator
- {
-       Q_OBJECT
- public:
-Index: src/insets/inset.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.C,v
-retrieving revision 1.131
-diff -u -r1.131 inset.C
---- src/insets/inset.C 5 Jan 2005 20:21:26 -0000       1.131
-+++ src/insets/inset.C 31 Jan 2005 09:31:42 -0000
-@@ -79,5 +79,5 @@
- void InsetOld::setPosCache(PainterInfo const &, int x, int y) const
- {
-       //lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
--      theCoords.insets_.add(this, x, y);
-+      theCoords.insets().add(this, x, y);
- }
-Index: src/insets/insetbase.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbase.C,v
-retrieving revision 1.39
-diff -u -r1.39 insetbase.C
---- src/insets/insetbase.C     19 Jan 2005 15:03:30 -0000      1.39
-+++ src/insets/insetbase.C     31 Jan 2005 12:01:20 -0000
-@@ -293,13 +293,13 @@
- int InsetBase::xo() const
- {
--      return theCoords.insets_.x(this);
-+      return theCoords.getInsets().x(this);
- }
- int InsetBase::yo() const
- {
--      return theCoords.insets_.y(this);
-+      return theCoords.getInsets().y(this);
- }
-@@ -310,7 +310,7 @@
-       //      << " x1: " << xo() << " x2: " << xo() + width()
-       //      << " y1: " << yo() - ascent() << " y2: " << yo() + descent()
-       //      << std::endl;
--      return theCoords.insets_.has(this)
-+      return theCoords.getInsets().has(this)
-                       && x >= xo()
-                       && x <= xo() + width()
-                       && y >= yo() - ascent()
-Index: src/insets/insettabular.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
-retrieving revision 1.452
-diff -u -r1.452 insettabular.C
---- src/insets/insettabular.C  27 Jan 2005 21:05:42 -0000      1.452
-+++ src/insets/insettabular.C  31 Jan 2005 12:01:20 -0000
-@@ -1024,7 +1024,7 @@
- {
-       int xx = 0;
-       int yy = 0;
--      Point o = theCoords.insets_.xy(&inset);
-+      Point o = theCoords.getInsets().xy(&inset);
-       int const xo = o.x_;
-       int const yo = o.y_;
-@@ -1055,7 +1055,7 @@
-       idx_type idx_min = 0;
-       int dist_min = std::numeric_limits<int>::max();
-       for (idx_type i = 0; i < nargs(); ++i) {
--              if (theCoords.insets_.has(tabular.getCellInset(i).get())) {
-+              if (theCoords.getInsets().has(tabular.getCellInset(i).get())) {
-                       int d = dist(*tabular.getCellInset(i), x, y);
-                       if (d < dist_min) {
-                               dist_min = d;
-Index: src/insets/updatableinset.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/updatableinset.C,v
-retrieving revision 1.50
-diff -u -r1.50 updatableinset.C
---- src/insets/updatableinset.C        27 Jan 2005 21:05:43 -0000      1.50
-+++ src/insets/updatableinset.C        31 Jan 2005 12:01:20 -0000
-@@ -43,7 +43,7 @@
-       }
-       int const workW = bv.workWidth();
--      int xo_ = theCoords.insets_.x(this);
-+      int xo_ = theCoords.getInsets().x(this);
-       int const tmp_xo_ = xo_ - scx;
-       if (tmp_xo_ > 0 && tmp_xo_ + width() < workW)
-@@ -63,7 +63,7 @@
- void UpdatableInset::scroll(BufferView & bv, int offset) const
- {
--      int const xo_ = theCoords.insets_.x(this);
-+      int const xo_ = theCoords.getInsets().x(this);
-       if (offset > 0) {
-               if (!scx && xo_ >= 20)
-                       return;
-Index: src/mathed/math_data.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_data.C,v
-retrieving revision 1.59
-diff -u -r1.59 math_data.C
---- src/mathed/math_data.C     5 Jan 2005 20:21:27 -0000       1.59
-+++ src/mathed/math_data.C     31 Jan 2005 12:01:19 -0000
-@@ -411,17 +411,17 @@
- void MathArray::setXY(int x, int y) const
- {
-       //lyxerr << "setting position cache for MathArray " << this << std::endl;
--      theCoords.arrays_.add(this, x, y);
-+      theCoords.arrays().add(this, x, y);
- }
- int MathArray::xo() const
- {
--      return theCoords.arrays_.x(this);
-+      return theCoords.getArrays().x(this);
- }
- int MathArray::yo() const
- {
--      return theCoords.arrays_.y(this);
-+      return theCoords.getArrays().y(this);
- }
-Index: src/mathed/math_diminset.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_diminset.C,v
-retrieving revision 1.23
-diff -u -r1.23 math_diminset.C
---- src/mathed/math_diminset.C 14 Aug 2004 14:03:42 -0000      1.23
-+++ src/mathed/math_diminset.C 31 Jan 2005 09:31:42 -0000
-@@ -40,5 +40,5 @@
- void MathDimInset::setPosCache(PainterInfo const &, int x, int y) const
- {
-       //lyxerr << "MathDimInset: cache to " << x << " " << y << std::endl;
--      theCoords.insets_.add(this, x, y);
-+      theCoords.insets().add(this, x, y);
- }
-Index: src/mathed/math_nestinset.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
-retrieving revision 1.143
-diff -u -r1.143 math_nestinset.C
---- src/mathed/math_nestinset.C        6 Jan 2005 16:07:01 -0000       1.143
-+++ src/mathed/math_nestinset.C        31 Jan 2005 12:01:19 -0000
-@@ -110,23 +110,23 @@
- // absolute again when actually drawing the cursor. What a mess.
-       BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
-       MathArray const & ar = sl.cell();
--      if (!theCoords.arrays_.has(&ar)) {
--              // this can (semi-)legally happen if we jsut created this cell
-+      if (!theCoords.getArrays().has(&ar)) {
-+              // this can (semi-)legally happen if we just created this cell
-               // and it never has been drawn before. So don't ASSERT.
-               //lyxerr << "no cached data for array " << &ar << endl;
-               x = 0;
-               y = 0;
-               return;
-       }
--      Point const pt = theCoords.arrays_.xy(&ar);
--      if (!theCoords.insets_.has(this)) {
-+      Point const pt = theCoords.getArrays().xy(&ar);
-+      if (!theCoords.getInsets().has(this)) {
-               // same as above
-               //lyxerr << "no cached data for inset " << this << endl;
-               x = 0;
-               y = 0;
-               return;
-       }
--      Point const pt2 = theCoords.insets_.xy(this);
-+      Point const pt2 = theCoords.getInsets().xy(this);
-       //lyxerr << "retrieving position cache for MathArray "
-       //      << pt.x_ << ' ' << pt.y_ << std::endl;
-       x = pt.x_ - pt2.x_ + ar.pos2x(sl.pos());
-Index: src/support/chdir.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/chdir.C,v
-retrieving revision 1.10
-diff -u -r1.10 chdir.C
---- src/support/chdir.C        20 Jan 2005 15:38:14 -0000      1.10
-+++ src/support/chdir.C        25 Jan 2005 12:47:15 -0000
-@@ -16,11 +16,17 @@
- # include <unistd.h>
- #endif
-+#ifdef _WIN32
-+# include <windows.h>
-+#endif
-+
- int lyx::support::chdir(std::string const & name)
- {
--#ifndef __EMX__
--      return ::chdir(name.c_str());
--#else
-+#ifdef __EMX__
-       return ::_chdir2(name.c_str());
-+#elif defined(_WIN32)
-+      return SetCurrentDirectory(name.c_str()) != 0 ? 0 : -1;
-+#else
-+      return ::chdir(name.c_str());
- #endif
- }
-Index: src/support/filetools.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
-retrieving revision 1.204
-diff -u -r1.204 filetools.C
---- src/support/filetools.C    31 Jan 2005 10:42:23 -0000      1.204
-+++ src/support/filetools.C    31 Jan 2005 11:08:10 -0000
-@@ -1153,6 +1153,11 @@
- cmd_ret const RunCommand(string const & cmd)
- {
-+#ifdef _WIN32
-+      // TODO: Implement this, or merge it into forkedcall.
-+      // Used for lyx2lyx in buffer.C, echo in math_extern and kpse in this file
-+      return make_pair(-1, string());
-+#else
-       // FIXME: replace all calls to RunCommand with ForkedCall
-       // (if the output is not needed) or the code in ispell.C
-       // (if the output is needed).
-@@ -1193,6 +1198,7 @@
-       sigprocmask(SIG_SETMASK, &oldMask, 0);
-       return make_pair(pret, ret);
-+#endif
- }
-Index: src/support/forkedcall.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcall.C,v
-retrieving revision 1.21
-diff -u -r1.21 forkedcall.C
---- src/support/forkedcall.C   20 Jan 2005 15:38:14 -0000      1.21
-+++ src/support/forkedcall.C   25 Jan 2005 12:41:14 -0000
-@@ -30,6 +30,10 @@
- #include "support/lyxlib.h"
- #include "support/filetools.h"
- #include "support/os.h"
-+#ifdef _WIN32
-+#include "os_win32.h"
-+#include <process.h>
-+#endif
- #include "debug.h"
-@@ -41,7 +45,9 @@
- #include <csignal>
- #include <cstdlib>
- #include <sys/types.h>
--#include <sys/wait.h>
-+#ifndef _WIN32
-+# include <sys/wait.h>
-+#endif
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
-@@ -70,7 +76,9 @@
-               if (secs > 0) {
-                       new Murder(secs, pid);
-               } else if (pid != 0) {
-+#ifdef SIGKILL
-                       lyx::support::kill(pid, SIGKILL);
-+#endif
-               }
-       }
-@@ -78,7 +86,9 @@
-       void kill()
-       {
-               if (pid_ != 0) {
-+#ifdef SIGKILL
-                       lyx::support::kill(pid_, SIGKILL);
-+#endif
-               }
-               lyxerr << "Killed " << pid_ << std::endl;
-               delete this;
-@@ -152,14 +162,16 @@
-       if (!pid())
-               return false;
-+#ifndef _WIN32
-       // Un-UNIX like, but we don't have much use for
-       // knowing if a zombie exists, so just reap it first.
-       int waitstatus;
-       waitpid(pid(), &waitstatus, WNOHANG);
-       // Racy of course, but it will do.
--      if (::kill(pid(), 0) && errno == ESRCH)
-+      if (lyx::kill(pid(), 0) && errno == ESRCH)
-               return false;
-+#endif
-       return true;
- }
-@@ -178,6 +190,7 @@
-               Murder::killItDead(0, pid());
-       } else {
-+#ifdef SIGHUP
-               int ret = lyx::support::kill(pid(), SIGHUP);
-               // The process is already dead if wait_for_death is false
-@@ -186,6 +199,7 @@
-               if (wait_for_death) {
-                       Murder::killItDead(tolerance, pid());
-               }
-+#endif
-       }
- }
-@@ -195,6 +209,7 @@
- {
-       // We'll pretend that the child returns 1 on all error conditions.
-       retval_ = 1;
-+#ifndef _WIN32
-       int status;
-       bool wait = true;
-       while (wait) {
-@@ -223,6 +238,7 @@
-                       wait = false;
-               }
-       }
-+#endif
-       return retval_;
- }
-@@ -299,7 +315,12 @@
-               std::cout << *ait << std::endl;
-       argv.push_back(0);
--#ifndef __EMX__
-+#ifdef __EMX
-+      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());
-+#else
-       pid_t const cpid = ::fork();
-       if (cpid == 0) {
-               // Child
-@@ -310,9 +331,6 @@
-                      << strerror(errno) << endl;
-               _exit(1);
-       }
--#else
--      pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND,
--                                 argv[0], &*argv.begin());
- #endif
-       if (cpid < 0) {
-Index: src/support/forkedcall.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcall.h,v
-retrieving revision 1.19
-diff -u -r1.19 forkedcall.h
---- src/support/forkedcall.h   26 Sep 2004 14:19:47 -0000      1.19
-+++ src/support/forkedcall.h   17 Jan 2005 12:17:09 -0000
-@@ -31,6 +31,10 @@
- #include <sys/types.h>
-+#ifdef _WIN32
-+typedef int pid_t;
-+#endif
-+
- namespace lyx {
- namespace support {
-Index: src/support/forkedcontr.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcontr.C,v
-retrieving revision 1.27
-diff -u -r1.27 forkedcontr.C
---- src/support/forkedcontr.C  20 Jan 2005 15:38:14 -0000      1.27
-+++ src/support/forkedcontr.C  21 Jan 2005 09:51:07 -0000
-@@ -19,14 +19,22 @@
- #include "debug.h"
-+#ifdef _WIN32
-+#include "os_win32.h"
-+#include <windows.h>
-+#endif
-+
- #include <boost/bind.hpp>
- #include <cerrno>
- #include <cstdlib>
-+
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
--#include <sys/wait.h>
-+#ifndef _WIN32
-+# include <sys/wait.h>
-+#endif
- using boost::bind;
-@@ -176,7 +184,9 @@
-       ForkedcallsController::Data & store =
-               fcc.reaped_children[++fcc.current_child];
-       // Clean up the child process.
-+#ifndef _WIN32
-       store.pid = wait(&store.status);
-+#endif
- }
- } // namespace anon
-@@ -193,11 +203,12 @@
- ForkedcallsController::ForkedcallsController()
-       : reaped_children(50), current_child(-1)
- {
-+#ifndef _WIN32
-       signal(SIGCHLD, child_handler);
--
-       sigemptyset(&oldMask);
-       sigemptyset(&newMask);
-       sigaddset(&newMask, SIGCHLD);
-+#endif
- }
-@@ -206,7 +217,9 @@
- // I want to print or something.
- ForkedcallsController::~ForkedcallsController()
- {
-+#ifndef _WIN32
-       signal(SIGCHLD, SIG_DFL);
-+#endif
- }
-@@ -215,6 +228,7 @@
-       forkedCalls.push_back(newcall.clone());
-       if (forkedCalls.size() > reaped_children.size()) {
-+#ifndef _WIN32
-               // Block the SIGCHLD signal.
-               sigprocmask(SIG_BLOCK, &newMask, &oldMask);
-@@ -222,6 +236,7 @@
-               // Unblock the SIGCHLD signal and restore the old mask.
-               sigprocmask(SIG_SETMASK, &oldMask, 0);
-+#endif
-       }
- }
-@@ -255,8 +270,10 @@
-       if (current_child == -1)
-               return;
-+#ifndef _WIN32
-       // Block the SIGCHLD signal.
-       sigprocmask(SIG_BLOCK, &newMask, &oldMask);
-+#endif
-       for (int i = 0; i != 1 + current_child; ++i) {
-               Data & store = reaped_children[i];
-@@ -312,8 +329,10 @@
-       // Reset the counter
-       current_child = -1;
-+#ifndef _WIN32
-       // Unblock the SIGCHLD signal and restore the old mask.
-       sigprocmask(SIG_SETMASK, &oldMask, 0);
-+#endif
- }
- } // namespace support
-Index: src/support/forkedcontr.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcontr.h,v
-retrieving revision 1.18
-diff -u -r1.18 forkedcontr.h
---- src/support/forkedcontr.h  7 Nov 2004 13:22:51 -0000       1.18
-+++ src/support/forkedcontr.h  23 Jan 2005 12:25:33 -0000
-@@ -19,7 +19,10 @@
- #include <boost/shared_ptr.hpp>
- #include <csignal>
--//#include <sys/types.h> // needed for pid_t
-+#ifdef _WIN32
-+typedef int pid_t;
-+#endif
-+#include <sys/types.h> // needed for pid_t
- #include <list>
- #include <vector>
-@@ -79,8 +82,10 @@
-       /// The child processes
-       ListType forkedCalls;
-+#ifndef _WIN32
-       /// Used to block SIGCHLD signals.
-       sigset_t newMask, oldMask;
-+#endif
- };
- } // namespace support
-Index: src/support/fs_extras.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/fs_extras.C,v
-retrieving revision 1.1
-diff -u -r1.1 fs_extras.C
---- src/support/fs_extras.C    31 Jan 2005 10:42:24 -0000      1.1
-+++ src/support/fs_extras.C    31 Jan 2005 11:31:39 -0000
-@@ -22,6 +22,10 @@
- #   endif
- # endif
-+#ifdef BOOST_WINDOWS
-+# include <windows.h>
-+#endif
-+
- namespace fs = boost::filesystem;
- namespace boost {
-@@ -32,6 +36,12 @@
- #ifdef BOOST_POSIX
-       return ::access(ph.string().c_str(), R_OK) == 0;
- #endif
-+#ifdef BOOST_WINDOWS
-+      DWORD const attr = ::GetFileAttributes( ph.string().c_str() );
-+      return attr != INVALID_FILE_ATTRIBUTES && 
-+              ( attr & FILE_ATTRIBUTE_DIRECTORY ) != FILE_ATTRIBUTE_DIRECTORY;
-+
-+#endif
- }
-@@ -40,14 +50,21 @@
- #ifdef BOOST_POSIX
-       return ::access(ph.string().c_str(), W_OK) == 0;
- #endif
-+#ifdef BOOST_WINDOWS
-+      DWORD const attr = ::GetFileAttributes( ph.string().c_str() );
-+      if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_READONLY) != 0) {
-+              // Read-only - no write access
-+              return false;
-+      }
-+      return attr != INVALID_FILE_ATTRIBUTES && 
-+              ( attr & FILE_ATTRIBUTE_DIRECTORY ) != FILE_ATTRIBUTE_DIRECTORY;
-+#endif
- }
- bool is_readonly(path const & ph)
- {
--#ifdef BOOST_POSIX
-       return is_readable(ph) && !is_writable(ph);
--#endif
- }
-@@ -115,6 +132,16 @@
-                               "boost::filesystem::copy_file",
-                               source, target,
-                               fs::detail::system_error_code()));
-+#endif
-+
-+#ifdef BOOST_WINDOWS
-+      if (::CopyFile(source.string().c_str(), target.string().c_str(), FALSE) == 0) {
-+              boost::throw_exception(
-+                      filesystem_error(
-+                              "boost::filesystem::copy_file",
-+                              source, target,
-+                              fs::detail::system_error_code()));
-+      }
- #endif
- }
-Index: src/support/getcwd.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/getcwd.C,v
-retrieving revision 1.12
-diff -u -r1.12 getcwd.C
---- src/support/getcwd.C       20 Jan 2005 15:38:14 -0000      1.12
-+++ src/support/getcwd.C       21 Jan 2005 09:50:41 -0000
-@@ -19,6 +19,10 @@
- # include <unistd.h>
- #endif
-+#ifdef _WIN32
-+# include <windows.h>
-+#endif
-+
- using boost::scoped_array;
- using std::string;
-@@ -29,10 +33,13 @@
- inline
- char * l_getcwd(char * buffer, size_t size)
- {
--#ifndef __EMX__
--      return ::getcwd(buffer, size);
--#else
-+#ifdef __EMX
-       return ::_getcwd2(buffer, size);
-+#elif defined(_WIN32)
-+      GetCurrentDirectory(size, buffer);
-+      return buffer;
-+#else
-+      return ::getcwd(buffer, size);
- #endif
- }
-Index: src/support/kill.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/kill.C,v
-retrieving revision 1.12
-diff -u -r1.12 kill.C
---- src/support/kill.C 7 Nov 2004 13:22:51 -0000       1.12
-+++ src/support/kill.C 20 Jan 2005 11:46:47 -0000
-@@ -15,7 +15,38 @@
- #include <sys/types.h>
- #include <csignal>
-+#ifdef _WIN32
-+#include "debug.h"
-+#include "os.h"
-+
-+#include <windows.h>
-+#include <errno.h>
-+
-+using std::endl;
-+#endif //_WIN32
-+
- int lyx::support::kill(int pid, int sig)
- {
-+#ifdef _WIN32
-+      if (pid == (int)GetCurrentProcessId()) {
-+              return -(raise(sig));
-+      } else {
-+              HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
-+              if (!hProcess) {
-+                      lyxerr << "kill OpenProcess failed!" << endl;
-+                      return -1;
-+              } else {
-+                      if (!TerminateProcess(hProcess, sig)){
-+                              lyxerr << "kill process failed!" << endl;
-+                              CloseHandle(hProcess);
-+                              return -1;
-+                      }
-+              CloseHandle(hProcess);
-+              }
-+      }
-+      return 0;
-+
-+#else
-       return ::kill(pid, sig);
-+#endif
- }
-Index: src/support/mkdir.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/mkdir.C,v
-retrieving revision 1.16
-diff -u -r1.16 mkdir.C
---- src/support/mkdir.C        20 Jan 2005 15:38:14 -0000      1.16
-+++ src/support/mkdir.C        25 Jan 2005 12:52:02 -0000
-@@ -18,6 +18,9 @@
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
-+#ifdef _WIN32
-+# include <Windows.h>
-+#endif
- int lyx::support::mkdir(std::string const & pathname, unsigned long int mode)
- {
-@@ -30,12 +33,12 @@
-       // POSIX
-       return ::mkdir(pathname.c_str(), mode_t(mode));
- # endif
--#else
--# if HAVE__MKDIR
-+#elif defined(_WIN32)
-       // plain Windows 32
--      return ::_mkdir(pathname.c_str());
--# else
--#  error "Don't know how to create a directory on this system."
--# endif
-+      return CreateDirectory(pathname.c_str(), 0) != 0 ? 0 : -1;
-+#elif HAVE__MKDIR
-+      return ::_mkdir(pathname.c_str());
-+#else
-+#   error "Don't know how to create a directory on this system."
- #endif
- }
-Index: src/support/os_win32.h
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/os_win32.h,v
-retrieving revision 1.1
-diff -u -r1.1 os_win32.h
---- src/support/os_win32.h     22 Jan 2005 15:36:53 -0000      1.1
-+++ src/support/os_win32.h     25 Jan 2005 12:40:09 -0000
-@@ -65,16 +65,6 @@
- #define O_NONBLOCK      0x4000
- inline int fcntl (int, int, ...) {return -1;}
--//signal.h
--#define SIGHUP 1
--#define SIGKILL 9
--
--//sys/time.h
--//struct timeval {
--//  long tv_sec;
--//  long tv_usec;
--//};
--
- //unistd.h
- inline int fork () {return -1;}
- #define pipe(a) _pipe(a,0,0)
-Index: src/support/rmdir.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/rmdir.C,v
-retrieving revision 1.8
-diff -u -r1.8 rmdir.C
---- src/support/rmdir.C        20 Jan 2005 15:38:14 -0000      1.8
-+++ src/support/rmdir.C        25 Jan 2005 12:13:39 -0000
-@@ -16,7 +16,15 @@
- # include <unistd.h>
- #endif
-+#ifdef _WIN32
-+# include <windows.h>
-+#endif
-+
- int lyx::support::rmdir(std::string const & dir)
- {
--      return ::rmdir(dir.c_str());
-+#ifdef _WIN32
-+      return ::RemoveDirectory(dir.c_str()) != 0 ? 0 : -1;
-+#else
-+      return :rmdir(dir.c_str());
-+#endif
- }
-Index: src/support/socktools.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/socktools.C,v
-retrieving revision 1.6
-diff -u -r1.6 socktools.C
---- src/support/socktools.C    20 Jan 2005 15:38:14 -0000      1.6
-+++ src/support/socktools.C    21 Jan 2005 09:43:42 -0000
-@@ -15,8 +15,10 @@
- #include "debug.h"
-+#ifndef _WIN32
- #include <sys/socket.h>
- #include <sys/un.h>
-+#endif
- #include <fcntl.h>
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
-@@ -48,6 +50,7 @@
- // special file 'name' will be created in the filesystem.
- int listen(string const & name, int queue)
- {
-+#ifndef _WIN32
-       int fd; // File descriptor for the socket
-       sockaddr_un addr; // Structure that hold the socket address
-@@ -105,14 +108,17 @@
-               lyx::support::unlink(name);
-               return -1;
-       }
--
-       return fd;
-+#else
-+      return -1;
-+#endif
- }
- // Returns a file descriptor for a new connection from the socket
- // descriptor 'sd' (or -1 in case of error)
- int accept(int sd)
- {
-+#ifndef _WIN32
-       int fd;
-       // Returns the new file descriptor or -1 in case of error
-@@ -132,6 +138,9 @@
-               return -1;
-       }
-       return fd;
-+#else
-+      return -1;
-+#endif
- }
- } // namespace socktools
-Index: src/support/tempname.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/tempname.C,v
-retrieving revision 1.25
-diff -u -r1.25 tempname.C
---- src/support/tempname.C     20 Jan 2005 15:38:14 -0000      1.25
-+++ src/support/tempname.C     24 Jan 2005 07:51:08 -0000
-@@ -30,6 +30,10 @@
- # include <sys/stat.h>
- #endif
-+#ifdef _WIN32
-+# include <io.h>
-+#endif
-+
- using boost::scoped_array;
- using std::string;
-@@ -42,6 +46,9 @@
- {
- #if defined(HAVE_MKSTEMP)
-       return ::mkstemp(templ);
-+#elif defined(_WIN32)
-+      ::_mktemp(templ);
-+      return (int) ::fopen(templ, "w");
- #elif defined(HAVE_MKTEMP)
-       // This probably just barely works...
-       ::mktemp(templ);
-@@ -58,7 +65,9 @@
- {
-       string const tmpdir(dir.empty() ? package().temp_dir() : dir);
-       string tmpfl(AddName(tmpdir, mask));
-+#ifndef _WIN32
-       tmpfl += convert<string>(getpid());
-+#endif
-       tmpfl += "XXXXXX";
-       // The supposedly safe mkstemp version
-@@ -69,7 +78,11 @@
-       int const tmpf = make_tempfile(tmpl.get());
-       if (tmpf != -1) {
-               string const t(tmpl.get());
-+#ifdef _WIN32
-+              ::fclose((FILE *) tmpf);
-+#else
-               ::close(tmpf);
-+#endif
-               lyxerr[Debug::FILES] << "Temporary file `" << t
-                                    << "' created." << endl;
-               return t;
-Index: src/support/userinfo.C
-===================================================================
-RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/userinfo.C,v
-retrieving revision 1.9
-diff -u -r1.9 userinfo.C
---- src/support/userinfo.C     20 Jan 2005 15:38:14 -0000      1.9
-+++ src/support/userinfo.C     21 Jan 2005 09:43:42 -0000
-@@ -15,7 +15,9 @@
- #include <boost/assert.hpp>
--#include <pwd.h>
-+#ifndef _WIN32
-+# include <pwd.h>
-+#endif
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
-@@ -28,6 +30,7 @@
- string const user_name()
- {
-+#ifndef _WIN32
-       struct passwd * pw(getpwuid(geteuid()));
-       BOOST_ASSERT(pw);
-@@ -35,6 +38,9 @@
-       if (name.empty())
-               name = pw->pw_name;
-       return name;
-+#else
-+      return "dummy";
-+#endif
- }
index 4d1796f8d4de946ebe8f393cb3f112eaa7fa7a3f..648dd9da72357a7c310997f8af44a66f8a865db9 100644 (file)
@@ -6,9 +6,10 @@ To compile using MicroSoft Visual Studio 2003.NET, do this:
 2) Make sure QTDIR is set in your global environment, and QTDIR\bin
    is in your path. Control panel, system, advanced, environment
    variables in your friend on Windows XP.
 2) Make sure QTDIR is set in your global environment, and QTDIR\bin
    is in your path. Control panel, system, advanced, environment
    variables in your friend on Windows XP.
-3) Apply the lyx-devel.patch using GNU patch. Download from
+3) Apply the win32_kludge.diff using GNU patch. Download from
    http://gnuwin32.sourceforge.net/packages/patch.htm
    http://gnuwin32.sourceforge.net/packages/patch.htm
-   and type "patch -p0 development\win32\lyx-devel.patch"   in cmd box with current working directory right outside
+   and type "patch -p0 < development\win32\win32_kludge.diff"
+   in cmd box with current working directory right outside
    lyx-devel
 4) Open the development\win32\lyx.sln file in Visual Studio,
    compile and run. You can probably also use the free version
    lyx-devel
 4) Open the development\win32\lyx.sln file in Visual Studio,
    compile and run. You can probably also use the free version
diff --git a/development/Win32/win32_kludge.diff b/development/Win32/win32_kludge.diff
new file mode 100644 (file)
index 0000000..6be9112
--- /dev/null
@@ -0,0 +1,802 @@
+Index: src/DepTable.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/DepTable.C,v
+retrieving revision 1.41
+diff -u -r1.41 DepTable.C
+--- src/DepTable.C     13 Oct 2003 01:01:33 -0000      1.41
++++ src/DepTable.C     19 Jan 2005 10:35:54 -0000
+@@ -26,7 +26,9 @@
+ #include <fstream>
+ #ifndef CXX_GLOBAL_CSTD
++# ifndef _WIN32
+ using std::time;
++# endif
+ #endif
+ using lyx::support::ltrim;
+Index: src/buffer.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
+retrieving revision 1.609
+diff -u -r1.609 buffer.C
+--- src/buffer.C       31 Jan 2005 10:42:17 -0000      1.609
++++ src/buffer.C       31 Jan 2005 11:08:10 -0000
+@@ -77,7 +77,11 @@
+ #include <boost/bind.hpp>
+ #include <boost/filesystem/operations.hpp>
+-#include <utime.h>
++#ifdef _WIN32
++# include <windows.h>
++#else
++# include <utime.h>
++#endif
+ #include <iomanip>
+ #include <stack>
+Index: src/cursor.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
+retrieving revision 1.119
+diff -u -r1.119 cursor.C
+--- src/cursor.C       18 Jan 2005 14:15:55 -0000      1.119
++++ src/cursor.C       31 Jan 2005 11:08:09 -0000
+@@ -58,7 +58,9 @@
+ using std::vector;
+ using std::endl;
+ #ifndef CXX_GLOBAL_CSTD
++# ifndef _WIN32
+ using std::isalpha;
++# endif
+ #endif
+ using std::min;
+ using std::swap;
+Index: src/ispell.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ispell.C,v
+retrieving revision 1.25
+diff -u -r1.25 ispell.C
+--- src/ispell.C       20 Jan 2005 16:17:36 -0000      1.25
++++ src/ispell.C       23 Jan 2005 12:09:37 -0000
+@@ -24,11 +24,17 @@
+ #include "support/forkedcall.h"
++#ifdef _WIN32
++# include "support/os_win32.h"
++#endif
++
+ // HP-UX 11.x doesn't have this header
+ #ifdef HAVE_SYS_SELECT_H
+ #include <sys/select.h>
+ #endif
+-#include <sys/time.h>
++#ifndef _WIN32
++# include <sys/time.h>
++#endif
+ using boost::shared_ptr;
+@@ -88,6 +94,7 @@
+       }
+       // child process
++#ifndef _WIN32
+       dup2(pipein[0], STDIN_FILENO);
+       dup2(pipeout[1], STDOUT_FILENO);
+       dup2(pipeerr[1], STDERR_FILENO);
+@@ -180,6 +187,7 @@
+       lyxerr << "LyX: Failed to start ispell!" << endl;
+       _exit(0);
++#endif
+ }
+@@ -191,6 +199,7 @@
+ {
+       lyxerr[Debug::GUI] << "Created ispell" << endl;
++#ifndef _WIN32
+       // static due to the setvbuf. Ugly.
+       static char o_buf[BUFSIZ];
+@@ -275,6 +284,7 @@
+       close(pipeerr[1]);
+       child_->kill();
+       child_.reset(0);
++#endif
+ }
+@@ -295,18 +305,23 @@
+               fclose(out);
+       }
++#ifndef _WIN32
+       close(pipein[0]);
+       close(pipein[1]);
+       close(pipeout[0]);
+       close(pipeout[1]);
+       close(pipeerr[0]);
+       close(pipeerr[1]);
++#endif
+       delete [] str;
+ }
+ bool ISpell::select(bool & err_read)
+ {
++#ifdef _WIN32
++      return false;
++#else
+       fd_set infds;
+       struct timeval tv;
+       int retval = 0;
+@@ -316,11 +331,15 @@
+       tv.tv_sec = 2;
+       tv.tv_usec = 0;
++#ifdef HAVE_SELECT
+       retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1),
+                       SELECT_TYPE_ARG234 (&infds),
+                       0,
+                       0,
+                       SELECT_TYPE_ARG5 (&tv));
++#else
++      retval = -1;
++#endif
+       // error
+       if (retval <= 0)
+@@ -335,6 +354,7 @@
+       fgets(buf, BUFSIZ, in);
+       err_read = false;
+       return false;
++#endif
+ }
+Index: src/lyx_cb.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
+retrieving revision 1.247
+diff -u -r1.247 lyx_cb.C
+--- src/lyx_cb.C       31 Jan 2005 10:42:18 -0000      1.247
++++ src/lyx_cb.C       31 Jan 2005 10:57:53 -0000
+@@ -44,6 +44,10 @@
+ #include "support/path.h"
+ #include "support/systemcall.h"
++#ifdef _WIN32
++# include "support/os_win32.h" // fork()
++#endif
++
+ #include <boost/shared_ptr.hpp>
+ #include <boost/filesystem/operations.hpp>
+Index: src/lyxserver.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxserver.C,v
+retrieving revision 1.59
+diff -u -r1.59 lyxserver.C
+--- src/lyxserver.C    20 Jan 2005 15:07:36 -0000      1.59
++++ src/lyxserver.C    21 Jan 2005 09:47:31 -0000
+@@ -54,6 +54,10 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#ifdef _WIN32
++# include "support/os_win32.h" // F_SETFL, O_NONBLOCK, fcntl
++#endif
++
+ #ifdef __EMX__
+ #include <cstdlib>
+ #include <io.h>
+@@ -182,6 +186,8 @@
+       // Imported handles can be used both with OS/2 APIs and emx
+       // library functions.
+       fd = _imphandle(os2fd);
++#elif defined(_WIN32)
++
+ #else
+       if (::access(filename.c_str(), F_OK) == 0) {
+               lyxerr << "LyXComm: Pipe " << filename << " already exists.\n"
+@@ -236,10 +242,12 @@
+       }
+ #endif
++#ifndef _WIN32
+       if (::close(fd) < 0) {
+               lyxerr << "LyXComm: Could not close pipe " << filename
+                      << '\n' << strerror(errno) << endl;
+       }
++#endif
+ // OS/2 pipes are deleted automatically
+ #ifndef __EMX__
+@@ -275,7 +283,13 @@
+       errno = 0;
+       int status;
+       // the single = is intended here.
+-      while ((status = ::read(infd, charbuf, charbuf_size - 1))) {
++      while ((status = 
++#ifndef _WIN32
++              ::read(infd, charbuf, charbuf_size - 1)
++#else
++              -1
++#endif
++              )) {
+               if (status > 0) {
+                       charbuf[status] = '\0'; // turn it into a c string
+@@ -332,6 +346,9 @@
+       if (pipename.empty()) return;
++#ifdef _WIN32
++      return;
++#else
+       if (!ready) {
+               lyxerr << "LyXComm: Pipes are closed. Could not send "
+                      << msg << endl;
+@@ -342,6 +359,7 @@
+               closeConnection();
+               openConnection();
+       }
++#endif
+ #ifdef __EMX__
+       APIRET rc;
+       int errnum;
+Index: src/lyxsocket.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxsocket.C,v
+retrieving revision 1.6
+diff -u -r1.6 lyxsocket.C
+--- src/lyxsocket.C    23 Jul 2004 19:01:48 -0000      1.6
++++ src/lyxsocket.C    19 Jan 2005 11:18:01 -0000
+@@ -68,7 +68,9 @@
+ LyXServerSocket::~LyXServerSocket()
+ {
+       lyx_gui::unregister_socket_callback(fd_);
++#ifndef _WIN32
+       ::close(fd_);
++#endif
+       lyx::support::unlink(address_);
+       lyxerr[Debug::LYXSERVER] << "lyx: Server socket quitting" << endl;
+ }
+@@ -155,7 +157,11 @@
+ {
+       string const linen(line + '\n');
+       int const size = linen.size();
++#ifndef _WIN32
+       int const written = ::write(fd_, linen.c_str(), size);
++#else
++      int const written = -1;
++#endif
+       if (written < size) { // Allways mean end of connection.
+               if ((written == -1) && (errno == EPIPE)) {
+                       // The program will also receive a SIGPIPE
+@@ -194,7 +200,9 @@
+ LyXDataSocket::~LyXDataSocket()
+ {
++#ifndef _WIN32
+       ::close(fd_);
++#endif
+       lyx_gui::unregister_socket_callback(fd_);
+       lyxerr[Debug::LYXSERVER] << "lyx: Data socket " << fd_ << " quitting."
+@@ -216,7 +224,13 @@
+       int count;
+       // read and store characters in buffer
+-      while ((count = ::read(fd_, charbuf, charbuf_size - 1)) > 0) {
++      while ((count = 
++#ifndef _WIN32
++              ::read(fd_, charbuf, charbuf_size - 1)
++#else
++              0
++#endif
++              ) > 0) {
+               buffer_.append(charbuf, charbuf + count);
+       }
+@@ -250,7 +264,11 @@
+ {
+       string const linen(line + '\n');
+       int const size = linen.size();
++#ifndef _WIN32
+       int const written = ::write(fd_, linen.c_str(), size);
++#else
++      int const written = -1;
++#endif
+       if (written < size) { // Allways mean end of connection.
+               if ((written == -1) && (errno == EPIPE)) {
+                       // The program will also receive a SIGPIPE
+Index: src/client/client.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/client.C,v
+retrieving revision 1.7
+diff -u -r1.7 client.C
+--- src/client/client.C        20 Jan 2005 15:38:13 -0000      1.7
++++ src/client/client.C        21 Jan 2005 09:43:09 -0000
+@@ -25,12 +25,14 @@
+ # include <unistd.h>
+ #endif
++#ifndef _WIN32
+ // select()
+-#include <sys/select.h>
++# include <sys/select.h>
+ // socket(), connect()
+-#include <sys/socket.h>
+-#include <sys/un.h>
++# include <sys/socket.h>
++# include <sys/un.h>
++#endif
+ // fcntl()
+ #include <fcntl.h>
+Index: src/frontends/LyXView.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXView.C,v
+retrieving revision 1.49
+diff -u -r1.49 LyXView.C
+--- src/frontends/LyXView.C    20 Jan 2005 15:38:14 -0000      1.49
++++ src/frontends/LyXView.C    21 Jan 2005 09:43:10 -0000
+@@ -39,7 +39,9 @@
+ #include <boost/bind.hpp>
+-#include <sys/time.h>
++#ifndef _WIN32
++# include <sys/time.h>
++#endif
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+Index: src/support/filetools.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
+retrieving revision 1.204
+diff -u -r1.204 filetools.C
+--- src/support/filetools.C    31 Jan 2005 10:42:23 -0000      1.204
++++ src/support/filetools.C    31 Jan 2005 11:08:10 -0000
+@@ -1153,6 +1153,11 @@
+ cmd_ret const RunCommand(string const & cmd)
+ {
++#ifdef _WIN32
++      // TODO: Implement this, or merge it into forkedcall.
++      // Used for lyx2lyx in buffer.C, echo in math_extern and kpse in this file
++      return make_pair(-1, string());
++#else
+       // FIXME: replace all calls to RunCommand with ForkedCall
+       // (if the output is not needed) or the code in ispell.C
+       // (if the output is needed).
+@@ -1193,6 +1198,7 @@
+       sigprocmask(SIG_SETMASK, &oldMask, 0);
+       return make_pair(pret, ret);
++#endif
+ }
+Index: src/support/forkedcall.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcall.C,v
+retrieving revision 1.21
+diff -u -r1.21 forkedcall.C
+--- src/support/forkedcall.C   20 Jan 2005 15:38:14 -0000      1.21
++++ src/support/forkedcall.C   25 Jan 2005 12:41:14 -0000
+@@ -30,6 +30,10 @@
+ #include "support/lyxlib.h"
+ #include "support/filetools.h"
+ #include "support/os.h"
++#ifdef _WIN32
++#include "os_win32.h"
++#include <process.h>
++#endif
+ #include "debug.h"
+@@ -41,7 +45,9 @@
+ #include <csignal>
+ #include <cstdlib>
+ #include <sys/types.h>
+-#include <sys/wait.h>
++#ifndef _WIN32
++# include <sys/wait.h>
++#endif
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+@@ -70,7 +76,9 @@
+               if (secs > 0) {
+                       new Murder(secs, pid);
+               } else if (pid != 0) {
++#ifdef SIGKILL
+                       lyx::support::kill(pid, SIGKILL);
++#endif
+               }
+       }
+@@ -78,7 +86,9 @@
+       void kill()
+       {
+               if (pid_ != 0) {
++#ifdef SIGKILL
+                       lyx::support::kill(pid_, SIGKILL);
++#endif
+               }
+               lyxerr << "Killed " << pid_ << std::endl;
+               delete this;
+@@ -152,14 +162,16 @@
+       if (!pid())
+               return false;
++#ifndef _WIN32
+       // Un-UNIX like, but we don't have much use for
+       // knowing if a zombie exists, so just reap it first.
+       int waitstatus;
+       waitpid(pid(), &waitstatus, WNOHANG);
+       // Racy of course, but it will do.
+-      if (::kill(pid(), 0) && errno == ESRCH)
++      if (lyx::kill(pid(), 0) && errno == ESRCH)
+               return false;
++#endif
+       return true;
+ }
+@@ -178,6 +190,7 @@
+               Murder::killItDead(0, pid());
+       } else {
++#ifdef SIGHUP
+               int ret = lyx::support::kill(pid(), SIGHUP);
+               // The process is already dead if wait_for_death is false
+@@ -186,6 +199,7 @@
+               if (wait_for_death) {
+                       Murder::killItDead(tolerance, pid());
+               }
++#endif
+       }
+ }
+@@ -195,6 +209,7 @@
+ {
+       // We'll pretend that the child returns 1 on all error conditions.
+       retval_ = 1;
++#ifndef _WIN32
+       int status;
+       bool wait = true;
+       while (wait) {
+@@ -223,6 +238,7 @@
+                       wait = false;
+               }
+       }
++#endif
+       return retval_;
+ }
+@@ -299,7 +315,12 @@
+               std::cout << *ait << std::endl;
+       argv.push_back(0);
+-#ifndef __EMX__
++#ifdef __EMX
++      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());
++#else
+       pid_t const cpid = ::fork();
+       if (cpid == 0) {
+               // Child
+@@ -310,9 +331,6 @@
+                      << strerror(errno) << endl;
+               _exit(1);
+       }
+-#else
+-      pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND,
+-                                 argv[0], &*argv.begin());
+ #endif
+       if (cpid < 0) {
+Index: src/support/forkedcall.h
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcall.h,v
+retrieving revision 1.19
+diff -u -r1.19 forkedcall.h
+--- src/support/forkedcall.h   26 Sep 2004 14:19:47 -0000      1.19
++++ src/support/forkedcall.h   17 Jan 2005 12:17:09 -0000
+@@ -31,6 +31,10 @@
+ #include <sys/types.h>
++#ifdef _WIN32
++typedef int pid_t;
++#endif
++
+ namespace lyx {
+ namespace support {
+Index: src/support/forkedcontr.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcontr.C,v
+retrieving revision 1.27
+diff -u -r1.27 forkedcontr.C
+--- src/support/forkedcontr.C  20 Jan 2005 15:38:14 -0000      1.27
++++ src/support/forkedcontr.C  21 Jan 2005 09:51:07 -0000
+@@ -19,14 +19,22 @@
+ #include "debug.h"
++#ifdef _WIN32
++#include "os_win32.h"
++#include <windows.h>
++#endif
++
+ #include <boost/bind.hpp>
+ #include <cerrno>
+ #include <cstdlib>
++
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+-#include <sys/wait.h>
++#ifndef _WIN32
++# include <sys/wait.h>
++#endif
+ using boost::bind;
+@@ -176,7 +184,9 @@
+       ForkedcallsController::Data & store =
+               fcc.reaped_children[++fcc.current_child];
+       // Clean up the child process.
++#ifndef _WIN32
+       store.pid = wait(&store.status);
++#endif
+ }
+ } // namespace anon
+@@ -193,11 +203,12 @@
+ ForkedcallsController::ForkedcallsController()
+       : reaped_children(50), current_child(-1)
+ {
++#ifndef _WIN32
+       signal(SIGCHLD, child_handler);
+-
+       sigemptyset(&oldMask);
+       sigemptyset(&newMask);
+       sigaddset(&newMask, SIGCHLD);
++#endif
+ }
+@@ -206,7 +217,9 @@
+ // I want to print or something.
+ ForkedcallsController::~ForkedcallsController()
+ {
++#ifndef _WIN32
+       signal(SIGCHLD, SIG_DFL);
++#endif
+ }
+@@ -215,6 +228,7 @@
+       forkedCalls.push_back(newcall.clone());
+       if (forkedCalls.size() > reaped_children.size()) {
++#ifndef _WIN32
+               // Block the SIGCHLD signal.
+               sigprocmask(SIG_BLOCK, &newMask, &oldMask);
+@@ -222,6 +236,7 @@
+               // Unblock the SIGCHLD signal and restore the old mask.
+               sigprocmask(SIG_SETMASK, &oldMask, 0);
++#endif
+       }
+ }
+@@ -255,8 +270,10 @@
+       if (current_child == -1)
+               return;
++#ifndef _WIN32
+       // Block the SIGCHLD signal.
+       sigprocmask(SIG_BLOCK, &newMask, &oldMask);
++#endif
+       for (int i = 0; i != 1 + current_child; ++i) {
+               Data & store = reaped_children[i];
+@@ -312,8 +329,10 @@
+       // Reset the counter
+       current_child = -1;
++#ifndef _WIN32
+       // Unblock the SIGCHLD signal and restore the old mask.
+       sigprocmask(SIG_SETMASK, &oldMask, 0);
++#endif
+ }
+ } // namespace support
+Index: src/support/forkedcontr.h
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/forkedcontr.h,v
+retrieving revision 1.18
+diff -u -r1.18 forkedcontr.h
+--- src/support/forkedcontr.h  7 Nov 2004 13:22:51 -0000       1.18
++++ src/support/forkedcontr.h  23 Jan 2005 12:25:33 -0000
+@@ -19,7 +19,10 @@
+ #include <boost/shared_ptr.hpp>
+ #include <csignal>
+-//#include <sys/types.h> // needed for pid_t
++#ifdef _WIN32
++typedef int pid_t;
++#endif
++#include <sys/types.h> // needed for pid_t
+ #include <list>
+ #include <vector>
+@@ -79,8 +82,10 @@
+       /// The child processes
+       ListType forkedCalls;
++#ifndef _WIN32
+       /// Used to block SIGCHLD signals.
+       sigset_t newMask, oldMask;
++#endif
+ };
+ } // namespace support
+Index: src/support/socktools.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/socktools.C,v
+retrieving revision 1.6
+diff -u -r1.6 socktools.C
+--- src/support/socktools.C    20 Jan 2005 15:38:14 -0000      1.6
++++ src/support/socktools.C    21 Jan 2005 09:43:42 -0000
+@@ -15,8 +15,10 @@
+ #include "debug.h"
++#ifndef _WIN32
+ #include <sys/socket.h>
+ #include <sys/un.h>
++#endif
+ #include <fcntl.h>
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+@@ -48,6 +50,7 @@
+ // special file 'name' will be created in the filesystem.
+ int listen(string const & name, int queue)
+ {
++#ifndef _WIN32
+       int fd; // File descriptor for the socket
+       sockaddr_un addr; // Structure that hold the socket address
+@@ -105,14 +108,17 @@
+               lyx::support::unlink(name);
+               return -1;
+       }
+-
+       return fd;
++#else
++      return -1;
++#endif
+ }
+ // Returns a file descriptor for a new connection from the socket
+ // descriptor 'sd' (or -1 in case of error)
+ int accept(int sd)
+ {
++#ifndef _WIN32
+       int fd;
+       // Returns the new file descriptor or -1 in case of error
+@@ -132,6 +138,9 @@
+               return -1;
+       }
+       return fd;
++#else
++      return -1;
++#endif
+ }
+ } // namespace socktools
+Index: src/support/tempname.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/tempname.C,v
+retrieving revision 1.25
+diff -u -r1.25 tempname.C
+--- src/support/tempname.C     20 Jan 2005 15:38:14 -0000      1.25
++++ src/support/tempname.C     24 Jan 2005 07:51:08 -0000
+@@ -30,6 +30,10 @@
+ # include <sys/stat.h>
+ #endif
++#ifdef _WIN32
++# include <io.h>
++#endif
++
+ using boost::scoped_array;
+ using std::string;
+@@ -42,6 +46,9 @@
+ {
+ #if defined(HAVE_MKSTEMP)
+       return ::mkstemp(templ);
++#elif defined(_WIN32)
++      ::_mktemp(templ);
++      return (int) ::fopen(templ, "w");
+ #elif defined(HAVE_MKTEMP)
+       // This probably just barely works...
+       ::mktemp(templ);
+@@ -58,7 +65,9 @@
+ {
+       string const tmpdir(dir.empty() ? package().temp_dir() : dir);
+       string tmpfl(AddName(tmpdir, mask));
++#ifndef _WIN32
+       tmpfl += convert<string>(getpid());
++#endif
+       tmpfl += "XXXXXX";
+       // The supposedly safe mkstemp version
+@@ -69,7 +78,11 @@
+       int const tmpf = make_tempfile(tmpl.get());
+       if (tmpf != -1) {
+               string const t(tmpl.get());
++#ifdef _WIN32
++              ::fclose((FILE *) tmpf);
++#else
+               ::close(tmpf);
++#endif
+               lyxerr[Debug::FILES] << "Temporary file `" << t
+                                    << "' created." << endl;
+               return t;
+Index: src/support/userinfo.C
+===================================================================
+RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/userinfo.C,v
+retrieving revision 1.9
+diff -u -r1.9 userinfo.C
+--- src/support/userinfo.C     20 Jan 2005 15:38:14 -0000      1.9
++++ src/support/userinfo.C     21 Jan 2005 09:43:42 -0000
+@@ -15,7 +15,9 @@
+ #include <boost/assert.hpp>
+-#include <pwd.h>
++#ifndef _WIN32
++# include <pwd.h>
++#endif
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+@@ -28,6 +30,7 @@
+ string const user_name()
+ {
++#ifndef _WIN32
+       struct passwd * pw(getpwuid(geteuid()));
+       BOOST_ASSERT(pw);
+@@ -35,6 +38,9 @@
+       if (name.empty())
+               name = pw->pw_name;
+       return name;
++#else
++      return "dummy";
++#endif
+ }