]> git.lyx.org Git - lyx.git/commitdiff
some changes to make some compilers somewhat happier
authorAndré Pönitz <poenitz@gmx.net>
Tue, 8 Jan 2002 11:03:34 +0000 (11:03 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 8 Jan 2002 11:03:34 +0000 (11:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3310 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/mathed/formula.C
src/mathed/math_cursor.C
src/mathed/math_data.h
src/mathed/math_factory.C
src/mathed/math_hash.C
src/mathed/math_inset.h
src/mathed/math_iterator.C
src/mathed/math_iterator.h
src/mathed/math_parser.h
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h
src/mathed/math_xdata.C

index 37fb7351b3a42c72b86736aa3cb6010deaffdb06..40fbf3d7ad5831b6ab80db9d23bd9fc857118a63 100644 (file)
@@ -503,7 +503,6 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
 
 bool needEqnArray(string const & extra)
 {
-       return false;
        return extra == "dsolve";
 }
 
index 34ecf9af922d240337db9299982856d00fc2d14e..3a2f30501302b9117cf6159ce1e85cbae3269e38 100644 (file)
@@ -619,7 +619,7 @@ void MathCursor::macroModeClose()
 
 int MathCursor::macroNamePos() const
 {
-       for (int i = pos() - 1; i >= 0; --i) { 
+       for (MathInset::difference_type i = pos() - 1; i >= 0; --i) { 
                MathAtom & p = array().at(i);
                if (p->code() == LM_TC_TEX && p->getChar() == '\\')
                        return i;
@@ -631,7 +631,8 @@ int MathCursor::macroNamePos() const
 string MathCursor::macroName() const
 {
        string s;
-       for (int i = macroNamePos(); i >= 0 && i < int(pos()); ++i) 
+       MathInset::difference_type i = macroNamePos(); 
+       for ( ; i >= 0 && i < int(pos()); ++i) 
                s += array().at(i)->getChar();
        return s;
 }
index 373396bbdb8bbb74d398bf3a6e9409c9450fb87f..2e029e2aa195ca0e8a44a74c902e911f35ffa9d3 100644 (file)
@@ -51,6 +51,8 @@ public:
        ///
        typedef buffer_type::size_type       size_type;
        ///
+       typedef buffer_type::difference_type difference_type;
+       ///
        typedef buffer_type::size_type       idx_type;
        ///
        typedef buffer_type::size_type       pos_type;
index 7e09a0abcc706c00edcba25c56d244666e23a956..1c49eb935b1fc1c7c36dbb95bae71219d8110789 100644 (file)
@@ -30,7 +30,7 @@ MathAtom createMathInset(latexkeys const * l)
        case LM_TK_FUNCLIM:
                return MathAtom(new MathFuncLimInset(l->name));
        case LM_TK_SPECIAL:
-               return MathAtom(new MathSpecialCharInset(l->id));
+               return MathAtom(new MathSpecialCharInset(static_cast<char>(l->id)));
        case LM_TK_SYM:
        case LM_TK_CMR:
        case LM_TK_CMSY:
index 59777ecb61d3ecb23e7bd1e25974e0a07d706220..46927b920b0e46672d20a9c88642f335a59b45ae 100644 (file)
@@ -11,6 +11,7 @@
 
 namespace {
 
+// global
 std::map<string, latexkeys> theWordList;
 
 
@@ -18,11 +19,12 @@ struct key_type {
        ///
        char const * name;
        ///
-       short token;
+       MathTokenEnum token;
        ///
        unsigned int id;
 };
 
+
 key_type wordlist_array[] = 
 {
        {"!",  LM_TK_SPACE, 0},
index 5b8d6de1da09769f6b1a0172d68af1f0c5809f43..8f607e319f984c971ab7d0445ee10530b85f5d35 100644 (file)
@@ -78,15 +78,17 @@ class MathPosFinder;
 class MathInset {
 public: 
        /// short of anything else reasonable
-       typedef MathArray::size_type     size_type;
+       typedef MathArray::size_type        size_type;
+       /// type for cursor positions differences within a cell
+       typedef MathArray::difference_type  difference_type;
        /// type for cursor positions within a cell
-       typedef MathArray::size_type     pos_type;
+       typedef MathArray::size_type        pos_type;
        /// type for cell indices
-       typedef size_type                idx_type;
+       typedef size_type                   idx_type;
        /// type for row numbers
-       typedef size_type                row_type;
+       typedef size_type                   row_type;
        /// type for column numbers
-       typedef size_type                col_type;
+       typedef size_type                   col_type;
 
        /// our members behave nicely...
        MathInset() {}
index 0ba7588063a374e79f995405c0ab3bf9871f2f81..3d6406c799c2faa4f9b33aafff4db283ff77a6e4 100644 (file)
@@ -138,10 +138,10 @@ void MathIterator::operator++()
 }
 
 
-void MathIterator::jump(int i)
+void MathIterator::jump(MathInset::difference_type i)
 {
        position().pos_ += i;
-       lyx::Assert(position().pos_ >= 0);
+       //lyx::Assert(position().pos_ >= 0);
        lyx::Assert(position().pos_ <= cell().size());
 }
 
index 03bd047870cb80e4a9884a530516dcd55cd7873d..7b484b030b41be4c37166a333024513a6c3c0510 100644 (file)
@@ -21,7 +21,7 @@ public:
        /// move on one step
        void operator++();
        /// move on several steps
-       void jump(int n);
+       void jump(MathInset::difference_type);
        /// read access to top most item
        MathCursorPos const & position() const;
        /// write access to top most item
index 8984fa37633264e09523d3caad6b2071dc3f80c8..c3f64eea5e54b562a07dd35936cd40fb0dd9a58e 100644 (file)
@@ -26,8 +26,6 @@
 #include "LString.h"
 #include "math_defs.h"
 
-class MathHullInset;
-class MathMacroTemplate;
 class MathAtom;
 class MathArray;
 class LyXLex;
@@ -36,7 +34,7 @@ class LyXLex;
 enum MathTokenEnum
 {
        ///
-       LM_TK_SYM = 256,
+       LM_TK_SYM,
        ///
        LM_TK_BOX,
        ///
@@ -118,36 +116,41 @@ enum MathTokenEnum
 
 ///
 struct latexkeys {
-       ///
+       /// name of the macro or primitive
        string name;
-       ///
-       short token;
-       ///
+       /// one of the categories above
+       MathTokenEnum token;
+       /// an id within a category if needed (only for spaces?)
        unsigned int id;
-       ///
-       unsigned char latex_font_id;
-       ///
+       /// which font to use (optional)
+       unsigned int latex_font_id;
+       /// operator/...
        string type;
-       ///
+       /// how is this called as XML entity?
        string xmlname;
 };
 
 
-///
+/// check whether this is a well-known (La)TeX macro or primitive
 latexkeys const * in_word_set(string const & str);
 
-///
-void ReadSymbols(string const & file);
-
+/// parse formula from a string
 bool mathed_parse_normal(MathAtom &, string const &);
+/// ... a stream
 bool mathed_parse_normal(MathAtom &, std::istream &);
+/// ... the LyX lexxer
 bool mathed_parse_normal(MathAtom &, LyXLex &);
 
+/// parse a macro definition from a string, enter it into the macro table
 string mathed_parse_macro(string const &);
+/// ... a stream
 string mathed_parse_macro(std::istream &);
+/// ... the LyX lexxer
 string mathed_parse_macro(LyXLex &);
 
-void mathed_parse_cell(MathArray & ar, string const & str);
-void mathed_parse_cell(MathArray & ar, std::istream & is);
+/// parse a single cell from a string
+void mathed_parse_cell(MathArray & ar, string const &);
+/// ... a stream
+void mathed_parse_cell(MathArray & ar, std::istream &);
 
 #endif
index b752716f3ada9806ced79562655fe32ce5623ada..5c5aa5c7e3c79acc4379e31763da7e77b5df7bcb 100644 (file)
@@ -106,37 +106,37 @@ int MathScriptInset::dy1(MathInset const * nuc) const
 int MathScriptInset::dx0(MathInset const * nuc) const
 {
        lyx::Assert(hasDown());
-       return hasLimits(nuc) ? (width(nuc) - down().width()) / 2 : nwid(nuc);
+       return hasLimits(nuc) ? (width2(nuc) - down().width()) / 2 : nwid(nuc);
 }
 
 
 int MathScriptInset::dx1(MathInset const * nuc) const
 {
        lyx::Assert(hasUp());
-       return hasLimits(nuc) ? (width(nuc) - up().width()) / 2 : nwid(nuc);
+       return hasLimits(nuc) ? (width2(nuc) - up().width()) / 2 : nwid(nuc);
 }
 
 
 int MathScriptInset::dxx(MathInset const * nuc) const
 {
        //lyx::Assert(nuc());
-       return hasLimits(nuc)  ?  (width(nuc) - nwid(nuc)) / 2  :  0;
+       return hasLimits(nuc)  ?  (width2(nuc) - nwid(nuc)) / 2  :  0;
 }
 
 
-int MathScriptInset::ascent(MathInset const * nuc) const
+int MathScriptInset::ascent2(MathInset const * nuc) const
 {
        return dy1(nuc) + (hasUp() ? up().ascent() : 0);
 }
 
 
-int MathScriptInset::descent(MathInset const * nuc) const
+int MathScriptInset::descent2(MathInset const * nuc) const
 {
        return dy0(nuc) + (hasDown() ? down().descent() : 0);
 }
 
 
-int MathScriptInset::width(MathInset const * nuc) const
+int MathScriptInset::width2(MathInset const * nuc) const
 {
        int wid = 0;
        if (hasLimits(nuc)) {
@@ -190,10 +190,9 @@ void MathScriptInset::metrics(MathInset const * nuc,
        MathNestInset::metrics(mi);
        if (nuc)
                nuc->metrics(mi);
-
-       ascent_  = ascent(nuc);
-       descent_ = descent(nuc);
-       width_   = width(nuc);
+       ascent_  = ascent2(nuc);
+       descent_ = descent2(nuc);
+       width_   = width2(nuc);
 }
 
 
index 608ce1fda5cc4f2978163b3e9b2aa837f3a0d450..b6626f2806488700e283f27fad285fd0a304bc8b 100644 (file)
@@ -34,11 +34,11 @@ public:
        ///
        void draw(MathInset const * nuc, Painter &, int x, int y) const;
        ///
-       int ascent(MathInset const * nuc) const;
+       int ascent2(MathInset const * nuc) const;
        ///
-       int descent(MathInset const * nuc) const;
+       int descent2(MathInset const * nuc) const;
        ///
-       int width(MathInset const * nuc) const;
+       int width2(MathInset const * nuc) const;
 
        ///
        bool idxLeft(idx_type &, pos_type &) const;
index 28f5d5c32e40c15a38ba710d1ff1bf29240cf669..998c3e013052aa97ae2dad5aab42e862680d0860 100644 (file)
@@ -36,9 +36,9 @@ void MathXArray::metrics(MathMetricsInfo const & mi) const
                MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
                if (q) {
                        q->metrics(p, mi);
-                       ascent_  = std::max(ascent_,  q->ascent(p));
-                       descent_ = std::max(descent_, q->descent(p));
-                       width_  += q->width(p); 
+                       ascent_  = std::max(ascent_,  q->ascent2(p));
+                       descent_ = std::max(descent_, q->descent2(p));
+                       width_  += q->width2(p);        
                        ++it;
                } else {
                        p->metrics(mi);
@@ -67,7 +67,7 @@ void MathXArray::draw(Painter & pain, int x, int y) const
                MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
                if (q) {
                        q->draw(p, pain, x, y);
-                       x += q->width(p);
+                       x += q->width2(p);
                        ++it;
                } else {
                        p->draw(pain, x, y);
@@ -87,7 +87,7 @@ int MathXArray::pos2x(size_type targetpos) const
                if (q) {
                        ++it;
                        if (it < target)
-                               x += q->width(p);
+                               x += q->width2(p);
                        else  // "half" position
                                x += q->dxx(p) + q->nwid(p);
                } else
@@ -111,7 +111,7 @@ MathArray::size_type MathXArray::x2pos(int targetx) const
                if (it + 1 != end())
                        q = asScript(it);
                if (q) {
-                       wid = q->width(p);
+                       wid = q->width2(p);
                        ++it;
                } else
                        wid = p->width();