]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_mathmlstream.C
split inset -> inset + updatableinset
[lyx.git] / src / mathed / math_mathmlstream.C
index a1f73f0e3f15e37480b45b9bf5e5192b799a128b..8a226ac17f1f550153e4ac44a84e41facebe4353 100644 (file)
@@ -1,3 +1,4 @@
+
 #include <config.h>
 
 #include "math_mathmlstream.h"
 using std::ostream;
 using std::strlen;
 
+namespace {
+
+       bool isAlpha(char c)
+       {
+               return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
+       }
+
+}
 
 WriteStream::WriteStream(ostream & os, bool fragile, bool latex)
        : os_(os), fragile_(fragile), firstitem_(false), latex_(latex),
@@ -39,8 +48,6 @@ void WriteStream::addlines(unsigned int n)
 
 void WriteStream::pendingSpace(bool how)
 {
-       if (how)
-               os_ << ' ';
        pendingspace_ = how;
 }
 
@@ -61,9 +68,9 @@ WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
 
 WriteStream & operator<<(WriteStream & ws, char const * s)
 {
-       if (ws.pendingSpace()) {
-               lyxerr << "writing a space in a string\n";
-               ws.os() << ' ';
+       if (ws.pendingSpace() && strlen(s) > 0) {
+               if (isAlpha(s[0]))
+                       ws.os() << ' ';
                ws.pendingSpace(false);
        }
        ws.os() << s;
@@ -75,12 +82,8 @@ WriteStream & operator<<(WriteStream & ws, char const * s)
 WriteStream & operator<<(WriteStream & ws, char c)
 {
        if (ws.pendingSpace()) {
-               //if (isalpha(c))
-               //      ws.os() << ' ';
-               if (!isalpha(c)) {
-                       lyxerr << "I'd like to suppress writing a space\n";
-               }
-               ws.os() << ' ';
+               if (isAlpha(c))
+                       ws.os() << ' ';
                ws.pendingSpace(false);
        }
        ws.os() << c;
@@ -167,20 +170,19 @@ void MathMLStream::cr()
 }
 
 
-
 //////////////////////////////////////////////////////////////////////
 
 
 MapleStream & operator<<(MapleStream & ms, MathAtom const & at)
 {
-       at->maplize(ms);
+       at->maple(ms);
        return ms;
 }
 
 
 MapleStream & operator<<(MapleStream & ms, MathArray const & ar)
 {
-       maplize(ar, ms);
+       maple(ar, ms);
        return ms;
 }
 
@@ -209,16 +211,54 @@ MapleStream & operator<<(MapleStream & ms, int i)
 //////////////////////////////////////////////////////////////////////
 
 
+MaximaStream & operator<<(MaximaStream & ms, MathAtom const & at)
+{
+       at->maxima(ms);
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, MathArray const & ar)
+{
+       maxima(ar, ms);
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, char const * s)
+{
+       ms.os() << s;
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, char c)
+{
+       ms.os() << c;
+       return ms;
+}
+
+
+MaximaStream & operator<<(MaximaStream & ms, int i)
+{
+       ms.os() << i;
+       return ms;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
 MathematicaStream & operator<<(MathematicaStream & ms, MathAtom const & at)
 {
-       at->mathematicize(ms);
+       at->mathematica(ms);
        return ms;
 }
 
 
 MathematicaStream & operator<<(MathematicaStream & ms, MathArray const & ar)
 {
-       mathematicize(ar, ms);
+       mathematica(ar, ms);
        return ms;
 }
 
@@ -250,14 +290,14 @@ MathematicaStream & operator<<(MathematicaStream & ms, int i)
 
 OctaveStream & operator<<(OctaveStream & ns, MathAtom const & at)
 {
-       at->octavize(ns);
+       at->octave(ns);
        return ns;
 }
 
 
 OctaveStream & operator<<(OctaveStream & ns, MathArray const & ar)
 {
-       octavize(ar, ns);
+       octave(ar, ns);
        return ns;
 }
 
@@ -323,4 +363,3 @@ NormalStream & operator<<(NormalStream & ns, int i)
 
 
 //////////////////////////////////////////////////////////////////////
-