Browse Source

Closes #95: Switch to Backbone's CMake Scheme.

develop
Kolan Sh 7 years ago
parent
commit
5bfa613f47
  1. 6
      .gitmodules
  2. 132
      CMakeLists.txt
  3. 27
      INSTALL
  4. 20
      cmake/CPackDetectArch.cmake
  5. 69
      cmake/FindVala.cmake
  6. 31
      cmake/MacroOptionalAddSubdirectory.cmake
  7. 180
      cmake/UseVala.cmake
  8. 1
      cmake/backbone
  9. 11
      cpack/CMakeLists.txt
  10. 11
      laview-latex-struct.pc.in
  11. 22
      pkg-config/CMakeLists.txt
  12. 11
      pkg-config/pkg-config.pc.in
  13. 50
      po/CMakeLists.txt
  14. 11
      po/gettext-config.h.in
  15. 34
      po/laview-latex-struct-0.pot
  16. 34
      po/ru/laview-latex-struct-0.po
  17. 37
      src/CMakeLists.txt
  18. 11
      src/gettext-config.h.in
  19. 0
      src/latex-struct/AddSpace.vala
  20. 0
      src/latex-struct/AddSpaces.vala
  21. 7
      src/latex-struct/CMakeLists.txt
  22. 0
      src/latex-struct/Cell.vala
  23. 0
      src/latex-struct/ColParam.vala
  24. 0
      src/latex-struct/ColParams.vala
  25. 0
      src/latex-struct/DocIfaces.vala
  26. 0
      src/latex-struct/Glob.vala
  27. 0
      src/latex-struct/GlobParser.vala
  28. 0
      src/latex-struct/Graphics.vala
  29. 0
      src/latex-struct/GraphicsParser.vala
  30. 0
      src/latex-struct/Longtable.vala
  31. 0
      src/latex-struct/LongtableParser.vala
  32. 0
      src/latex-struct/Parser.vala
  33. 0
      src/latex-struct/ParserFactory.vala
  34. 0
      src/latex-struct/Row.vala
  35. 0
      src/latex-struct/Subtable.vala
  36. 0
      src/latex-struct/Table.vala
  37. 0
      src/latex-struct/TableParser.vala
  38. 0
      src/latex-struct/Tabular.vala
  39. 0
      src/latex-struct/TabularParser.vala
  40. 0
      src/latex-struct/Text.vala
  41. 0
      src/latex-struct/TextParser.vala
  42. 0
      src/latex-struct/main.vala
  43. 17
      src/library_constructor.c
  44. 419
      test/CMakeLists.txt
  45. 88
      test/ltable-test/CMakeLists.txt
  46. 0
      test/ltable-test/LTableTest.vala
  47. 326
      test/parse-test/CMakeLists.txt
  48. 0
      test/parse-test/ParseTest.vala
  49. 26
      test/split-test/CMakeLists.txt
  50. 0
      test/split-test/SplitTest.vala
  51. 1
      util/backbone
  52. 48
      util/update-po.sh
  53. 19
      util/valadoc.sh
  54. 2
      valadoc_env

6
.gitmodules

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

132
CMakeLists.txt

@ -2,130 +2,20 @@ PROJECT (LAviewLatexStruct C)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
SET (MAJOR 0)
SET (MINOR 0)
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
SET (PROJ_LCASE "laview-latex-struct")
# configure a header file for Gettext
SET (GETTEXT_PACKAGE "${PROJ_LCASE}")
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
IF (WIN32)
SET (LOCALEDIR "")
ELSE ()
SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
ENDIF ()
SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
IF (NOT CUSTOM_LOCALEDIR STREQUAL "")
SET (LOCALEDIR "${CUSTOM_LOCALEDIR}")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ENDIF ()
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
SET (LOCALE_INSTALL_DIR "share/locale")
MACRO_OPTIONAL_ADD_SUBDIRECTORY (po)
SET (PROJECT_LOWERCASE_NAME "laview-latex-struct")
SET (PROJECT_DESCRIPTION "LaTeX representation in the memory.")
# 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 (MAJOR 0)
SET (MINOR 1)
SET (PATCH 0)
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

@ -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.

20
cmake/CPackDetectArch.cmake

@ -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}")

