#include "math_iter.h"
#include "math_inset.h"
#include "symbol_def.h"
-#include "error.h"
+#include "support/lstrings.h"
+#include "debug.h"
const int SizeInset = sizeof(char*) + 2;
const int SizeFont = 2;
memcpy(&p, &array->bf[pos+1], sizeof(p));
return p;
} else {
- fprintf(stderr,"Math Error: This is not an inset[%d]\n", array->bf[pos]);
+ lyxerr << "Math Error: This is not an inset["
+ << array->bf[pos] << "]" << endl;
return 0;
}
}
return (MathParInset*)GetInset();
}
- fprintf(stderr,"Math Error: This is not an active inset\n");
+ lyxerr << "Math Error: This is not an active inset" << endl;
return 0;
}
else
if (c==LM_TC_TAB || c==LM_TC_CR) {
shift++;
-// fprintf(stderr, "Es un tab.");
+// lyxerr <<"Es un tab.";
}
else {
- fprintf(stderr, "Math Warning: expected inset.");
- fflush(stderr);
+ lyxerr << "Math Warning: expected inset." << endl;
}
}
LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
{
if (!array) {
-// fprintf(stderr, "Math error: Attempting to copy a void array.\n");
+// lyxerr << "Math error: Attempting to copy a void array." << endl;
return 0;
}
int dx = pos2 - pos1;
a = new LyxArrayBase(dx+LyxArrayBase::ARRAY_MIN_SIZE);
-// fprintf(stderr, "VA %d %d %d ", pos1, pos2, dx); fflush(stderr);
+// lyxerr << "VA " << pos2 << " " << pos2 << " " << dx << endl;
memcpy(&a->bf[(fc) ? 1: 0], &array->bf[pos1], dx);
if (fc) {
a->bf[0] = fc;
void MathedIter::Clear()
{
if (!array) {
- fprintf(stderr, "Math error: Attempting to clean a void array.\n");
+ lyxerr << "Math error: Attempting to clean a void array." << endl;
return;
}
Reset();
void MathedXIter::Clean(int pos2)
{
if (!array) {
- fprintf(stderr, "Math error: Attempting to clean a void array.\n");
+ lyxerr << "Math error: Attempting to clean a void array." << endl;
return;
}
void MathedXIter::Merge(LyxArrayBase *a0)
{
if (!a0) {
- lyxerr.debug("Math error: Attempting to merge a void array.",
- Error::MATHED);
+ lyxerr[Debug::MATHED]
+ << "Math error: Attempting to merge a void array." << endl;
+
return;
}
// All insets must be clonned
bool MathedXIter::Next()
{
-// fprintf(stderr, "Ne[%d]", pos);
+// lyxerr << "Ne[" << pos << "]";
if (!OK()) return false;
int w=0;
-// fprintf(stderr, "xt ");
+// lyxerr << "xt ";
if (IsInset()) {
MathedInset* px = GetInset();
w = px->Width();
} else {
byte c = GetChar();
if (c>=' ') {
-// fprintf(stderr, "WD[%d %d %c] ", fcode, size, c); fflush(stderr);
+// lyxerr << "WD[" << fcode << " " << size << " " << c << endl;
w = mathed_char_width(fcode, size, c);
} else
if (c==LM_TC_TAB && p) {
// w = p->GetTab(col+1);
w = (crow) ? crow->getTab(col+1): 0;
- //fprintf(stderr, "WW[%d]", w);
+ //lyxerr << "WW[" << w << "]";
} else
if (c==LM_TC_CR && p) {
x = 0;
y = crow->getBaseline();
w = crow->getTab(0);
}
-// fprintf(stderr, "WW[%d %d|%d]", col, row, w);
+// lyxerr << "WW[" << col " " << row << "|" << w << "]";
} else
- fprintf(stderr, "No hubo w[%d]!", (int)c);
+ lyxerr << "No hubo w[" << c << "]!";
}
if (MathedIter::Next()) {
-// fprintf(stderr, "LNX %d ", pos); fflush(stderr);
+// lyxerr <<"LNX " << pos << endl;
// if (sw>0 && GetChar()!=LM_TC_UP && GetChar()!=LM_TC_DOWN) {
// w = (sx>sw) ? 0: sw-sx;
if ((sw>0 || sx>0) && GetChar()!=LM_TC_UP && GetChar()!=LM_TC_DOWN) {
void MathedXIter::addRow()
{
if (!crow) {
- lyxerr.debug(LString("MathErr: Attempt to insert new"
- " line in a subparagraph. ")
- + long(this), Error::MATHED);
+ lyxerr[Debug::MATHED] << "MathErr: Attempt to insert new"
+ " line in a subparagraph. " << this << endl;
+
return;
}
// Create new item for the structure
void MathedXIter::delRow()
{
if (!crow) {
- lyxerr.debug("MathErr: Attempt to delete a line in a subparagraph.",
- Error::MATHED);
+ lyxerr[Debug::MATHED] << "MathErr: Attempt to delete a line in a subparagraph." << endl;
return;
}
bool line_empty = true;
crow->w[tab] = tx;
}
else
- fprintf(stderr, "MathErr: No tabs allowed here");
+ lyxerr << "MathErr: No tabs allowed here" << endl;
}
void MathedXIter::subMetrics(int a, int d)
{
if (!crow) {
-// fprintf(stderr, "MathErr: Attempt to submetric a subparagraph.");
+// lyxerr << "MathErr: Attempt to submetric a subparagraph." << endl;
return;
}
crow->asc = a;
limits = false;
}
else {
- lyxerr.debug(LString("Mathed Sel-Error: Unrecognized code[")
- + int(cx) + ']', Error::MATHED);
+ lyxerr[Debug::MATHED]
+ << "Mathed Sel-Error: Unrecognized code["
+ << cx << ']' << endl;
break;
}
if (pos<pos2) Next();
{
GoBegin();
if (!crow) {
-// fprintf(stderr, " CRW%d ", ncols);
+// lyxerr << " CRW" << ncols << " ";
crow = new MathedRowSt(ncols+1); // this leaks
}
-// fprintf(stderr, " CRW[%p] ", crow);
+// lyxerr<< " CRW[" << crow << "] ";
MathedRowSt *row = crow;
while (OK()) {
if (IsCR()) {
// r->next = crow->next;
crow->next = r;
crow = r;
-// fprintf(stderr, " CX[%p]", crow);
+// lyxerr << " CX[" << crow << "]";
}
Next();
}