Merge branch 'release-0.1.1'
This commit is contained in:
commit
77c310fb05
|
@ -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
|
129
CMakeLists.txt
129
CMakeLists.txt
|
@ -2,129 +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 (MINOR 1)
|
||||
SET (PATCH 1)
|
||||
SET (VERSION ${MAJOR}.${MINOR}.${PATCH})
|
||||
|
||||
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
INCLUDE (MacroOptionalAddSubdirectory)
|
||||
INCLUDE (CPackDetectArch)
|
||||
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") # supress Gcc warnings
|
||||
|
||||
# configure a header file for Gettext
|
||||
SET (GETTEXT_PACKAGE "laview-latex-struct")
|
||||
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 ()
|
||||
|
|
27
INSTALL
27
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.
|
||||
|
|
|
@ -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}")
|
|
@ -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")
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
|
||||
# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
|
||||
# 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, <neundorf@kde.org>
|
||||
#
|
||||
# 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)
|
|
@ -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
|
||||
# <provided_name>.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
|
||||
# <provided_name>.h and <provided_name>_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)
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 7041f32ce90e745a7084ac4c5369dfb82da6685b
|
|
@ -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)
|
|
@ -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:
|
|
@ -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"
|
||||
)
|
|
@ -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@
|
|
@ -1,9 +1,41 @@
|
|||
find_package(Gettext REQUIRED)
|
||||
if (NOT GETTEXT_MSGMERGE_EXECUTABLE)
|
||||
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)
|
||||
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)
|
||||
ENDIF (NOT GETTEXT_MSGFMT_EXECUTABLE)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef @GettextUniqueHeader@_H
|
||||
#define @GettextUniqueHeader@_H
|
||||
|
||||
#define GETTEXT_PACKAGE "@GettextPackageNameAbi@"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define _(String) dgettext (GETTEXT_PACKAGE, String)
|
||||
#endif
|
||||
|
||||
#endif // @GettextUniqueHeader@_H
|
|
@ -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-10-26 17:59+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -17,45 +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/TableParser.vala:413
|
||||
#: /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/latex-struct/Table.vala:312
|
||||
msgid "3rd param (limits) is incorrect. Read the manual."
|
||||
msgstr ""
|
||||
|
||||
#: /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/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 ""
|
||||
|
|
|
@ -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-10-26 15:56+0300\n"
|
||||
"PO-Revision-Date: 2014-05-28 10:50+0400\n"
|
||||
"Last-Translator: <backbone@backbone.ws>\n"
|
||||
"Language-Team: Russian\n"
|
||||
|
@ -18,50 +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/TableParser.vala:413
|
||||
#: /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/latex-struct/Table.vala:312
|
||||
msgid "3rd param (limits) is incorrect. Read the manual."
|
||||
msgstr "3-ий параметр (limits) не верный. Смотрите документацию."
|
||||
|
||||
#: /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/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'."
|
||||
|
|
|
@ -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}
|
||||
CUSTOM_VAPIS
|
||||
GENERATE_VAPI laview-latex-struct-${MAJOR}
|
||||
GENERATE_HEADER laview-latex-struct-${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})
|
||||
IF (WIN32)
|
||||
SET_TARGET_PROPERTIES (laview-latex-struct PROPERTIES PREFIX "" IMPORT_PREFIX "" SUFFIX "-${MAJOR}.dll")
|
||||
ENDIF (WIN32)
|
||||
|
||||
IF (UNIX)
|
||||
INSTALL (TARGETS laview-latex-struct DESTINATION lib)
|
||||
ELSEIF (WIN32)
|
||||
INSTALL (TARGETS laview-latex-struct
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
ENDIF (UNIX)
|
||||
|
||||
INSTALL (FILES ${CMAKE_BINARY_DIR}/src/laview-latex-struct-${MAJOR}.h DESTINATION include)
|
||||
ADD_SUBDIRECTORY (latex-struct)
|
||||
|
|
181
src/Table.vala
181
src/Table.vala
|
@ -1,181 +0,0 @@
|
|||
namespace LAview {
|
||||
|
||||
/**
|
||||
* Tables and its components in the document.
|
||||
*/
|
||||
namespace Table {
|
||||
|
||||
/**
|
||||
* Any Table in the LaTeX document.
|
||||
*/
|
||||
public abstract class ATable : ADoc {
|
||||
|
||||
/**
|
||||
* Align of the table.
|
||||
*
|
||||
* Possible values: 't', 'b'.
|
||||
*/
|
||||
public char align;
|
||||
|
||||
/**
|
||||
* Style of the {@link AddSpace}/{@link Subtable}.
|
||||
*/
|
||||
public AddSpaces.Style style;
|
||||
|
||||
/**
|
||||
* Parameters of columns.
|
||||
*/
|
||||
public ColParams params = new ColParams ();
|
||||
|
||||
/**
|
||||
* Main sutable.
|
||||
*/
|
||||
public Subtable table = new Subtable ();
|
||||
|
||||
/**
|
||||
* First Header.
|
||||
*/
|
||||
public Subtable first_header = new Subtable ();
|
||||
|
||||
/**
|
||||
* Header.
|
||||
*/
|
||||
public Subtable header = new Subtable ();
|
||||
|
||||
/**
|
||||
* Footer.
|
||||
*/
|
||||
public Subtable footer = new Subtable ();
|
||||
|
||||
/**
|
||||
* Last Footer.
|
||||
*/
|
||||
public Subtable last_footer = new Subtable ();
|
||||
|
||||
protected ATable () {}
|
||||
|
||||
/**
|
||||
* Gets a copy of the //Table//.
|
||||
*/
|
||||
public override IDoc copy () {
|
||||
var clone = Object.new (this.get_type ()) as ATable;
|
||||
|
||||
clone.align = align;
|
||||
clone.style = style;
|
||||
clone.params = params.copy () as ColParams;
|
||||
clone.table = table.copy () as Subtable;
|
||||
clone.first_header = first_header.copy () as Subtable;
|
||||
clone.header = header.copy () as Subtable;
|
||||
clone.footer = footer.copy () as Subtable;
|
||||
clone.last_footer = last_footer.copy () as Subtable;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates LaTeX string for the //Table//.
|
||||
*/
|
||||
public override string generate () {
|
||||
assert (false);
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes {@link Cell}-s in the column by specified index.
|
||||
*
|
||||
* @param index index of column to remove.
|
||||
* @param line_style {@link Row.OpLineStyle} of the operation.
|
||||
*/
|
||||
public void remove_col (int index, Row.OpLineStyle line_style
|
||||
= Row.OpLineStyle.BORDER_DBLLINES) {
|
||||
if (index >= params.size) return;
|
||||
|
||||
var param = params.get (index) as ColParam;
|
||||
|
||||
if ((line_style & Row.OpLineStyle.VBORDER) != 0 && param.align != "") {
|
||||
if (params.size > 1) {
|
||||
if (index == 0)
|
||||
(params.get (1) as ColParam).nllines = param.nllines;
|
||||
else if (index == params.size - 1)
|
||||
(params.get (params.size - 2) as ColParam).nrlines = param.nrlines;
|
||||
}
|
||||
}
|
||||
|
||||
if ((line_style & Row.OpLineStyle.VDBLLINES) != 0) {
|
||||
if (index > 0 && index < params.size - 1) {
|
||||
var prev = params.get (index - 1) as ColParam,
|
||||
next = params.get (index + 1) as ColParam;
|
||||
next.nllines = prev.nrlines != 0 || next.nllines != 0 ? 1 : 0;
|
||||
prev.nrlines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
params.remove_at (index);
|
||||
|
||||
first_header.remove_col (index, line_style);
|
||||
header.remove_col (index, line_style);
|
||||
footer.remove_col (index, line_style);
|
||||
last_footer.remove_col (index, line_style);
|
||||
table.remove_col (index, line_style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones column of {@link Cell}-s by specified indexes.
|
||||
*
|
||||
* @param src_index source position of the column.
|
||||
* @param dest_index destination to clone the column.
|
||||
* @param multicol preserve multicolumn property or not.
|
||||
* @param line_style {@link Row.OpLineStyle} of the operation.
|
||||
*/
|
||||
public void clone_col (int src_index, int dest_index, bool multicol,
|
||||
Row.OpLineStyle line_style
|
||||
= Row.OpLineStyle.BORDER_DBLLINES) {
|
||||
if (src_index >= params.size || dest_index > params.size) return;
|
||||
|
||||
var param = params.get (src_index).copy () as ColParam;
|
||||
|
||||
if ((Row.OpLineStyle.VBORDER & line_style) != 0) {
|
||||
if (dest_index >= params.size) {
|
||||
var last_param = params.get (params.size - 1) as ColParam;
|
||||
if (last_param.align != "")
|
||||
param.nrlines = last_param.nrlines;
|
||||
} else {
|
||||
var first_param = params.get (0) as ColParam;
|
||||
if (dest_index == 0 && first_param.align != "")
|
||||
param.nllines = first_param.nllines;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Row.OpLineStyle.VDBLLINES & line_style) != 0) {
|
||||
int prev_index;
|
||||
bool prev_edit = false;
|
||||
|
||||
if (dest_index < params.size) {
|
||||
prev_index = dest_index > 0 ? dest_index - 1 : 0;
|
||||
if (prev_index > 0) prev_edit = true;
|
||||
var dest_param = params.get (dest_index) as ColParam;
|
||||
dest_param.nllines = param.nrlines != 0 || dest_param.nllines != 0 ? 1 : 0;
|
||||
param.nrlines = 0;
|
||||
} else {
|
||||
prev_edit = true;
|
||||
prev_index = params.size - 1;
|
||||
}
|
||||
|
||||
if (prev_edit) {
|
||||
var prev_param = params.get (prev_index) as ColParam;
|
||||
param.nllines = prev_param.nrlines != 0 || param.nllines != 0 ? 1 : 0;
|
||||
prev_param.nrlines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
params.insert (dest_index, param);
|
||||
|
||||
first_header.clone_col (src_index, dest_index, multicol, line_style);
|
||||
header.clone_col (src_index, dest_index, multicol, line_style);
|
||||
footer.clone_col (src_index, dest_index, multicol, line_style);
|
||||
last_footer.clone_col (src_index, dest_index, multicol, line_style);
|
||||
table.clone_col (src_index, dest_index, multicol, line_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 <glib/gi18n-lib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define _(String) dgettext (GETTEXT_PACKAGE, String)
|
||||
#endif
|
||||
|
||||
#endif // LAVIEW_LATEX_STRUCT_H
|
|
@ -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} <<BR>>
|
||||
* 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;
|
|
@ -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 ();
|
|
@ -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)
|
|
@ -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),
|
|
@ -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 ();
|
|
@ -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 () {}
|
||||
}
|
|
@ -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 ();
|
|
@ -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 () {}
|
||||
}
|
|
@ -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[");
|
|
@ -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 ();
|
|
@ -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 ();
|
|
@ -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 ();
|
|
@ -0,0 +1,335 @@
|
|||
namespace LAview {
|
||||
|
||||
/**
|
||||
* Tables and its components in the document.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
public abstract class ATable : ADoc {
|
||||
|
||||
/**
|
||||
* Align of the table.
|
||||
*
|
||||
* Possible values: 't', 'b'.
|
||||
*/
|
||||
public char align;
|
||||
|
||||
/**
|
||||
* Style of the {@link AddSpace}/{@link Subtable}.
|
||||
*/
|
||||
public AddSpaces.Style style;
|
||||
|
||||
/**
|
||||
* Parameters of columns.
|
||||
*/
|
||||
public ColParams params = new ColParams ();
|
||||
|
||||
/**
|
||||
* Main sutable.
|
||||
*/
|
||||
public Subtable table = new Subtable ();
|
||||
|
||||
/**
|
||||
* First Header.
|
||||
*/
|
||||
public Subtable first_header = new Subtable ();
|
||||
|
||||
/**
|
||||
* Header.
|
||||
*/
|
||||
public Subtable header = new Subtable ();
|
||||
|
||||
/**
|
||||
* Footer.
|
||||
*/
|
||||
public Subtable footer = new Subtable ();
|
||||
|
||||
/**
|
||||
* Last Footer.
|
||||
*/
|
||||
public Subtable last_footer = new Subtable ();
|
||||
|
||||
protected ATable () {}
|
||||
|
||||
/**
|
||||
* Gets a copy of the ``ATable``.
|
||||
*/
|
||||
public override IDoc copy () {
|
||||
var clone = Object.new (get_type ()) as ATable;
|
||||
|
||||
clone.align = align;
|
||||
clone.style = style;
|
||||
clone.params = params.copy () as ColParams;
|
||||
clone.table = table.copy () as Subtable;
|
||||
clone.first_header = first_header.copy () as Subtable;
|
||||
clone.header = header.copy () as Subtable;
|
||||
clone.footer = footer.copy () as Subtable;
|
||||
clone.last_footer = last_footer.copy () as Subtable;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates LaTeX string for the ``ATable``.
|
||||
*/
|
||||
public override string generate () {
|
||||
assert (false);
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes {@link Cell}-s in the column by specified index.
|
||||
*
|
||||
* @param index index of column to remove.
|
||||
* @param line_style {@link Row.OpLineStyle} of the operation.
|
||||
*/
|
||||
public void remove_col (int index, Row.OpLineStyle line_style
|
||||
= Row.OpLineStyle.BORDER_DBLLINES) {
|
||||
if (index >= params.size) return;
|
||||
|
||||
var param = params.get (index) as ColParam;
|
||||
|
||||
if ((line_style & Row.OpLineStyle.VBORDER) != 0 && param.align != "") {
|
||||
if (params.size > 1) {
|
||||
if (index == 0)
|
||||
(params.get (1) as ColParam).nllines = param.nllines;
|
||||
else if (index == params.size - 1)
|
||||
(params.get (params.size - 2) as ColParam).nrlines = param.nrlines;
|
||||
}
|
||||
}
|
||||
|
||||
if ((line_style & Row.OpLineStyle.VDBLLINES) != 0) {
|
||||
if (index > 0 && index < params.size - 1) {
|
||||
var prev = params.get (index - 1) as ColParam,
|
||||
next = params.get (index + 1) as ColParam;
|
||||
next.nllines = prev.nrlines != 0 || next.nllines != 0 ? 1 : 0;
|
||||
prev.nrlines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
params.remove_at (index);
|
||||
|
||||
first_header.remove_col (index, line_style);
|
||||
header.remove_col (index, line_style);
|
||||
footer.remove_col (index, line_style);
|
||||
last_footer.remove_col (index, line_style);
|
||||
table.remove_col (index, line_style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones column of {@link Cell}-s by specified indexes.
|
||||
*
|
||||
* @param src_index source position of the column.
|
||||
* @param dest_index destination to clone the column.
|
||||
* @param multicol preserve multicolumn property or not.
|
||||
* @param line_style {@link Row.OpLineStyle} of the operation.
|
||||
*/
|
||||
public void clone_col (int src_index, int dest_index, bool multicol,
|
||||
Row.OpLineStyle line_style
|
||||
= Row.OpLineStyle.BORDER_DBLLINES) {
|
||||
if (src_index >= params.size || dest_index > params.size) return;
|
||||
|
||||
var param = params.get (src_index).copy () as ColParam;
|
||||
|
||||
if ((Row.OpLineStyle.VBORDER & line_style) != 0) {
|
||||
if (dest_index >= params.size) {
|
||||
var last_param = params.get (params.size - 1) as ColParam;
|
||||
if (last_param.align != "")
|
||||
param.nrlines = last_param.nrlines;
|
||||
} else {
|
||||
var first_param = params.get (0) as ColParam;
|
||||
if (dest_index == 0 && first_param.align != "")
|
||||
param.nllines = first_param.nllines;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Row.OpLineStyle.VDBLLINES & line_style) != 0) {
|
||||
int prev_index;
|
||||
bool prev_edit = false;
|
||||
|
||||
if (dest_index < params.size) {
|
||||
prev_index = dest_index > 0 ? dest_index - 1 : 0;
|
||||
if (prev_index > 0) prev_edit = true;
|
||||
var dest_param = params.get (dest_index) as ColParam;
|
||||
dest_param.nllines = param.nrlines != 0 || dest_param.nllines != 0 ? 1 : 0;
|
||||
param.nrlines = 0;
|
||||
} else {
|
||||
prev_edit = true;
|
||||
prev_index = params.size - 1;
|
||||
}
|
||||
|
||||
if (prev_edit) {
|
||||
var prev_param = params.get (prev_index) as ColParam;
|
||||
param.nllines = prev_param.nrlines != 0 || param.nllines != 0 ? 1 : 0;
|
||||
prev_param.nrlines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
params.insert (dest_index, param);
|
||||
|
||||
first_header.clone_col (src_index, dest_index, multicol, line_style);
|
||||
header.clone_col (src_index, dest_index, multicol, line_style);
|
||||
footer.clone_col (src_index, dest_index, multicol, line_style);
|
||||
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<SplitLimit?> 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<SplitLimit?> sorted_limits) {
|
||||
var lim_indexes = new uint[sorted_limits.length];
|
||||
for (var i = 0; i < sorted_limits.length; ++i)
|
||||
lim_indexes[i] = sorted_limits.index (i).first;
|
||||
return lim_indexes;
|
||||
}
|
||||
|
||||
ATable? split_table (Array<SplitLimit?> 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<<BR>>
|
||||
* ``[fix1 fix2 colA1 colA2 colA3 colA4 colA5 fix3 fix4 colB1 colB2 colB3 colB4 fix5 fix6]``<<BR>>
|
||||
* with limits { {2, 6, 2}, {9, 12, 3} }<<BR>>
|
||||
* will be splitted into 3 tables<<BR>>
|
||||
* [fix1 fix2 colA1 colA2 fix3 fix4 colB1 colB2 colB3 fix5 fix6]<<BR>>
|
||||
* [fix1 fix2 colA3 colA4 fix3 fix4 colB4 fix6]<<BR>>
|
||||
* [fix1 fix2 colA5 fix3 fix4 fix6]<<BR>>
|
||||
* 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<SplitLimit?> limits,
|
||||
Row.OpLineStyle line_style = Row.OpLineStyle.BORDER_DBLLINES) throws SplitError {
|
||||
/* is table a child of glob */
|
||||
var glob_index = glob.index_of (this);
|
||||
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<SplitLimit?>.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<int> clines_p = clines.first ();
|
||||
foreach (var cell in tmp_row as Gee.ArrayList<Cell>) {
|
|
@ -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 ();
|
|
@ -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;
|
|
@ -1,16 +1,16 @@
|
|||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h>
|
||||
#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
|
||||
}
|
||||
|
|
@ -1,390 +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 the 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/laview-latex-struct-${MAJOR}.vapi
|
||||
GENERATE_VAPI
|
||||
GENERATE_HEADER
|
||||
)
|
||||
ADD_EXECUTABLE (ParseTest ${ParseTest_C})
|
||||
TARGET_LINK_LIBRARIES (ParseTest laview-latex-struct ${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
|
||||
GENERATE_VAPI
|
||||
GENERATE_HEADER
|
||||
)
|
||||
ADD_EXECUTABLE (LTableTest ${LTableTest_C})
|
||||
TARGET_LINK_LIBRARIES (LTableTest laview-latex-struct ${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 .-.")
|
||||
|
||||
# enable testing
|
||||
ENABLE_TESTING ()
|
||||
INCLUDE (CTest)
|
||||
|
|
|
@ -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 ()
|
|
@ -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;
|
|
@ -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 ()
|
|
@ -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 ()
|
|
@ -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<Table.ATable.SplitLimit?> ();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
9 11 3
|
||||
2 6 2
|
||||
13 16 1
|
|
@ -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}
|
|
@ -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}
|
|
@ -0,0 +1 @@
|
|||
Subproject commit aa78f6d42c85f7f9a98a1a6273230a9775824fc7
|
|
@ -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
|
|
@ -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
|
|
@ -1,2 +1,2 @@
|
|||
BASEDIR=src
|
||||
PKGS=gtk+-3.0 gee-0.8 gmodule-2.0 posix
|
||||
PKGS=gee-0.8 posix
|
||||
|
|
Loading…
Reference in New Issue