Add -enable-assertions to configure, cleanup assertions, fix crash in LyXFont::ascent() and friends

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@384 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-12-16 14:16:42 +00:00
parent 7c6267e4b1
commit 6f8422af71
16 changed files with 204 additions and 202 deletions

View File

@ -1,3 +1,35 @@
1999-12-16 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxfont.C (ascent): Make sure that char is _always_ used as
unsigned.
(descent): ditto
(lbearing): ditto
(rbearing): ditto
* src/paragraph.C (GetWord): assert on pos>=0
(GetChar): ditto
* src/support/lyxstring.C: condition the use of an invariant on
ENABLE_ASSERTIONS
* src/support/lyxstring.h: ditto
* src/Bullet.[Ch]: replace DEBUG_AS_DEFAULT by
ENABLE_ASSERTIONS. Use LAssert.h instead of plain assert().
* src/support/lstrings.h: add LAssert.h, in case it is needed.
* src/lyxfunc.C: do not include LAssert.h, it is not used.
* src/support/filetools.C: ditto
* src/support/LAssert.h: make Assert a no-op if ENABLE_ASSERTIONS
is not defined.
* INSTALL: document the new configure flags
* configure.in: suppress --with-debug; add --enable-assertions
* acinclude.m4: various changes in alignment of help strings.
1999-12-16 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/kbmap.C: commented out the use of the hash map in kb_map,

13
INSTALL
View File

@ -179,20 +179,23 @@ this file.
In particular, the following options could be useful in some
desperate cases:
o --with-debug that specifies whether you want to have debug information
by default on standard error. Default is no.
o --with-warnings that make the compiler output more warnings during
the compilation of LyX. Opposite is --without-warnings. By default,
this flag is on for development versions only.
o --enable-assertions that make the compilier generater run-time
code which checks that some variables have sane values. Opposite
is --disable-assertions. By default, this flag is on for
development versions only.
o --with-broken-headers that provides prototypes to replace functions
not correctly defined in SunOS4 and SCO header files. Its only effect is
to suppress a few warnings. It is autodetected by default.
o --without-latex-config that disables the automatic detection of your
latex. This detection is automatically disabled if latex cannot be found.
If you find that you have to use this flag, please report it as a bug.
latex configuration. This detection is automatically disabled if
latex cannot be found. If you find that you have to use this
flag, please report it as a bug.
o --without-liberty suppresses the detection of the -liberty library
(see the section 'Problems').

View File

