lyx_mirror/src/mathed/InsetMathDiff.cpp

121 lines
1.9 KiB
C++
Raw Normal View History

/**
* \file InsetMathDiff.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Andr<EFBFBD> P<EFBFBD>nitz
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetMathDiff.h"
#include "MathData.h"
#include "MathStream.h"
#include "debug.h"
namespace lyx {
using std::auto_ptr;
using std::endl;
InsetMathDiff::InsetMathDiff()
: InsetMathNest(1)
{}
auto_ptr<Inset> InsetMathDiff::doClone() const
{
return auto_ptr<Inset>(new InsetMathDiff(*this));
}
void InsetMathDiff::addDer(MathData const & der)
{
cells_.push_back(der);
}
void InsetMathDiff::normalize(NormalStream & os) const
{
os << "[diff";
for (idx_type idx = 0; idx < nargs(); ++idx)
os << ' ' << cell(idx);
os << ']';
}
bool InsetMathDiff::metrics(MetricsInfo &, Dimension &) const
{
lyxerr << "should not happen" << endl;
return true;
}
void InsetMathDiff::draw(PainterInfo &, int, int) const
{
lyxerr << "should not happen" << endl;
}
void InsetMathDiff::maple(MapleStream & os) const
{
os << "diff(";
for (idx_type idx = 0; idx < nargs(); ++idx) {
if (idx != 0)
os << ',';
os << cell(idx);
}
os << ')';
}
void InsetMathDiff::maxima(MaximaStream & os) const
Improve Computer Algebra System, from Enrico Forestieri <forenr@tlc.unipr.it> * src/mathed/math_symbolinset.C (void MathSymbolInset::maxima): - newer maxima versions use inf instead of INF - add support for greek pi (void MathSymbolInset::mathematica): - add support for \cdot * src/mathed/math_stringinset.h - account for the const version of asStringInset() * src/mathed/math_extern.C (bool extractScript): - added bool superscript to formal parameters in order to only extract superscripts (MathArray::iterator extractArgument): - leave out delimiters and a possible superscript for function arguments (bool isKnownFunction): (bool extractFunctionName): - recognize standard and user defined function names (void splitScripts): - correctly split scripts as expected by other functions (MathAtom replaceDelims): - ranamed as replaceParenDelims (bool testOpenBracket): (bool testCloseBracket): - test for "[" and "]", respectively (MathAtom replaceBracketDelims): - replace something delimited by "[" and "]" with a proper DelimInset (void extractDelims): - create a DelimInset for "[" and "]" delimiters, too (void extractFunctions): - improved recognition of function names (bool testTermDelimiter): - test for '+' or '-' as term delimiters (MathArray::iterator extractTerm): - extract a "term", i.e., something delimited by '+' or '-' (bool testDiffItem): - improved recognition of a "differential fraction" (void extractDiff): - call splitScripts() on numerator and denominator of a differential fraction before analyzing them (void extractLims): - improved recognition of a limit function (void extractStructure): - reorganized order of searches (MathArray pipeThroughMaxima): - newer versions of maxima use simpsum instead of SIMPSUM (string fromMathematicaName): - translates from mathematica names (MathArray pipeThroughMathematica): - calls mathematica and collects its output (MathArray pipeThroughExtern): - add support for mathematica * src/mathed/math_numberinset.C * src/mathed/math_numberinset.h (void MathNumberInset::mathematica): - add support for mathematica * src/mathed/math_matrixinset.C * src/mathed/math_matrixinset.h (void MathMatrixInset::mathematica): - add support for mathematica * src/mathed/math_diffinset.C * src/mathed/math_diffinset.h (void MathDiffInset::maxima): - add support for maxima (void MathDiffInset::mathematica): - mathematica uses "D" and not "Dt" for normal derivatives * src/mathed/math_liminset.C * src/mathed/math_liminset.h (void MathLimInset::maxima): - add support for maxima (void MathLimInset::mathematica): - mathematica uses "Limit" and not "Lim" for limits * src/mathed/math_exfuncinset.C (string asMathematicaName): - added some more function names git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14865 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-02 01:57:36 +00:00
{
os << "diff(";
for (idx_type idx = 0; idx < nargs(); ++idx) {
if (idx != 0)
os << ',';
os << cell(idx);
if (idx != 0)
os << ",1";
}
os << ')';
}
void InsetMathDiff::mathematica(MathematicaStream & os) const
{
Improve Computer Algebra System, from Enrico Forestieri <forenr@tlc.unipr.it> * src/mathed/math_symbolinset.C (void MathSymbolInset::maxima): - newer maxima versions use inf instead of INF - add support for greek pi (void MathSymbolInset::mathematica): - add support for \cdot * src/mathed/math_stringinset.h - account for the const version of asStringInset() * src/mathed/math_extern.C (bool extractScript): - added bool superscript to formal parameters in order to only extract superscripts (MathArray::iterator extractArgument): - leave out delimiters and a possible superscript for function arguments (bool isKnownFunction): (bool extractFunctionName): - recognize standard and user defined function names (void splitScripts): - correctly split scripts as expected by other functions (MathAtom replaceDelims): - ranamed as replaceParenDelims (bool testOpenBracket): (bool testCloseBracket): - test for "[" and "]", respectively (MathAtom replaceBracketDelims): - replace something delimited by "[" and "]" with a proper DelimInset (void extractDelims): - create a DelimInset for "[" and "]" delimiters, too (void extractFunctions): - improved recognition of function names (bool testTermDelimiter): - test for '+' or '-' as term delimiters (MathArray::iterator extractTerm): - extract a "term", i.e., something delimited by '+' or '-' (bool testDiffItem): - improved recognition of a "differential fraction" (void extractDiff): - call splitScripts() on numerator and denominator of a differential fraction before analyzing them (void extractLims): - improved recognition of a limit function (void extractStructure): - reorganized order of searches (MathArray pipeThroughMaxima): - newer versions of maxima use simpsum instead of SIMPSUM (string fromMathematicaName): - translates from mathematica names (MathArray pipeThroughMathematica): - calls mathematica and collects its output (MathArray pipeThroughExtern): - add support for mathematica * src/mathed/math_numberinset.C * src/mathed/math_numberinset.h (void MathNumberInset::mathematica): - add support for mathematica * src/mathed/math_matrixinset.C * src/mathed/math_matrixinset.h (void MathMatrixInset::mathematica): - add support for mathematica * src/mathed/math_diffinset.C * src/mathed/math_diffinset.h (void MathDiffInset::maxima): - add support for maxima (void MathDiffInset::mathematica): - mathematica uses "D" and not "Dt" for normal derivatives * src/mathed/math_liminset.C * src/mathed/math_liminset.h (void MathLimInset::maxima): - add support for maxima (void MathLimInset::mathematica): - mathematica uses "Limit" and not "Lim" for limits * src/mathed/math_exfuncinset.C (string asMathematicaName): - added some more function names git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14865 a592a061-630c-0410-9148-cb99ea01b6c8
2006-09-02 01:57:36 +00:00
os << "D[";
for (idx_type idx = 0; idx < nargs(); ++idx) {
if (idx != 0)
os << ',';
os << cell(idx);
}
os << ']';
}
void InsetMathDiff::mathmlize(MathStream & os) const
{
os << "diff(";
for (idx_type idx = 0; idx < nargs(); ++idx) {
if (idx != 0)
os << ',';
os << cell(idx);
}
os << ')';
}
void InsetMathDiff::write(WriteStream &) const
{
lyxerr << "should not happen" << endl;
}
} // namespace lyx