summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument_p.cpp
diff options
context:
space:
mode:
authorRobert Griebl <rgriebl@trolltech.com>2008-07-30 21:14:24 (GMT)
committerRobert Griebl <rgriebl@trolltech.com>2009-07-29 08:50:20 (GMT)
commitd7b688870aead912690188b324d370b920a7a600 (patch)
treeaac6c19d222ca3bad65cfbb850483a647013c67a /src/gui/text/qtextdocument_p.cpp
parente5262a0c29c743f2afd4ba249e8adff984c1ca83 (diff)
downloadQt-d7b688870aead912690188b324d370b920a7a600.zip
Qt-d7b688870aead912690188b324d370b920a7a600.tar.gz
Qt-d7b688870aead912690188b324d370b920a7a600.tar.bz2
Port of Qt to VxWorks
This makes Qt work on VxWorks 6.6+ in native (kernel) mode. * compiles with the WindRiver GNU toolchain (Linux only) * works with QWS (tested with the VNC driver only) * tested on PPC hardware and the x86 VxWorks simulator * no q3support, no phonon, no webkit * no QSharedMemory, no QSystemSemaphore, no QProcess * only one QApplication instance (flat address space) * filesystem support depends heavily on the quality of the native driver * QLibrary is just a dummy to make plugins work at all * qmake transparently creates VxWorks munching rules for static ctors * made auto-test cope with missing OS features A special note regarding the Q_FOREACH patch for dcc: when calling foreach(a,c) with c being a function returning a container, the compiler would generate 5 references to some labels (.LXXXX), which are not there (so the linker complains in the end). Seems like dcc doesn't really like the 'true ? 0 : <function call to get type>' statement Reviewed-By: Harald Fernengel
Diffstat (limited to 'src/gui/text/qtextdocument_p.cpp')
-rw-r--r--src/gui/text/qtextdocument_p.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index ea37e04..e66b07c 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -60,6 +60,15 @@ QT_BEGIN_NAMESPACE
#define PMDEBUG if(0) qDebug
+// The VxWorks DIAB compiler crashes when initializing the anonymouse union with { a7 }
+#if !defined(Q_CC_DIAB)
+# define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \
+ QTextUndoCommand c = { a1, a2, a3, a4, a5, a6, { a7 }, a8 }
+#else
+# define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \
+ QTextUndoCommand c = { a1, a2, a3, a4, a5, a6 }; c.blockFormat = a7; c.revision = a8
+#endif
+
/*
Structure of a document:
@@ -406,9 +415,9 @@ int QTextDocumentPrivate::insertBlock(const QChar &blockSeparator,
int b = blocks.findNode(pos);
QTextBlockData *B = blocks.fragment(b);
- QTextUndoCommand c = { QTextUndoCommand::BlockInserted, editBlock != 0,
- op, charFormat, strPos, pos, { blockFormat },
- B->revision };
+ QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::BlockInserted, editBlock != 0,
+ op, charFormat, strPos, pos, blockFormat,
+ B->revision);
appendUndoItem(c);
Q_ASSERT(undoState == undoStack.size());
@@ -447,9 +456,9 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format
int b = blocks.findNode(pos);
QTextBlockData *B = blocks.fragment(b);
- QTextUndoCommand c = { QTextUndoCommand::Inserted, editBlock != 0,
- QTextUndoCommand::MoveCursor, format, strPos, pos, { strLength },
- B->revision };
+ QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::Inserted, editBlock != 0,
+ QTextUndoCommand::MoveCursor, format, strPos, pos, strLength,
+ B->revision);
appendUndoItem(c);
B->revision = undoState;
Q_ASSERT(undoState == undoStack.size());
@@ -606,12 +615,12 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
int blockRevision = B->revision;
QTextFragmentData *X = fragments.fragment(x);
- QTextUndoCommand c = { QTextUndoCommand::Removed, editBlock != 0,
- op, X->format, X->stringPosition, key, { X->size_array[0] },
- blockRevision };
- QTextUndoCommand cInsert = { QTextUndoCommand::Inserted, editBlock != 0,
- op, X->format, X->stringPosition, dstKey, { X->size_array[0] },
- blockRevision };
+ QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::Removed, editBlock != 0,
+ op, X->format, X->stringPosition, key, X->size_array[0],
+ blockRevision);
+ QT_INIT_TEXTUNDOCOMMAND(cInsert, QTextUndoCommand::Inserted, editBlock != 0,
+ op, X->format, X->stringPosition, dstKey, X->size_array[0],
+ blockRevision);
if (key+1 != blocks.position(b)) {
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
@@ -723,8 +732,8 @@ void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFor
fragment->format = newFormatIdx;
}
- QTextUndoCommand c = { QTextUndoCommand::CharFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat,
- 0, pos, { length }, 0 };
+ QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::CharFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat,
+ 0, pos, length, 0);
appendUndoItem(c);
pos += length;
@@ -783,8 +792,8 @@ void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlo
block(it)->invalidate();
- QTextUndoCommand c = { QTextUndoCommand::BlockFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat,
- 0, it.position(), { 1 }, 0 };
+ QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::BlockFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat,
+ 0, it.position(), 1, 0);
appendUndoItem(c);
if (group != oldGroup) {
@@ -1298,8 +1307,8 @@ void QTextDocumentPrivate::changeObjectFormat(QTextObject *obj, int format)
if (f)
documentChange(f->firstPosition(), f->lastPosition() - f->firstPosition());
- QTextUndoCommand c = { QTextUndoCommand::GroupFormatChange, editBlock != 0, QTextUndoCommand::MoveCursor, oldFormatIndex,
- 0, 0, { obj->d_func()->objectIndex }, 0 };
+ QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::GroupFormatChange, editBlock != 0, QTextUndoCommand::MoveCursor, oldFormatIndex,
+ 0, 0, obj->d_func()->objectIndex, 0);
appendUndoItem(c);
endEditBlock();