@ -146,7 +146,7 @@ AC_PROG_CXX_GNU
dnl We might want to get or shut warnings.
AC_ARG_WITH(warnings,
[ --with-warnings tell GNU C++ to display more warnings],,
[ --with-warnings tell the compiler to display more warnings],,
[ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then
with_warnings=yes;
else
@ -309,12 +309,10 @@ dnl and could need some improvement.
AC_DEFUN(LYX_CXX_STL_STRING,[
AC_REQUIRE([LYX_PROG_CXX])
AC_MSG_CHECKING(whether the included std::string should be used)
AC_ARG_WITH(included-string,[
--with-included-string use LyX string class instead of STL string
],[
with_included_string=$withval
],[
AC_TRY_COMPILE([
AC_ARG_WITH(included-string,
[ --with-included-string use LyX string class instead of STL string],
[with_included_string=$withval],
[AC_TRY_COMPILE([
#include <string>
using std::string;
],[

View File

@ -193,10 +193,18 @@ AC_REPLACE_FUNCS(strerror atexit)
AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps],
[AC_DEFINE(TWO_COLOR_ICONS)
lyx_flags="$lyx_flags two-colors"])
AC_ARG_WITH(debug,[ --with-debug output debug information by default],
[AC_DEFINE(DEBUG_AS_DEFAULT,1,
[Define if you want debugging turned on as default.])
lyx_flags="$lyx_flags debug"])
AC_ARG_ENABLE(assertions,
[ --enable-assertions add runtime sanity checks in the program],,
[if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
enable_assertions=yes;
else
enable_assertions=no;
fi;])
if test "x$enable_assertions" = xyes ; then
lyx_flags="$lyx_flags assertions"
AC_DEFINE(ENABLE_ASSERTIONS,1,
[Define if you want assertions to be enabled in the code])
fi
### Finish the work.
AC_CONFIG_SUBDIRS(lib lib/reLyX)

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-12-16 07:10+0100\n"
"POT-Creation-Date: 1999-12-16 14:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -114,7 +114,7 @@ msgid "Error: Cannot open file: "
msgstr ""
#: src/buffer.C:2156 src/buffer.C:2746 src/buffer.C:3507 src/buffer.C:3529
#: src/paragraph.C:3590
#: src/paragraph.C:3553
msgid "LYX_ERROR:"
msgstr ""
@ -176,7 +176,7 @@ msgstr ""
msgid "Could not run with file:"
msgstr ""
#: src/buffer.C:3508 src/buffer.C:3530 src/paragraph.C:3591
#: src/buffer.C:3508 src/buffer.C:3530 src/paragraph.C:3554
msgid "Cannot open temporary file:"
msgstr ""
@ -283,8 +283,8 @@ msgstr ""
msgid "Could not convert file"
msgstr ""
#: src/bufferlist.C:563 src/lyxfunc.C:2485 src/lyxfunc.C:2624
#: src/lyxfunc.C:2703
#: src/bufferlist.C:563 src/lyxfunc.C:2484 src/lyxfunc.C:2623
#: src/lyxfunc.C:2702
msgid "Document is already open:"
msgstr ""
@ -767,8 +767,8 @@ msgstr ""
msgid "Clipart"
msgstr ""
#: src/insets/figinset.C:2155 src/lyxfunc.C:2517 src/lyxfunc.C:2580
#: src/lyxfunc.C:2803
#: src/insets/figinset.C:2155 src/lyxfunc.C:2516 src/lyxfunc.C:2579
#: src/lyxfunc.C:2802
msgid "Document"
msgstr ""
@ -910,8 +910,8 @@ msgid "Use include|#U"
msgstr ""
#. launches dialog
#: src/insets/insetinclude.C:111 src/lyx_cb.C:369 src/lyxfunc.C:2465
#: src/lyxfunc.C:2555 src/lyxfunc.C:2604 src/lyxfunc.C:2677 src/lyxfunc.C:2778
#: src/insets/insetinclude.C:111 src/lyx_cb.C:369 src/lyxfunc.C:2464
#: src/lyxfunc.C:2554 src/lyxfunc.C:2603 src/lyxfunc.C:2676 src/lyxfunc.C:2777
#: src/menus.C:177 src/menus.C:309 src/menus.C:310 src/menus.C:311
msgid "Documents"
msgstr ""
@ -991,7 +991,7 @@ msgid "Ref: "
msgstr ""
#. /
#: src/insets/insettoc.h:35 src/lyxfunc.C:784
#: src/insets/insettoc.h:35 src/lyxfunc.C:783
msgid "Table of Contents"
msgstr ""
@ -1665,7 +1665,7 @@ msgstr ""
msgid "Save As"
msgstr ""
#: src/LyXAction.C:149 src/lyxfunc.C:638
#: src/LyXAction.C:149 src/lyxfunc.C:637
msgid "Cancel"
msgstr ""
@ -2029,7 +2029,7 @@ msgstr ""
msgid "(If not, document is not saved.)"
msgstr ""
#: src/lyx_cb.C:370 src/lyxfunc.C:2466
#: src/lyx_cb.C:370 src/lyxfunc.C:2465
msgid "Templates"
msgstr ""
@ -2038,9 +2038,9 @@ msgid "Enter Filename to Save Document as"
msgstr ""
#. Cancel: Do nothing
#: src/lyx_cb.C:382 src/lyxfunc.C:2472 src/lyxfunc.C:2499 src/lyxfunc.C:2564
#: src/lyxfunc.C:2613 src/lyxfunc.C:2638 src/lyxfunc.C:2648 src/lyxfunc.C:2693
#: src/lyxfunc.C:2718 src/lyxfunc.C:2728 src/lyxfunc.C:2787
#: src/lyx_cb.C:382 src/lyxfunc.C:2471 src/lyxfunc.C:2498 src/lyxfunc.C:2563
#: src/lyxfunc.C:2612 src/lyxfunc.C:2637 src/lyxfunc.C:2647 src/lyxfunc.C:2692
#: src/lyxfunc.C:2717 src/lyxfunc.C:2727 src/lyxfunc.C:2786
msgid "Canceled."
msgstr ""
@ -2145,7 +2145,7 @@ msgid "Executing command:"
msgstr ""
#: src/lyx_cb.C:828 src/lyx_cb.C:864 src/lyx_cb.C:897 src/lyx_cb.C:924
#: src/lyxfunc.C:2508
#: src/lyxfunc.C:2507
msgid "File already exists:"
msgstr ""
@ -2732,218 +2732,218 @@ msgstr ""
msgid "Found."
msgstr ""
#: src/lyxfunc.C:276
#: src/lyxfunc.C:275
msgid "Unknown sequence:"
msgstr ""
#: src/lyxfunc.C:319 src/lyxfunc.C:2415
#: src/lyxfunc.C:318 src/lyxfunc.C:2414
msgid "Unknown action"
msgstr ""
#. no
#: src/lyxfunc.C:333
#: src/lyxfunc.C:332
msgid "Document is read-only"
msgstr ""
#. no
#: src/lyxfunc.C:338
#: src/lyxfunc.C:337
msgid "Command not allowed without any document open"
msgstr ""
#: src/lyxfunc.C:559
#: src/lyxfunc.C:558
msgid "Text mode"
msgstr ""
#: src/lyxfunc.C:765
#: src/lyxfunc.C:764
msgid "Unknown import type: "
msgstr ""
#: src/lyxfunc.C:1093
#: src/lyxfunc.C:1092
msgid "Layout "
msgstr ""
#: src/lyxfunc.C:1094
#: src/lyxfunc.C:1093
msgid " not known"
msgstr ""
#: src/lyxfunc.C:1236
#: src/lyxfunc.C:1235
msgid "No cross-reference to toggle"
msgstr ""
#: src/lyxfunc.C:1587
#: src/lyxfunc.C:1586
msgid "Mark removed"
msgstr ""
#: src/lyxfunc.C:1592
#: src/lyxfunc.C:1591
msgid "Mark set"
msgstr ""
#: src/lyxfunc.C:1695
#: src/lyxfunc.C:1694
msgid "Mark off"
msgstr ""
#: src/lyxfunc.C:1705
#: src/lyxfunc.C:1704
msgid "Mark on"
msgstr ""
#: src/lyxfunc.C:2006
#: src/lyxfunc.C:2005
msgid "Push-toolbar needs argument > 0"
msgstr ""
#: src/lyxfunc.C:2024
#: src/lyxfunc.C:2023
msgid "Usage: toolbar-add-to <LyX command>"
msgstr ""
#: src/lyxfunc.C:2048 src/mathed/formula.C:874
#: src/lyxfunc.C:2047 src/mathed/formula.C:874
msgid "Math greek mode on"
msgstr ""
#: src/lyxfunc.C:2059 src/mathed/formula.C:885
#: src/lyxfunc.C:2058 src/mathed/formula.C:885
msgid "Math greek keyboard on"
msgstr ""
#: src/lyxfunc.C:2061 src/mathed/formula.C:887
#: src/lyxfunc.C:2060 src/mathed/formula.C:887
msgid "Math greek keyboard off"
msgstr ""
#: src/lyxfunc.C:2096
#: src/lyxfunc.C:2095
msgid "Missing argument"
msgstr ""
#. / what appears in the minibuffer when opening
#: src/lyxfunc.C:2112 src/mathed/formula.h:73
#: src/lyxfunc.C:2111 src/mathed/formula.h:73
msgid "Math editor mode"
msgstr ""
#: src/lyxfunc.C:2119
#: src/lyxfunc.C:2118
msgid "This is only allowed in math mode!"
msgstr ""
#: src/lyxfunc.C:2273
#: src/lyxfunc.C:2272
msgid "Opening child document "
msgstr ""
#: src/lyxfunc.C:2305
#: src/lyxfunc.C:2304
msgid "Unknown kind of footnote"
msgstr ""
#: src/lyxfunc.C:2374
#: src/lyxfunc.C:2373
msgid "Document is read only"
msgstr ""
#: src/lyxfunc.C:2467
#: src/lyxfunc.C:2466
msgid "Enter Filename for new document"
msgstr ""
#: src/lyxfunc.C:2468
#: src/lyxfunc.C:2467
msgid "newfile"
msgstr ""
#: src/lyxfunc.C:2487 src/lyxfunc.C:2626 src/lyxfunc.C:2705
#: src/lyxfunc.C:2486 src/lyxfunc.C:2625 src/lyxfunc.C:2704
msgid ""
"Do you want to close that document now?\n"
"('No' will just switch to the open version)"
msgstr ""
#: src/lyxfunc.C:2510
#: src/lyxfunc.C:2509
msgid "Do you want to open the document?"
msgstr ""
#. loads document
#: src/lyxfunc.C:2512 src/lyxfunc.C:2575
#: src/lyxfunc.C:2511 src/lyxfunc.C:2574
msgid "Opening document"
msgstr ""
#: src/lyxfunc.C:2519 src/lyxfunc.C:2582
#: src/lyxfunc.C:2518 src/lyxfunc.C:2581
msgid "opened."
msgstr ""
#: src/lyxfunc.C:2528
#: src/lyxfunc.C:2527
msgid "Choose template"
msgstr ""
#: src/lyxfunc.C:2556 src/lyxfunc.C:2605 src/lyxfunc.C:2678 src/lyxfunc.C:2779
#: src/lyxfunc.C:2555 src/lyxfunc.C:2604 src/lyxfunc.C:2677 src/lyxfunc.C:2778
msgid "Examples"
msgstr ""
#: src/lyxfunc.C:2558
#: src/lyxfunc.C:2557
msgid "Select Document to Open"
msgstr ""
#: src/lyxfunc.C:2584
#: src/lyxfunc.C:2583
msgid "Could not open document"
msgstr ""
#: src/lyxfunc.C:2607
#: src/lyxfunc.C:2606
msgid "Select ASCII file to Import"
msgstr ""
#: src/lyxfunc.C:2645 src/lyxfunc.C:2725
#: src/lyxfunc.C:2644 src/lyxfunc.C:2724
msgid "A document by the name"
msgstr ""
#: src/lyxfunc.C:2647 src/lyxfunc.C:2727
#: src/lyxfunc.C:2646 src/lyxfunc.C:2726
msgid "already exists. Overwrite?"
msgstr ""
#: src/lyxfunc.C:2653
#: src/lyxfunc.C:2652
msgid "Importing ASCII file"
msgstr ""
#: src/lyxfunc.C:2657
#: src/lyxfunc.C:2656
msgid "ASCII file "
msgstr ""
#: src/lyxfunc.C:2659 src/lyxfunc.C:2750
#: src/lyxfunc.C:2658 src/lyxfunc.C:2749
msgid "imported."
msgstr ""
#: src/lyxfunc.C:2682
#: src/lyxfunc.C:2681
msgid "Select Noweb file to Import"
msgstr ""
#: src/lyxfunc.C:2685
#: src/lyxfunc.C:2684
msgid "Select LaTeX file to Import"
msgstr ""
#: src/lyxfunc.C:2735
#: src/lyxfunc.C:2734
msgid "Importing LaTeX file"
msgstr ""
#: src/lyxfunc.C:2740
#: src/lyxfunc.C:2739
msgid "Importing Noweb file"
msgstr ""
#: src/lyxfunc.C:2748
#: src/lyxfunc.C:2747
msgid "Noweb file "
msgstr ""
#: src/lyxfunc.C:2748
#: src/lyxfunc.C:2747
msgid "LateX file "
msgstr ""
#: src/lyxfunc.C:2753
#: src/lyxfunc.C:2752
msgid "Could not import Noweb file"
msgstr ""
#: src/lyxfunc.C:2754
#: src/lyxfunc.C:2753
msgid "Could not import LaTeX file"
msgstr ""
#: src/lyxfunc.C:2781
#: src/lyxfunc.C:2780
msgid "Select Document to Insert"
msgstr ""
#. Inserts document
#: src/lyxfunc.C:2799
#: src/lyxfunc.C:2798
msgid "Inserting document"
msgstr ""
#: src/lyxfunc.C:2805
#: src/lyxfunc.C:2804
msgid "inserted."
msgstr ""
#: src/lyxfunc.C:2807
#: src/lyxfunc.C:2806
msgid "Could not insert document"
msgstr ""
@ -4421,7 +4421,7 @@ msgstr ""
msgid "Warning: Invalid Length (valid example: 10mm)"
msgstr ""
#: src/paragraph.C:1964
#: src/paragraph.C:1927
msgid "Senseless with this layout!"
msgstr ""
@ -4638,48 +4638,48 @@ msgstr ""
msgid "Replace word|#R"
msgstr ""
#: src/support/filetools.C:178 src/support/filetools.C:187
#: src/support/filetools.C:194
#: src/support/filetools.C:177 src/support/filetools.C:186
#: src/support/filetools.C:193
msgid "LyX Internal Error!"
msgstr ""
#: src/support/filetools.C:179
#: src/support/filetools.C:178
msgid "Could not test if directory is writeable"
msgstr ""
#: src/support/filetools.C:188
#: src/support/filetools.C:187
msgid "Cannot open directory test file"
msgstr ""
#: src/support/filetools.C:195
#: src/support/filetools.C:194
msgid "Created test file but cannot remove it?"
msgstr ""
#: src/support/filetools.C:360
#: src/support/filetools.C:359
msgid "Error! Cannot open directory:"
msgstr ""
#: src/support/filetools.C:373
#: src/support/filetools.C:372
msgid "Error! Could not remove file:"
msgstr ""
#: src/support/filetools.C:387
#: src/support/filetools.C:386
msgid "Error! Couldn't create temporary directory:"
msgstr ""
#: src/support/filetools.C:403
#: src/support/filetools.C:402
msgid "Error! Couldn't delete temporary directory:"
msgstr ""
#: src/support/filetools.C:456
#: src/support/filetools.C:455
msgid "Internal error!"
msgstr ""
#: src/support/filetools.C:457
#: src/support/filetools.C:456
msgid "Call to createDirectory with invalid name"
msgstr ""
#: src/support/filetools.C:462
#: src/support/filetools.C:461
msgid "Error! Couldn't create directory:"
msgstr ""

View File

@ -39,7 +39,7 @@ Bullet::Bullet(const int f, const int c, const int s)
size = MIN;
}
generateText();
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}

View File

@ -21,9 +21,7 @@
#include "LString.h"
#ifdef DEBUG_AS_DEFAULT
#include <cassert>
#endif
#include "support/LAssert.h"
///
class Bullet {
@ -69,28 +67,28 @@ public:
protected:
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
void testInvariant() const
{
assert(font >= MIN);
assert(font < FONTMAX);
assert(character >= MIN);
assert(character < CHARMAX);
assert(size >= MIN);
assert(size < SIZEMAX);
assert(user_text >= -1);
assert(user_text <= 1);
Assert(font >= MIN);
Assert(font < FONTMAX);
Assert(character >= MIN);
Assert(character < CHARMAX);
Assert(size >= MIN);
Assert(size < SIZEMAX);
Assert(user_text >= -1);
Assert(user_text <= 1);
// now some relational/operational tests
if (user_text == 1) {
assert(font == -1 && (character == -1 && size == -1));
// assert(!text.empty()); // this isn't necessarily an error
Assert(font == -1 && (character == -1 && size == -1));
// Assert(!text.empty()); // this isn't necessarily an error
}
// else if (user_text == -1) {
// assert(!text.empty()); // this also isn't necessarily an error
// Assert(!text.empty()); // this also isn't necessarily an error
// }
// else {
// // user_text == 0
// assert(text.empty()); // not usually true
// Assert(text.empty()); // not usually true
// }
}
#endif
@ -154,7 +152,7 @@ private:
inline Bullet::Bullet(string const & t)
: font(MIN), character(MIN), size(MIN), user_text(1), text(t)
{
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
@ -173,7 +171,7 @@ inline void Bullet::setCharacter(const int c)
character = c;
}
user_text = 0;
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
@ -188,7 +186,7 @@ inline void Bullet::setFont(const int f)
font = f;
}
user_text = 0;
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
@ -203,7 +201,7 @@ inline void Bullet::setSize(const int s)
size = s;
}
user_text = 0;
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
@ -214,7 +212,7 @@ inline void Bullet::setText(string const & t)
font = character = size = MIN;
user_text = 1;
text = t;
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
@ -246,7 +244,7 @@ inline string Bullet::getText() const
inline Bullet & Bullet::operator = (const Bullet & b)
{
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
b.testInvariant();
#endif
font = b.font;
@ -254,7 +252,7 @@ inline Bullet & Bullet::operator = (const Bullet & b)
size = b.size;
user_text = b.user_text;
text = b.text;
#ifdef DEBUG_AS_DEFAULT
#ifdef ENABLE_ASSERTIONS
this->testInvariant();
#endif
return *this;

View File

@ -812,12 +812,12 @@ int LyXFont::maxDescent() const
int LyXFont::ascent(char c) const
{
XFontStruct * finfo = getXFontstruct();
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
unsigned int index = c - finfo->min_char_or_byte2;
return finfo->per_char[index].ascent;
} else
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].ascent;
else
return finfo->ascent;
}
@ -825,12 +825,12 @@ int LyXFont::ascent(char c) const
int LyXFont::descent(char c) const
{
XFontStruct * finfo = getXFontstruct();
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
unsigned int index = c - finfo->min_char_or_byte2;
return finfo->per_char[index].descent;
} else
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].descent;
else
return finfo->descent;
}
@ -849,12 +849,12 @@ int LyXFont::width(char c) const
int LyXFont::lbearing(char c) const
{
XFontStruct * finfo = getXFontstruct();
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
unsigned int index = c - finfo->min_char_or_byte2;
return finfo->per_char[index].lbearing;
} else
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing;
else
return 0;
}
@ -862,12 +862,12 @@ int LyXFont::lbearing(char c) const
int LyXFont::rbearing(char c) const
{
XFontStruct * finfo = getXFontstruct();
unsigned int uc = static_cast<unsigned char>(c);
if (finfo->per_char
&& static_cast<unsigned char>(c) >= finfo->min_char_or_byte2
&& static_cast<unsigned char>(c) <= finfo->max_char_or_byte2) {
unsigned int index = c - finfo->min_char_or_byte2;
return finfo->per_char[index].rbearing;
} else
&& uc >= finfo->min_char_or_byte2
&& uc <= finfo->max_char_or_byte2)
return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing;
else
return width(c);
}

View File

@ -52,7 +52,6 @@
#include "lyx_gui_misc.h"
#include "support/filetools.h"
#include "support/FileInfo.h"
#include "support/LAssert.h"
#include "support/syscall.h"
#include "support/lstrings.h"
#include "support/path.h"

View File

@ -17,7 +17,6 @@
#include <cstdlib>
#include <unistd.h>
#include <X11/Xlocale.h>
/* #include <assert.h> */
/* #include <malloc.h> */
#define lstat stat
#define S_ISLNK(x) false

View File

@ -25,6 +25,7 @@ using std::ios;
#include "tex-strings.h"
#include "bufferparams.h"
#include "support/FileInfo.h"
#include "support/LAssert.h"
#include "debug.h"
#include "LaTeXFeatures.h"
#include "insets/insetinclude.h"
@ -1023,16 +1024,7 @@ LyXFont::FONT_SIZE LyXParagraph::HighestFontInRange(LyXParagraph::size_type star
char LyXParagraph::GetChar(LyXParagraph::size_type pos)
{
#ifdef DEVEL_VERSION
/* a workaround to 'fix' some bugs in text-class */
if (pos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
lyxerr << "FATAL ERROR (LyXParagraph::GetChar):"
" bad position " << pos << endl;
abort();
}
#endif
Assert(pos>=0);
if (pos < size()) {
return text[pos];
@ -1080,16 +1072,7 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos)
char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
{
#ifdef DEVEL_VERSION
/* a workaround to 'fix' some bugs in text-class */
if (pos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
lyxerr << "FATAL ERROR (LyXParagraph::GetChar):"
" bad position " << pos << endl;
abort();
}
#endif
Assert(pos>=0);
if (pos < size()) {
return text[pos];
@ -1135,40 +1118,20 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
}
// return an string of the current word, and the end of the word in lastpos.
string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
//Added 98/9/21 by REH
// return an string of the current word, and the end of the word
// in lastpos.
{
Assert(lastpos>=0);
// the current word is defined as starting at the first character from
// the immediate left of lastpospos which meets the definition of IsLetter(),
// continuing to the last character to the right of this meeting
// IsLetter.
// i just left this in from GetChar()
{
#ifdef DEVEL_VERSION
/* a workaround to 'fix' some bugs in text-class */
if (lastpos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
lyxerr << "FATAL ERROR (LyXParagraph::GetWord):"
" bad position " << lastpos << endl;
abort();
}
#endif
string theword;
// grab a word
//i think the devcode aborts before this, but why not be
// versatile?
if (lastpos < 0) lastpos= 0;
// move back until we have a letter
//there's no real reason to have firstpos & lastpos as

View File

@ -4,8 +4,8 @@
//namespace LyX {
#define HAVE_TEMPLATE
#ifdef HAVE_TEMPLATE
#ifdef ENABLE_ASSERTIONS
//template<class X, class A> inline void Assert(A assertion)
template<class A> inline void Assert(A assertion)
{
@ -23,7 +23,7 @@ template<class A> inline void Assert(A * ptr)
abort();
}
}
#endif
#endif /* HAVE_PARTIAL_SPECIALIZATION */
//template<class A, class E> inline void Assert(A assertion, E except)
//{
@ -32,12 +32,13 @@ template<class A> inline void Assert(A * ptr)
#else
inline void lyx_assert(...)
{
// nothing
}
template<class A> inline void Assert(A /*assertion*/) {;}
#endif /* ENABLE_ASSERTIONS */
#endif
#endif
//} // end of namespace LyX
#endif /* LASSERT_H */

View File

@ -31,7 +31,6 @@ using std::pair;
#include "FileInfo.h"
#include "support/path.h" // I know it's OS/2 specific (SMiyata)
#include "gettext.h"
#include "LAssert.h"
#include "lyxlib.h"
// Which part of this is still necessary? (JMarc).

View File

@ -10,6 +10,8 @@
#include <cstring>
#include "LAssert.h"
//#warning verify this please. Lgb
///
template<class T>

View File

@ -300,7 +300,7 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
///////////////////////////////////////
// The lyxstring Invariant tester
///////////////////////////////////////
#ifdef DEVEL_VERSION
#ifdef ENABLE_ASSERTIONS
/** Testing of the lyxstring invariant
* By creating an object that tests the lyxstring invariant during its
@ -379,7 +379,7 @@ void lyxstringInvariant::helper() const
#define TestlyxstringInvariant(s) lyxstringInvariant lyxstring_invariant(s);
#else
#define TestlyxstringInvariant(s)
#endif //DEVEL_VERSION
#endif /* ENABLE_ASSERTIONS */
///////////////////////////////////////

View File

@ -599,7 +599,7 @@ private:
empty_reps.
*/
#ifdef DEVEL_VERSION
#ifdef ENABLE_ASSERTIONS
/// lyxstringInvariant is used to test the lyxstring Invariant
friend class lyxstringInvariant;
#endif