Compare commits

..

8 Commits

21 changed files with 712 additions and 122 deletions

4
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "cmake/backbone"]
path = cmake/backbone
url = https://git.backbone.ws/kolan/cmake.backbone.git
url = git@git.backbone.ws:cmake/backbone.git
[submodule "util/backbone"]
path = util/backbone
url = https://git.backbone.ws/kolan/cmake.backbone-utils.git
url = git@git.backbone.ws:cmake/backbone-utils.git

@ -1 +1 @@
Subproject commit 206751e1f4814716d716f6bc297c280d4bf1dcf7
Subproject commit 02f3a0f7d969534872799b45a95d3c5a6fef14c3

View File

@ -5,7 +5,7 @@ namespace LAview {
/**
* List of {@link AddSpace}-s.
*/
public class AddSpaces : ADocList<AddSpace> {
public class AddSpaces : ADocList {
/**
* Style of the {@link AddSpace}/{@link Subtable}.
@ -33,7 +33,7 @@ namespace LAview {
*/
public AddSpaces () {}
protected override ADocList<AddSpace> create_default_instance () { return new AddSpaces (); }
protected override ADocList create_default_instance () { return new AddSpaces (); }
/**
* Gets a copy of the ``AddSpaces``.

View File

@ -5,9 +5,9 @@ namespace LAview {
/**
* List of Column Parameters.
*/
public class ColParams : ADocList<ColParam> {
public class ColParams : ADocList {
protected override ADocList<ColParam> create_default_instance () { return new ColParams (); }
protected override ADocList create_default_instance () { return new ColParams (); }
/**
* Constructs a new empty ``ColParams``.

View File

@ -39,14 +39,14 @@ namespace LAview {
/**
* Any iterable LaTeX Document.
*/
public abstract class ADocList<T> : Gee.ArrayList<T>, IDoc {
public abstract class ADocList : Gee.ArrayList<IDoc>, IDoc {
protected ADocList () {}
/**
* Object.new (this.get_type ()) doesn't work for me for ArrayList.
*/
protected abstract ADocList<T> create_default_instance ();
protected abstract ADocList create_default_instance ();
/**
* Gets a copy of the ``ADocList``.
@ -54,11 +54,8 @@ namespace LAview {
public virtual IDoc copy () {
var clone = create_default_instance ();
foreach (T dociface in this) {
var doc = dociface as IDoc;
assert (doc != null);
clone.add (doc.copy ());
}
foreach (IDoc dociface in this)
clone.add (dociface.copy () as IDoc);
return clone;
}
@ -69,11 +66,8 @@ namespace LAview {
public virtual string generate () {
var result = new StringBuilder ();
foreach (T dociface in this) {
var doc = dociface as IDoc;
assert (doc != null);
result.append (doc.generate ());
}
foreach (IDoc dociface in this)
result.append (dociface.generate ());
return result.str;
}

View File

@ -3,9 +3,9 @@ namespace LAview {
/**
* List of any LaTeX documents except Glob documents.
*/
public class Glob : ADocList<IDoc> {
public class Glob : ADocList {
protected override ADocList<IDoc> create_default_instance () { return new Glob (); }
protected override ADocList create_default_instance () { return new Glob (); }
/**
* Constructs a new empty ``Glob``.

View File

@ -93,7 +93,7 @@ namespace LAview {
col_param.nrlines = wlen - 1 - nrlines;
// Bug #94: Parse Multiple defined columns in the tabular/longtable.
while (count-- > 0) col_params.insert (0, col_param.copy () as ColParam);
while (count-- > 0) col_params.insert (0, col_param.copy ());
match_info.next ();
}

View File

@ -82,7 +82,7 @@ namespace LAview {
/* back-slash counter for one-line comments */
protected uint back_slash_counter = 0;
protected Parser (Array<Link> links) {
public Parser (Array<Link> links) {
/* initializing scanner links */
this.links = links;

View File

@ -5,7 +5,7 @@ namespace LAview {
/**
* Row in the {@link Subtable}.
*/
public class Row : ADocList<Cell> {
public class Row : ADocList {
/**
* Expands {@link AddSpaces.Style}.
@ -137,7 +137,7 @@ namespace LAview {
*/
public Row () {}
protected override ADocList<Cell> create_default_instance () { return new Row (); }
protected override ADocList create_default_instance () { return new Row (); }
/**
* Gets a copy of the ``Row``.
@ -162,7 +162,7 @@ namespace LAview {
while (lines_type != LinesType.NONE) {
lines_type = LinesType.NONE;
foreach (var cell in lcount_row) {
foreach (var cell in lcount_row as Gee.ArrayList<Cell>) {
if (overline && cell.noverlines != 0
|| !overline && cell.nunderlines != 0) {
if (lines_type == LinesType.NONE) {
@ -208,7 +208,7 @@ namespace LAview {
uint cline_begin = 0, cline_end = 0;
var where = Where.SEARCH_BEGIN;
for (var idx = 0, max_idx = lcount_row.size; idx < max_idx; ++idx) {
var cell = lcount_row[idx];
var cell = lcount_row[idx] as Cell;
switch (where) {
case Where.SEARCH_BEGIN:
@ -216,8 +216,8 @@ namespace LAview {
|| !overline && cell.nunderlines != 0) {
if (idx + 1 < max_idx
&& (overline && lcount_row[idx + 1].noverlines != 0
|| !overline && lcount_row[idx + 1].nunderlines != 0)) {
&& (overline && (lcount_row[idx + 1] as Cell).noverlines != 0
|| !overline && (lcount_row[idx + 1] as Cell).nunderlines != 0)) {
cline_end = cline_begin + cell.ncells;
where = Where.SEARCH_END;
} else {
@ -236,8 +236,8 @@ namespace LAview {
break;
case Where.SEARCH_END:
if (idx + 1 >= max_idx
|| overline && lcount_row[idx + 1].noverlines == 0
|| !overline && lcount_row[idx + 1].nunderlines == 0) {
|| overline && (lcount_row[idx + 1] as Cell).noverlines == 0
|| !overline && (lcount_row[idx + 1] as Cell).nunderlines == 0) {
if (clines_added)
s.append_c (' ');
s.append_printf (lcount_row.style != Style.DEFAULT ?
@ -258,7 +258,7 @@ namespace LAview {
}
}
foreach (var cell in lcount_row) {
foreach (var cell in lcount_row as Gee.ArrayList<Cell>) {
if (overline && cell.noverlines != 0
|| !overline && cell.nunderlines != 0) {
if (overline)
@ -279,14 +279,14 @@ namespace LAview {
if ((line_style & OpLineStyle.VBORDER) != 0) {
if (index < 0 || index >= size) {
var last_cell = this[size - 1];
var last_cell = get (size - 1) as Cell;
if (last_cell.multitype == Cell.Multitype.MULTICOL
|| last_cell.multitype == Cell.Multitype.MULTICOLROW)
cell.nrlines = last_cell.nrlines;
} else if (index == 0) {
if (this[index].multitype == Cell.Multitype.MULTICOL
|| this[index].multitype == Cell.Multitype.MULTICOLROW)
cell.nllines = this[index].nllines;
if ((get (index) as Cell).multitype == Cell.Multitype.MULTICOL
|| (get (index) as Cell).multitype == Cell.Multitype.MULTICOLROW)
cell.nllines = (get (index) as Cell).nllines;
}
}
@ -294,7 +294,7 @@ namespace LAview {
var prev_index = index - 1;
if (index >= 0 && index < size) { // next == [index]
var idx_cell = this[index];
var idx_cell = get (index) as Cell;
if (idx_cell.multitype == Cell.Multitype.MULTICOL
|| idx_cell.multitype == Cell.Multitype.MULTICOLROW ) {
idx_cell.nllines = cell.nrlines != 0 || idx_cell.nllines != 0 ? 1 : 0;
@ -307,7 +307,7 @@ namespace LAview {
if (prev_index >= 0 && prev_index < size
&& (cell.multitype == Cell.Multitype.MULTICOL
|| cell.multitype == Cell.Multitype.MULTICOLROW)) {
var idx_cell = this[prev_index];
var idx_cell = get (prev_index) as Cell;
cell.nllines = idx_cell.nrlines != 0 || cell.nllines != 0 ? 1 : 0;
idx_cell.nrlines = 0;
}
@ -334,21 +334,21 @@ namespace LAview {
* @param line_style {@link Row.OpLineStyle} of the operation.
*/
public new Cell remove_at (int index, Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) {
var cell = this[index];
var cell = get (index) as Cell;
if ((line_style & OpLineStyle.VBORDER) != 0
&& (cell.multitype == Cell.Multitype.MULTICOL
|| cell.multitype == Cell.Multitype.MULTICOLROW)) {
if (size > 1) {
if (index == 0)
this[1].nllines = cell.nllines;
(get (1) as Cell).nllines = cell.nllines;
else if (index == size - 1)
this[size - 2].nrlines = cell.nrlines;
(get (size - 2) as Cell).nrlines = cell.nrlines;
}
if ((line_style & OpLineStyle.VDBLLINES) != 0) {
if (index > 0 && index + 1 < size) {
var prev = this[index - 1],
next = this[index + 1];
var prev = get (index - 1) as Cell,
next = get (index + 1) as Cell;
if (next.multitype == Cell.Multitype.MULTICOL
|| next.multitype == Cell.Multitype.MULTICOLROW) {
next.nllines = prev.nrlines != 0 || next.nllines != 0 ? 1 : 0;
@ -358,7 +358,7 @@ namespace LAview {
}
}
return base.remove_at (index);
return base.remove_at (index) as Cell;
}
/**

View File

@ -5,7 +5,7 @@ namespace LAview {
/**
* Subtable in the {@link ATable}.
*/
public class Subtable : ADocList<Row> {
public class Subtable : ADocList {
/**
* Caption of the table.
@ -27,7 +27,7 @@ namespace LAview {
*/
public AddSpaces.Style style { get; set; }
protected override ADocList<Row> create_default_instance () { return new Subtable (); }
protected override ADocList create_default_instance () { return new Subtable (); }
/**
* Constructs a new empty ``Subtable``.
@ -51,8 +51,8 @@ namespace LAview {
uint dncells = 0, sncells = 0;
while (si < max_si && di < max_di) {
var scell = src_row[si];
var dcell = dest_row[di];
var scell = src_row.get (si) as Cell;
var dcell = dest_row.get (di) as Cell;
dncells = dncells != 0 ? dncells
: uint.max (1, dcell.multitype == Cell.Multitype.MULTICOL ?
@ -76,8 +76,8 @@ namespace LAview {
uint tncells = 0, bncells = 0;
while (ti < max_ti && bi < max_bi) {
var tcell = top_row[ti];
var bcell = bottom_row[bi];
var tcell = top_row.get (ti) as Cell;
var bcell = bottom_row.get (bi) as Cell;
tncells = tncells != 0 ? tncells
: uint.max (1, tcell.multitype == Cell.Multitype.MULTICOL ?
@ -99,7 +99,7 @@ namespace LAview {
if ((line_style & Row.OpLineStyle.HBORDER) != 0) {
if (row2 == null)
process_border_lines (row, this[size - 1], false);
process_border_lines (row, get (size - 1) as Row, false);
else if (index_of (row2) == 0)
process_border_lines (row, row2, true);
}
@ -108,10 +108,10 @@ namespace LAview {
Row prev = null;
if (row2 != null) { // next == iter
prev = this[index_of (row2) - 1];
prev = get (index_of (row2) - 1) as Row;
process_double_lines (row, row2);
} else {
prev = this[size - 1];
prev = get (size - 1) as Row;
}
if (prev != null)
@ -126,10 +126,10 @@ namespace LAview {
* @param line_style {@link Row.OpLineStyle} of the operation.
*/
public void remove_col (uint index, Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) {
foreach (Row row in this) {
foreach (Row row in this as Gee.ArrayList<Row>) {
uint mindx = 0;
foreach (var cell in row) {
foreach (var cell in row as Gee.ArrayList<Cell>) {
uint ncells = 1;
if (cell.multitype == Cell.Multitype.MULTICOL)
@ -158,12 +158,12 @@ namespace LAview {
*/
public void clone_col (uint src_index, uint dest_index,
bool multicol, Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) {
foreach (var row in this) {
foreach (var row in this as Gee.ArrayList<Row>) {
uint mindx = 0;
var sidx = -1;
var didx = -1;
foreach (var cell in row) {
foreach (var cell in row as Gee.ArrayList<Cell>) {
uint ncells = 1;
if (cell.multitype == Cell.Multitype.MULTICOL)
@ -176,7 +176,7 @@ namespace LAview {
didx = row.index_of (cell);
if (sidx != -1 && didx != -1) {
var cell2 = row[sidx].copy () as Cell;
var cell2 = row.get (sidx).copy () as Cell;
if (!multicol && cell2.multitype == Cell.Multitype.MULTICOL)
cell2.ncells = 1;
row.insert (didx, cell2, line_style);
@ -193,14 +193,15 @@ namespace LAview {
Cell cell;
while (mindx < dest_index) {
cell = row[row.size - 1].copy () as Cell;
var row_size = row.size;
cell = row.get (row_size - 1).copy () as Cell;
cell.contents = empty_global_doc;
cell.ncells = 1;
row.add (cell, line_style);
mindx++;
}
cell = row[sidx].copy () as Cell;
cell = row.get (sidx).copy () as Cell;
if (!multicol && cell.multitype == Cell.Multitype.MULTICOL)
cell.ncells = 1;
row.add (cell, line_style);
@ -228,19 +229,19 @@ namespace LAview {
* @param line_style {@link Row.OpLineStyle} of the operation.
*/
public new Row remove_at (int index, Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) {
if (size > 1 && 0 != (line_style & Row.OpLineStyle.HBORDER)) {
if (size > 1 && 0 != line_style & Row.OpLineStyle.HBORDER) {
if (index == 0)
process_border_lines (this[1], this[index], true);
process_border_lines (get (1) as Row, get (index) as Row, true);
else if (index == size - 1)
process_border_lines (this[size - 2], this[index], false);
process_border_lines (get (size - 2) as Row, get (index) as Row, false);
}
if ((line_style & Row.OpLineStyle.HDBLLINES) != 0)
if (index > 0 && index + 1 < size)
process_double_lines (this[index + 1],
this[index - 1]);
process_double_lines (get (index + 1) as Row,
get (index - 1) as Row);
return base.remove_at (index);
return base.remove_at (index) as Row;
}
/**
@ -251,7 +252,7 @@ namespace LAview {
* @param line_style {@link Row.OpLineStyle} of the operation.
*/
public new void insert (int index, Row row, Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) {
process_opline_insert (row, this[index], line_style);
process_opline_insert (row, get (index) as Row, line_style);
base.insert (index, row);
}
@ -282,12 +283,12 @@ namespace LAview {
uint min_olines = 0, min_ulines = 0;
foreach (var cell in row) {
foreach (var cell in row as Gee.ArrayList<Cell>) {
min_olines = uint.min (min_olines, cell.noverlines);
min_ulines = uint.min (min_ulines, cell.nunderlines);
}
foreach (var cell in row) {
foreach (var cell in row as Gee.ArrayList<Cell>) {
switch (row_pos) {
case RowPos.FIRST:
cell.noverlines = uint.min (min_olines + 1, cell.noverlines);
@ -322,7 +323,7 @@ namespace LAview {
s.append ("\\tabularnewline");
}
foreach (var row in this) {
foreach (var row in this as Gee.ArrayList<Row>) {
var row_style = Row.Style.DEFAULT;
if (style != AddSpaces.Style.DEFAULT) {

View File

@ -49,7 +49,7 @@ namespace LAview {
public ColParams params { get; set; default = new ColParams (); }
/**
* Main subtable.
* Main sutable.
*/
public Subtable table { get; set; default = new Subtable (); }
@ -111,21 +111,21 @@ namespace LAview {
= Row.OpLineStyle.BORDER_DBLLINES) {
if (index >= params.size) return;
var param = params[index];
var param = params.get (index) as ColParam;
if ((line_style & Row.OpLineStyle.VBORDER) != 0 && param.align != "") {
if (params.size > 1) {
if (index == 0)
params[1].nllines = param.nllines;
(params.get (1) as ColParam).nllines = param.nllines;
else if (index == params.size - 1)
params[params.size - 2].nrlines = param.nrlines;
(params.get (params.size - 2) as ColParam).nrlines = param.nrlines;
}
}
if ((line_style & Row.OpLineStyle.VDBLLINES) != 0) {
if (index > 0 && index < params.size - 1) {
var prev = params[index - 1],
next = params[index + 1];
var prev = params.get (index - 1) as ColParam,
next = params.get (index + 1) as ColParam;
next.nllines = prev.nrlines != 0 || next.nllines != 0 ? 1 : 0;
prev.nrlines = 0;
}
@ -153,15 +153,15 @@ namespace LAview {
= Row.OpLineStyle.BORDER_DBLLINES) {
if (src_index >= params.size || dest_index > params.size) return;
var param = params[src_index].copy () as ColParam;
var param = params.get (src_index).copy () as ColParam;
if ((Row.OpLineStyle.VBORDER & line_style) != 0) {
if (dest_index >= params.size) {
var last_param = params[params.size - 1];
var last_param = params.get (params.size - 1) as ColParam;
if (last_param.align != "")
param.nrlines = last_param.nrlines;
} else {
var first_param = params[0];
var first_param = params.get (0) as ColParam;
if (dest_index == 0 && first_param.align != "")
param.nllines = first_param.nllines;
}
@ -174,7 +174,7 @@ namespace LAview {
if (dest_index < params.size) {
prev_index = dest_index > 0 ? dest_index - 1 : 0;
if (prev_index > 0) prev_edit = true;
var dest_param = params[dest_index];
var dest_param = params.get (dest_index) as ColParam;
dest_param.nllines = param.nrlines != 0 || dest_param.nllines != 0 ? 1 : 0;
param.nrlines = 0;
} else {
@ -183,7 +183,7 @@ namespace LAview {
}
if (prev_edit) {
var prev_param = params[prev_index];
var prev_param = params.get (prev_index) as ColParam;
param.nllines = prev_param.nrlines != 0 || param.nllines != 0 ? 1 : 0;
prev_param.nrlines = 0;
}
@ -219,7 +219,7 @@ namespace LAview {
uint max_cols;
}
bool check_limits (List<weak SplitLimit?> sorted_limits) {
bool check_limits (List<SplitLimit?> sorted_limits) {
/* check nearby limits */
for (var i = 1; i < sorted_limits.length(); ++i)
if (sorted_limits.nth_data(i - 1).last >= sorted_limits.nth_data(i).first
@ -234,14 +234,14 @@ namespace LAview {
return true;
}
uint [] get_indexes (List<weak SplitLimit?> sorted_limits) {
uint [] get_indexes (List<SplitLimit?> sorted_limits) {
var lim_indexes = new uint[sorted_limits.length()];
for (var i = 0; i < sorted_limits.length(); ++i)
lim_indexes[i] = sorted_limits.nth_data(i).first;
return lim_indexes;
}
ATable? split_table (List<weak SplitLimit?> sorted_limits, uint [] lim_indexes,
ATable? split_table (List<SplitLimit?> sorted_limits, uint [] lim_indexes,
Row.OpLineStyle line_style) {
var return_table = copy () as ATable;
@ -286,12 +286,11 @@ namespace LAview {
*
* @param glob {@link Glob} document with a ``ATable``.
* @param limits array of {@link SplitLimit}s.
* @param delimiter any LaTeX code to separate new tables, '\\', for ex
* @param line_style {@link Row.OpLineStyle} of the operation.
*
* @return number of ``ATable``s the table splitted to.
*/
public uint split (Glob glob, List<SplitLimit?> limits, string delimiter = "",
public uint split (Glob glob, List<SplitLimit?> limits,
Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) throws SplitError {
/* is table a child of glob */
var glob_index = glob.index_of (this);
@ -311,17 +310,13 @@ namespace LAview {
if (!check_limits (sorted_limits))
throw new SplitError.INDEX_ERROR (_("3rd param (limits) is incorrect. Read the manual."));
/* split the table on several tables inserting them before glob_index + 1 */
/* split the table on several longtables inserting them before glob_index + 1 */
var lim_indexes = get_indexes (sorted_limits);
ATable temp_table;
uint result = 0;
var part_idx = glob_index + 1;
while (null != (temp_table = split_table (sorted_limits, lim_indexes, line_style))) {
if (delimiter != "" && part_idx != glob_index + 1) {
glob.insert (part_idx++, new Text(delimiter));
++result;
}
glob.insert (part_idx++, temp_table);
++result;
}

View File

@ -19,7 +19,7 @@ namespace LAview {
protected bool in_caption = false;
protected TableParser (Array<Link> links) {
public TableParser (Array<Link> links) {
base (links);
group.append_val (new Link ({}, {}));
@ -232,7 +232,7 @@ namespace LAview {
var subdoc = subparserGlobal.parse (cell_contents, subdoc_start.line, subdoc_start.pos);
unowned List<int> clines_p = clines.first ();
foreach (var cell in row) {
foreach (var cell in row as Gee.ArrayList<Cell>) {
if (clines_p == null) break;
for (var i = 0, max_i = cell.ncells; i < max_i; ++i) {
@ -258,7 +258,7 @@ namespace LAview {
switch (lines_type) {
case Row.LinesType.HLINE:
if (subtable.size != 0) {
foreach (var cell in subtable[subtable.size - 1]) {
foreach (var cell in subtable.get (subtable.size - 1) as Gee.ArrayList<Cell>) {
cell.nunderlines += nhlines;
clear_lines = true;
}
@ -268,9 +268,9 @@ namespace LAview {
/* #85 Assert in LINE_CLINES case */
if (row.size == 0 && subtable.size == 0)
break;
var tmp_row = row.size != 0 ? row : subtable[subtable.size - 1];
var tmp_row = row.size != 0 ? row : subtable.get (subtable.size - 1) as Row;
unowned List<int> clines_p = clines.first ();
foreach (var cell in tmp_row) {
foreach (var cell in tmp_row as Gee.ArrayList<Cell>) {
if (clines_p == null) break;
if (clines_p != null && clines_p.data != 0)
@ -313,7 +313,7 @@ namespace LAview {
Row last_row;
if (subtable.size != 0)
last_row = subtable[subtable.size-1];
last_row = subtable.get(subtable.size-1) as Row;
else
last_row = new Row ();
@ -322,7 +322,7 @@ namespace LAview {
} else if (row.top.size == 0 || subtable.size == 0) {
row.top.add (add_space);
} else if (row.top.size == 1 && subtable.size != 0) {
last_row.between.add (row.top[0]);
last_row.between.add (row.top.get (0) as AddSpace);
row.top.remove_at (0);
row.top.add (add_space);
}
@ -331,7 +331,7 @@ namespace LAview {
protected void spaces_to_last_row () {
var top = row.top;
if (top.size == 1 && subtable.size != 0) {
subtable[subtable.size - 1].between.add (top[0]);
(subtable.get (subtable.size - 1) as Row).between.add (top.get (0) as AddSpace);
top.remove_at (0);
}
}
@ -522,9 +522,11 @@ namespace LAview {
case TableTagType.DBLBACKSLASHES:
case TableTagType.TABULARNEWLINE:
if (tag == TableTagType.DBLBACKSLASHES) {
var row_length = row.size;
var col_param = "";
if (row.size < table.params.size)
col_param = table.params[row.size].align;
if (row_length < table.params.size)
col_param = (table.params.get (row_length) as ColParam).align;
if (col_param != ""
&& (col_param.index_of_char ('p') != -1
|| col_param.index_of_char ('b') != -1

View File

@ -107,7 +107,7 @@ namespace LAview {
col_param.nrlines = wlen - 1 - nrlines;
// Bug #94: Parse Multiple defined columns in the tabular/longtable.
while (count-- > 0) col_params.insert (0, col_param.copy () as ColParam);
while (count-- > 0) col_params.insert (0, col_param.copy ());
match_info.next ();
}

View File

@ -1,7 +1,6 @@
SET (BinName ltable_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LTableTest.vala)
SET (BinPackages gee-0.8)
SET (BinPkgModules gee-0.8)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/latex-struct/${PROJECT_LOWERCASE_NAME}-${MAJOR}.vapi)
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/latex-struct")

View File

@ -75,7 +75,7 @@ public class Main : Object {
ltable.clone_col (1000, 0, true);
} else if (args[3] == "append_row0") {
var table = ltable.table;
table.add (table[0].copy () as Table.Row);
table.add (table.get (0).copy () as Table.Row);
} else {
stdout.printf ("Incorrect operation '%s' specified.\n", args[3]);
return -1;
@ -84,7 +84,7 @@ public class Main : Object {
if (args[3] == "append_row0") {
var tabular = subdoc as Table.Tabular;
var table = tabular.table;
table.add (table[0].copy () as Table.Row);
table.add (table.get (0).copy () as Table.Row);
}
}
}

View File

@ -1,7 +1,6 @@
SET (BinName parse_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ParseTest.vala)
SET (BinPackages gee-0.8)
SET (BinPkgModules gee-0.8)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/latex-struct/${PROJECT_LOWERCASE_NAME}-${MAJOR}.vapi)
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/latex-struct")

View File

@ -60,26 +60,22 @@ public class Main : Object {
foreach (var subdoc in doc) {
stdout.printf ("%s\n", subdoc.get_type ().name ());
if (subdoc is Table.Tabular || subdoc is Table.Longtable) {
if (subdoc.get_type ().name () == "LAviewTableTabular"
|| subdoc.get_type ().name () == "LAviewTableLongtable") {
unowned Table.Subtable subtable = null;
if (subdoc is Table.Tabular) {
var t = subdoc as Table.Tabular;
assert (t != null);
subtable = t.table;
} else {
var t = subdoc as Table.Longtable;
assert (t != null);
subtable = t.table;
}
if (subdoc.get_type ().name () == "LAviewTableTabular")
subtable = (subdoc as Table.Tabular).table;
else
subtable = (subdoc as Table.Longtable).table;
foreach (var row in subtable) {
foreach (var cell in row) {
var glob = cell.contents;
foreach (var cell in (row as Table.Row)) {
var glob = (cell as Table.Cell).contents;
foreach (var glob_subdoc in glob) {
if (!( glob_subdoc is LAview.Text )) {
if (glob_subdoc.get_type ().name () != "LAviewText") {
stdout.printf (" %s\n", glob_subdoc.get_type ().name ());
}
}
@ -94,7 +90,7 @@ public class Main : Object {
foreach (var subdoc in doc) {
stdout.printf ("%s\n", subdoc.get_type ().name ());
if (subdoc is LAview.Graphics) {
if (subdoc.get_type ().name () == "LAviewGraphics") {
var graphics = subdoc as Graphics;
stdout.printf (" width=%f%s, height=%f%s, path=%s,\n gen()=%s\n",
graphics.width, graphics.width_unit, graphics.height, graphics.height_unit,

View File

@ -1,7 +1,6 @@
SET (BinName split_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} SplitTest.vala)
SET (BinPackages gee-0.8)
SET (BinPkgModules gee-0.8)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/latex-struct/${PROJECT_LOWERCASE_NAME}-${MAJOR}.vapi)
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/latex-struct")

386
test/tex/CMakeLists.txt Normal file
View File

@ -0,0 +1,386 @@
FIND_PACKAGE (PkgConfig REQUIRED)
PKG_CHECK_MODULES (GLIB2 REQUIRED glib-2.0)
PKG_CHECK_MODULES (GOBJECT2 REQUIRED gobject-2.0)
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS})
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS})
IF (CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS (${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER})
ENDIF ()
# add the executable
ADD_EXECUTABLE (txr_parse_test txr_parse_test.c)
TARGET_LINK_LIBRARIES (txr_parse_test txr-texparser ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
# add ltable_test executable
ADD_EXECUTABLE (ltable_test ltable_test.c)
TARGET_LINK_LIBRARIES (ltable_test txr-texparser ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
# add the install targets and files
# INSTALL (TARGETS txr_parse_test ltable_test DESTINATION bin)
# parsing test macro
MACRO (do_parse_test testname table_path etalon_path regexp)
IF ("${etalon_path}" STREQUAL "")
SET (extra_args "")
ELSE ()
SET (extra_args --etalon ${etalon_path})
ENDIF ()
ADD_TEST (txr_parse_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/txr_parse_test --table ${table_path} ${extra_args})
SET_TESTS_PROPERTIES (txr_parse_test-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (do_parse_test)
# test throttle.tex
do_parse_test (throttleList ${PROJECT_SOURCE_DIR}/test/throttle.tex ""
"list all objects
TXRText
TXRLongtable
TXRText
TXRTabular
TXRText
TXRGraphics
TXRText
end of objects
")
# test throttle.tex
do_parse_test (throttleWalk ${PROJECT_SOURCE_DIR}/test/throttle.tex ""
"Walk through all objects
TXRText
TXRLongtable
TXRText
TXRTabular
TXRText
TXRGraphics
width=0.000000.null., height=0.000000.null., path=174,
gen..=.includegraphics., angle=25, scale=3,angle=70 , , .{174}
resized gen.. = .includegraphics.angle=25,scale=3.{174}
TXRText
end of objects
")
# test throttle.tex
do_parse_test (throttleCmp ${PROJECT_SOURCE_DIR}/test/throttle.tex ""
"Original and generated text are EQUAL .-.")
# test throttle.tex
do_parse_test (throttleErr1 ${PROJECT_SOURCE_DIR}/test/throttle_err1.tex ""
"Error parsing TeX document: TXRGlobScanner:33:15: : Unexpected stop tag sequence '..end{longtable}' without start tag pair.
.end{longtable}
.")
# test throttle.tex
do_parse_test (throttleErr2 ${PROJECT_SOURCE_DIR}/test/throttle_err2.tex ""
"Error parsing TeX document: TXRGlobScanner:33:1: Start tag sequence '..begin{longtable}' without stop tag pair.
.begin{longtable}
.
")
# test throttle.tex
do_parse_test (throttleErr3 ${PROJECT_SOURCE_DIR}/test/throttle_err3.tex ""
"Error parsing TeX document: TXRGlobScanner:34:1: Error parsing subdoc.
.begin{longtable}
.
TXRLongtableScanner:55:46: Stop external tag sequence '..end{longtable}' without start tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{longtable} & & & & .tabularnewline
.
")
# test throttle.tex
do_parse_test (throttleErr4 ${PROJECT_SOURCE_DIR}/test/throttle_err4.tex ""
"Error parsing TeX document: TXRGlobScanner:33:13: : Unexpected stop tag sequence '..end{tabular}' without start tag pair.
.end{tabular}
.")
# test throttle.tex
do_parse_test (throttleErr5 ${PROJECT_SOURCE_DIR}/test/throttle_err5.tex ""
"Error parsing TeX document: TXRGlobScanner:33:1: Start tag sequence '..begin{tabular}' without stop tag pair.
.begin{tabular}
.
")
# test throttle.tex
do_parse_test (throttleErr6 ${PROJECT_SOURCE_DIR}/test/throttle_err6.tex ""
"Error parsing TeX document: TXRGlobScanner:34:1: Error parsing subdoc.
.begin{tabular}
.
TXRTabularScanner:55:46: Stop external tag sequence '..end{tabular}' without start tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{tabular} & & & & .tabularnewline
.
")
# test formular.tex
do_parse_test (formularList ${PROJECT_SOURCE_DIR}/test/formular.tex ""
"list all objects
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRGraphics
TXRText
end of objects
")
# test formular.tex
do_parse_test (formularWalk ${PROJECT_SOURCE_DIR}/test/formular.tex ""
"Walk through all objects
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRGraphics
width=12.000000cm, height=25.000000cm, path=151,
gen..=.includegraphics.width=12cm,height=25cm.{151}
resized gen.. = .includegraphics.width=6.000000pt,height=50.000000dd.{151}
TXRText
end of objects
")
# test formular.tex
do_parse_test (formularCmp ${PROJECT_SOURCE_DIR}/test/formular.tex ""
"Original and generated text are EQUAL .-.")
# test formular.tex
do_parse_test (formularErr1 ${PROJECT_SOURCE_DIR}/test/formular_err1.tex ""
"Error parsing TeX document: TXRGlobScanner:192:15: : Unexpected stop tag sequence '..end{longtable}' without start tag pair.
.end{longtable}
.")
# test formular.tex
do_parse_test (formularErr2 ${PROJECT_SOURCE_DIR}/test/formular_err2.tex ""
"Error parsing TeX document: TXRGlobScanner:44:1: Start tag sequence '..begin{longtable}' without stop tag pair.
.begin{longtable}
.
")
# test for caption in all_subtables.tex
do_parse_test (captionTest ${PROJECT_SOURCE_DIR}/test/all_subtables.tex ""
".begin{document}
.begin{longtable}{.c.c.}
.caption{Caption of the table}
")
# test all_subtables.tex
do_parse_test (all_subtablesCmp ${PROJECT_SOURCE_DIR}/test/all_subtables.tex ""
"Original and generated text are EQUAL .-.")
# test all_subtables.tex
do_parse_test (linesCmp ${PROJECT_SOURCE_DIR}/test/lines.tex ${PROJECT_SOURCE_DIR}/test/lines.etalon.tex
"Original and generated text are EQUAL .-.")
# test ltable_embedded.tex
do_parse_test (ltable_embedded ${PROJECT_SOURCE_DIR}/test/ltable_embedded.tex ""
"Original and generated text are EQUAL .-.")
# test ltable_double_embedded.tex
do_parse_test (ltable_double_embedded ${PROJECT_SOURCE_DIR}/test/ltable_double_embedded.tex ""
"Original and generated text are EQUAL .-.")
# test throttle_VK2500.tex
do_parse_test (throttle_VK2500Cmp ${PROJECT_SOURCE_DIR}/test/throttle_VK2500.tex ""
"Original and generated text are EQUAL .-.")
# test throttle_VK2500.tex
do_parse_test (throttle_VK2500PSCmp ${PROJECT_SOURCE_DIR}/test/throttle_VK2500PS.tex ""
"Original and generated text are EQUAL .-.")
# test throttle_VK2500_dos_newlines_.tex
do_parse_test (throttle_VK2500PS_dos_newlines_ListWalk ${PROJECT_SOURCE_DIR}/test/throttle_VK2500PS_dos_newlines.tex ""
"list all objects
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
end of objects
Walk through all objects
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
end of objects
")
# test graph_in_ltable.tex
do_parse_test (graph_in_ltable ${PROJECT_SOURCE_DIR}/test/graph_in_ltable.tex ""
"
list all objects
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRLongtable
TXRLongtable
TXRText
TXRLongtable
TXRGraphics
TXRLongtable
TXRText
end of objects
Walk through all objects
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRLongtable
TXRText
TXRLongtable
TXRText
end of objects
")
# test ltable_square_arg.tex
do_parse_test (ltable_square_arg ${PROJECT_SOURCE_DIR}/test/ltable_square_arg.tex ""
"Original and generated text are EQUAL .-.")
# test table_in_table.tex
do_parse_test (table_in_table ${PROJECT_SOURCE_DIR}/test/table_in_table.tex ""
"
list all objects
")
# test unary_quotes.tex
do_parse_test (unary_quotes ${PROJECT_SOURCE_DIR}/test/unary_quotes.tex ""
"
list all objects
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
end of objects
Walk through all objects
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
TXRTabular
TXRText
end of objects
")
# test back_slashes_in_a_table.tex
do_parse_test (back_slashes_in_a_table ${PROJECT_SOURCE_DIR}/test/back_slashes_in_a_table.tex ${PROJECT_SOURCE_DIR}/test/back_slashes_in_a_table.etalon.tex
"Original and generated text are EQUAL .-.")
# ltable_test macro
macro (ltable_test testname tex_path1 tex_path2 operation regexp)
add_test (ltable_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ltable_test ${tex_path1} ${tex_path2} ${operation})
set_tests_properties (ltable_test-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
endmacro (ltable_test)
# ltable_test rm0row
ltable_test (rm0row ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_rm0row.tex rm0row
"Etalon and generated text are EQUAL .-.")
# ltable_test rm1row
ltable_test (rm1row ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_rm1row.tex rm1row
"Etalon and generated text are EQUAL .-.")
# ltable_test rm1000row
ltable_test (rm1000row ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_rm1000row.tex rm1000row
"Etalon and generated text are EQUAL .-.")
# ltable_test rm_last_row
ltable_test (rm_last_row ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_rm_last_row.tex rm_last_row
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_0
ltable_test (clone_0_0 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_0_0.tex clone_0_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_1
ltable_test (clone_0_1 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_0_1.tex clone_0_1
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_1_0
ltable_test (clone_1_0 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_1_0.tex clone_1_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_last
ltable_test (clone_0_last ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_0_last.tex clone_0_last
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_last_0
ltable_test (clone_last_0 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_last_0.tex clone_last_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_lastp1
ltable_test (clone_0_lastp1 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_0_lastp1.tex clone_0_lastp1
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_lastp1_0
ltable_test (clone_lastp1_0 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_lastp1_0.tex clone_lastp1_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_1000
ltable_test (clone_0_1000 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_0_1000.tex clone_0_1000
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_1000_0
ltable_test (clone_1000_0 ${PROJECT_SOURCE_DIR}/test/formular.tex ${PROJECT_SOURCE_DIR}/test/ltable_clone_1000_0.tex clone_1000_0
"Etalon and generated text are EQUAL .-.")
# ltable_test append_row0
ltable_test (append_row0 ${PROJECT_SOURCE_DIR}/test/table_rows.tex ${PROJECT_SOURCE_DIR}/test/table_rows.etalon.tex append_row0
"Etalon and generated text are EQUAL .-.")
# enable testing
ENABLE_TESTING ()

219
test/tex/txr_parse_test.c Normal file
View File

@ -0,0 +1,219 @@
///@cond INTERNAL
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <locale.h>
#include "txr-texparser.h"
static gchar *fnameTable = NULL;
static gchar *fnameEtalon = NULL;
static gchar *fnameWrite = NULL;
static GOptionEntry entries[] =
{
{ "table", 't', 0, G_OPTION_ARG_FILENAME, &fnameTable, "File with a table", NULL },
{ "etalon", 'e', 0, G_OPTION_ARG_FILENAME, &fnameEtalon, "File with etalon table", NULL },
{ "write", 'w', 0, G_OPTION_ARG_FILENAME, &fnameWrite, "File to write", NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
int main (int argc, char *argv[])
{
GOptionContext *context;
GError *error = NULL;
GError *parse_error = NULL;
gchar *contents = NULL,
*generated = NULL,
*gentext;
TXRGlob *doc = NULL;
TXRGlobIter it;
//MamanBar *bar;
//MamanBar *bar1;
//#if (!GLIB_CHECK_VERSION (2, 36, 0))
// g_type_init ();
//#endif
//bar = g_object_new (MAMAN_BAR_TYPE, NULL);
//g_printf ("type = %s\n", G_OBJECT_TYPE_NAME (bar));
//g_object_unref (bar);
//bar1 = g_object_new (MAMAN_BAR_TYPE, NULL);
//g_object_unref (bar1);
//(void) bar1;
//return 0;
setlocale (LC_ALL, "");
#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init ();
#endif
/* commandline arguments processing */
context = g_option_context_new ("- tests LaTeX parser");
g_option_context_add_main_entries (context, entries, NULL);//GETTEXT_PACKAGE);
// g_option_context_add_group (context, gtk_get_option_group (TRUE));
if (!g_option_context_parse (context, &argc, &argv, &error))
{
fprintf (stderr, "option parsing failed: %s\n", error->message);
exit (1);
}
g_option_context_free (context);
/* read table */
if (!fnameTable)
{
fprintf (stderr, "Specify file with a table");
goto err;
}
/* load file contents
*/
if (!g_file_get_contents (fnameTable, &contents, NULL, &error))
{
g_printf ("Unable to read file: %s\n", error->message);
goto err;
}
g_free (fnameTable);
g_assert ((contents == NULL && error != NULL)
|| (contents != NULL && error == NULL));
/* parse TeX */
doc = txr_parse (contents, &parse_error);
if (parse_error)
{
g_print ("Error parsing TeX document: %s\n", parse_error->message);
goto err;
}
else
{
puts ("TeX document successfully parsed\n");
}
/* list all objects */
g_printf ("list all objects\n");
for (it = txr_glob_first (doc); it; it = txr_glob_iter_next (it))
{
g_printf ("%s\n", G_OBJECT_TYPE_NAME (*it));
if ( !g_strcmp0 ("TXRTabular", G_OBJECT_TYPE_NAME (*it))
|| !g_strcmp0 ("TXRLongtable", G_OBJECT_TYPE_NAME (*it)))
{
TXRSubtable *subtable;
TXRSubtableIter st_it;
if (!g_strcmp0 ("TXRTabular", G_OBJECT_TYPE_NAME (*it)))
subtable = txr_tabular_get_table (TXR_TABULAR (*it));
else
subtable = txr_longtable_get_table (TXR_LONGTABLE (*it));
for (st_it = txr_subtable_first (subtable); st_it; st_it = txr_subtable_iter_next (st_it))
{
TXRRow *row = TXR_ROW (*st_it);
TXRRowIter row_it;
for (row_it = txr_row_first (row); row_it; row_it = txr_row_iter_next (row_it))
{
TXRCell *cell = TXR_CELL (*row_it);
TXRGlob *glob = txr_cell_get_contents (cell);
TXRGlobIter glob_it;
for (glob_it = txr_glob_first (glob); glob_it; glob_it = txr_glob_iter_next (glob_it))
{
if (g_strcmp0 ("TXRText", G_OBJECT_TYPE_NAME (*glob_it)))
g_printf (" %s\n", G_OBJECT_TYPE_NAME (*glob_it));
}
}
}
}
}
g_printf ("end of objects\n\n");
/* walk through all objects */
g_printf ("Walk through all objects\n");
for (it = txr_glob_first (doc); it; it = txr_glob_iter_next (it))
{
g_printf ("%s\n", G_OBJECT_TYPE_NAME (*it));
if (!g_strcmp0 ("TXRGraphics", G_OBJECT_TYPE_NAME (*it)))
{
gdouble width = 0,
height = 0;
gchar *w_unit = NULL,
*h_unit = NULL;
TXRGraphics *graphics = txr_graphics_clone (TXR_GRAPHICS (*it));
txr_graphics_get_size (graphics, &width, &w_unit, &height, &h_unit);
gentext = txr_glob_gen ((TXRGlob *) graphics);
g_printf (" width=%f%s, height=%f%s, path=%s,\n gen()=%s\n",
width, w_unit, height, h_unit,
txr_graphics_get_path (graphics),
gentext);
g_free (gentext);
/* test txr_graphics_set_size () */
txr_graphics_set_size (graphics, width / 2, "pt", height * 2, "dd");
gentext = txr_glob_gen ((TXRGlob *) graphics);
g_printf ("resized gen() = %s\n", gentext);
g_free (gentext);
txr_graphics_unref (graphics);
g_free (w_unit);
g_free (h_unit);
}
}
g_printf ("end of objects\n\n");
/* generate plain-TeX document */
generated = txr_glob_gen (doc);
/* load etalon file
*/
if (fnameEtalon)
{
g_free (contents);
if (!g_file_get_contents (fnameEtalon, &contents, NULL, &error))
{
g_printf ("Unable to read file: %s\n", error->message);
goto err;
}
}
g_free (fnameEtalon);
if (!g_strcmp0 (contents, generated))
g_printf ("Original and generated text are EQUAL ;-)\n");
else
g_printf ("Original and generated text are NOT EQUAL ;-(\n");
g_printf ("--- Generated plain-TeX (generated) ---\n%s", generated);
/* write to file */
if (fnameWrite)
g_file_set_contents (fnameWrite, generated, -1, NULL);
g_free (fnameWrite);
err:
//end:
g_free (contents);
g_free (generated);
if (parse_error)
{
g_error_free (parse_error);
}
if (error)
{
g_error_free (error);
}
txr_glob_unref (doc);
return 0;
}
///@endcond

@ -1 +1 @@
Subproject commit 11c998aca2aa1b787286b336e579e5a4e31f471a
Subproject commit d4e233ae72412f4dfef9b7c39ae7a1b6667fb446