69
cmake/FindVala.cmake

@ -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")

31
cmake/MacroOptionalAddSubdirectory.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)

180
cmake/UseVala.cmake

@ -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)

1
cmake/backbone

@ -0,0 +1 @@
Subproject commit 7041f32ce90e745a7084ac4c5369dfb82da6685b

11
cpack/CMakeLists.txt

@ -0,0 +1,11 @@
SET (CONTACT "backbone@backbone.ws")
SET (DEBIAN_DEPENDENCIES "valac (>= 0.24), libglib2.0-bin (>= 2.33), libgee (>=
0.16)")
SET (DEBIAN_SECTION "Libraries")
SET (REDHAT_DEPENDENCIES "vala >= 0.24, glib >= 2.33, libgee >= 0.16")
SET (REDHAT_SECTION "Applications/Text")
SET (LICENSE "LGPLv3+")
SET (WIN32_UNINSTALL_NAME "LVLatStr") # <= 8 symbols for the name
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
INCLUDE (CPackCommon)

11
laview-latex-struct.pc.in

@ -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:

22
pkg-config/CMakeLists.txt

@ -0,0 +1,22 @@
# configure pkg-config file
IF (WIN32)
SET (PkgConfigPrefix "")
ELSE ()
SET (PkgConfigPrefix ${CMAKE_INSTALL_PREFIX})
ENDIF ()
SET (PkgConfigExecPrefix "\${prefix}")
SET (PkgConfigLibDir "\${exec_prefix}/lib")
SET (PkgConfigIncludeDir "\${prefix}/include")
SET (PkgConfigName "${CMAKE_PROJECT_NAME}")
SET (PkgConfigDescription "${PROJECT_DESCRIPTION}")
SET (PkgConfigVersion "${MAJOR}.${MINOR}.${PATCH}")
SET (PkgConfigLibs "-L\${libdir}")
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-${MAJOR}")
SET (PkgConfigLibsPrivate "")
SET (PkgConfigCflags "")
CONFIGURE_FILE (
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc"
)

11
pkg-config/pkg-config.pc.in

@ -0,0 +1,11 @@
prefix=@PkgConfigPrefix@
exec_prefix=@PkgConfigExecPrefix@
libdir=@PkgConfigLibDir@
includedir=@PkgConfigIncludeDir@
Name: @PkgConfigName@
Description: @PkgConfigDescription@
Version: @PkgConfigVersion@
Libs: @PkgConfigLibs@
Libs.private: @PkgConfigLibsPrivate@
Cflags: @PkgConfigCflags@

50
po/CMakeLists.txt

