+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,
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').
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
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;
],[
dnl Adds a --with-'dir-name' option (described by 'desc') and puts the
dnl resulting directory name in 'dir-var-name'.
AC_DEFUN(LYX_WITH_DIR,[
- AC_ARG_WITH($1,[ --with-$1 specify $2])
+ AC_ARG_WITH($1,[ --with-$1 specify $2])
AC_MSG_CHECKING([for $2])
if test -z "$with_$3"; then
AC_CACHE_VAL(lyx_cv_$3, lyx_cv_$3=$4)
# some functions we'd like to have
AC_ARG_WITH(broken-headers,
- [ --with-broken-headers define some functions on SunOS4 and SCO],
+ [ --with-broken-headers define some functions on SunOS4 and SCO],
[lyx_broken_headers=$withval])
if test "x$lyx_broken_headers" = "xyes"; then
lyx_flags="$lyx_flags broken-headers"
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)
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"
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 ""
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 ""
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 ""
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 ""
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 ""
msgstr ""
#. /
-#: src/insets/insettoc.h:35 src/lyxfunc.C:784
+#: src/insets/insettoc.h:35 src/lyxfunc.C:783
msgid "Table of Contents"
msgstr ""
msgid "Save As"
msgstr ""
-#: src/LyXAction.C:149 src/lyxfunc.C:638
+#: src/LyXAction.C:149 src/lyxfunc.C:637
msgid "Cancel"
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 ""
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 ""
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 ""
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 ""
msgid "Warning: Invalid Length (valid example: 10mm)"
msgstr ""
-#: src/paragraph.C:1964
+#: src/paragraph.C:1927
msgid "Senseless with this layout!"
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 ""
size = MIN;
}
generateText();
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
#include "LString.h"
-#ifdef DEBUG_AS_DEFAULT
-#include <cassert>
-#endif
+#include "support/LAssert.h"
///
class Bullet {
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
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
}
character = c;
}
user_text = 0;
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
font = f;
}
user_text = 0;
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
size = s;
}
user_text = 0;
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
font = character = size = MIN;
user_text = 1;
text = t;
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
testInvariant();
#endif
}
inline Bullet & Bullet::operator = (const Bullet & b)
{
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
b.testInvariant();
#endif
font = b.font;
size = b.size;
user_text = b.user_text;
text = b.text;
-#ifdef DEBUG_AS_DEFAULT
+#ifdef ENABLE_ASSERTIONS
this->testInvariant();
#endif
return *this;
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;
}
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;
}
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;
}
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);
}
#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"
#include <cstdlib>
#include <unistd.h>
#include <X11/Xlocale.h>
-/* #include <assert.h> */
/* #include <malloc.h> */
#define lstat stat
#define S_ISLNK(x) false
#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"
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];
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];
}
+// 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
//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)
{
abort();
}
}
-#endif
+#endif /* HAVE_PARTIAL_SPECIALIZATION */
//template<class A, class E> inline void Assert(A assertion, E except)
//{
#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 */
+
#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).
#include <cstring>
+#include "LAssert.h"
+
//#warning verify this please. Lgb
///
template<class T>
///////////////////////////////////////
// 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
#define TestlyxstringInvariant(s) lyxstringInvariant lyxstring_invariant(s);
#else
#define TestlyxstringInvariant(s)
-#endif //DEVEL_VERSION
+#endif /* ENABLE_ASSERTIONS */
///////////////////////////////////////
empty_reps.
*/
-#ifdef DEVEL_VERSION
+#ifdef ENABLE_ASSERTIONS
/// lyxstringInvariant is used to test the lyxstring Invariant
friend class lyxstringInvariant;
#endif