make Kayvan's compiler happy

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6827 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-04-17 06:22:07 +00:00
parent 4864347591
commit 31ccf710a5
2 changed files with 30 additions and 57 deletions

View File

@ -491,7 +491,7 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
<< " content: " << lines[row] << "\n"; << " content: " << lines[row] << "\n";
dummy.resize(3); dummy.resize(3);
} }
lines.at(row) = dummy.at(1); lines[row] = dummy[1];
//cerr << "line: " << row << " above 0: " << dummy[0] << "\n"; //cerr << "line: " << row << " above 0: " << dummy[0] << "\n";
//cerr << "line: " << row << " below 2: " << dummy[2] << "\n"; //cerr << "line: " << row << " below 2: " << dummy[2] << "\n";
@ -499,19 +499,19 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
for (int i = 0; i <= 2; i += 2) { for (int i = 0; i <= 2; i += 2) {
//cerr << " reading from line string '" << dummy[i] << "'\n"; //cerr << " reading from line string '" << dummy[i] << "'\n";
Parser p1(dummy.at(i)); Parser p1(dummy[i]);
while (p1.good()) { while (p1.good()) {
Token t = p1.getToken(); Token t = p1.getToken();
//cerr << "read token: " << t << "\n"; //cerr << "read token: " << t << "\n";
if (t.cs() == "hline") { if (t.cs() == "hline") {
if (i == 0) { if (i == 0) {
rowinfo[row].topline = true; rowinfo[row].topline = true;
for (size_t c = 0; c < colinfo.size(); ++c) for (size_t col = 0; col < colinfo.size(); ++col)
cellinfos.at(c).topline = true; cellinfos[col].topline = true;
} else { } else {
rowinfo[row].bottomline = true; rowinfo[row].bottomline = true;
for (size_t c = 0; c < colinfo.size(); ++c) for (size_t col = 0; col < colinfo.size(); ++col)
cellinfos.at(c).bottomline = true; cellinfos[col].bottomline = true;
} }
} else if (t.cs() == "cline") { } else if (t.cs() == "cline") {
string arg = p1.verbatimItem(); string arg = p1.verbatimItem();
@ -519,13 +519,13 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
vector<string> t; vector<string> t;
split(arg, t, '-'); split(arg, t, '-');
t.resize(2); t.resize(2);
size_t from = string2int(t.at(0)); size_t from = string2int(t[0]);
size_t to = string2int(t.at(1)); size_t to = string2int(t[1]);
for (size_t col = from; col < to; ++col) { for (size_t col = from; col < to; ++col) {
if (i == 0) if (i == 0)
cellinfos.at(col).topline = true; cellinfos[col].topline = true;
else else
cellinfos.at(col).bottomline = true; cellinfos[col].bottomline = true;
} }
} else { } else {
cerr << "unexpected line token: " << t << endl; cerr << "unexpected line token: " << t << endl;
@ -537,11 +537,11 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
vector<string> cells; vector<string> cells;
split(lines[row], cells, TAB); split(lines[row], cells, TAB);
for (size_t col = 0, cell = 0; cell < cells.size() && col < colinfo.size(); ++col, ++cell) { for (size_t col = 0, cell = 0; cell < cells.size() && col < colinfo.size(); ++col, ++cell) {
//cerr << "cell content: " << cells.at(cell) << "\n"; //cerr << "cell content: " << cells[cell] << "\n";
Parser p(cells.at(cell)); Parser p(cells[cell]);
p.skipSpaces(); p.skipSpaces();
//cerr << "handling cell: " << p.nextToken().cs() << " '" << //cerr << "handling cell: " << p.nextToken().cs() << " '" <<
//cells.at(cell) << "'\n"; //cells[cell] << "'\n";
if (p.nextToken().cs() == "multicolumn") { if (p.nextToken().cs() == "multicolumn") {
// how many cells? // how many cells?
p.getToken(); p.getToken();
@ -550,7 +550,7 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
// special cell properties alignment // special cell properties alignment
vector<ColInfo> t; vector<ColInfo> t;
bool leftline = handle_colalign(p, t); bool leftline = handle_colalign(p, t);
CellInfo & ci = cellinfos.at(col); CellInfo & ci = cellinfos[col];
ci.multi = 1; ci.multi = 1;
ci.align = t.front().align; ci.align = t.front().align;
ci.content = parse(p, FLAG_ITEM, mode, false); ci.content = parse(p, FLAG_ITEM, mode, false);
@ -560,11 +560,11 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
// add dummy cells for multicol // add dummy cells for multicol
for (size_t i = 0; i < ncells - 1 && col < colinfo.size(); ++i) { for (size_t i = 0; i < ncells - 1 && col < colinfo.size(); ++i) {
++col; ++col;
cellinfos.at(col).multi = 2; cellinfos[col].multi = 2;
cellinfos.at(col).align = "center"; cellinfos[col].align = "center";
} }
} else { } else {
cellinfos.at(col).content = parse(p, FLAG_ITEM, mode, false); cellinfos[col].content = parse(p, FLAG_ITEM, mode, false);
} }
} }
@ -572,13 +572,13 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
//cerr << "// handle almost empty last row what we have\n"; //cerr << "// handle almost empty last row what we have\n";
// handle almost empty last row // handle almost empty last row
if (row && lines.at(row).empty() && row + 1 == rowinfo.size()) { if (row && lines[row].empty() && row + 1 == rowinfo.size()) {
//cerr << "remove empty last line\n"; //cerr << "remove empty last line\n";
if (rowinfo.at(row).topline); if (rowinfo[row].topline);
rowinfo.at(row - 1).bottomline = true; rowinfo[row - 1].bottomline = true;
for (size_t c = 0; c < colinfo.size(); ++c) for (size_t col = 0; col < colinfo.size(); ++col)
if (cellinfo.at(row).at(c).topline) if (cellinfo[row][col].topline)
cellinfo.at(row - 1).at(c).bottomline = true; cellinfo[row - 1][col].bottomline = true;
rowinfo.pop_back(); rowinfo.pop_back();
} }
@ -592,13 +592,13 @@ void handle_tabular(Parser & p, ostream & os, mode_type mode)
//cerr << "// after header\n"; //cerr << "// after header\n";
for (size_t col = 0; col < colinfo.size(); ++col) { for (size_t col = 0; col < colinfo.size(); ++col) {
os << "<column alignment=\"" << colinfo.at(col).align << "\""; os << "<column alignment=\"" << colinfo[col].align << "\"";
if (colinfo.at(col).rightline) if (colinfo[col].rightline)
os << " rightline=\"true\""; os << " rightline=\"true\"";
if (col == 0 && leftline) if (col == 0 && leftline)
os << " leftline=\"true\""; os << " leftline=\"true\"";
os << " valignment=\"top\""; os << " valignment=\"top\"";
os << " width=\"" << colinfo.at(col).width << "\""; os << " width=\"" << colinfo[col].width << "\"";
os << ">\n"; os << ">\n";
} }
//cerr << "// after cols\n"; //cerr << "// after cols\n";
@ -877,31 +877,6 @@ bool outer)
} }
if (flags & FLAG_BRACED) {
if (t.cat() == catSpace)
continue;
if (t.cat() != catBegin) {
p.error("opening brace expected");
return;
}
// skip the brace and collect everything to the next matching
// closing brace
flags = FLAG_BRACE_LAST;
}
if (flags & FLAG_OPTION) {
if (t.cat() == catOther && t.character() == '[') {
parse(p, os, FLAG_BRACK_LAST, mode, outer);
} else {
// no option found, put back token and we are done
p.putback();
}
return;
}
// //
// cat codes // cat codes
// //
@ -1016,11 +991,6 @@ bool outer)
else if (t.cs() == "\\" && mode == TEXT_MODE && curr_env() == "tabular") else if (t.cs() == "\\" && mode == TEXT_MODE && curr_env() == "tabular")
os << LINE; os << LINE;
else if (t.character() == ']' && (flags & FLAG_BRACK_LAST)) {
//cerr << "finished reading option\n";
return;
}
else if (t.cat() == catOther) else if (t.cat() == catOther)
os << string(1, t.character()); os << string(1, t.character());

View File

@ -1,7 +1,10 @@
#include <config.h>
#include "texparser.h" #include "texparser.h"
#include "Lsstream.h"
#include <iostream> #include <iostream>
#include <sstream>
using std::cerr; using std::cerr;
using std::endl; using std::endl;