@ -1,9 +1,41 @@
find_package(Gettext REQUIRED)
if (NOT GETTEXT_MSGMERGE_EXECUTABLE)
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
endif (NOT GETTEXT_MSGMERGE_EXECUTABLE)
if (NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
endif (NOT GETTEXT_MSGFMT_EXECUTABLE)
add_subdirectory(ru)
#add_subdirectory(de)
SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME_ABI}")
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
IF (WIN32)
SET (LOCALEDIR "")
ELSE ()
SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
ENDIF ()
SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
IF (NOT CUSTOM_LOCALEDIR STREQUAL "")
SET (LOCALEDIR "${CUSTOM_LOCALEDIR}")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ENDIF ()
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
SET (LOCALE_INSTALL_DIR "share/locale")
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
INCLUDE (MacroOptionalAddSubdirectory)
FIND_PACKAGE (Gettext REQUIRED)
MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs)
# configure a header file for Gettext
SET (VERSION ${MAJOR}.${MINOR}.${PATCH})
SET (PROJECT_LOWERCASE_NAME_ABI "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader)
SET (GettextPackageNameAbi "${PROJECT_LOWERCASE_NAME_ABI}")
CONFIGURE_FILE (
"gettext-config.h.in"
"${PROJECT_BINARY_DIR}/po/gettext-config.h"
)
IF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
MESSAGE (FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
IF (NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGFMT_EXECUTABLE)

11
po/gettext-config.h.in

@ -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

34
po/laview-latex-struct-0.pot

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: laview-latex-struct-0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-31 18:16+0400\n"
"POT-Creation-Date: 2014-10-26 17:59+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,57 +17,57 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:58
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:58
#, c-format
msgid "Begin tag sequence '%s' without end tag pair."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:127
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:582
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:127
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:585
#, c-format
msgid ": Unexpected end tag sequence '%s' without begin tag pair."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:179
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:188
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:205
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:148
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:148
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:179
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:188
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:205
msgid "Error parsing subdoc."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/LongtableParser.vala:44
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/LongtableParser.vala:44
#, c-format
msgid "Incorrect longtable parameters doesn't match '%s' regexp."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:298
msgid "2nd param (ATable) isn't a child of the 1st (Glob)."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:312
msgid "3rd param (limits) is incorrect. Read the manual."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:329
msgid "Cann't split the table. Read the manual."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:416
#, c-format
msgid "Unexpected end external tag sequence '%s' without begin tag pair."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:449
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:452
#, c-format
msgid "Begin tag sequence '%s':%d:%d without end tag pair."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:612
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:615
msgid "\\cline parameters doesn't match {number-number} regexp."
msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TabularParser.vala:43
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TabularParser.vala:43
#, c-format
msgid "Incorrect tabular parameters doesn't match '%s' regexp."
msgstr ""

34
po/ru/laview-latex-struct-0.po

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: laview-latex-struct-0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-31 18:16+0400\n"
"POT-Creation-Date: 2014-10-26 15:56+0300\n"
"PO-Revision-Date: 2014-05-28 10:50+0400\n"
"Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: Russian\n"
@ -18,62 +18,62 @@ msgstr ""
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:58
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:58
#, c-format
msgid "Begin tag sequence '%s' without end tag pair."
msgstr "Стартовая последовательность тегов '%s' без соответствующей стоп-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:127
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:582
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:127
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:585
#, c-format
msgid ": Unexpected end tag sequence '%s' without begin tag pair."
msgstr ""
": Неожиданная завершающая последовательность тегов '%s' без соответствующей "
"старт-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:179
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:188
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:205
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:148
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:148
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:179
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:188
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:205
msgid "Error parsing subdoc."
msgstr "Ошибка разбора поддокумента."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/LongtableParser.vala:44
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/LongtableParser.vala:44
#, c-format
msgid "Incorrect longtable parameters doesn't match '%s' regexp."
msgstr "Неверные параметры longtable не удовлетворяют рег. выражению '%s'."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:298
msgid "2nd param (ATable) isn't a child of the 1st (Glob)."
msgstr "2-ой параметр (ATable) не является дочерним узлом 1-ого (Glob)."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:312
msgid "3rd param (limits) is incorrect. Read the manual."
msgstr "3-ий параметр (limits) не верный. Смотрите документацию."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:329
msgid "Cann't split the table. Read the manual."
msgstr "Невозможно разбить таблицу. Смотрите документацию."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:416
#, c-format
msgid "Unexpected end external tag sequence '%s' without begin tag pair."
msgstr ""
": Неожиданная завершающая последовательность внешних тегов '%s' без "
"соответствующей старт-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:449
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:452
#, c-format
msgid "Begin tag sequence '%s':%d:%d without end tag pair."
msgstr ""
"Стартовая последовательность тегов '%s':%d:%d без соответствующей стоп-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:612
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:615
msgid "\\cline parameters doesn't match {number-number} regexp."
msgstr "Параметры \\cline не соответствует рег. выражению {число-число}."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TabularParser.vala:43
#: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TabularParser.vala:43
#, c-format
msgid "Incorrect tabular parameters doesn't match '%s' regexp."
msgstr "Неверные параметры tabular не удовлетворяют рег. выражению '%s'."

37
src/CMakeLists.txt

@ -1,36 +1,3 @@
INCLUDE (FindVala)
INCLUDE (UseVala)
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/po)
FIND_PACKAGE (PkgConfig REQUIRED)
PKG_CHECK_MODULES (GEE REQUIRED gee-0.8)
INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS})
FILE (GLOB_RECURSE LAviewSources RELATIVE ${CMAKE_SOURCE_DIR}/src *.vala)
VALA_PRECOMPILE (VALA_C ${LAviewSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG} --vapi=${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
CUSTOM_VAPIS
GENERATE_VAPI ${PROJ_LCASE}-${MAJOR}_internal
GENERATE_HEADER ${PROJ_LCASE}-${MAJOR}
)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}")
ADD_LIBRARY (${PROJ_LCASE} SHARED ${VALA_C} ${PROJECT_SOURCE_DIR}/src/vala_unsupported.c)
TARGET_LINK_LIBRARIES (${PROJ_LCASE} ${GEE_LIBRARIES})
SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES SOVERSION ${MAJOR})
IF (WIN32)
SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES PREFIX "" IMPORT_PREFIX "" SUFFIX "-${MAJOR}.dll")
ENDIF (WIN32)
IF (UNIX)
INSTALL (TARGETS ${PROJ_LCASE} DESTINATION lib)
ELSEIF (WIN32)
INSTALL (TARGETS ${PROJ_LCASE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
ENDIF (UNIX)
INSTALL (FILES ${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.h DESTINATION include)
ADD_SUBDIRECTORY (latex-struct)

11
src/gettext-config.h.in

@ -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

0
src/AddSpace.vala → src/latex-struct/AddSpace.vala

0
src/AddSpaces.vala → src/latex-struct/AddSpaces.vala

7
src/latex-struct/CMakeLists.txt

@ -0,0 +1,7 @@
SET (LibName ${PROJECT_LOWERCASE_NAME})
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala)
SET (LibPackages gee-0.8 posix)
SET (LibPkgModules gee-0.8)
SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
SET (LibInstall ON)
INCLUDE (ValaLibCommonRules)

0
src/Cell.vala → src/latex-struct/Cell.vala

0
src/ColParam.vala → src/latex-struct/ColParam.vala

0
src/ColParams.vala → src/latex-struct/ColParams.vala

0
src/DocIfaces.vala → src/latex-struct/DocIfaces.vala

0
src/Glob.vala → src/latex-struct/Glob.vala

0
src/GlobParser.vala → src/latex-struct/GlobParser.vala

0
src/Graphics.vala → src/latex-struct/Graphics.vala

0
src/GraphicsParser.vala → src/latex-struct/GraphicsParser.vala

0
src/Longtable.vala → src/latex-struct/Longtable.vala

0
src/LongtableParser.vala → src/latex-struct/LongtableParser.vala

0
src/Parser.vala → src/latex-struct/Parser.vala

0
src/ParserFactory.vala → src/latex-struct/ParserFactory.vala

0
src/Row.vala → src/latex-struct/Row.vala

0
src/Subtable.vala → src/latex-struct/Subtable.vala

0
src/Table.vala → src/latex-struct/Table.vala

0
src/TableParser.vala → src/latex-struct/TableParser.vala

0
src/Tabular.vala → src/latex-struct/Tabular.vala

0
src/TabularParser.vala → src/latex-struct/TabularParser.vala

0
src/Text.vala → src/latex-struct/Text.vala

0
src/TextParser.vala → src/latex-struct/TextParser.vala

0
src/main.vala → src/latex-struct/main.vala

17
src/vala_unsupported.c → src/library_constructor.c

@ -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
}

419
test/CMakeLists.txt

@ -1,416 +1,5 @@
INCLUDE (FindVala)
INCLUDE (UseVala)
ADD_SUBDIRECTORY (ltable-test)
ADD_SUBDIRECTORY (parse-test)
ADD_SUBDIRECTORY (split-test)
FIND_PACKAGE (PkgConfig REQUIRED)
PKG_CHECK_MODULES (GEE REQUIRED gee-0.8)
INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}")
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src")
# add parse_test executable
FILE (GLOB_RECURSE ParseTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test ParseTest.vala)
VALA_PRECOMPILE (ParseTest_C ${ParseTestSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG}
CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
GENERATE_VAPI
GENERATE_HEADER
)
ADD_EXECUTABLE (ParseTest ${ParseTest_C})
TARGET_LINK_LIBRARIES (ParseTest ${PROJ_LCASE} ${GEE_LIBRARIES})
# add ltable_test executable
FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test LTableTest.vala)
VALA_PRECOMPILE (LTableTest_C ${LTableTestSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG}
CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
GENERATE_VAPI
GENERATE_HEADER
)
ADD_EXECUTABLE (LTableTest ${LTableTest_C})
TARGET_LINK_LIBRARIES (LTableTest ${PROJ_LCASE} ${GEE_LIBRARIES})
# add split_test executable
FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test SplitTest.vala)
VALA_PRECOMPILE (SplitTest_C ${LTableTestSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG}
CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
GENERATE_VAPI
GENERATE_HEADER
)
ADD_EXECUTABLE (SplitTest ${SplitTest_C})
TARGET_LINK_LIBRARIES (SplitTest ${PROJ_LCASE} ${GEE_LIBRARIES})
# parsing test macro
MACRO (do_parse_test testname table_path etalon_path regexp)
IF ("${etalon_path}" STREQUAL "")
SET (extra_args "")
ELSE ()
SET (extra_args --etalon ${etalon_path})
ENDIF ()
ADD_TEST (ParseTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ParseTest --table ${table_path} ${extra_args})
SET_TESTS_PROPERTIES (ParseTest-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (do_parse_test)
# test throttle.tex
do_parse_test (throttleList ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test throttle.tex
do_parse_test (includegraphicsWalk ${PROJECT_SOURCE_DIR}/test/tex/includegraphics.tex ""
"Walk through all objects
LAviewText
LAviewGraphics
width=0.000000. height=3.000000pt. path=174.
gen..=.includegraphics.height=3.000000pt.angle=25.scale=3.{174}
resized gen.. = .includegraphics.width=0.500000pt.height=6.000000dd.angle=25.scale=3.{174}
LAviewText
LAviewGraphics
width=12.000000cm. height=25.000000cm. path=151.
gen..=.includegraphics.width=12.000000cm.height=25.000000cm.{151}
resized gen.. = .includegraphics.width=0.500000pt.height=50.000000dd.{151}
LAviewText
end of objects
")
# test throttle.tex
do_parse_test (throttleCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex ""
"Original and generated text are EQUAL .-.")
# test throttle.tex
do_parse_test (throttleErr1 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err1.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair.
.end{longtable}
.")
# test throttle.tex
do_parse_test (throttleErr2 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err2.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{longtable}' without end tag pair.
.begin{longtable}
.
")
# test throttle.tex
do_parse_test (throttleErr3 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err3.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc.
.begin{longtable}
.
LAviewParsersLongtableParser:55:46: Stop external tag sequence '..end{longtable}' without begin tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{longtable} & & & & .tabularnewline
.
")
# test throttle.tex
do_parse_test (throttleErr4 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err4.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:13: : Unexpected end tag sequence '..end{tabular}' without begin tag pair.
.end{tabular}
.")
# test throttle.tex
do_parse_test (throttleErr5 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err5.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{tabular}' without end tag pair.
.begin{tabular}
.
")
# test throttle.tex
do_parse_test (throttleErr6 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err6.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc.
.begin{tabular}
.
LAviewParsersTabularParser:55:46: Stop external tag sequence '..end{tabular}' without begin tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{tabular} & & & & .tabularnewline
.
")
# test formular.tex
do_parse_test (formularList ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test formular.tex
do_parse_test (formularWalk ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"Walk through all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test formular.tex
do_parse_test (formularCmp ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"Original and generated text are EQUAL .-.")
# test formular.tex
do_parse_test (formularErr1 ${PROJECT_SOURCE_DIR}/test/tex/formular_err1.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:192:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair.
.end{longtable}
.")
# test formular.tex
do_parse_test (formularErr2 ${PROJECT_SOURCE_DIR}/test/tex/formular_err2.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:44:1: Begin tag sequence '..begin{longtable}' without end tag pair.
.begin{longtable}
.
")
# test for caption in all_subtables.tex
do_parse_test (captionTest ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex ""
".begin{document}
.begin{longtable}{.c.c.}
.caption{Caption of the table}
")
# test all_subtables.tex
do_parse_test (all_subtablesCmp ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex ""
"Original and generated text are EQUAL .-.")
# test all_subtables.tex
do_parse_test (linesCmp ${PROJECT_SOURCE_DIR}/test/tex/lines.tex ${PROJECT_SOURCE_DIR}/test/tex/lines.etalon.tex
"Original and generated text are EQUAL .-.")