From 8b8f9b6f1539971fd183d02473f5e0aaaeede7bf Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 23 Jul 2014 15:08:46 +0400 Subject: [PATCH 1/8] Hide internal classes. --- CMakeLists.txt | 3 ++- src/CMakeLists.txt | 22 +++++++++++----------- test/CMakeLists.txt | 8 ++++---- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bc4c95..50403d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,10 @@ INCLUDE (MacroOptionalAddSubdirectory) INCLUDE (CPackDetectArch) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") # supress Gcc warnings +SET (PROJ_LCASE "laview-latex-struct") # configure a header file for Gettext -SET (GETTEXT_PACKAGE "laview-latex-struct") +SET (GETTEXT_PACKAGE "${PROJ_LCASE}") ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}") IF (WIN32) SET (LOCALEDIR "") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 391ef48..6abb6b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,27 +10,27 @@ FILE (GLOB_RECURSE LAviewSources RELATIVE ${CMAKE_SOURCE_DIR}/src *.vala) VALA_PRECOMPILE (VALA_C ${LAviewSources} PACKAGES gee-0.8 posix - OPTIONS --thread ${VALA_DEBUG} + OPTIONS --thread ${VALA_DEBUG} --vapi=${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi CUSTOM_VAPIS - GENERATE_VAPI laview-latex-struct-${MAJOR} - GENERATE_HEADER laview-latex-struct-${MAJOR} + GENERATE_VAPI ${PROJ_LCASE}-${MAJOR}_internal + GENERATE_HEADER ${PROJ_LCASE}-${MAJOR} ) INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}") -ADD_LIBRARY (laview-latex-struct SHARED ${VALA_C} ${PROJECT_SOURCE_DIR}/src/vala_unsupported.c) -TARGET_LINK_LIBRARIES (laview-latex-struct ${GEE_LIBRARIES}) -SET_TARGET_PROPERTIES (laview-latex-struct PROPERTIES VERSION ${VERSION}) -SET_TARGET_PROPERTIES (laview-latex-struct PROPERTIES SOVERSION ${MAJOR}) +ADD_LIBRARY (${PROJ_LCASE} SHARED ${VALA_C} ${PROJECT_SOURCE_DIR}/src/vala_unsupported.c) +TARGET_LINK_LIBRARIES (${PROJ_LCASE} ${GEE_LIBRARIES}) +SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES VERSION ${VERSION}) +SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES SOVERSION ${MAJOR}) IF (WIN32) - SET_TARGET_PROPERTIES (laview-latex-struct PROPERTIES PREFIX "" IMPORT_PREFIX "" SUFFIX "-${MAJOR}.dll") + SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES PREFIX "" IMPORT_PREFIX "" SUFFIX "-${MAJOR}.dll") ENDIF (WIN32) IF (UNIX) - INSTALL (TARGETS laview-latex-struct DESTINATION lib) + INSTALL (TARGETS ${PROJ_LCASE} DESTINATION lib) ELSEIF (WIN32) - INSTALL (TARGETS laview-latex-struct + INSTALL (TARGETS ${PROJ_LCASE} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ENDIF (UNIX) -INSTALL (FILES ${CMAKE_BINARY_DIR}/src/laview-latex-struct-${MAJOR}.h DESTINATION include) +INSTALL (FILES ${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.h DESTINATION include) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6fac8b4..f058ffb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,24 +14,24 @@ FILE (GLOB_RECURSE ParseTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test ParseTest. VALA_PRECOMPILE (ParseTest_C ${ParseTestSources} PACKAGES gee-0.8 posix OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/laview-latex-struct-${MAJOR}.vapi + CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}_internal.vapi GENERATE_VAPI GENERATE_HEADER ) ADD_EXECUTABLE (ParseTest ${ParseTest_C}) -TARGET_LINK_LIBRARIES (ParseTest laview-latex-struct ${GEE_LIBRARIES}) +TARGET_LINK_LIBRARIES (ParseTest ${PROJ_LCASE} ${GEE_LIBRARIES}) # add ltable_test executable FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test LTableTest.vala) VALA_PRECOMPILE (LTableTest_C ${LTableTestSources} PACKAGES gee-0.8 posix OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/laview-latex-struct-${MAJOR}.vapi + CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}_internal.vapi GENERATE_VAPI GENERATE_HEADER ) ADD_EXECUTABLE (LTableTest ${LTableTest_C}) -TARGET_LINK_LIBRARIES (LTableTest laview-latex-struct ${GEE_LIBRARIES}) +TARGET_LINK_LIBRARIES (LTableTest ${PROJ_LCASE} ${GEE_LIBRARIES}) # parsing test macro MACRO (do_parse_test testname table_path etalon_path regexp) From 592e75d484a87cb0cf24f8acc1a80cf7903c6e9c Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 23 Jul 2014 18:18:46 +0400 Subject: [PATCH 2/8] Use Vala's 'is' syntax instead of .get_type().name(). --- test/LTableTest.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/LTableTest.vala b/test/LTableTest.vala index 2e25d86..1d930c9 100644 --- a/test/LTableTest.vala +++ b/test/LTableTest.vala @@ -44,7 +44,7 @@ public class Main : Object { foreach (var subdoc in doc) { stdout.printf ("%s\n", subdoc.get_type ().name ()); - if (subdoc.get_type ().name () == "LAviewTableLongtable") { + if (subdoc is Table.Longtable) { var ltable = subdoc as Table.Longtable; if (args[3] == "rm0row") { @@ -80,7 +80,7 @@ public class Main : Object { stdout.printf ("Incorrect operation '%s' specified.\n", args[3]); return -1; } - } else if (subdoc.get_type ().name () == "LAviewTableTabular") { + } else if (subdoc is Table.Tabular) { if (args[3] == "append_row0") { var tabular = subdoc as Table.Tabular; var table = tabular.table; From cd955915a917460fa1431204a4820f94b7c6d16b Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 25 Jul 2014 18:30:55 +0400 Subject: [PATCH 3/8] Mark class names with monospace font. --- src/AddSpace.vala | 6 +++--- src/AddSpaces.vala | 6 +++--- src/Cell.vala | 6 +++--- src/ColParam.vala | 6 +++--- src/ColParams.vala | 2 +- src/DocIfaces.vala | 12 ++++++------ src/Glob.vala | 2 +- src/Graphics.vala | 6 +++--- src/Longtable.vala | 6 +++--- src/Row.vala | 36 ++++++++++++++++++------------------ src/Subtable.vala | 18 +++++++++--------- src/Table.vala | 4 ++-- src/Tabular.vala | 6 +++--- src/Text.vala | 6 +++--- 14 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/AddSpace.vala b/src/AddSpace.vala index 2fd6523..f06a258 100644 --- a/src/AddSpace.vala +++ b/src/AddSpace.vala @@ -16,7 +16,7 @@ namespace LAview { public string height = ""; /** - * Constructs a new //AddSpace// based on value. + * Constructs a new ``AddSpace`` based on value. * * @param height [0-9]+{bp,cc,cm,dd,em,ex,in,mm,pc,pt,sp} <
> * or [0-9]+.[0-9][0-9]{\textwidth,columnwidth,paperwidth,linewidth,textheight,paperheight} @@ -28,14 +28,14 @@ namespace LAview { private AddSpace () {} /** - * Gets a copy of the //AddSpace//. + * Gets a copy of the ``AddSpace``. */ public override IDoc copy () { return new AddSpace.with_params (height); } /** - * Generates LaTeX string for the //AddSpace//. + * Generates LaTeX string for the ``AddSpace``. */ public override string generate () { return height; diff --git a/src/AddSpaces.vala b/src/AddSpaces.vala index a471dab..088f19b 100644 --- a/src/AddSpaces.vala +++ b/src/AddSpaces.vala @@ -29,14 +29,14 @@ namespace LAview { public Style style = Style.DEFAULT; /** - * Constructs a new empty //AddSpaces//. + * Constructs a new empty ``AddSpaces``. */ public AddSpaces () {} protected override ADocList create_default_instance () { return new AddSpaces (); } /** - * Gets a copy of the //AddSpaces//. + * Gets a copy of the ``AddSpaces``. */ public override IDoc copy () { var clone = base.copy () as AddSpaces; @@ -45,7 +45,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //AddSpaces//. + * Generates LaTeX string for the ``AddSpaces``. */ public override string generate () { var result = new StringBuilder (); diff --git a/src/Cell.vala b/src/Cell.vala index 94ba9ad..1b3ace7 100644 --- a/src/Cell.vala +++ b/src/Cell.vala @@ -97,7 +97,7 @@ namespace LAview { } /** - * Constructs a new //Cell// based on it's properties. + * Constructs a new ``Cell`` based on it's properties. */ public Cell.with_params (Multitype multitype, uint ncells, uint nllines, string align, uint nrlines, uint noverlines, uint nunderlines, @@ -117,7 +117,7 @@ namespace LAview { private Cell () {} /** - * Gets a copy of the //Cell//. + * Gets a copy of the ``Cell``. */ public override IDoc copy () { return new Cell.with_params (multitype, ncells, nllines, align, nrlines, @@ -125,7 +125,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //Cell//. + * Generates LaTeX string for the ``Cell``. */ public override string generate () { var result = new StringBuilder (before), diff --git a/src/ColParam.vala b/src/ColParam.vala index 9eae593..687a176 100644 --- a/src/ColParam.vala +++ b/src/ColParam.vala @@ -25,7 +25,7 @@ namespace LAview { public uint nrlines; /** - * Constructs a new //ColParam// by it's properties. + * Constructs a new ``ColParam`` by it's properties. */ public ColParam.with_params (uint nllines = 1, string align = "c", @@ -38,14 +38,14 @@ namespace LAview { private ColParam () {} /** - * Gets a copy of the //ColParam//. + * Gets a copy of the ``ColParam``. */ public override IDoc copy () { return new ColParam.with_params (nllines, align, nrlines); } /** - * Generates LaTeX string for the //ColParam//. + * Generates LaTeX string for the ``ColParam``. */ public override string generate () { var result = new StringBuilder (); diff --git a/src/ColParams.vala b/src/ColParams.vala index 453230b..1dea434 100644 --- a/src/ColParams.vala +++ b/src/ColParams.vala @@ -10,7 +10,7 @@ namespace LAview { protected override ADocList create_default_instance () { return new ColParams (); } /** - * Constructs a new empty //ColParams//. + * Constructs a new empty ``ColParams``. */ public ColParams () {} } diff --git a/src/DocIfaces.vala b/src/DocIfaces.vala index cdb2b87..826612d 100644 --- a/src/DocIfaces.vala +++ b/src/DocIfaces.vala @@ -6,12 +6,12 @@ namespace LAview { public interface IDoc : Object { /** - * Gets a copy of the //IDoc//. + * Gets a copy of the ``IDoc``. */ public abstract IDoc copy (); /** - * Generates LaTeX string for the //IDoc//. + * Generates LaTeX string for the ``IDoc``. */ public abstract string generate (); } @@ -24,14 +24,14 @@ namespace LAview { protected ADoc () {} /** - * Gets a copy of the //ADoc//. + * Gets a copy of the ``ADoc``. */ public virtual IDoc copy () { return Object.new (this.get_type ()) as IDoc; } /** - * Generates LaTeX string for the //ADoc//. + * Generates LaTeX string for the ``ADoc``. */ public virtual string generate () { return ""; } } @@ -49,7 +49,7 @@ namespace LAview { protected abstract ADocList create_default_instance (); /** - * Gets a copy of the //ADocList//. + * Gets a copy of the ``ADocList``. */ public virtual IDoc copy () { var clone = create_default_instance (); @@ -61,7 +61,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //ADocList//. + * Generates LaTeX string for the ``ADocList``. */ public virtual string generate () { var result = new StringBuilder (); diff --git a/src/Glob.vala b/src/Glob.vala index aa427b3..84ae9bb 100644 --- a/src/Glob.vala +++ b/src/Glob.vala @@ -8,7 +8,7 @@ namespace LAview { protected override ADocList create_default_instance () { return new Glob (); } /** - * Constructs a new empty //Glob//. + * Constructs a new empty ``Glob``. */ public Glob () {} } diff --git a/src/Graphics.vala b/src/Graphics.vala index 76c2a69..6487787 100644 --- a/src/Graphics.vala +++ b/src/Graphics.vala @@ -50,7 +50,7 @@ namespace LAview { public string height_unit = ""; /** - * Constructs a new //Graphics// by it's properties. + * Constructs a new ``Graphics`` by it's properties. * * @param path path to the image on the disk. */ @@ -61,7 +61,7 @@ namespace LAview { private Graphics () {} /** - * Gets a copy of the //Graphics//. + * Gets a copy of the ``Graphics``. */ public override IDoc copy () { var clone = new Graphics.with_params (path); @@ -74,7 +74,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //Graphics//. + * Generates LaTeX string for the ``Graphics``. */ public override string generate () { var str = new StringBuilder ("\\includegraphics["); diff --git a/src/Longtable.vala b/src/Longtable.vala index ea89314..d3bb462 100644 --- a/src/Longtable.vala +++ b/src/Longtable.vala @@ -10,19 +10,19 @@ namespace LAview { public class Longtable : ATable { /** - * Constructs a new //Longtable// with default parameters. + * Constructs a new ``Longtable`` with default parameters. */ public Longtable () {} /** - * Gets a copy of the //Longtable//. + * Gets a copy of the ``Longtable``. */ public override IDoc copy () { return base.copy (); } /** - * Generates LaTeX string for the //Longtable//. + * Generates LaTeX string for the ``Longtable``. */ public override string generate () { var s = new StringBuilder (); diff --git a/src/Row.vala b/src/Row.vala index c6d5d59..b9bc0d9 100644 --- a/src/Row.vala +++ b/src/Row.vala @@ -18,28 +18,28 @@ namespace LAview { DEFAULT = 0, /** - * Formal style for the first //Row// in the {@link Subtable}. + * Formal style for the first ``Row`` in the {@link Subtable}. */ FORMAL_FIRST, /** - * Formal style for the middle //Row// in the {@link Subtable}. + * Formal style for the middle ``Row`` in the {@link Subtable}. */ FORMAL_REST, /** - * Formal style for the last //Row// in the {@link Subtable}. + * Formal style for the last ``Row`` in the {@link Subtable}. */ FORMAL_LAST, /** - * Formal style for a single //Row// in the {@link Subtable}. + * Formal style for a single ``Row`` in the {@link Subtable}. */ FORMAL_SINGLE } /** - * Style of any operation on {@link ATable}/{@link Subtable} or //Row// + * Style of any operation on {@link ATable}/{@link Subtable} or ``Row`` * for lines preserving/creation. */ public enum OpLineStyle { @@ -86,12 +86,12 @@ namespace LAview { } /** - * Any text before the //Row//. + * Any text before the ``Row``. */ public string before = ""; /** - * Style of any operation on {@link ATable}/{@link Subtable} or //Row// + * Style of any operation on {@link ATable}/{@link Subtable} or ``Row`` * for lines preserving/creation. */ public Style style; @@ -112,35 +112,35 @@ namespace LAview { public AddSpaces between = new AddSpaces (); /** - * Type of horizontal lines for the //Row//. + * Type of horizontal lines for the ``Row``. */ public enum LinesType { /** - * //Row// has no horizontal lines. + * ``Row`` has no horizontal lines. */ NONE = 0, /** - * //Row// has continuous horizontal line on the top. + * ``Row`` has continuous horizontal line on the top. */ HLINE, /** - * //Row// has noncontinuous horizontal line on the top. + * ``Row`` has noncontinuous horizontal line on the top. */ CLINES } /** - * Constructs a new empty //Row//. + * Constructs a new empty ``Row``. */ public Row () {} protected override ADocList create_default_instance () { return new Row (); } /** - * Gets a copy of the //Row//. + * Gets a copy of the ``Row``. */ public override IDoc copy () { var clone = base.copy () as Row; @@ -315,7 +315,7 @@ namespace LAview { } /** - * Removes a {@link Cell} from the //Row//. + * Removes a {@link Cell} from the ``Row``. * * @param cell {@link Cell} to remove. * @param line_style {@link Row.OpLineStyle} of the operation. @@ -328,7 +328,7 @@ namespace LAview { } /** - * Removes a {@link Cell} from the //Row// at specified position. + * Removes a {@link Cell} from the ``Row`` at specified position. * * @param index position of the {@link Cell} to remove. * @param line_style {@link Row.OpLineStyle} of the operation. @@ -362,7 +362,7 @@ namespace LAview { } /** - * Inserts a {@link Cell} to the //Row// to specified position. + * Inserts a {@link Cell} to the ``Row`` to specified position. * * @param index position to insert the {@link Cell}. * @param cell {@link Cell} to insert. @@ -374,7 +374,7 @@ namespace LAview { } /** - * Adds a {@link Cell} to the //Row//. + * Adds a {@link Cell} to the ``Row``. * * @param cell {@link Cell} to add. * @param line_style {@link Row.OpLineStyle} of the operation. @@ -385,7 +385,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //Row//. + * Generates LaTeX string for the ``Row``. */ public override string generate () { var s = new StringBuilder (); diff --git a/src/Subtable.vala b/src/Subtable.vala index 3ef62e8..66de581 100644 --- a/src/Subtable.vala +++ b/src/Subtable.vala @@ -13,12 +13,12 @@ namespace LAview { public string caption = ""; /** - * Any text before the //Subtable//. + * Any text before the ``Subtable``. */ public string before = ""; /** - * Any text after the //Subtable//. + * Any text after the ``Subtable``. */ public string after = ""; @@ -30,12 +30,12 @@ namespace LAview { protected override ADocList create_default_instance () { return new Subtable (); } /** - * Constructs a new empty //Subtable//. + * Constructs a new empty ``Subtable``. */ public Subtable () {} /** - * Gets a copy of the //Subtable//. + * Gets a copy of the ``Subtable``. */ public override IDoc copy () { var clone = base.copy () as Subtable; @@ -210,7 +210,7 @@ namespace LAview { } /** - * Removes {@link Row} from from //Subtable//. + * Removes {@link Row} from from ``Subtable``. * * @param row {@link Row} to remove. * @param line_style {@link Row.OpLineStyle} of the operation. @@ -223,7 +223,7 @@ namespace LAview { } /** - * Removes a {@link Row} from the //Subtable// at specified position. + * Removes a {@link Row} from the ``Subtable`` at specified position. * * @param index position of the {@link Row} to remove. * @param line_style {@link Row.OpLineStyle} of the operation. @@ -245,7 +245,7 @@ namespace LAview { } /** - * Inserts a {@link Row} to the //Subtable// to specified position. + * Inserts a {@link Row} to the ``Subtable`` to specified position. * * @param index position to insert the {@link Row}. * @param row {@link Row} to insert. @@ -257,7 +257,7 @@ namespace LAview { } /** - * Adds a {@link Row} to the //Subtable//. + * Adds a {@link Row} to the ``Subtable``. * * @param row {@link Row} to add. * @param line_style {@link Row.OpLineStyle} of the operation. @@ -309,7 +309,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //Subtable//. + * Generates LaTeX string for the ``Subtable``. */ public override string generate () { var s = new StringBuilder (); diff --git a/src/Table.vala b/src/Table.vala index c565863..1fad106 100644 --- a/src/Table.vala +++ b/src/Table.vala @@ -55,7 +55,7 @@ namespace LAview { protected ATable () {} /** - * Gets a copy of the //Table//. + * Gets a copy of the ``ATable``. */ public override IDoc copy () { var clone = Object.new (this.get_type ()) as ATable; @@ -73,7 +73,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //Table//. + * Generates LaTeX string for the ``ATable``. */ public override string generate () { assert (false); diff --git a/src/Tabular.vala b/src/Tabular.vala index 10cb847..84c290b 100644 --- a/src/Tabular.vala +++ b/src/Tabular.vala @@ -10,7 +10,7 @@ namespace LAview { public class Tabular : ATable { /** - * Constructs a new //Tabular// with default parameters. + * Constructs a new ``Tabular`` with default parameters. */ public Tabular () {} @@ -24,7 +24,7 @@ namespace LAview { public string width = ""; /** - * Gets a copy of the //Tabular//. + * Gets a copy of the ``Tabular``. */ public override IDoc copy () { var clone = base.copy () as Tabular; @@ -33,7 +33,7 @@ namespace LAview { } /** - * Generates LaTeX string for the //Tabular//. + * Generates LaTeX string for the ``Tabular``. */ public override string generate () { var s = new StringBuilder (); diff --git a/src/Text.vala b/src/Text.vala index 6bb1995..e39f5fd 100644 --- a/src/Text.vala +++ b/src/Text.vala @@ -11,7 +11,7 @@ namespace LAview { public string text = ""; /** - * Constructs a new //Text//. + * Constructs a new ``Text``. * * @param text UTF-8 string. */ @@ -20,14 +20,14 @@ namespace LAview { } /** - * Gets a copy of the //Text//. + * Gets a copy of the ``Text``. */ public override IDoc copy () { return new Text (text); } /** - * Generates LaTeX string for the //Text//. + * Generates LaTeX string for the ``Text``. */ public override string generate () { return text; From 87457ff03e96249b26e1d5535b5b6db580f7e003 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 26 Jul 2014 17:02:45 +0400 Subject: [PATCH 4/8] Do not use internal vapi in external executables. --- test/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f058ffb..0ba40bc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,12 +9,12 @@ INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS}) INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}") INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src") -# add the executable +# add parse_test executable FILE (GLOB_RECURSE ParseTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test ParseTest.vala) VALA_PRECOMPILE (ParseTest_C ${ParseTestSources} PACKAGES gee-0.8 posix OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}_internal.vapi + CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi GENERATE_VAPI GENERATE_HEADER ) @@ -26,7 +26,7 @@ FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test LTableTes VALA_PRECOMPILE (LTableTest_C ${LTableTestSources} PACKAGES gee-0.8 posix OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}_internal.vapi + CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi GENERATE_VAPI GENERATE_HEADER ) From 62b56bcbb05bd27ca725c4597afa9b7c49b66b05 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 25 Jul 2014 18:29:22 +0400 Subject: [PATCH 5/8] ATable::split () added. Split an ATable into several ATables by columns according to the limits. --- po/laview-latex-struct-0.pot | 14 ++- po/ru/laview-latex-struct-0.po | 14 ++- src/Table.vala | 156 +++++++++++++++++++++++++++++- test/CMakeLists.txt | 26 +++++ test/SplitTest.vala | 137 ++++++++++++++++++++++++++ test/tex/limits1.in | 3 + test/tex/limits_table1.etalon.tex | 127 ++++++++++++++++++++++++ test/tex/limits_table1.tex | 46 +++++++++ 8 files changed, 520 insertions(+), 3 deletions(-) create mode 100644 test/SplitTest.vala create mode 100644 test/tex/limits1.in create mode 100644 test/tex/limits_table1.etalon.tex create mode 100644 test/tex/limits_table1.tex diff --git a/po/laview-latex-struct-0.pot b/po/laview-latex-struct-0.pot index 6504219..44b4dcd 100644 --- a/po/laview-latex-struct-0.pot +++ b/po/laview-latex-struct-0.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: laview-latex-struct-0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-07-18 18:10+0400\n" +"POT-Creation-Date: 2014-07-31 18:16+0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,6 +41,18 @@ msgstr "" msgid "Incorrect longtable parameters doesn't match '%s' regexp." msgstr "" +#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298 +msgid "2nd param (ATable) isn't a child of the 1st (Glob)." +msgstr "" + +#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312 +msgid "3rd param (limits) is incorrect. Read the manual." +msgstr "" + +#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329 +msgid "Cann't split the table. Read the manual." +msgstr "" + #: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413 #, c-format msgid "Unexpected end external tag sequence '%s' without begin tag pair." diff --git a/po/ru/laview-latex-struct-0.po b/po/ru/laview-latex-struct-0.po index 0b48ef4..dfa2a2f 100644 --- a/po/ru/laview-latex-struct-0.po +++ b/po/ru/laview-latex-struct-0.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: laview-latex-struct-0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-07-18 18:10+0400\n" +"POT-Creation-Date: 2014-07-31 18:16+0400\n" "PO-Revision-Date: 2014-05-28 10:50+0400\n" "Last-Translator: \n" "Language-Team: Russian\n" @@ -44,6 +44,18 @@ msgstr "Ошибка разбора поддокумента." msgid "Incorrect longtable parameters doesn't match '%s' regexp." msgstr "Неверные параметры longtable не удовлетворяют рег. выражению '%s'." +#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298 +msgid "2nd param (ATable) isn't a child of the 1st (Glob)." +msgstr "2-ой параметр (ATable) не является дочерним узлом 1-ого (Glob)." + +#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312 +msgid "3rd param (limits) is incorrect. Read the manual." +msgstr "3-ий параметр (limits) не верный. Смотрите документацию." + +#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329 +msgid "Cann't split the table. Read the manual." +msgstr "Невозможно разбить таблицу. Смотрите документацию." + #: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413 #, c-format msgid "Unexpected end external tag sequence '%s' without begin tag pair." diff --git a/src/Table.vala b/src/Table.vala index 1fad106..366a6cd 100644 --- a/src/Table.vala +++ b/src/Table.vala @@ -5,6 +5,27 @@ namespace LAview { */ namespace Table { + /** + * Any error at ``ATable`` splitting. + */ + public errordomain SplitError { + + /** + * ``ATable`` isn't a child of the {@link Glob}. + */ + ISNT_CHILD, + + /** + * Any errors in the split indexes. + */ + INDEX_ERROR, + + /** + * Any other error. + */ + OTHER, + } + /** * Any Table in the LaTeX document. */ @@ -58,7 +79,7 @@ namespace LAview { * Gets a copy of the ``ATable``. */ public override IDoc copy () { - var clone = Object.new (this.get_type ()) as ATable; + var clone = Object.new (get_type ()) as ATable; clone.align = align; clone.style = style; @@ -176,6 +197,139 @@ namespace LAview { last_footer.clone_col (src_index, dest_index, multicol, line_style); table.clone_col (src_index, dest_index, multicol, line_style); } + + /** + * Bounds of the ``ATable`` to split. + */ + public struct SplitLimit { + + /** + * First column index [0; last]. + */ + uint first; + + /** + * Last column index [first; ncols - 1]. + */ + uint last; + + /** + * Maximum of columns per page [1; ncols]. + */ + uint max_cols; + } + + bool check_limits (Array sorted_limits) { + /* check nearby limits */ + for (var i = 1; i < sorted_limits.length; ++i) + if (sorted_limits.index (i - 1).last >= sorted_limits.index (i).first + || sorted_limits.index (i).first > sorted_limits.index (i).last) + return false; + + /* check limits of the first and last elements */ + if (sorted_limits.index (0).first > sorted_limits.index (0).last + || params.size <= sorted_limits.index (sorted_limits.length - 1).last) + return false; + + return true; + } + + uint [] get_indexes (Array sorted_limits) { + var lim_indexes = new uint[sorted_limits.length]; + for (var i = 0; i < sorted_limits.length; ++i) + lim_indexes[i] = sorted_limits.index (i).first; + return lim_indexes; + } + + ATable? split_table (Array sorted_limits, uint [] lim_indexes, + Row.OpLineStyle line_style) { + + var return_table = copy () as ATable; + bool split_finish = true; + + /* removing spare columns */ + for (uint i = sorted_limits.length - 1; i < sorted_limits.length; --i) { // group + for (uint j = sorted_limits.index (i).last; + j >= lim_indexes[i] + sorted_limits.index (i).max_cols + && j <= sorted_limits.index (i).last; --j) + return_table.remove_col ((int)j, line_style); + + for (uint j = lim_indexes[i] - 1; j >= sorted_limits.index (i).first && j < lim_indexes[i]; --j) + return_table.remove_col ((int)j, line_style); + + /* count indexes */ + if (lim_indexes[i] <= sorted_limits.index (i).last) { + split_finish = false; + lim_indexes[i] += sorted_limits.index (i).max_cols; + } + } + + /* did any indexes updated */ + if (split_finish) + return null; + + return return_table; + } + + /** + * Split an ``ATable`` into several ``ATable``s by columns according to the limits. + * + * For example: table<
> + * ``[fix1 fix2 colA1 colA2 colA3 colA4 colA5 fix3 fix4 colB1 colB2 colB3 colB4 fix5 fix6]``<
> + * with limits { {2, 6, 2}, {9, 12, 3} }<
> + * will be splitted into 3 tables<
> + * [fix1 fix2 colA1 colA2 fix3 fix4 colB1 colB2 colB3 fix5 fix6]<
> + * [fix1 fix2 colA3 colA4 fix3 fix4 colB4 fix6]<
> + * [fix1 fix2 colA5 fix3 fix4 fix6]<
> + * 3rd param 'limits'. For all elements following conditions should be satisfied. + * last[i] < first[i+1], 0 <= first[i] <= last[i] <= ncols-1, 1 <= max_cols <= ncols. + * + * @param glob {@link Glob} document with a ``ATable``. + * @param limits array of {@link SplitLimit}s. + * @param line_style {@link Row.OpLineStyle} of the operation. + * + * @return number of ``ATable``s the table splitted to. + */ + public uint split (Glob glob, Array limits, + Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) throws SplitError { + /* is table a child of glob */ + var glob_index = glob.index_of (this); + if (glob_index == -1) + throw new SplitError.ISNT_CHILD (_("2nd param (ATable) isn't a child of the 1st (Glob).")); + + /* sorting limits */ + var sorted_limits = new Array.sized (false, false, sizeof (SplitLimit), limits.length); + sorted_limits.append_vals (limits.data, limits.length); + + sorted_limits.sort ((ref a, ref b) => { + if (a.first < b.first) return -1; + if (a.first > b.first) return 1; + return 0; + }); + + /* checking limits for intersections */ + if (!check_limits (sorted_limits)) + throw new SplitError.INDEX_ERROR (_("3rd param (limits) is incorrect. Read the manual.")); + + /* 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))) { + glob.insert (part_idx++, temp_table); + ++result; + } + + /* remove table from the doc */ + if (result != 0) + glob.remove_at (glob_index); + else + throw new SplitError.OTHER (_("Cann't split the table. Read the manual.")); + + return result; + } } } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0ba40bc..7b1cdb3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,6 +33,18 @@ VALA_PRECOMPILE (LTableTest_C ${LTableTestSources} ADD_EXECUTABLE (LTableTest ${LTableTest_C}) TARGET_LINK_LIBRARIES (LTableTest ${PROJ_LCASE} ${GEE_LIBRARIES}) +# add split_test executable +FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test SplitTest.vala) +VALA_PRECOMPILE (SplitTest_C ${LTableTestSources} + PACKAGES gee-0.8 posix + OPTIONS --thread ${VALA_DEBUG} + CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi + GENERATE_VAPI + GENERATE_HEADER + ) +ADD_EXECUTABLE (SplitTest ${SplitTest_C}) +TARGET_LINK_LIBRARIES (SplitTest ${PROJ_LCASE} ${GEE_LIBRARIES}) + # parsing test macro MACRO (do_parse_test testname table_path etalon_path regexp) IF ("${etalon_path}" STREQUAL "") @@ -386,5 +398,19 @@ ltable_test (clone_1000_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_ ltable_test (append_row0 ${PROJECT_SOURCE_DIR}/test/tex/table_rows.tex ${PROJECT_SOURCE_DIR}/test/tex/table_rows.etalon.tex append_row0 "Etalon and generated text are EQUAL .-.") +MACRO (do_split_test testname limits table etalon regexp) + ADD_TEST (split_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SplitTest + --limits ${limits} --table ${table} --etalon ${etalon}) +SET_TESTS_PROPERTIES (split_test-${testname} + PROPERTIES PASS_REGULAR_EXPRESSION ${regexp} + FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING") +ENDMACRO (do_split_test) + +# test TeXReport_splitLongtable () function +do_split_test (split_test ${PROJECT_SOURCE_DIR}/test/tex/limits1.in + ${PROJECT_SOURCE_DIR}/test/tex/limits_table1.tex + ${PROJECT_SOURCE_DIR}/test/tex/limits_table1.etalon.tex +"Etalon and generated text are EQUAL ...\n") + # enable testing ENABLE_TESTING () diff --git a/test/SplitTest.vala b/test/SplitTest.vala new file mode 100644 index 0000000..bc46218 --- /dev/null +++ b/test/SplitTest.vala @@ -0,0 +1,137 @@ +using LAview; + +public class Main : Object { + static string fname_limits = ""; + static string fname_table = ""; + static string fname_etalon = ""; + static string fname_write = ""; + + const OptionEntry [] options = { + { "limits", 'l', 0, OptionArg.FILENAME, ref fname_limits, "File with limits", null }, + { "table", 't', 0, OptionArg.FILENAME, ref fname_table, "File with a table", null }, + { "etalon", 'e', 0, OptionArg.FILENAME, ref fname_etalon, "File with etalon table", null }, + { "write", 'w', 0, OptionArg.FILENAME, ref fname_write, "File to write", null }, + { null } + }; + + public static int main (string [] args) { + + Intl.setlocale (LocaleCategory.ALL, ""); + + /* commandline arguments processing */ + try { + var opt_context = new OptionContext ("- tests LaTeX parser"); + opt_context.set_help_enabled (true); + opt_context.add_main_entries (options, null); + opt_context.parse (ref args); + } catch (OptionError e) { + stderr.printf ("error: %s\n", e.message); + stderr.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]); + return -1; + } + + /* read limits */ + if (fname_limits == null) { + stderr.printf ("Specify file with limits\n"); + return -1; + } + + var stream = FileStream.open (fname_limits, "r"); + if (stream == null) { + stdout.puts ("Cann't open limits file\n"); + return -1; + } + + uint lim[3] = { 0, 0, 0}; + var limits = new Array (); + + while (3 == stream.scanf ("%u %u %u", out lim[0], out lim[1], out lim[2])) { + var split_lim = Table.ATable.SplitLimit (); + split_lim.first = lim[0]; + split_lim.last = lim[1]; + split_lim.max_cols = lim[2]; + limits.append_val (split_lim); + } + + /* read table */ + if (fname_table == null) { + stderr.printf ("Specify file with a table or read help (%s --help)", args[0]); + return -1; + } + + /* load file contents */ + string contents; + try { + FileUtils.get_contents (fname_table, out contents); + } catch (FileError e) { + stderr.printf ("error: %s\n", e.message); + return -1; + } + + /* parse TeX */ + Glob doc; + try { + doc = LAview.parse (contents); + stdout.printf ("TeX document successfully parsed\n"); + + } catch (Parsers.ParseError e) { + stderr.printf ("Error parsing TeX document: %s\n", e.message); + return -1; + } + + /* find a longtable object */ + Table.Longtable table = null; + foreach (var subdoc in doc) { + if (subdoc is Table.Longtable) { + table = subdoc as Table.Longtable; + break; + } + } + + if (table == null) { + stderr.puts ("longtable object not found\n"); + return -1; + } + + /* split the table */ + try { + table.split (doc, limits); + } catch (Table.SplitError e) { + stderr.puts (e.message); + return -1; + } + + /* load etalon file */ + if (fname_etalon != null) { + try { + FileUtils.get_contents (fname_etalon, out contents); + } catch (FileError e) { + stderr.printf ("error: %s\n", e.message); + return -1; + } + } + + /* generate */ + var generated = doc.generate (); + + /* compare with an etalon */ + if (contents == generated) + stdout.puts ("Etalon and generated text are EQUAL ;-)\n"); + else + stdout.puts ("Etalon and generated text are NOT EQUAL ;-(\n"); + + stdout.printf ("--- Generated plain-TeX (generated) ---\n%s", generated); + + /* write to file */ + if (fname_write != null ) + try { + FileUtils.set_contents (fname_write, generated); + } catch (FileError e) { + stderr.printf ("error: %s\n", e.message); + return -1; + } + + return 0; + } + +} diff --git a/test/tex/limits1.in b/test/tex/limits1.in new file mode 100644 index 0000000..9f17b03 --- /dev/null +++ b/test/tex/limits1.in @@ -0,0 +1,3 @@ +9 11 3 +2 6 2 +13 16 1 diff --git a/test/tex/limits_table1.etalon.tex b/test/tex/limits_table1.etalon.tex new file mode 100644 index 0000000..4b19a19 --- /dev/null +++ b/test/tex/limits_table1.etalon.tex @@ -0,0 +1,127 @@ +%% LyX 2.0.3 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[english]{article} +\usepackage[T1]{fontenc} +\usepackage[latin9]{inputenc} +\usepackage{longtable} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. +%% Because html converters don't know tabularnewline +\providecommand{\tabularnewline}{\\} + +\makeatother + +\usepackage{babel} +\begin{document} +\begin{longtable}{|c|c|c|c|c|c|c|c|c|c|c|c|} +\hline +fh1 & fh2 & fh3 & fh4 & fh8 & fh9 & fh10 & fh11 & fh12 & fh13 & fh14 & fh18\tabularnewline +\endfirsthead +\hline +h1 & h2 & h3 & h4 & h8 & h9 & h10 & h11 & h12 & h13 & h14 & h18\tabularnewline +\endhead +\hline +f1 & f2 & f3 & f4 & f8 & f9 & f10 & f11 & f12 & f13 & f14 & f18\tabularnewline +\hline +a1 & a2 & a3 & a4 & a8 & a9 & a10 & a11 & a12 & a13 & a14 & a18\tabularnewline +\hline +\hline +b1 & b2 & \multicolumn{2}{c|}{b3} & b8 & b9 & b10 & b11 & b12 & b13 & b14 & \multicolumn{1}{c|}{b15}\tabularnewline +\hline +\multicolumn{4}{|c|}{c1} & c8 & c9 & \multicolumn{3}{c|}{c10} & c13 & c14 & c18\tabularnewline +\hline +d1 & d2 & d3 & \multicolumn{6}{c|}{d4} & d13 & d14 & \multicolumn{1}{c|}{d16}\tabularnewline +\hline +\multicolumn{4}{|c|}{e1} & e8 & e9 & e10 & e11 & \multicolumn{3}{c|}{e12} & e18\tabularnewline +\hline +g1 & g2 & \multicolumn{9}{c|}{g3} & g18\tabularnewline +\hline +\multicolumn{11}{|c|}{i1} & i3\tabularnewline +\hline +j1 & \multicolumn{11}{c|}{j2}\tabularnewline +\hline +\end{longtable}\begin{longtable}{|c|c|c|c|c|c|c|c|c|} +\hline +fh1 & fh2 & fh5 & fh6 & fh8 & fh9 & fh13 & fh15 & fh18\tabularnewline +\endfirsthead +\hline +h1 & h2 & h5 & h6 & h8 & h9 & h13 & h15 & h18\tabularnewline +\endhead +\hline +f1 & f2 & f5 & f6 & f8 & f9 & f13 & f15 & f18\tabularnewline +\hline +a1 & a2 & a5 & a6 & a8 & a9 & a13 & a15 & a18\tabularnewline +\hline +\hline +b1 & b2 & \multicolumn{2}{c|}{b3} & b8 & b9 & b13 & \multicolumn{2}{c|}{b15}\tabularnewline +\hline +\multicolumn{2}{|c|}{c1} & c5 & c6 & c8 & c9 & c13 & c15 & c18\tabularnewline +\hline +d1 & d2 & \multicolumn{4}{c|}{d4} & d13 & d15 & \multicolumn{1}{c|}{d16}\tabularnewline +\hline +\multicolumn{3}{|c|}{e1} & e6 & e8 & e9 & \multicolumn{2}{c|}{e12} & e18\tabularnewline +\hline +g1 & g2 & \multicolumn{6}{c|}{g3} & g18\tabularnewline +\hline +\multicolumn{8}{|c|}{i1} & i3\tabularnewline +\hline +j1 & \multicolumn{8}{c|}{j2}\tabularnewline +\hline +\end{longtable}\begin{longtable}{|c|c|c|c|c|c|c|c|} +\hline +fh1 & fh2 & fh7 & fh8 & fh9 & fh13 & fh16 & fh18\tabularnewline +\endfirsthead +\hline +h1 & h2 & h7 & h8 & h9 & h13 & h16 & h18\tabularnewline +\endhead +\hline +f1 & f2 & f7 & f8 & f9 & f13 & f16 & f18\tabularnewline +\hline +a1 & a2 & a7 & a8 & a9 & a13 & a16 & a18\tabularnewline +\hline +\hline +b1 & b2 & \multicolumn{1}{c|}{b3} & b8 & b9 & b13 & \multicolumn{2}{c|}{b15}\tabularnewline +\hline +\multicolumn{2}{|c|}{c1} & c7 & c8 & c9 & c13 & c16 & c18\tabularnewline +\hline +d1 & d2 & \multicolumn{3}{c|}{d4} & d13 & \multicolumn{2}{c|}{d16}\tabularnewline +\hline +\multicolumn{2}{|c|}{e1} & e7 & e8 & e9 & \multicolumn{1}{c|}{e12} & e16 & e18\tabularnewline +\hline +g1 & g2 & \multicolumn{5}{c|}{g3} & g18\tabularnewline +\hline +\multicolumn{7}{|c|}{i1} & i3\tabularnewline +\hline +j1 & \multicolumn{7}{c|}{j2}\tabularnewline +\hline +\end{longtable}\begin{longtable}{|c|c|c|c|c|c|} +\hline +fh1 & fh2 & fh9 & fh13 & fh17 & fh18\tabularnewline +\endfirsthead +\hline +h1 & h2 & h9 & h13 & h17 & h18\tabularnewline +\endhead +\hline +f1 & f2 & f9 & f13 & f17 & f18\tabularnewline +\hline +a1 & a2 & a9 & a13 & a17 & a18\tabularnewline +\hline +\hline +b1 & b2 & b9 & b13 & \multicolumn{2}{c|}{b15}\tabularnewline +\hline +\multicolumn{2}{|c|}{c1} & c9 & c13 & c17 & c18\tabularnewline +\hline +d1 & d2 & \multicolumn{1}{c|}{d4} & d13 & \multicolumn{2}{c|}{d16}\tabularnewline +\hline +\multicolumn{2}{|c|}{e1} & e9 & \multicolumn{1}{c|}{e12} & e17 & e18\tabularnewline +\hline +g1 & g2 & \multicolumn{2}{c|}{g3} & g17 & g18\tabularnewline +\hline +\multicolumn{4}{|c|}{i1} & i2 & i3\tabularnewline +\hline +j1 & \multicolumn{5}{c|}{j2}\tabularnewline +\hline +\end{longtable} +\end{document} diff --git a/test/tex/limits_table1.tex b/test/tex/limits_table1.tex new file mode 100644 index 0000000..2fa3c70 --- /dev/null +++ b/test/tex/limits_table1.tex @@ -0,0 +1,46 @@ +%% LyX 2.0.3 created this file. For more info, see http://www.lyx.org/. +%% Do not edit unless you really know what you are doing. +\documentclass[english]{article} +\usepackage[T1]{fontenc} +\usepackage[latin9]{inputenc} +\usepackage{longtable} + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. +%% Because html converters don't know tabularnewline +\providecommand{\tabularnewline}{\\} + +\makeatother + +\usepackage{babel} +\begin{document} +\begin{longtable}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} +\hline +fh1 & fh2 & fh3 & fh4 & fh5 & fh6 & fh7 & fh8 & fh9 & fh10 & fh11 & fh12 & fh13 & fh14 & fh15 & fh16 & fh17 & fh18\tabularnewline +\endfirsthead +\hline +h1 & h2 & h3 & h4 & h5 & h6 & h7 & h8 & h9 & h10 & h11 & h12 & h13 & h14 & h15 & h16 & h17 & h18\tabularnewline +\endhead +\hline +f1 & f2 & f3 & f4 & f5 & f6 & f7 & f8 & f9 & f10 & f11 & f12 & f13 & f14 & f15 & f16 & f17 & f18\tabularnewline +\hline +a1 & a2 & a3 & a4 & a5 & a6 & a7 & a8 & a9 & a10 & a11 & a12 & a13 & a14 & a15 & a16 & a17 & a18\tabularnewline +\hline +\hline +b1 & b2 & \multicolumn{5}{c|}{b3} & b8 & b9 & b10 & b11 & b12 & b13 & b14 & \multicolumn{4}{c|}{b15}\tabularnewline +\hline +\multicolumn{4}{|c|}{c1} & c5 & c6 & c7 & c8 & c9 & \multicolumn{3}{c|}{c10} & c13 & c14 & c15 & c16 & c17 & c18\tabularnewline +\hline +d1 & d2 & d3 & \multicolumn{9}{c|}{d4} & d13 & d14 & d15 & \multicolumn{3}{c|}{d16}\tabularnewline +\hline +\multicolumn{5}{|c|}{e1} & e6 & e7 & e8 & e9 & e10 & e11 & \multicolumn{4}{c|}{e12} & e16 & e17 & e18\tabularnewline +\hline +g1 & g2 & \multicolumn{14}{c|}{g3} & g17 & g18\tabularnewline +\hline +\multicolumn{16}{|c|}{i1} & i2 & i3\tabularnewline +\hline +j1 & \multicolumn{17}{c|}{j2}\tabularnewline +\hline +\end{longtable} +\end{document} From 763bae902da15e0b8ba1dfe6e82c89c7d43b2df0 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 1 Aug 2014 14:39:26 +0400 Subject: [PATCH 6/8] Fix: assert in LINE_CLINES case. --- src/TableParser.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/TableParser.vala b/src/TableParser.vala index 17a82ec..c16a9de 100644 --- a/src/TableParser.vala +++ b/src/TableParser.vala @@ -265,6 +265,9 @@ namespace LAview { } break; case Row.LinesType.CLINES: + /* #85 Assert in LINE_CLINES case */ + if (row.size == 0 && subtable.size == 0) + break; var tmp_row = row.size != 0 ? row : subtable.get (subtable.size - 1) as Row; unowned List clines_p = clines.first (); foreach (var cell in tmp_row as Gee.ArrayList) { From 5bfa613f47034a97221a586a775625418cf1a383 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 26 Oct 2014 15:02:41 +0300 Subject: [PATCH 7/8] Closes #95: Switch to Backbone's CMake Scheme. --- .gitmodules | 6 + CMakeLists.txt | 132 +----- INSTALL | 27 +- cmake/CPackDetectArch.cmake | 20 - cmake/FindVala.cmake | 69 --- cmake/MacroOptionalAddSubdirectory.cmake | 31 -- cmake/UseVala.cmake | 180 -------- cmake/backbone | 1 + cpack/CMakeLists.txt | 11 + laview-latex-struct.pc.in | 11 - pkg-config/CMakeLists.txt | 22 + pkg-config/pkg-config.pc.in | 11 + po/CMakeLists.txt | 50 ++- po/gettext-config.h.in | 11 + po/laview-latex-struct-0.pot | 34 +- po/ru/laview-latex-struct-0.po | 34 +- src/CMakeLists.txt | 37 +- src/gettext-config.h.in | 11 - src/{ => latex-struct}/AddSpace.vala | 0 src/{ => latex-struct}/AddSpaces.vala | 0 src/latex-struct/CMakeLists.txt | 7 + src/{ => latex-struct}/Cell.vala | 0 src/{ => latex-struct}/ColParam.vala | 0 src/{ => latex-struct}/ColParams.vala | 0 src/{ => latex-struct}/DocIfaces.vala | 0 src/{ => latex-struct}/Glob.vala | 0 src/{ => latex-struct}/GlobParser.vala | 0 src/{ => latex-struct}/Graphics.vala | 0 src/{ => latex-struct}/GraphicsParser.vala | 0 src/{ => latex-struct}/Longtable.vala | 0 src/{ => latex-struct}/LongtableParser.vala | 0 src/{ => latex-struct}/Parser.vala | 0 src/{ => latex-struct}/ParserFactory.vala | 0 src/{ => latex-struct}/Row.vala | 0 src/{ => latex-struct}/Subtable.vala | 0 src/{ => latex-struct}/Table.vala | 0 src/{ => latex-struct}/TableParser.vala | 0 src/{ => latex-struct}/Tabular.vala | 0 src/{ => latex-struct}/TabularParser.vala | 0 src/{ => latex-struct}/Text.vala | 0 src/{ => latex-struct}/TextParser.vala | 0 src/{ => latex-struct}/main.vala | 0 ...la_unsupported.c => library_constructor.c} | 17 +- test/CMakeLists.txt | 419 +----------------- test/ltable-test/CMakeLists.txt | 88 ++++ test/{ => ltable-test}/LTableTest.vala | 0 test/parse-test/CMakeLists.txt | 326 ++++++++++++++ test/{ => parse-test}/ParseTest.vala | 0 test/split-test/CMakeLists.txt | 26 ++ test/{ => split-test}/SplitTest.vala | 0 util/backbone | 1 + util/update-po.sh | 48 -- util/valadoc.sh | 19 - valadoc_env | 2 +- 54 files changed, 625 insertions(+), 1026 deletions(-) create mode 100644 .gitmodules delete mode 100644 cmake/CPackDetectArch.cmake delete mode 100644 cmake/FindVala.cmake delete mode 100644 cmake/MacroOptionalAddSubdirectory.cmake delete mode 100644 cmake/UseVala.cmake create mode 160000 cmake/backbone create mode 100644 cpack/CMakeLists.txt delete mode 100644 laview-latex-struct.pc.in create mode 100644 pkg-config/CMakeLists.txt create mode 100644 pkg-config/pkg-config.pc.in create mode 100644 po/gettext-config.h.in delete mode 100644 src/gettext-config.h.in rename src/{ => latex-struct}/AddSpace.vala (100%) rename src/{ => latex-struct}/AddSpaces.vala (100%) create mode 100644 src/latex-struct/CMakeLists.txt rename src/{ => latex-struct}/Cell.vala (100%) rename src/{ => latex-struct}/ColParam.vala (100%) rename src/{ => latex-struct}/ColParams.vala (100%) rename src/{ => latex-struct}/DocIfaces.vala (100%) rename src/{ => latex-struct}/Glob.vala (100%) rename src/{ => latex-struct}/GlobParser.vala (100%) rename src/{ => latex-struct}/Graphics.vala (100%) rename src/{ => latex-struct}/GraphicsParser.vala (100%) rename src/{ => latex-struct}/Longtable.vala (100%) rename src/{ => latex-struct}/LongtableParser.vala (100%) rename src/{ => latex-struct}/Parser.vala (100%) rename src/{ => latex-struct}/ParserFactory.vala (100%) rename src/{ => latex-struct}/Row.vala (100%) rename src/{ => latex-struct}/Subtable.vala (100%) rename src/{ => latex-struct}/Table.vala (100%) rename src/{ => latex-struct}/TableParser.vala (100%) rename src/{ => latex-struct}/Tabular.vala (100%) rename src/{ => latex-struct}/TabularParser.vala (100%) rename src/{ => latex-struct}/Text.vala (100%) rename src/{ => latex-struct}/TextParser.vala (100%) rename src/{ => latex-struct}/main.vala (100%) rename src/{vala_unsupported.c => library_constructor.c} (61%) create mode 100644 test/ltable-test/CMakeLists.txt rename test/{ => ltable-test}/LTableTest.vala (100%) create mode 100644 test/parse-test/CMakeLists.txt rename test/{ => parse-test}/ParseTest.vala (100%) create mode 100644 test/split-test/CMakeLists.txt rename test/{ => split-test}/SplitTest.vala (100%) create mode 160000 util/backbone delete mode 100755 util/update-po.sh delete mode 100755 util/valadoc.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..309b0cd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cmake/backbone"] + path = cmake/backbone + url = git@git.backbone.ws:cmake/backbone.git +[submodule "util/backbone"] + path = util/backbone + url = git@git.backbone.ws:cmake/backbone-utils.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 50403d0..4f5af0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,130 +2,20 @@ PROJECT (LAviewLatexStruct C) CMAKE_MINIMUM_REQUIRED (VERSION 2.8) +SET (PROJECT_LOWERCASE_NAME "laview-latex-struct") +SET (PROJECT_DESCRIPTION "LaTeX representation in the memory.") + SET (MAJOR 0) -SET (MINOR 0) -SET (PATCH 1) -SET (VERSION ${MAJOR}.${MINOR}.${PATCH}) +SET (MINOR 1) +SET (PATCH 0) -LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -INCLUDE (MacroOptionalAddSubdirectory) -INCLUDE (CPackDetectArch) - -SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") # supress Gcc warnings -SET (PROJ_LCASE "laview-latex-struct") - -# configure a header file for Gettext -SET (GETTEXT_PACKAGE "${PROJ_LCASE}") -ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}") -IF (WIN32) - SET (LOCALEDIR "") -ELSE () - SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") -ENDIF () -SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into") -IF (NOT CUSTOM_LOCALEDIR STREQUAL "") - SET (LOCALEDIR "${CUSTOM_LOCALEDIR}") - MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}") -ENDIF () -ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}") -SET (LOCALE_INSTALL_DIR "share/locale") -MACRO_OPTIONAL_ADD_SUBDIRECTORY (po) - -# Avoid of "dll not found" messages -SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/run") - -# configure a header file for Gettext -CONFIGURE_FILE ( - "${PROJECT_SOURCE_DIR}/src/gettext-config.h.in" - "${PROJECT_BINARY_DIR}/src/gettext-config.h" - ) - -IF ( CMAKE_BUILD_TYPE STREQUAL "Debug" ) - SET (VALA_DEBUG "-g") -ENDIF () - -# configure pkg-config file -IF (WIN32) - SET (prefix "") -ELSE () - SET (prefix ${CMAKE_INSTALL_PREFIX}) -ENDIF () -SET (exec_prefix "\${prefix}") -SET (libdir "\${exec_prefix}/lib") -SET (prefincludedir "\${prefix}/include") -SET (link_lib1 "\${libdir}") -SET (link_lib2 "laview-latex-struct") -CONFIGURE_FILE ( - "${PROJECT_SOURCE_DIR}/laview-latex-struct.pc.in" - "${PROJECT_BINARY_DIR}/laview-latex-struct-${MAJOR}.pc" - ) - -SET (CMAKE_C_FLAGS_DEBUG "-ggdb3 -O0 -ftest-coverage -Wcoverage-mismatch ${CMAKE_C_FLAGS_DEBUG}") -SET (CMAKE_C_FLAGS_RELEASE "-O2 ${CMAKE_C_FLAGS_RELEASE}") +LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone) ADD_SUBDIRECTORY (src) +ADD_SUBDIRECTORY (po) +ADD_SUBDIRECTORY (pkg-config) ADD_SUBDIRECTORY (test) +ADD_SUBDIRECTORY (cpack) -## CPack configuration ## -SET (CPACK_PACKAGE_CONTACT "backbone@backbone.ws") -SET (CPACK_PACKAGE_VENDOR "backbone@backbone.ws") -SET (CPACK_NSIS_MODIFY_PATH ON) -SET (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -INCLUDE (InstallRequiredSystemLibraries) -SET (CPACK_RESOURCE_FILE_LICENSE - "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") -SET (CPACK_PACKAGE_DESCRIPTION_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/README") -INSTALL (FILES "${PROJECT_BINARY_DIR}/laview-latex-struct-${MAJOR}.pc" - DESTINATION lib/pkgconfig) -INSTALL (FILES "${PROJECT_BINARY_DIR}/src/laview-latex-struct-${MAJOR}.vapi" - DESTINATION share/vala/vapi) -#SET (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME}") -#SET (CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME}") -SET (CPACK_PACKAGE_VERSION_MAJOR "${MAJOR}") -SET (CPACK_PACKAGE_VERSION_MINOR "${MINOR}") -SET (CPACK_PACKAGE_VERSION_PATCH "${PATCH}") -SET (CPACK_PACKAGE_VERSION "${VERSION}") - -IF (UNIX) - SET (CPACK_GENERATOR "DEB;RPM;STGZ;TBZ2;TGZ;TZ;ZIP") - SET (CPACK_SOURCE_GENERATOR "DEB;RPM;STGZ;TBZ2;TGZ;TZ;ZIP") - SET (CPACK_PACKAGE_NAME "laview-latex-struct") - SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "LaTeX representation in the memory") - SET (CPACK_PACKAGE_DESCRIPTION "LaTeX representation in the memory " - "Scanner + Generator + Operations on document objects.") - - # Debian specific options - SET (CPACK_DEBIAN_PACKAGE_DEPENDS "valac (>= 0.24), libglib2.0-bin (>= 2.33)") - SET (CPACK_DEBIAN_PACKAGE_SECTION "Libraries") - # SET (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${ARCHITECTURE}") - # SET (CPACK_DEBIAN_PACKAGE_PRIORITY "optional") - SET (CPACK_DEBIAN_PACKAGE_RECOMMENDS "") - SET (CPACK_DEBIAN_PACKAGE_SUGGESTS "") - - # RPM specific options - # SET (CPACK_RPM_PACKAGE_ARCHITECTURE "${ARCHITECTURE}") - SET (CPACK_RPM_PACKAGE_LICENSE "LGPLv3+") - SET (CPACK_RPM_PACKAGE_GROUP "Applications/Text") - SET (CPACK_RPM_PACKAGE_REQUIRES "vala >= 0.24, glib >= 2.33") - SET (CPACK_RPM_PACKAGE_PROVIDES "laview-latex-struct") - - # http://public.kitware.com/Bug/view.php?id=12997 - SET(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${ARCHITECTURE}") - -ELSEIF (WIN32) - SET (CPACK_GENERATOR "NSIS") - SET (CPACK_SOURCE_GENERATOR "NSIS") - SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CMAKE_PROJECT_NAME}-${MAJOR}") - #SET (CPACK_NSIS_MENU_LINKS "${EWS_WEBSITE}" "Homepage for ${EWS_APP_NAME}") - #SET (CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\${EXE_TARGET_NAME}.exe) - #SET (CPACK_NSIS_URL_INFO_ABOUT "${EWS_WEBSITE}") - #SET (CPACK_NSIS_HELP_LINK "${EWS_WEBSITE}") - SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}-${MAJOR}") - SET (CPACK_UNINSTALL_NAME "LVLatStr-${MAJOR}") # <=10 symbols: https://redmine.backbone.ws/issues/83 -ENDIF () - -INCLUDE (CPack) - -INCLUDE (CTest) +# enable testing +ENABLE_TESTING () diff --git a/INSTALL b/INSTALL index 067d493..3e899a5 100644 --- a/INSTALL +++ b/INSTALL @@ -6,7 +6,7 @@ Vala: https://wiki.gnome.org/Projects/Vala Gee: https://wiki.gnome.org/Projects/Libgee CMake: http://www.cmake.org -NSIS (Win-only): http://nsis.sourceforge.net +NSIS (W32): http://nsis.sourceforge.net Run-Time Dependencies @@ -29,18 +29,15 @@ pull-requests to the mainstream. $ mkdir build-gcc && cd build-gcc $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -$ make +$ make -j$((`getconf _NPROCESSORS_ONLN`+1)) Compilation under MS Windows $ mkdir build-mingw && cd build-mingw -$ LANG=en -$ PKG_CONFIG_PATH= -$ PATH=/c/MinGW/lib:/c/MinGW/bin:$PATH $ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release -$ make +$ make -j$((NUMBER_OF_PROCESSORS + 1)) - Compilation under BSD-based. + Compilation under BSD-based Systems. TODO: add description here. @@ -51,17 +48,17 @@ TODO: add description here. Packing/Installation under GNU/Linux $ cpack -Install using your favourite package manager. +Install using System Package Manager. Packing/Installation under MS Windows $ cpack -Install using an executable generated by NSIS. +Install using generated by NSIS executable. Packing/Installation under BSD-based $ cpack -Install using your favourite package manager. +Install using System Package Manager. Testing @@ -69,17 +66,19 @@ Install using your favourite package manager. Testing under GNU/Linux -$ LANG=en ctest +$ ctest -j$((`getconf _NPROCESSORS_ONLN`+1)) Automated tests for memory leaks: -$ LANG=en ctest -D NightlyMemCheck && grep definitely Testing/Temporary/LastDynamicAnalysis_*.log +$ ctest -j$((NUMBER_OF_PROCESSORS + 1)) -D NightlyMemCheck && grep definitely Testing/Temporary/LastDynamicAnalysis_*.log Testing under MS Windows -$ LANG=en ctest +$ ctest -j$((NUMBER_OF_PROCESSORS + 1)) Automated tests for memory leaks are not available as far as Valgrind not present on this platform. Testing under BSD-based -$ LANG=en ctest +$ ctest +Automated tests for memory leaks are not available as far as Valgrind not +present on this platform. diff --git a/cmake/CPackDetectArch.cmake b/cmake/CPackDetectArch.cmake deleted file mode 100644 index e878179..0000000 --- a/cmake/CPackDetectArch.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# Kernel of Operation System -EXECUTE_PROCESS (COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE OSKERNEL) -MESSAGE ("OSKERNEL = ${OSKERNEL}") -STRING (TOLOWER "${OSKERNEL}" OSKERNEL) - -# CPU Architecture -SET (CUSTOM_ARCHITECTURE "" CACHE STRING "Specify custom target architecutre") -SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}") -IF (ARCHITECTURE STREQUAL "") - # SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") - # SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}") - EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE) - - # Replacements - STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}") - STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}") - STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}") - -ENDIF () -MESSAGE ("ARCHITECTURE = ${ARCHITECTURE}") diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake deleted file mode 100644 index c8854ce..0000000 --- a/cmake/FindVala.cmake +++ /dev/null @@ -1,69 +0,0 @@ -## -# Find module for the Vala compiler (valac) -# -# This module determines wheter a Vala compiler is installed on the current -# system and where its executable is. -# -# Call the module using "find_package(Vala) from within your CMakeLists.txt. -# -# The following variables will be set after an invocation: -# -# VALA_FOUND Whether the vala compiler has been found or not -# VALA_EXECUTABLE Full path to the valac executable if it has been found -# VALA_VERSION Version number of the available valac -# VALA_USE_FILE Include this file to define the vala_precompile function -## - -## -# Copyright 2009-2010 Jakob Westhoff. All rights reserved. -# Copyright 2010-2011 Daniel Pfeifer -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are those -# of the authors and should not be interpreted as representing official policies, -# either expressed or implied, of Jakob Westhoff -## - -# Search for the valac executable in the usual system paths. -find_program(VALA_EXECUTABLE valac) -mark_as_advanced(VALA_EXECUTABLE) - -# Determine the valac version -if(VALA_EXECUTABLE) - execute_process(COMMAND ${VALA_EXECUTABLE} "--version" - OUTPUT_VARIABLE VALA_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}") -endif(VALA_EXECUTABLE) - -# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call. -# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka. -# VALA_EXECUTABLE is set) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vala - REQUIRED_VARS VALA_EXECUTABLE - VERSION_VAR VALA_VERSION) - -set(VALA_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVala.cmake") - diff --git a/cmake/MacroOptionalAddSubdirectory.cmake b/cmake/MacroOptionalAddSubdirectory.cmake deleted file mode 100644 index 545048b..0000000 --- a/cmake/MacroOptionalAddSubdirectory.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION() -# MACRO_OPTIONAL_ADD_SUBDIRECTORY( ) -# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(), -# this will have two effects -# 1 - CMake will not complain if the directory doesn't exist -# This makes sense if you want to distribute just one of the subdirs -# in a source package, e.g. just one of the subdirs in kdeextragear. -# 2 - If the directory exists, it will offer an option to skip the -# subdirectory. -# This is useful if you want to compile only a subset of all -# directories. - -# Copyright (c) 2007, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir ) - GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE) - IF(EXISTS ${_fullPath}) - IF(${ARGC} EQUAL 2) - OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1}) - ELSE(${ARGC} EQUAL 2) - OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE) - ENDIF(${ARGC} EQUAL 2) - IF(BUILD_${_dir}) - ADD_SUBDIRECTORY(${_dir}) - ENDIF(BUILD_${_dir}) - ENDIF(EXISTS ${_fullPath}) -ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY) diff --git a/cmake/UseVala.cmake b/cmake/UseVala.cmake deleted file mode 100644 index 436d1d0..0000000 --- a/cmake/UseVala.cmake +++ /dev/null @@ -1,180 +0,0 @@ -## -# Compile vala files to their c equivalents for further processing. -# -# The "vala_precompile" function takes care of calling the valac executable on -# the given source to produce c files which can then be processed further using -# default cmake functions. -# -# The first parameter provided is a variable, which will be filled with a list -# of c files outputted by the vala compiler. This list can than be used in -# conjuction with functions like "add_executable" or others to create the -# neccessary compile rules with CMake. -# -# The following sections may be specified afterwards to provide certain options -# to the vala compiler: -# -# SOURCES -# A list of .vala files to be compiled. Please take care to add every vala -# file belonging to the currently compiled project or library as Vala will -# otherwise not be able to resolve all dependencies. -# -# PACKAGES -# A list of vala packages/libraries to be used during the compile cycle. The -# package names are exactly the same, as they would be passed to the valac -# "--pkg=" option. -# -# OPTIONS -# A list of optional options to be passed to the valac executable. This can be -# used to pass "--thread" for example to enable multi-threading support. -# -# CUSTOM_VAPIS -# A list of custom vapi files to be included for compilation. This can be -# useful to include freshly created vala libraries without having to install -# them in the system. -# -# GENERATE_VAPI -# Pass all the needed flags to the compiler to create an internal vapi for -# the compiled library. The provided name will be used for this and a -# .vapi file will be created. -# -# GENERATE_HEADER -# Let the compiler generate a header file for the compiled code. There will -# be a header file as well as an internal header file being generated called -# .h and _internal.h -# -# The following call is a simple example to the vala_precompile macro showing -# an example to every of the optional sections: -# -# find_package(Vala "0.12" REQUIRED) -# inlcude(${VALA_USE_FILE}) -# -# vala_precompile(VALA_C -# SOURCES -# source1.vala -# source2.vala -# source3.vala -# PACKAGES -# gtk+-2.0 -# gio-1.0 -# posix -# DIRECTORY -# gen -# OPTIONS -# --thread -# CUSTOM_VAPIS -# some_vapi.vapi -# GENERATE_VAPI -# myvapi -# GENERATE_HEADER -# myheader -# ) -# -# Most important is the variable VALA_C which will contain all the generated c -# file names after the call. -## - -## -# Copyright 2009-2010 Jakob Westhoff. All rights reserved. -# Copyright 2010-2011 Daniel Pfeifer -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# The views and conclusions contained in the software and documentation are those -# of the authors and should not be interpreted as representing official policies, -# either expressed or implied, of Jakob Westhoff -## - -include(CMakeParseArguments) - -function(vala_precompile output) - cmake_parse_arguments(ARGS "" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI" - "SOURCES;PACKAGES;OPTIONS;CUSTOM_VAPIS" ${ARGN}) - - if(ARGS_DIRECTORY) - set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY}) - else(ARGS_DIRECTORY) - set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif(ARGS_DIRECTORY) - include_directories(${DIRECTORY}) - set(vala_pkg_opts "") - foreach(pkg ${ARGS_PACKAGES}) - list(APPEND vala_pkg_opts "--pkg=${pkg}") - endforeach(pkg ${ARGS_PACKAGES}) - set(in_files "") - set(out_files "") - foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) - list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}") - string(REPLACE ".vala" ".c" src ${src}) - string(REPLACE ".gs" ".c" src ${src}) - set(out_file "${DIRECTORY}/${src}") - list(APPEND out_files "${DIRECTORY}/${src}") - endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) - - set(custom_vapi_arguments "") - if(ARGS_CUSTOM_VAPIS) - foreach(vapi ${ARGS_CUSTOM_VAPIS}) - if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR}) - list(APPEND custom_vapi_arguments ${vapi}) - else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR}) - list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi}) - endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR}) - endforeach(vapi ${ARGS_CUSTOM_VAPIS}) - endif(ARGS_CUSTOM_VAPIS) - - set(vapi_arguments "") - if(ARGS_GENERATE_VAPI) - list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi") - set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi") - - # Header and internal header is needed to generate internal vapi - if (NOT ARGS_GENERATE_HEADER) - set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI}) - endif(NOT ARGS_GENERATE_HEADER) - endif(ARGS_GENERATE_VAPI) - - set(header_arguments "") - if(ARGS_GENERATE_HEADER) - list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h") - list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") - list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h") - list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") - endif(ARGS_GENERATE_HEADER) - - add_custom_command(OUTPUT ${out_files} - COMMAND - ${VALA_EXECUTABLE} - ARGS - "-C" - ${header_arguments} - ${vapi_arguments} - "-b" ${CMAKE_CURRENT_SOURCE_DIR} - "-d" ${DIRECTORY} - ${vala_pkg_opts} - ${ARGS_OPTIONS} - ${in_files} - ${custom_vapi_arguments} - DEPENDS - ${in_files} - ${ARGS_CUSTOM_VAPIS} - ) - set(${output} ${out_files} PARENT_SCOPE) -endfunction(vala_precompile) diff --git a/cmake/backbone b/cmake/backbone new file mode 160000 index 0000000..7041f32 --- /dev/null +++ b/cmake/backbone @@ -0,0 +1 @@ +Subproject commit 7041f32ce90e745a7084ac4c5369dfb82da6685b diff --git a/cpack/CMakeLists.txt b/cpack/CMakeLists.txt new file mode 100644 index 0000000..3181975 --- /dev/null +++ b/cpack/CMakeLists.txt @@ -0,0 +1,11 @@ +SET (CONTACT "backbone@backbone.ws") +SET (DEBIAN_DEPENDENCIES "valac (>= 0.24), libglib2.0-bin (>= 2.33), libgee (>= +0.16)") +SET (DEBIAN_SECTION "Libraries") +SET (REDHAT_DEPENDENCIES "vala >= 0.24, glib >= 2.33, libgee >= 0.16") +SET (REDHAT_SECTION "Applications/Text") +SET (LICENSE "LGPLv3+") +SET (WIN32_UNINSTALL_NAME "LVLatStr") # <= 8 symbols for the name + +LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +INCLUDE (CPackCommon) diff --git a/laview-latex-struct.pc.in b/laview-latex-struct.pc.in deleted file mode 100644 index 40fa22e..0000000 --- a/laview-latex-struct.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@prefincludedir@ - -Name: LaTeX-Struct -Description: LaTeX representation in the memory + Scanner + Generator + Operations on document objects. -Version: @VERSION@ -Libs: -L@link_lib1@ -l@link_lib2@ -Libs.private: -Cflags: diff --git a/pkg-config/CMakeLists.txt b/pkg-config/CMakeLists.txt new file mode 100644 index 0000000..77cb03a --- /dev/null +++ b/pkg-config/CMakeLists.txt @@ -0,0 +1,22 @@ +# configure pkg-config file +IF (WIN32) + SET (PkgConfigPrefix "") +ELSE () + SET (PkgConfigPrefix ${CMAKE_INSTALL_PREFIX}) +ENDIF () +SET (PkgConfigExecPrefix "\${prefix}") +SET (PkgConfigLibDir "\${exec_prefix}/lib") +SET (PkgConfigIncludeDir "\${prefix}/include") + +SET (PkgConfigName "${CMAKE_PROJECT_NAME}") +SET (PkgConfigDescription "${PROJECT_DESCRIPTION}") +SET (PkgConfigVersion "${MAJOR}.${MINOR}.${PATCH}") +SET (PkgConfigLibs "-L\${libdir}") +SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-${MAJOR}") +SET (PkgConfigLibsPrivate "") +SET (PkgConfigCflags "") + +CONFIGURE_FILE ( + "${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc" +) diff --git a/pkg-config/pkg-config.pc.in b/pkg-config/pkg-config.pc.in new file mode 100644 index 0000000..ad5264d --- /dev/null +++ b/pkg-config/pkg-config.pc.in @@ -0,0 +1,11 @@ +prefix=@PkgConfigPrefix@ +exec_prefix=@PkgConfigExecPrefix@ +libdir=@PkgConfigLibDir@ +includedir=@PkgConfigIncludeDir@ + +Name: @PkgConfigName@ +Description: @PkgConfigDescription@ +Version: @PkgConfigVersion@ +Libs: @PkgConfigLibs@ +Libs.private: @PkgConfigLibsPrivate@ +Cflags: @PkgConfigCflags@ diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index a588e22..946851e 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,9 +1,41 @@ -find_package(Gettext REQUIRED) -if (NOT GETTEXT_MSGMERGE_EXECUTABLE) -MESSAGE(FATAL_ERROR "Please install msgmerge binary") -endif (NOT GETTEXT_MSGMERGE_EXECUTABLE) -if (NOT GETTEXT_MSGFMT_EXECUTABLE) -MESSAGE(FATAL_ERROR "Please install msgmerge binary") -endif (NOT GETTEXT_MSGFMT_EXECUTABLE) -add_subdirectory(ru) -#add_subdirectory(de) +SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME_ABI}") +ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}") + +IF (WIN32) + SET (LOCALEDIR "") +ELSE () + SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") +ENDIF () + +SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into") + +IF (NOT CUSTOM_LOCALEDIR STREQUAL "") + SET (LOCALEDIR "${CUSTOM_LOCALEDIR}") + MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}") +ENDIF () + +ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}") +SET (LOCALE_INSTALL_DIR "share/locale") +LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +INCLUDE (MacroOptionalAddSubdirectory) +FIND_PACKAGE (Gettext REQUIRED) + +MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs) + +# configure a header file for Gettext +SET (VERSION ${MAJOR}.${MINOR}.${PATCH}) +SET (PROJECT_LOWERCASE_NAME_ABI "${PROJECT_LOWERCASE_NAME}-${MAJOR}") + +STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader) +SET (GettextPackageNameAbi "${PROJECT_LOWERCASE_NAME_ABI}") +CONFIGURE_FILE ( + "gettext-config.h.in" + "${PROJECT_BINARY_DIR}/po/gettext-config.h" + ) + +IF (NOT GETTEXT_MSGMERGE_EXECUTABLE) + MESSAGE (FATAL_ERROR "Please install msgmerge binary") +ENDIF (NOT GETTEXT_MSGMERGE_EXECUTABLE) +IF (NOT GETTEXT_MSGFMT_EXECUTABLE) + MESSAGE(FATAL_ERROR "Please install msgmerge binary") +ENDIF (NOT GETTEXT_MSGFMT_EXECUTABLE) diff --git a/po/gettext-config.h.in b/po/gettext-config.h.in new file mode 100644 index 0000000..7dd3e38 --- /dev/null +++ b/po/gettext-config.h.in @@ -0,0 +1,11 @@ +#ifndef @GettextUniqueHeader@_H +#define @GettextUniqueHeader@_H + +#define GETTEXT_PACKAGE "@GettextPackageNameAbi@" +#include + +#ifdef WIN32 +#define _(String) dgettext (GETTEXT_PACKAGE, String) +#endif + +#endif // @GettextUniqueHeader@_H diff --git a/po/laview-latex-struct-0.pot b/po/laview-latex-struct-0.pot index 44b4dcd..1cc17f4 100644 --- a/po/laview-latex-struct-0.pot +++ b/po/laview-latex-struct-0.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: laview-latex-struct-0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-07-31 18:16+0400\n" +"POT-Creation-Date: 2014-10-26 17:59+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,57 +17,57 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:58 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:58 #, c-format msgid "Begin tag sequence '%s' without end tag pair." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:127 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:582 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:127 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:585 #, c-format msgid ": Unexpected end tag sequence '%s' without begin tag pair." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:148 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:148 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:179 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:188 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:205 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:148 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:148 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:179 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:188 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:205 msgid "Error parsing subdoc." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/LongtableParser.vala:44 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/LongtableParser.vala:44 #, c-format msgid "Incorrect longtable parameters doesn't match '%s' regexp." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:298 msgid "2nd param (ATable) isn't a child of the 1st (Glob)." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:312 msgid "3rd param (limits) is incorrect. Read the manual." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:329 msgid "Cann't split the table. Read the manual." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:416 #, c-format msgid "Unexpected end external tag sequence '%s' without begin tag pair." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:449 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:452 #, c-format msgid "Begin tag sequence '%s':%d:%d without end tag pair." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:612 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:615 msgid "\\cline parameters doesn't match {number-number} regexp." msgstr "" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TabularParser.vala:43 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TabularParser.vala:43 #, c-format msgid "Incorrect tabular parameters doesn't match '%s' regexp." msgstr "" diff --git a/po/ru/laview-latex-struct-0.po b/po/ru/laview-latex-struct-0.po index dfa2a2f..05fe7b0 100644 --- a/po/ru/laview-latex-struct-0.po +++ b/po/ru/laview-latex-struct-0.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: laview-latex-struct-0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-07-31 18:16+0400\n" +"POT-Creation-Date: 2014-10-26 15:56+0300\n" "PO-Revision-Date: 2014-05-28 10:50+0400\n" "Last-Translator: \n" "Language-Team: Russian\n" @@ -18,62 +18,62 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" -#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:58 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:58 #, c-format msgid "Begin tag sequence '%s' without end tag pair." msgstr "Стартовая последовательность тегов '%s' без соответствующей стоп-пары." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:127 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:582 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:127 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:585 #, c-format msgid ": Unexpected end tag sequence '%s' without begin tag pair." msgstr "" ": Неожиданная завершающая последовательность тегов '%s' без соответствующей " "старт-пары." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:148 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:148 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:179 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:188 -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:205 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:148 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:148 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:179 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:188 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:205 msgid "Error parsing subdoc." msgstr "Ошибка разбора поддокумента." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/LongtableParser.vala:44 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/LongtableParser.vala:44 #, c-format msgid "Incorrect longtable parameters doesn't match '%s' regexp." msgstr "Неверные параметры longtable не удовлетворяют рег. выражению '%s'." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:298 msgid "2nd param (ATable) isn't a child of the 1st (Glob)." msgstr "2-ой параметр (ATable) не является дочерним узлом 1-ого (Glob)." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:312 msgid "3rd param (limits) is incorrect. Read the manual." msgstr "3-ий параметр (limits) не верный. Смотрите документацию." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:329 msgid "Cann't split the table. Read the manual." msgstr "Невозможно разбить таблицу. Смотрите документацию." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:416 #, c-format msgid "Unexpected end external tag sequence '%s' without begin tag pair." msgstr "" ": Неожиданная завершающая последовательность внешних тегов '%s' без " "соответствующей старт-пары." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:449 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:452 #, c-format msgid "Begin tag sequence '%s':%d:%d without end tag pair." msgstr "" "Стартовая последовательность тегов '%s':%d:%d без соответствующей стоп-пары." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:612 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:615 msgid "\\cline parameters doesn't match {number-number} regexp." msgstr "Параметры \\cline не соответствует рег. выражению {число-число}." -#: /home/kolan/projects/LAview/LaTeX-Struct/src/TabularParser.vala:43 +#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TabularParser.vala:43 #, c-format msgid "Incorrect tabular parameters doesn't match '%s' regexp." msgstr "Неверные параметры tabular не удовлетворяют рег. выражению '%s'." diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6abb6b8..0300a5e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,36 +1,3 @@ -INCLUDE (FindVala) -INCLUDE (UseVala) +INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/po) -FIND_PACKAGE (PkgConfig REQUIRED) - -PKG_CHECK_MODULES (GEE REQUIRED gee-0.8) -INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS}) - -FILE (GLOB_RECURSE LAviewSources RELATIVE ${CMAKE_SOURCE_DIR}/src *.vala) - -VALA_PRECOMPILE (VALA_C ${LAviewSources} - PACKAGES gee-0.8 posix - OPTIONS --thread ${VALA_DEBUG} --vapi=${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi - CUSTOM_VAPIS - GENERATE_VAPI ${PROJ_LCASE}-${MAJOR}_internal - GENERATE_HEADER ${PROJ_LCASE}-${MAJOR} - ) -INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}") -ADD_LIBRARY (${PROJ_LCASE} SHARED ${VALA_C} ${PROJECT_SOURCE_DIR}/src/vala_unsupported.c) -TARGET_LINK_LIBRARIES (${PROJ_LCASE} ${GEE_LIBRARIES}) -SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES VERSION ${VERSION}) -SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES SOVERSION ${MAJOR}) -IF (WIN32) - SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES PREFIX "" IMPORT_PREFIX "" SUFFIX "-${MAJOR}.dll") -ENDIF (WIN32) - -IF (UNIX) - INSTALL (TARGETS ${PROJ_LCASE} DESTINATION lib) -ELSEIF (WIN32) - INSTALL (TARGETS ${PROJ_LCASE} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -ENDIF (UNIX) - -INSTALL (FILES ${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.h DESTINATION include) +ADD_SUBDIRECTORY (latex-struct) diff --git a/src/gettext-config.h.in b/src/gettext-config.h.in deleted file mode 100644 index e88d6ba..0000000 --- a/src/gettext-config.h.in +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef LAVIEW_LATEX_STRUCT_H -#define LAVIEW_LATEX_STRUCT_H - -#define GETTEXT_PACKAGE "laview-latex-struct-@LAVIEW_LATEX_STRUCT_VERSION_MAJOR@" -#include - -#ifdef WIN32 -#define _(String) dgettext (GETTEXT_PACKAGE, String) -#endif - -#endif // LAVIEW_LATEX_STRUCT_H diff --git a/src/AddSpace.vala b/src/latex-struct/AddSpace.vala similarity index 100% rename from src/AddSpace.vala rename to src/latex-struct/AddSpace.vala diff --git a/src/AddSpaces.vala b/src/latex-struct/AddSpaces.vala similarity index 100% rename from src/AddSpaces.vala rename to src/latex-struct/AddSpaces.vala diff --git a/src/latex-struct/CMakeLists.txt b/src/latex-struct/CMakeLists.txt new file mode 100644 index 0000000..c376666 --- /dev/null +++ b/src/latex-struct/CMakeLists.txt @@ -0,0 +1,7 @@ +SET (LibName ${PROJECT_LOWERCASE_NAME}) +FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala) +SET (LibPackages gee-0.8 posix) +SET (LibPkgModules gee-0.8) +SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c) +SET (LibInstall ON) +INCLUDE (ValaLibCommonRules) diff --git a/src/Cell.vala b/src/latex-struct/Cell.vala similarity index 100% rename from src/Cell.vala rename to src/latex-struct/Cell.vala diff --git a/src/ColParam.vala b/src/latex-struct/ColParam.vala similarity index 100% rename from src/ColParam.vala rename to src/latex-struct/ColParam.vala diff --git a/src/ColParams.vala b/src/latex-struct/ColParams.vala similarity index 100% rename from src/ColParams.vala rename to src/latex-struct/ColParams.vala diff --git a/src/DocIfaces.vala b/src/latex-struct/DocIfaces.vala similarity index 100% rename from src/DocIfaces.vala rename to src/latex-struct/DocIfaces.vala diff --git a/src/Glob.vala b/src/latex-struct/Glob.vala similarity index 100% rename from src/Glob.vala rename to src/latex-struct/Glob.vala diff --git a/src/GlobParser.vala b/src/latex-struct/GlobParser.vala similarity index 100% rename from src/GlobParser.vala rename to src/latex-struct/GlobParser.vala diff --git a/src/Graphics.vala b/src/latex-struct/Graphics.vala similarity index 100% rename from src/Graphics.vala rename to src/latex-struct/Graphics.vala diff --git a/src/GraphicsParser.vala b/src/latex-struct/GraphicsParser.vala similarity index 100% rename from src/GraphicsParser.vala rename to src/latex-struct/GraphicsParser.vala diff --git a/src/Longtable.vala b/src/latex-struct/Longtable.vala similarity index 100% rename from src/Longtable.vala rename to src/latex-struct/Longtable.vala diff --git a/src/LongtableParser.vala b/src/latex-struct/LongtableParser.vala similarity index 100% rename from src/LongtableParser.vala rename to src/latex-struct/LongtableParser.vala diff --git a/src/Parser.vala b/src/latex-struct/Parser.vala similarity index 100% rename from src/Parser.vala rename to src/latex-struct/Parser.vala diff --git a/src/ParserFactory.vala b/src/latex-struct/ParserFactory.vala similarity index 100% rename from src/ParserFactory.vala rename to src/latex-struct/ParserFactory.vala diff --git a/src/Row.vala b/src/latex-struct/Row.vala similarity index 100% rename from src/Row.vala rename to src/latex-struct/Row.vala diff --git a/src/Subtable.vala b/src/latex-struct/Subtable.vala similarity index 100% rename from src/Subtable.vala rename to src/latex-struct/Subtable.vala diff --git a/src/Table.vala b/src/latex-struct/Table.vala similarity index 100% rename from src/Table.vala rename to src/latex-struct/Table.vala diff --git a/src/TableParser.vala b/src/latex-struct/TableParser.vala similarity index 100% rename from src/TableParser.vala rename to src/latex-struct/TableParser.vala diff --git a/src/Tabular.vala b/src/latex-struct/Tabular.vala similarity index 100% rename from src/Tabular.vala rename to src/latex-struct/Tabular.vala diff --git a/src/TabularParser.vala b/src/latex-struct/TabularParser.vala similarity index 100% rename from src/TabularParser.vala rename to src/latex-struct/TabularParser.vala diff --git a/src/Text.vala b/src/latex-struct/Text.vala similarity index 100% rename from src/Text.vala rename to src/latex-struct/Text.vala diff --git a/src/TextParser.vala b/src/latex-struct/TextParser.vala similarity index 100% rename from src/TextParser.vala rename to src/latex-struct/TextParser.vala diff --git a/src/main.vala b/src/latex-struct/main.vala similarity index 100% rename from src/main.vala rename to src/latex-struct/main.vala diff --git a/src/vala_unsupported.c b/src/library_constructor.c similarity index 61% rename from src/vala_unsupported.c rename to src/library_constructor.c index 5f69d31..86f9298 100644 --- a/src/vala_unsupported.c +++ b/src/library_constructor.c @@ -1,16 +1,16 @@ -#if defined(_WIN32) +#if defined(_WIN32) || defined(_WIN64) #include #endif #include "gettext-config.h" -#if defined(_WIN32) +#if defined(_WIN32) || defined(_WIN64) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) -#elif defined (__GNUC__) -void __attribute__ ((constructor)) laview_latex_struct_load (void) +#elif defined(linux) || defined(UNIX) || defined(__unix__) +void __attribute__ ((constructor)) load_library (void) #endif { -#if defined(_WIN32) +#if defined(_WIN32) || defined(_WIN64) gchar dllPath[FILENAME_MAX], *dllDir, *localePath; @@ -25,10 +25,11 @@ void __attribute__ ((constructor)) laview_latex_struct_load (void) #if (!GLIB_CHECK_VERSION (2, 36, 0)) g_type_init (); +#endif - (void) dwReason; - (void) lpReserved; +#if defined(_WIN32) || defined(_WIN64) + (void) dwReason; // avoid + (void) lpReserved; // warngings return TRUE; #endif } - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7b1cdb3..a79e7b5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,416 +1,5 @@ -INCLUDE (FindVala) -INCLUDE (UseVala) +ADD_SUBDIRECTORY (ltable-test) +ADD_SUBDIRECTORY (parse-test) +ADD_SUBDIRECTORY (split-test) -FIND_PACKAGE (PkgConfig REQUIRED) - -PKG_CHECK_MODULES (GEE REQUIRED gee-0.8) -INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS}) - -INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}") -INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src") - -# add parse_test executable -FILE (GLOB_RECURSE ParseTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test ParseTest.vala) -VALA_PRECOMPILE (ParseTest_C ${ParseTestSources} - PACKAGES gee-0.8 posix - OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi - GENERATE_VAPI - GENERATE_HEADER - ) -ADD_EXECUTABLE (ParseTest ${ParseTest_C}) -TARGET_LINK_LIBRARIES (ParseTest ${PROJ_LCASE} ${GEE_LIBRARIES}) - -# add ltable_test executable -FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test LTableTest.vala) -VALA_PRECOMPILE (LTableTest_C ${LTableTestSources} - PACKAGES gee-0.8 posix - OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi - GENERATE_VAPI - GENERATE_HEADER - ) -ADD_EXECUTABLE (LTableTest ${LTableTest_C}) -TARGET_LINK_LIBRARIES (LTableTest ${PROJ_LCASE} ${GEE_LIBRARIES}) - -# add split_test executable -FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test SplitTest.vala) -VALA_PRECOMPILE (SplitTest_C ${LTableTestSources} - PACKAGES gee-0.8 posix - OPTIONS --thread ${VALA_DEBUG} - CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi - GENERATE_VAPI - GENERATE_HEADER - ) -ADD_EXECUTABLE (SplitTest ${SplitTest_C}) -TARGET_LINK_LIBRARIES (SplitTest ${PROJ_LCASE} ${GEE_LIBRARIES}) - -# 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 (ParseTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ParseTest --table ${table_path} ${extra_args}) - SET_TESTS_PROPERTIES (ParseTest-${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/tex/throttle.tex "" -"list all objects -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableTabular -LAviewText -end of objects - -") - -# test throttle.tex -do_parse_test (includegraphicsWalk ${PROJECT_SOURCE_DIR}/test/tex/includegraphics.tex "" -"Walk through all objects -LAviewText -LAviewGraphics - width=0.000000. height=3.000000pt. path=174. - gen..=.includegraphics.height=3.000000pt.angle=25.scale=3.{174} -resized gen.. = .includegraphics.width=0.500000pt.height=6.000000dd.angle=25.scale=3.{174} -LAviewText -LAviewGraphics - width=12.000000cm. height=25.000000cm. path=151. - gen..=.includegraphics.width=12.000000cm.height=25.000000cm.{151} -resized gen.. = .includegraphics.width=0.500000pt.height=50.000000dd.{151} -LAviewText -end of objects - -") - -# test throttle.tex -do_parse_test (throttleCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex "" -"Original and generated text are EQUAL .-.") - -# test throttle.tex -do_parse_test (throttleErr1 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err1.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:33:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair. -.end{longtable} - .") - -# test throttle.tex -do_parse_test (throttleErr2 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err2.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{longtable}' without end tag pair. -.begin{longtable} -. -") - -# test throttle.tex -do_parse_test (throttleErr3 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err3.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc. -.begin{longtable} -. -LAviewParsersLongtableParser:55:46: Stop external tag sequence '..end{longtable}' without begin tag pair. -.multicolumn{2}{|l|}{ЗМГ} & & .end{longtable} & & & & .tabularnewline - . -") - -# test throttle.tex -do_parse_test (throttleErr4 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err4.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:33:13: : Unexpected end tag sequence '..end{tabular}' without begin tag pair. -.end{tabular} - .") - -# test throttle.tex -do_parse_test (throttleErr5 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err5.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{tabular}' without end tag pair. -.begin{tabular} -. -") - -# test throttle.tex -do_parse_test (throttleErr6 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err6.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc. -.begin{tabular} -. -LAviewParsersTabularParser:55:46: Stop external tag sequence '..end{tabular}' without begin tag pair. -.multicolumn{2}{|l|}{ЗМГ} & & .end{tabular} & & & & .tabularnewline - . -") - -# test formular.tex -do_parse_test (formularList ${PROJECT_SOURCE_DIR}/test/tex/formular.tex "" -"list all objects -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -end of objects - -") - -# test formular.tex -do_parse_test (formularWalk ${PROJECT_SOURCE_DIR}/test/tex/formular.tex "" -"Walk through all objects -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -end of objects - -") - -# test formular.tex -do_parse_test (formularCmp ${PROJECT_SOURCE_DIR}/test/tex/formular.tex "" -"Original and generated text are EQUAL .-.") - -# test formular.tex -do_parse_test (formularErr1 ${PROJECT_SOURCE_DIR}/test/tex/formular_err1.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:192:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair. -.end{longtable} - .") - -# test formular.tex -do_parse_test (formularErr2 ${PROJECT_SOURCE_DIR}/test/tex/formular_err2.tex "" -"Error parsing TeX document: LAviewParsersGlobParser:44:1: Begin tag sequence '..begin{longtable}' without end tag pair. -.begin{longtable} -. -") - -# test for caption in all_subtables.tex -do_parse_test (captionTest ${PROJECT_SOURCE_DIR}/test/tex/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/tex/all_subtables.tex "" -"Original and generated text are EQUAL .-.") - -# test all_subtables.tex -do_parse_test (linesCmp ${PROJECT_SOURCE_DIR}/test/tex/lines.tex ${PROJECT_SOURCE_DIR}/test/tex/lines.etalon.tex -"Original and generated text are EQUAL .-.") - -# test ltable_embedded.tex -do_parse_test (ltable_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_embedded.tex "" -"Original and generated text are EQUAL .-.") - -# test ltable_double_embedded.tex -do_parse_test (ltable_double_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_double_embedded.tex "" -"Original and generated text are EQUAL .-.") - -# test throttle_VK2500.tex -do_parse_test (throttle_VK2500Cmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500.tex "" -"Original and generated text are EQUAL .-.") - -# test throttle_VK2500.tex -do_parse_test (throttle_VK2500PSCmp ${PROJECT_SOURCE_DIR}/test/tex/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/tex/throttle_VK2500PS_dos_newlines.tex "" -"list all objects -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -end of objects - -Walk through all objects -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -end of objects -") - -# test graph_in_ltable.tex -do_parse_test (graph_in_ltable ${PROJECT_SOURCE_DIR}/test/tex/graph_in_ltable.tex "" -" -list all objects -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableLongtable - LAviewTableLongtable -LAviewText -LAviewTableLongtable - LAviewGraphics - LAviewTableLongtable -LAviewText -end of objects - -Walk through all objects -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableLongtable -LAviewText -LAviewTableLongtable -LAviewText -end of objects -") - -# test ltable_square_arg.tex -do_parse_test (ltable_square_arg ${PROJECT_SOURCE_DIR}/test/tex/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/tex/table_in_table.tex "" -" -list all objects -") - -# test unary_quotes.tex -do_parse_test (unary_quotes ${PROJECT_SOURCE_DIR}/test/tex/unary_quotes.tex "" -" -list all objects -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -end of objects - -Walk through all objects -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -LAviewTableTabular -LAviewText -end of objects -") - -# test back_slashes_in_a_table.tex -do_parse_test (back_slashes_in_a_table ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.tex ${PROJECT_SOURCE_DIR}/test/tex/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}/LTableTest ${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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm0row.tex rm0row -"Etalon and generated text are EQUAL .-.") - -# ltable_test rm1row -ltable_test (rm1row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1row.tex rm1row -"Etalon and generated text are EQUAL .-.") - -# ltable_test rm1000row -ltable_test (rm1000row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1000row.tex rm1000row -"Etalon and generated text are EQUAL .-.") - -# ltable_test rm_last_row -ltable_test (rm_last_row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/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/tex/table_rows.tex ${PROJECT_SOURCE_DIR}/test/tex/table_rows.etalon.tex append_row0 -"Etalon and generated text are EQUAL .-.") - -MACRO (do_split_test testname limits table etalon regexp) - ADD_TEST (split_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SplitTest - --limits ${limits} --table ${table} --etalon ${etalon}) -SET_TESTS_PROPERTIES (split_test-${testname} - PROPERTIES PASS_REGULAR_EXPRESSION ${regexp} - FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING") -ENDMACRO (do_split_test) - -# test TeXReport_splitLongtable () function -do_split_test (split_test ${PROJECT_SOURCE_DIR}/test/tex/limits1.in - ${PROJECT_SOURCE_DIR}/test/tex/limits_table1.tex - ${PROJECT_SOURCE_DIR}/test/tex/limits_table1.etalon.tex -"Etalon and generated text are EQUAL ...\n") - -# enable testing -ENABLE_TESTING () +INCLUDE (CTest) diff --git a/test/ltable-test/CMakeLists.txt b/test/ltable-test/CMakeLists.txt new file mode 100644 index 0000000..e795a0a --- /dev/null +++ b/test/ltable-test/CMakeLists.txt @@ -0,0 +1,88 @@ +SET (BinName ltable_test) +FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LTableTest.vala) +SET (BinPackages 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") +INCLUDE (ValaBinCommonRules) + +# Longtable tests +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/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm0row.tex rm0row +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-rm0row PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test rm1row +ltable_test (rm1row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1row.tex rm1row +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-rm1row PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test rm1000row +ltable_test (rm1000row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1000row.tex rm1000row +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-rm1000row PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test rm_last_row +ltable_test (rm_last_row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm_last_row.tex rm_last_row +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-rm_last_row PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_0_0 +ltable_test (clone_0_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_0.tex clone_0_0 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_0_0 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_0_1 +ltable_test (clone_0_1 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_1.tex clone_0_1 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_0_1 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_1_0 +ltable_test (clone_1_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_1_0.tex clone_1_0 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_1_0 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_0_last +ltable_test (clone_0_last ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_last.tex clone_0_last +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_0_last PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_last_0 +ltable_test (clone_last_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_last_0.tex clone_last_0 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_last_0 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_0_lastp1 +ltable_test (clone_0_lastp1 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_lastp1.tex clone_0_lastp1 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_0_lastp1 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_lastp1_0 +ltable_test (clone_lastp1_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_lastp1_0.tex clone_lastp1_0 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_lastp1_0 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_0_1000 +ltable_test (clone_0_1000 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_1000.tex clone_0_1000 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_0_1000 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test clone_1000_0 +ltable_test (clone_1000_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_1000_0.tex clone_1000_0 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-clone_1000_0 PROPERTIES ENVIRONMENT "LANG=en") + +# ltable_test append_row0 +ltable_test (append_row0 ${PROJECT_SOURCE_DIR}/test/tex/table_rows.tex ${PROJECT_SOURCE_DIR}/test/tex/table_rows.etalon.tex append_row0 +"Etalon and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ltable_test-append_row0 PROPERTIES ENVIRONMENT "LANG=en") + +# enable testing +ENABLE_TESTING () diff --git a/test/LTableTest.vala b/test/ltable-test/LTableTest.vala similarity index 100% rename from test/LTableTest.vala rename to test/ltable-test/LTableTest.vala diff --git a/test/parse-test/CMakeLists.txt b/test/parse-test/CMakeLists.txt new file mode 100644 index 0000000..e6002a3 --- /dev/null +++ b/test/parse-test/CMakeLists.txt @@ -0,0 +1,326 @@ +SET (BinName parse_test) +FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ParseTest.vala) +SET (BinPackages 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") +INCLUDE (ValaBinCommonRules) + +# Parse tests +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 (ParseTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/parse_test --table ${table_path} ${extra_args}) + SET_TESTS_PROPERTIES (ParseTest-${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/tex/throttle.tex "" +"list all objects +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableTabular +LAviewText +end of objects + +") +SET_TESTS_PROPERTIES(ParseTest-throttleList PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (includegraphicsWalk ${PROJECT_SOURCE_DIR}/test/tex/includegraphics.tex "" +"Walk through all objects +LAviewText +LAviewGraphics + width=0.000000. height=3.000000pt. path=174. + gen..=.includegraphics.height=3.000000pt.angle=25.scale=3.{174} +resized gen.. = .includegraphics.width=0.500000pt.height=6.000000dd.angle=25.scale=3.{174} +LAviewText +LAviewGraphics + width=12.000000cm. height=25.000000cm. path=151. + gen..=.includegraphics.width=12.000000cm.height=25.000000cm.{151} +resized gen.. = .includegraphics.width=0.500000pt.height=50.000000dd.{151} +LAviewText +end of objects + +") +SET_TESTS_PROPERTIES(ParseTest-includegraphicsWalk PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-throttleCmp PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleErr1 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err1.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:33:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair. +.end{longtable} + .") +SET_TESTS_PROPERTIES(ParseTest-throttleErr1 PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleErr2 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err2.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{longtable}' without end tag pair. +.begin{longtable} +. +") +SET_TESTS_PROPERTIES(ParseTest-throttleErr2 PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleErr3 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err3.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc. +.begin{longtable} +. +LAviewParsersLongtableParser:55:46: Stop external tag sequence '..end{longtable}' without begin tag pair. +.multicolumn{2}{|l|}{ЗМГ} & & .end{longtable} & & & & .tabularnewline + . +") +SET_TESTS_PROPERTIES(ParseTest-throttleErr3 PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleErr4 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err4.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:33:13: : Unexpected end tag sequence '..end{tabular}' without begin tag pair. +.end{tabular} + .") +SET_TESTS_PROPERTIES(ParseTest-throttleErr4 PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleErr5 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err5.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{tabular}' without end tag pair. +.begin{tabular} +. +") +SET_TESTS_PROPERTIES(ParseTest-throttleErr5 PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle.tex +do_parse_test (throttleErr6 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err6.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc. +.begin{tabular} +. +LAviewParsersTabularParser:55:46: Stop external tag sequence '..end{tabular}' without begin tag pair. +.multicolumn{2}{|l|}{ЗМГ} & & .end{tabular} & & & & .tabularnewline + . +") +SET_TESTS_PROPERTIES(ParseTest-throttleErr6 PROPERTIES ENVIRONMENT "LANG=en") + +# test formular.tex +do_parse_test (formularList ${PROJECT_SOURCE_DIR}/test/tex/formular.tex "" +"list all objects +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +end of objects + +") +SET_TESTS_PROPERTIES(ParseTest-formularList PROPERTIES ENVIRONMENT "LANG=en") + +# test formular.tex +do_parse_test (formularWalk ${PROJECT_SOURCE_DIR}/test/tex/formular.tex "" +"Walk through all objects +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +end of objects + +") +SET_TESTS_PROPERTIES(ParseTest-formularWalk PROPERTIES ENVIRONMENT "LANG=en") + +# test formular.tex +do_parse_test (formularCmp ${PROJECT_SOURCE_DIR}/test/tex/formular.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-formularCmp PROPERTIES ENVIRONMENT "LANG=en") + +# test formular.tex +do_parse_test (formularErr1 ${PROJECT_SOURCE_DIR}/test/tex/formular_err1.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:192:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair. +.end{longtable} + .") +SET_TESTS_PROPERTIES(ParseTest-formularErr1 PROPERTIES ENVIRONMENT "LANG=en") + +# test formular.tex +do_parse_test (formularErr2 ${PROJECT_SOURCE_DIR}/test/tex/formular_err2.tex "" +"Error parsing TeX document: LAviewParsersGlobParser:44:1: Begin tag sequence '..begin{longtable}' without end tag pair. +.begin{longtable} +. +") +SET_TESTS_PROPERTIES(ParseTest-formularErr2 PROPERTIES ENVIRONMENT "LANG=en") + +# test for caption in all_subtables.tex +do_parse_test (captionTest ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex "" +".begin{document} +.begin{longtable}{.c.c.} +.caption{Caption of the table} +") +SET_TESTS_PROPERTIES(ParseTest-captionTest PROPERTIES ENVIRONMENT "LANG=en") + +# test all_subtables.tex +do_parse_test (all_subtablesCmp ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-all_subtablesCmp PROPERTIES ENVIRONMENT "LANG=en") + +# test all_subtables.tex +do_parse_test (linesCmp ${PROJECT_SOURCE_DIR}/test/tex/lines.tex ${PROJECT_SOURCE_DIR}/test/tex/lines.etalon.tex +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-linesCmp PROPERTIES ENVIRONMENT "LANG=en") + +# test ltable_embedded.tex +do_parse_test (ltable_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_embedded.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-ltable_embedded PROPERTIES ENVIRONMENT "LANG=en") + +# test ltable_double_embedded.tex +do_parse_test (ltable_double_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_double_embedded.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-ltable_double_embedded PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle_VK2500.tex +do_parse_test (throttle_VK2500Cmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-throttle_VK2500Cmp PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle_VK2500.tex +do_parse_test (throttle_VK2500PSCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500PS.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-throttle_VK2500PSCmp PROPERTIES ENVIRONMENT "LANG=en") + +# test throttle_VK2500_dos_newlines_.tex +do_parse_test (throttle_VK2500PS_dos_newlines_ListWalk ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500PS_dos_newlines.tex "" +"list all objects +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +end of objects + +Walk through all objects +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +end of objects +") +SET_TESTS_PROPERTIES(ParseTest-throttle_VK2500PS_dos_newlines_ListWalk PROPERTIES ENVIRONMENT "LANG=en") + +# test graph_in_ltable.tex +do_parse_test (graph_in_ltable ${PROJECT_SOURCE_DIR}/test/tex/graph_in_ltable.tex "" +" +list all objects +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableLongtable + LAviewTableLongtable +LAviewText +LAviewTableLongtable + LAviewGraphics + LAviewTableLongtable +LAviewText +end of objects + +Walk through all objects +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableLongtable +LAviewText +LAviewTableLongtable +LAviewText +end of objects +") +SET_TESTS_PROPERTIES(ParseTest-graph_in_ltable PROPERTIES ENVIRONMENT "LANG=en") + +# test ltable_square_arg.tex +do_parse_test (ltable_square_arg ${PROJECT_SOURCE_DIR}/test/tex/ltable_square_arg.tex "" +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-ltable_square_arg PROPERTIES ENVIRONMENT "LANG=en") + +# test table_in_table.tex +do_parse_test (table_in_table ${PROJECT_SOURCE_DIR}/test/tex/table_in_table.tex "" +" +list all objects +") +SET_TESTS_PROPERTIES(ParseTest-table_in_table PROPERTIES ENVIRONMENT "LANG=en") + +# test unary_quotes.tex +do_parse_test (unary_quotes ${PROJECT_SOURCE_DIR}/test/tex/unary_quotes.tex "" +" +list all objects +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +end of objects + +Walk through all objects +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +LAviewTableTabular +LAviewText +end of objects +") +SET_TESTS_PROPERTIES(ParseTest-unary_quotes PROPERTIES ENVIRONMENT "LANG=en") + +# test back_slashes_in_a_table.tex +do_parse_test (back_slashes_in_a_table ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.tex ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.etalon.tex +"Original and generated text are EQUAL .-.") +SET_TESTS_PROPERTIES(ParseTest-back_slashes_in_a_table PROPERTIES ENVIRONMENT "LANG=en") + +# enable testing +ENABLE_TESTING () diff --git a/test/ParseTest.vala b/test/parse-test/ParseTest.vala similarity index 100% rename from test/ParseTest.vala rename to test/parse-test/ParseTest.vala diff --git a/test/split-test/CMakeLists.txt b/test/split-test/CMakeLists.txt new file mode 100644 index 0000000..f517222 --- /dev/null +++ b/test/split-test/CMakeLists.txt @@ -0,0 +1,26 @@ +SET (BinName split_test) +FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} SplitTest.vala) +SET (BinPackages 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") +INCLUDE (ValaBinCommonRules) + +# Split tests +MACRO (do_split_test testname limits table etalon regexp) + ADD_TEST (SplitTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/split_test + --limits ${limits} --table ${table} --etalon ${etalon}) +SET_TESTS_PROPERTIES (SplitTest-${testname} + PROPERTIES PASS_REGULAR_EXPRESSION ${regexp} + FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING") +ENDMACRO (do_split_test) + +# test TeXReport_splitLongtable () function +do_split_test (split0 ${PROJECT_SOURCE_DIR}/test/tex/limits1.in + ${PROJECT_SOURCE_DIR}/test/tex/limits_table1.tex + ${PROJECT_SOURCE_DIR}/test/tex/limits_table1.etalon.tex +"Etalon and generated text are EQUAL ...\n") +SET_TESTS_PROPERTIES(SplitTest-split0 PROPERTIES ENVIRONMENT "LANG=en") + +# enable testing +ENABLE_TESTING () diff --git a/test/SplitTest.vala b/test/split-test/SplitTest.vala similarity index 100% rename from test/SplitTest.vala rename to test/split-test/SplitTest.vala diff --git a/util/backbone b/util/backbone new file mode 160000 index 0000000..aa78f6d --- /dev/null +++ b/util/backbone @@ -0,0 +1 @@ +Subproject commit aa78f6d42c85f7f9a98a1a6273230a9775824fc7 diff --git a/util/update-po.sh b/util/update-po.sh deleted file mode 100755 index 550adfa..0000000 --- a/util/update-po.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -## -# settings -## -PROJECT=laview-latex-struct-0 -PO_DIR_NAME=po - -SCRIPT_PATH=`readlink -f $0` -SCRIPT_DIR=${SCRIPT_PATH%/*} -PRJDIR=${SCRIPT_DIR%/*} - -C_FILELIST="${PRJDIR}/src/*.vala" -UI_FILELIST="${PRJDIR}/ui/*.glade" - -## -# code -## -xgettext --language=C --escape --package-name=$PROJECT --default-domain=$PROJECT --add-comments=/// \ - -k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \ - -kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \ - $PRJDIR/$PO_DIR_NAME/source.pot $C_FILELIST - -xgettext --language=C --escape --package-name=$PROJECT --default-domain=$PROJECT --add-comments=/// \ - -k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \ - -kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \ - $PRJDIR/$PO_DIR_NAME/glade.pot $C_FILELIST - -msgcat -o $PRJDIR/$PO_DIR_NAME/$PROJECT.pot --use-first $PRJDIR/$PO_DIR_NAME/source.pot $PRJDIR/$PO_DIR_NAME/glade.pot - -rm $PRJDIR/$PO_DIR_NAME/source.pot -rm $PRJDIR/$PO_DIR_NAME/glade.pot - -[ 0 != $? ] && echo "xgettext failed ;-(" && exit 1 -[ ! -e $PRJDIR/$PO_DIR_NAME/$PROJECT.pot ] && echo "No strings found ;-(" && exit 1 - -for d in $PRJDIR/$PO_DIR_NAME/*; do - [ ! -d $d ] && continue - - if [ -e $d/$PROJECT.po ]; then - echo "Merging '${d##*/}' locale" && msgmerge -F -U $d/$PROJECT.po $PRJDIR/$PO_DIR_NAME/$PROJECT.pot - [ 0 != $? ] && echo "msgmerge failed ;(" && exit 1 - else - echo "Creating '${d##*/}' locale" && msginit -l ${d##*/} -o $d/$PROJECT.po -i $PRJDIR/$PO_DIR_NAME/$PROJECT.pot - [ 0 != $? ] && echo "msginit failed ;(" && exit 1 - fi - -done diff --git a/util/valadoc.sh b/util/valadoc.sh deleted file mode 100755 index b5a62b5..0000000 --- a/util/valadoc.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -EXE_PATH="`readlink -f $0`" -PRJ_PATH="${EXE_PATH%/*/*}" -OUT_PATH="$PRJ_PATH/doc/html/latex-struct" -OUT_INTERNAL_PATH="$PRJ_PATH/doc/html/latex-struct-internals" - -echo "Generating documentation..." -rm -rf "$OUT_PATH" -valadoc --no-protected -o "$OUT_PATH" -b "$PRJ_PATH/src" `find "$PRJ_PATH/src" -name "*.vapi" -or -name "*.vala"` \ - --pkg=gtk+-3.0 --pkg=gee-0.8 --pkg=gmodule-2.0 --pkg=posix -firefox "$OUT_PATH"/latex-struct/index.htm &>/dev/null - -#echo "Generating internal documentation..." -#rm -rf "$OUT_INTERNAL_PATH" -#valadoc -o "$OUT_INTERNAL_PATH" -b "$PRJ_PATH/src" `find "$PRJ_PATH/src" -name "*.vapi" -or -name "*.vala"` \ -# --pkg=gtk+-3.0 --pkg=gee-0.8 --pkg=gmodule-2.0 --pkg=posix --internal - -#firefox "$OUT_INTERNAL_PATH"/latex-struct-internals/index.htm &>/dev/null diff --git a/valadoc_env b/valadoc_env index 2e03d6c..9464d65 100644 --- a/valadoc_env +++ b/valadoc_env @@ -1,2 +1,2 @@ BASEDIR=src -PKGS=gtk+-3.0 gee-0.8 gmodule-2.0 posix +PKGS=gee-0.8 posix From ccfcd4710081681f5a64034e8bb979dc17c2d90e Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 26 Oct 2014 18:30:30 +0300 Subject: [PATCH 8/8] Bumped version number to 0.1.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f5af0c..b66c654 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ SET (PROJECT_DESCRIPTION "LaTeX representation in the memory.") SET (MAJOR 0) SET (MINOR 1) -SET (PATCH 0) +SET (PATCH 1) LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone)