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> 1999-12-16 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/kbmap.C: commented out the use of the hash map in kb_map, * 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 In particular, the following options could be useful in some
desperate cases: 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 o --with-warnings that make the compiler output more warnings during
the compilation of LyX. Opposite is --without-warnings. By default, the compilation of LyX. Opposite is --without-warnings. By default,
this flag is on for development versions only. 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 o --with-broken-headers that provides prototypes to replace functions
not correctly defined in SunOS4 and SCO header files. Its only effect is not correctly defined in SunOS4 and SCO header files. Its only effect is
to suppress a few warnings. It is autodetected by default. to suppress a few warnings. It is autodetected by default.
o --without-latex-config that disables the automatic detection of your o --without-latex-config that disables the automatic detection of your
latex. This detection is automatically disabled if latex cannot be found. latex configuration. This detection is automatically disabled if
If you find that you have to use this flag, please report it as a bug. 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 o --without-liberty suppresses the detection of the -liberty library
(see the section 'Problems'). (see the section 'Problems').

View File

@ -146,7 +146,7 @@ AC_PROG_CXX_GNU
dnl We might want to get or shut warnings. dnl We might want to get or shut warnings.
AC_ARG_WITH(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 [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then
with_warnings=yes; with_warnings=yes;
else else
@ -309,12 +309,10 @@ dnl and could need some improvement.
AC_DEFUN(LYX_CXX_STL_STRING,[ AC_DEFUN(LYX_CXX_STL_STRING,[
AC_REQUIRE([LYX_PROG_CXX]) AC_REQUIRE([LYX_PROG_CXX])
AC_MSG_CHECKING(whether the included std::string should be used) AC_MSG_CHECKING(whether the included std::string should be used)
AC_ARG_WITH(included-string,[ AC_ARG_WITH(included-string,
--with-included-string use LyX string class instead of STL string [ --with-included-string use LyX string class instead of STL string],
],[ [with_included_string=$withval],
with_included_string=$withval [AC_TRY_COMPILE([
],[
AC_TRY_COMPILE([
#include <string> #include <string>
using std::string; using std::string;
],[ ],[
@ -583,7 +581,7 @@ dnl [default-yes-value])
dnl Adds a --with-'dir-name' option (described by 'desc') and puts the dnl Adds a --with-'dir-name' option (described by 'desc') and puts the
dnl resulting directory name in 'dir-var-name'. dnl resulting directory name in 'dir-var-name'.
AC_DEFUN(LYX_WITH_DIR,[ 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]) AC_MSG_CHECKING([for $2])
if test -z "$with_$3"; then if test -z "$with_$3"; then
AC_CACHE_VAL(lyx_cv_$3, lyx_cv_$3=$4) AC_CACHE_VAL(lyx_cv_$3, lyx_cv_$3=$4)

View File

@ -174,7 +174,7 @@ AC_TYPE_UID_T
# some functions we'd like to have # some functions we'd like to have
AC_ARG_WITH(broken-headers, 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]) [lyx_broken_headers=$withval])
if test "x$lyx_broken_headers" = "xyes"; then if test "x$lyx_broken_headers" = "xyes"; then
lyx_flags="$lyx_flags broken-headers" lyx_flags="$lyx_flags broken-headers"
@ -193,10 +193,18 @@ AC_REPLACE_FUNCS(strerror atexit)
AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps], AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps],
[AC_DEFINE(TWO_COLOR_ICONS) [AC_DEFINE(TWO_COLOR_ICONS)
lyx_flags="$lyx_flags two-colors"]) lyx_flags="$lyx_flags two-colors"])
AC_ARG_WITH(debug,[ --with-debug output debug information by default], AC_ARG_ENABLE(assertions,
[AC_DEFINE(DEBUG_AS_DEFAULT,1, [ --enable-assertions add runtime sanity checks in the program],,
[Define if you want debugging turned on as default.]) [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
lyx_flags="$lyx_flags debug"]) 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. ### Finish the work.
AC_CONFIG_SUBDIRS(lib lib/reLyX) AC_CONFIG_SUBDIRS(lib lib/reLyX)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,6 +25,7 @@ using std::ios;
#include "tex-strings.h" #include "tex-strings.h"
#include "bufferparams.h" #include "bufferparams.h"
#include "support/FileInfo.h" #include "support/FileInfo.h"
#include "support/LAssert.h"
#include "debug.h" #include "debug.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "insets/insetinclude.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) char LyXParagraph::GetChar(LyXParagraph::size_type pos)
{ {
#ifdef DEVEL_VERSION Assert(pos>=0);
/* 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
if (pos < size()) { if (pos < size()) {
return text[pos]; return text[pos];
@ -1080,16 +1072,7 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos)
char LyXParagraph::GetChar(LyXParagraph::size_type pos) const char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
{ {
#ifdef DEVEL_VERSION Assert(pos>=0);
/* 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
if (pos < size()) { if (pos < size()) {
return text[pos]; 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 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 Assert(lastpos>=0);
// in lastpos.
// the current word is defined as starting at the first character from // the current word is defined as starting at the first character from
// the immediate left of lastpospos which meets the definition of IsLetter(), // the immediate left of lastpospos which meets the definition of IsLetter(),
// continuing to the last character to the right of this meeting // continuing to the last character to the right of this meeting
// IsLetter. // 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; string theword;
// grab a word // 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 // move back until we have a letter
//there's no real reason to have firstpos & lastpos as //there's no real reason to have firstpos & lastpos as

View File

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

View File

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

View File

@ -10,6 +10,8 @@
#include <cstring> #include <cstring>
#include "LAssert.h"
//#warning verify this please. Lgb //#warning verify this please. Lgb
/// ///
template<class T> 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 // The lyxstring Invariant tester
/////////////////////////////////////// ///////////////////////////////////////
#ifdef DEVEL_VERSION #ifdef ENABLE_ASSERTIONS
/** Testing of the lyxstring invariant /** Testing of the lyxstring invariant
* By creating an object that tests the lyxstring invariant during its * 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); #define TestlyxstringInvariant(s) lyxstringInvariant lyxstring_invariant(s);
#else #else
#define TestlyxstringInvariant(s) #define TestlyxstringInvariant(s)
#endif //DEVEL_VERSION #endif /* ENABLE_ASSERTIONS */
/////////////////////////////////////// ///////////////////////////////////////

View File

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