Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • algorithms-library-toolkit/automata-library
  • fortmare/automata-library
  • wijnhjan/automata-library
  • zelenm14/automata-library
  • gregofi1/automata-library
  • slavim17/automata-library
6 results
Show changes
Commits on Source (661)
Showing
with 376 additions and 427 deletions
---
BasedOnStyle: WebKit
Standard: c++20
Cpp11BracedListStyle: true
IncludeCategories:
- Regex: '^"testing.hpp'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '__disabled__feature__$'
NamespaceIndentation: None
MaxEmptyLinesToKeep: 2
AlwaysBreakTemplateDeclarations: true
AlignEscapedNewlinesLeft: true
AlignAfterOpenBracket: Align
BinPackArguments: false
BinPackParameters: false
SpaceBeforeCpp11BracedList: false
...
# format: Fix whitespace in grammar files
c092e7eab12293693187f1596c2db7359db70aba
# format: Format .h files in test folder.
9eae843fd4f2e0374e11662b691013a69bcee34a
# format: Format cppaql tests
3fc9c7913e5bf05e2f6c5addfdd5db525cbb56a5
# tree: apply .clang-format file
e345b0d49a684c7d1f267201519e8cf3cd0d61fd
......@@ -25,21 +25,20 @@ doc/*
local/
**/local/
 
docs/userGuide/objs
docs/userGuide/res
docs/userGuide/objs/*
docs/userGuide/res/*
docs/userGuide/command_doc.tex
# our common build directories
/release
/debug
/debug-g++
/debug-clang++
/build
/snapshot
/release/
/debug/
/debug-g++/
/debug-clang++/
/build/
/snapshot/
/cmake-build-debug/
 
# doxygen output directory
/apidoc
......@@ -47,6 +46,9 @@ docs/userGuide/command_doc.tex
# CLion files
.idea/
 
# VS Code
.vscode/
# Eclipse workspace data
.metadata/
**/.settings
......
image: alpine:3.11
image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/alpine:3.15
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Disable double pipelines
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
# Run pipeline for tags
- if: $CI_COMMIT_TAG
# Allow scheduled run
- if: '$CI_PIPELINE_SOURCE == "schedule"'
# Allow manual run
- if: '$CI_PIPELINE_SOURCE == "web"'
 
stages:
- build
- test
- packaging
- notify
 
.template:only:merge: &only-merge
.template:only:default: &only-default
only:
- merge_requests
- branches
- tags
.template:only:merge-and-master: &only-merge-and-master
only:
- merge_requests
- master
- tags
 
.template:only:master: &only-master
only:
......@@ -24,60 +46,31 @@ stages:
# build + test
 
.template:build:
<<: *only-default
dependencies: []
stage: build
tags:
- altbuilder
script:
- mkdir -p build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -GNinja ..
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -GNinja -DANTLR4_JAR_LOCATION=/usr/bin/antlr-4.11.1-complete.jar ..
- ninja
- ctest . --output-on-failure -j $(nproc) --output-junit testReport.xml
- DESTDIR="." ninja install
artifacts:
paths:
- build/
expire_in: 1 day
.template:test:
dependencies: []
stage: test
tags:
- altbuilder
script:
- cd build
- ctest . --output-on-failure -j $(grep -c processor /proc/cpuinfo)
# -----------------------------------------------------------------------------
# .config:alpine: &distro_alpine
# <<: *only-merge
# image: alpine:3.11
#
# build:alpine:
# <<: *distro_alpine
# extends: .template:build
# before_script:
# - apk add --no-cache bash build-base cmake ninja python3 libexecinfo-dev libxml2-dev tclap-dev readline-dev qt5-qtbase-dev graphviz-dev jsoncpp-dev
#
# test:alpine:
# <<: *distro_alpine
# extends: .template:test
# dependencies:
# - build:alpine
# before_script:
# - apk add --no-cache bash bc coreutils python3 cmake libexecinfo libxml2 tclap readline qt5-qtbase qt5-qtbase-x11 graphviz jsoncpp
# -----------------------------------------------------------------------------
reports:
junit: build/testReport.xml
 
.config:builder: &distro_builder
image: gitlab.fit.cvut.cz:5000/algorithms-library-toolkit/infrastructure/ci-docker-images/alt-builder:latest
image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/alt-builder:latest
 
.build:builder:
<<: *distro_builder
extends: .template:build
 
.test:builder:
<<: *distro_builder
extends: .template:test
build:builder:gcc:
extends: .build:builder
 
......@@ -87,60 +80,244 @@ build:builder:clang-sanitizers:
CXX: clang++
CXXFLAGS: "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all" # -stdlib=libc++
 
test:builder:gcc:
extends: .test:builder
dependencies:
- build:builder:gcc
test:builder:clang-sanitizers:
extends: .test:builder
dependencies:
- build:builder:clang-sanitizers
#######################################################################################################################
# doc
 
build:doc:
image: gitlab.fit.cvut.cz:5000/algorithms-library-toolkit/infrastructure/ci-docker-images/alt-builder:latest
<<: *only-default
image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/alt-builder:latest
stage: build
before_script:
- apt-get update && apt-get install -y doxygen graphviz
script:
- mkdir -p build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_DOCS=1 -GNinja ..
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_DOCS=1 -GNinja -DANTLR4_JAR_LOCATION=/usr/bin/antlr-4.11.1-complete.jar ..
- ninja doxygen
artifacts:
paths:
- build/apidoc/
expire_in: 1 day
expire_in: 2 days
#######################################################################################################################
# package
# .template:package:
# <<: *only-merge-and-master
# stage: build
# script:
# - apkg build-dep
# - apkg build
# artifacts:
# paths:
# - pkg/pkgs
# - images.tar
# expire_in: 2 days
# .template:docker: &docker
# cache: {} # disable
# services:
# - name: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/docker:dind
# alias: docker
# variables:
# DOCKER_DRIVER: overlay2
# DOCKER_HOST: docker
# # TODO: Remove after enabling TLS; https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#docker-in-docker-with-tls-disabled-in-the-docker-executor.
# DOCKER_HOST: tcp://docker:2375
# DOCKER_TLS_CERTDIR: ""
# before_script:
# - apk add docker bash git
# - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# - docker info
# package:docker:
# <<: *docker
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/alpine:3.15
# extends: .template:package
# script:
# - docker build --target=deploy -f extra/docker/Dockerfile -t alt .
# - docker run alt /usr/bin/aql2 --version
# - docker tag alt "$CI_REGISTRY_IMAGE:snapshot"
# - docker save -o images.tar "$CI_REGISTRY_IMAGE:snapshot"
# package:arch:rolling:
# extends: .template:package
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/archlinux:latest
# before_script:
# - pacman -Suy --noconfirm python-setuptools python-pip git sudo binutils fakeroot
# - pacman -Sy --noconfirm cmake gcc make # https://gitlab.nic.cz/packaging/apkg/-/issues/64
# - echo "MAKEFLAGS=\"\$MAKEFLAGS -j$(nproc)\"" >> /etc/makepkg.conf
# - pip install apkg
# script: # A little dance with apkg because build step must be done as non-root (makepkg) and we need everything to be writable by nobody
# - apkg build-dep
# - chown -R nobody:nobody .
# - sudo -u nobody apkg build
# .package:deb:
# extends: .template:package
# before_script:
# - apt-get update && apt-get install -y python3-pip git
# - ${PIP_EXECUTABLE} install apkg
# variables:
# PIP_EXECUTABLE: pip
# DEBIAN_FRONTEND: noninteractive
# package:debian:bullseye: # deb-11
# extends: .package:deb
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/amd64/debian:bullseye
# package:debian:bookworm: # deb-testing
# extends: .package:deb
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/amd64/debian:bookworm
# script:
# - apkg build-dep --distro debian-98 # otherwise identifies as "debian"
# - apkg build --distro debian-98
# package:debian:sid: # deb-unstable
# extends: .package:deb
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/amd64/debian:sid
# script:
# - apkg build-dep --distro debian-99 # otherwise identifies as "debian"
# - apkg build --distro debian-99
# package:ubuntu:20.04:
# extends: .package:deb
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/ubuntu:20.04
# variables:
# CXX: g++-10
# package:ubuntu:22.04:
# extends: .package:deb
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/ubuntu:22.04
# package:ubuntu:22.10:
# extends: .package:deb
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/ubuntu:22.10
# .package:opensuse:
# extends: .template:package
# before_script:
# - zypper install --no-confirm python3-pip git rpm-build
# - pip3 install apkg
# package:opensuse:tumbleweed:
# extends: .package:opensuse
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/opensuse/tumbleweed
# variables:
# CXX: g++-11
# package:opensuse:leap:15.3:
# extends: .package:opensuse
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/opensuse/leap:15.3
# variables:
# CXX: g++-11
# package:opensuse:leap:15.4:
# extends: .package:opensuse
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/opensuse/leap:15.4
# variables:
# CXX: g++-11
# .package:fedora:
# extends: .template:package
# before_script:
# - dnf install -y python3-pip git rpm-build
# - pip3 install apkg
# package:fedora:34:
# extends: .package:fedora
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/fedora:34
# package:fedora:35:
# extends: .package:fedora
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/fedora:35
# package:fedora:36:
# extends: .package:fedora
# image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/fedora:36
# packages:
# stage: packaging
# <<: *only-merge-and-master
# dependencies:
# - package:arch:rolling
# - package:ubuntu:20.04
# - package:ubuntu:22.04
# - package:ubuntu:22.10
# - package:debian:bullseye
# - package:debian:bookworm
# - package:debian:sid
# - package:opensuse:tumbleweed
# - package:opensuse:leap:15.3
# - package:opensuse:leap:15.4
# - package:fedora:34
# - package:fedora:35
# - package:fedora:36
# - package:docker
# script:
# - echo "Hi, I can't be empty"
# artifacts:
# paths:
# - pkg/pkgs
# expire_in: 10 weeks
# packages:docker:
# stage: packaging
# <<: *docker
# <<: *only-master
# dependencies:
# - package:docker
# script:
# - docker load -i images.tar
# - docker push "$CI_REGISTRY_IMAGE":snapshot
 
#######################################################################################################################
# static analysis
 
.template:static-analysis:
<<: *only-default
stage: build
image: gitlab.fit.cvut.cz:5000/algorithms-library-toolkit/infrastructure/ci-docker-images/alt-builder:latest
image: ${CI_REGISTRY}/algorithms-library-toolkit/infrastructure/ci-docker-images/alt-builder:latest
before_script:
- mkdir -p build && pushd build
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. -GNinja
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. -GNinja -DANTLR4_JAR_LOCATION=/usr/bin/antlr-4.11.1-complete.jar
- popd
allow_failure: true # TODO: Remove
dependencies: []
 
# -----------------------------------------------------------------------------
 
static-analysis:cppcheck:
# static-analysis:cppcheck:
# extends: .template:static-analysis
# script:
# - cppcheck --version
# - cppcheck -q --enable=all --project=build/compile_commands.json --suppress="*:*/lib/*" --error-exitcode=1
static-analysis:clang-format:
extends: .template:static-analysis
script:
- cppcheck --version
- cppcheck -q --enable=all --project=build/compile_commands.json --suppress="*:*/lib/*" --error-exitcode=1
- ANCESTOR=$(git merge-base origin/master HEAD) # find nearest common ancestor between HEAD and master
- git diff $ANCESTOR..HEAD | tee orig.patch | clang-format-diff -p1 -regex="'./a.*/\(test-\)?src/.*'" | sed "s/+++ /+++ b\// g;s/--- /--- a\//g" > clang-format.patch
- if [[ -s clang-format.patch ]]; then cat clang-format.patch; echo "Download the patch in the artifact directory"; false; fi # file exists and has nonzero size - fail
allow_failure: false
artifacts:
when: always
paths:
- orig.patch
- clang-format.patch
 
static-analysis:clang-tidy:
extends: .template:static-analysis
variables:
CXX: clang++
script:
- exit 0 # Disable clang-tidy for now, it's too demanding and runner too slow
- clang-tidy --version
- jq ".[].file" build/compile_commands.json | tr -d "\"" | grep -v "test-src" | xargs -n1 -P$(grep -c processor /proc/cpuinfo) clang-tidy -p build/
- jq ".[].file" build/compile_commands.json | tr -d "\"" | grep -v "test-src" | xargs -n1 -P$(grep -c processor /proc/cpuinfo) clang-tidy -quiet -p build/ 2>&1 | grep -v "warnings generated"
# static-analysis:sources-check:
# extends: .template:static-analysis
# script:
# - python3 extra/scripts/sources-check.py .
 
#######################################################################################################################
# notify
......@@ -152,28 +329,3 @@ static-analysis:clang-tidy:
dependencies: []
script:
- curl -X POST -F token="$TOKEN" -F ref=master $PARAMS https://gitlab.fit.cvut.cz/api/v4/projects/$PROJECT_ID/trigger/pipeline
# -----------------------------------------------------------------------------
notify:pyalib:
<<: *only-master
extends: .template:notify
variables:
TOKEN: "$TOKEN_TRIGGER_PYALIB"
PROJECT_ID: "11497"
notify:release:stable:
<<: *only-tag
extends: .template:notify
variables:
TOKEN: "$TOKEN_TRIGGER_RELEASE"
PROJECT_ID: "17683"
PARAMS: "-F variables[RELEASE_REF]=$CI_COMMIT_TAG -F variables[RELEASE_MODE]=stable"
notify:release:snapshot:
<<: *only-master
extends: .template:notify
variables:
TOKEN: "$TOKEN_TRIGGER_RELEASE"
PROJECT_ID: "17683"
PARAMS: "-F variables[RELEASE_REF]=$CI_COMMIT_SHA -F variables[RELEASE_MODE]=snapshot"
# Partially stolen from https://bitbucket.org/mblum/libgp/src/2537ea7329ef/.ycm_extra_conf.py
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-pipe',
'-std=c++11',
'-g',
'-O0',
'-DDEBUG',
'-c',
'-Wall',
'-pedantic',
'-Wextra',
'-Werror',
'-Wshadow',
'-Wpointer-arith',
'-Wcast-qual',
'-Wdelete-non-virtual-dtor',
'-Wredundant-decls',
'-fPIC',
'-x', 'c++',
'-I./alib2algo/src',
'-I./alib2algo_experimental/src',
'-I./alib2aux/src',
'-I./alib2cli/src',
'-I./alib2common/src',
'-I./alib2data/src',
'-I./alib2data_experimental/src',
'-I./alib2elgo/src',
'-I./alib2measurepp/src',
'-I./alib2raw/src',
'-I./alib2std/src',
'-I./alib2str/src',
'-I./alib2str_experimental/src',
]
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
if compilation_database_folder:
database = ycm_core.CompilationDatabase(compilation_database_folder)
else:
database = None
SOURCE_EXTENSIONS = ['.cpp', '.c', '.cxx']
def DirectoryOfThisScript():
return os.path.dirname(os.path.abspath(__file__))
def IsHeaderFile(filename):
extension = os.path.splitext(filename)[1]
return extension in ['.h', '.hxx', '.hpp', '.hh']
def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
if not working_directory:
return list(flags)
new_flags = []
make_next_absolute = False
path_flags = ['-isystem', '-I', '-iquote', '--sysroot=']
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith('/'):
new_flag = os.path.join(working_directory, flag)
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith(path_flag):
path = flag[len(path_flag):]
new_flag = path_flag + os.path.join(working_directory, path)
break
if new_flag:
new_flags.append(new_flag)
return new_flags
def GetCompilationInfoForFile(filename):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile(filename):
basename = os.path.splitext(filename)[0]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists(replacement_file):
compilation_info = database.GetCompilationInfoForFile(replacement_file)
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile(filename)
def FlagsForFile(filename, **kwargs):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile(filename)
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_)
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)
return {
'flags': final_flags,
'do_cache': True
}
......@@ -15,14 +15,26 @@ add_definitions(-DQT_NO_FOREACH)
 
# If backtrace is available, use it
find_package(Backtrace)
if(NOT(CMAKE_BUILD_TYPE MATCHES RELEASE) AND BACKTRACE_EXISTS)
if(UNIX AND NOT(APPLE) AND NOT(CMAKE_BUILD_TYPE MATCHES RELEASE) AND BACKTRACE_EXISTS)
add_definitions(-DBACKTRACE)
endif()
 
# Add some basic compiler options
add_compile_options(-Wall -Wextra -pedantic -pipe -Woverloaded-virtual -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls)
add_compile_options(-Wall -Wextra -pedantic -pipe -Wshadow )
add_compile_options(-Wnon-virtual-dtor -Wcast-align -Wunused -Woverloaded-virtual -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls -Wold-style-cast)
set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}")
 
# -Wsign-conversion -Wconversion
if(${CMAKE_CXX_COMPILER_ID} MATCHES "(GNU)")
add_compile_options(-Wlogical-op)
# -Wuseless-cast # buggy; compains about creation of a temporary...
# -Wduplicated-cond -Wduplicated-branches # todo
endif ()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "(Clang)")
# add_compile_options(-Wlifetime) # enable once it becomes available
endif ()
# Use -Og (or -O0) in Debug
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
CHECK_CXX_COMPILER_FLAG("-Og" COMPILER_HAS_OG)
......
# - Try to find readline include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Readline)
#
# Variables defined by this module:
#
# READLINE_FOUND System has readline, include and lib dirs found
# Readline_INCLUDE_DIR The readline include directories.
# Readline_LIBRARY The readline library.
find_path(READLINE_INCLUDE_DIR NAMES readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline HINTS)
if(READLINE_INCLUDE_DIR)
file(READ "${READLINE_INCLUDE_DIR}/readline/readline.h" READLINE_VERSION_FILE)
string(REGEX MATCH "RL_VERSION_MAJOR[\ \t]*([0-9]*)" _ ${READLINE_VERSION_FILE})
set(READLINE_VERSION ${CMAKE_MATCH_1})
string(REGEX MATCH "RL_VERSION_MINOR[\ \t]*([0-9]*)" _ ${READLINE_VERSION_FILE})
set(READLINE_VERSION "${READLINE_VERSION}.${CMAKE_MATCH_1}")
endif()
# Handle the QUIETLY and REQUIRED arguments and set GRAPHVIZ_FOUND to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Readline
FOUND_VAR READLINE_FOUND
REQUIRED_VARS READLINE_INCLUDE_DIR READLINE_LIBRARY
VERSION_VAR READLINE_VERSION
)
mark_as_advanced(READLINE_INCLUDE_DIR READLINE_LIBRARY)
find_path(Tclap_INCLUDE_DIR NAMES tclap/CmdLine.h)
# Handle the QUIETLY and REQUIRED arguments and set GRAPHVIZ_FOUND to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Tclap
FOUND_VAR Tclap_FOUND
REQUIRED_VARS Tclap_INCLUDE_DIR
)
mark_as_advanced(Tclap_INCLUDE_DIR)
# - Find jsoncpp
#
# Find jsoncpp includes and library
#
# This module defines the following variables:
# jsoncpp_FOUND - True if libjsoncpp has been found.
# jsoncpp_INCLUDE_DIR - location to look for headers,
# jsoncpp_LIBRARIES - the libraries to link against libjsoncpp
find_path(jsoncpp_INCLUDE_DIR json/features.h json/json_features.h
PATH_SUFFIXES include jsoncpp include/jsoncpp)
find_library(jsoncpp_LIBRARY jsoncpp)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(jsoncpp DEFAULT_MSG
jsoncpp_INCLUDE_DIR jsoncpp_LIBRARY)
if(NOT jsoncpp_FOUND)
message(FATAL_ERROR "libjsoncpp missing" )
endif(NOT jsoncpp_FOUND)
set(jsoncpp_LIBRARIES ${jsoncpp_LIBRARY})
mark_as_advanced(
jsoncpp_INCLUDE_DIR
jsoncpp_LIBRARIES
)
......@@ -8,6 +8,3 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif()
 
message ( STATUS "[Install] Install prefix: ${CMAKE_INSTALL_PREFIX}")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
......@@ -19,8 +19,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()
 
option(WITH_DOCS "Build Doxygen")
option(WITH_AGUI "Build agui2 interface (deprecated gui)")
option(BUILD_TESTING "Compile and run tests" ON)
option(WITH_INSTALL_RPATH "Add RPATH set to installation dir" OFF)
 
include(alt)
include(CompilerFlags)
......@@ -29,6 +29,10 @@ include(Version)
 
include_directories(${PROJECT_BINARY_DIR})
 
if(WITH_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
# testing
include(CTest)
if(BUILD_TESTING)
......@@ -64,11 +68,6 @@ alt_module(alib2str_cli_integration)
alt_module(alib2raw_cli_integration)
alt_module(aql2)
 
if(WITH_AGUI)
alt_module(alib2gui)
alt_module(agui2)
endif()
# docs
if(WITH_DOCS)
alt_doxygen()
......
......@@ -6,3 +6,5 @@ String parsers cannot process correctly text files with more than 4096 character
Measuring memory allocations with library compiled by g++ is not working. The overload of operator new does not work properly.
 
All grammars with rules not allowing epsilon on the right hand side have special boolean flag generatesEpsilon. Thanks to this flag no other special handling of generating epsilon is needed.
On an templated function T1, T2, the method variant < T1, T2 >.is < ... > doesn't work when the types in the variant underwent normalization, i.e. they are both just object::Object. Typically the datastructure provides other call that let's us distinguish whether the variant is actually and semantically what originally was instance of T1 or T2. Example: right hand side of rules of context free grammar are either terminal or nonterminal and if the CFG is normalized, both the terminals and nonterminals are Objects, however there is a set terminalAlphabet and nonterminalAlphabet where if terminalAlphabet.contains ( variant ) the variant is terminal symbol else it is a nonterminal symbol.
......@@ -14,7 +14,7 @@ Originaly developed at Faculty of Information Technology of Czech Technical
University in Prague. It supposed to be a reference implementation of formal
algorithms as-are in papers. It's interface allows practical reuse of existing
algorithms in form of by pipe comunicating, partially using a query language in command
line, and partially using a GUI interface.
line.
 
 
The Latest Version
......@@ -30,16 +30,12 @@ should work on different platforms but there are still small parts of code that
Build tools:
* `cmake >= 3.12`
* `g++ >= 10.0` or `clang++ >= 9.0` (compilation in C++20)
* `antlr>=4.11` and `antlr4-runtime>=4.11`
 
Libraries:
* `tclap`
* `tclap` (header-only argument parsing library, fetched by CMake and git automatically during build process)
* `libxml2`
* `readline`
For GUI, you will need also the following libraries. However, GUI does not build by default now. Use cmake option `-DWITH_AGUI=ON` to build it:
* `Qt5-qtbase >= 5.7`
* `jsoncpp`
* `graphviz`
* `replxx>=0.0.4`
 
Optional dependencies:
* `doxygen` (for documentation generation)
......@@ -52,9 +48,8 @@ You can build from sources using cmake or [download packages][7] or sources of [
We recommend running the testsuite using `ctest` as well.
 
We support common cmake options, additional ones are:
* `-DWITH_AGUI=ON` to build deprecated GUI part
* `-DWITH_DOCS=ON` to build a `doxygen` target to generate API docs.
* `-DANTLR4_JAR_LOCATION=<path>` to specify path to `antlr-complete.jar` (you can also set `ANTLR4_JAR_LOCATION` env variable).
 
Documentation
-------------
......@@ -65,7 +60,11 @@ The high-level documentation is located at [ALT website][7].
Contributing
------------
Feel free to [fork][4] this project and send your merge requests there.
In case you want to run our Gitlab CI, remove all the following parts of code in `.gitlab-ci.yml`.
```
tags:
- altbuilder
```
 
Developers
----------
......@@ -100,4 +99,4 @@ Authors
[5]: https://gitlab.fit.cvut.cz/algorithms-library-toolkit/automata-library/container_registry
[6]: https://editorconfig.org
[7]: https://alt.fit.cvut.cz
[logo]: docs/logo.png
\ No newline at end of file
[logo]: docs/logo.png
project(alt-agui VERSION ${CMAKE_PROJECT_VERSION})
alt_executable(agui2
DEPENDS alib2algo alib2aux alib2data alib2str alib2gui
)
#include <QApplication>
#include <MainWindow.hpp>
#include <version.hpp>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return QApplication::exec();
}
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
/*
* AlgorithmAbstraction.hpp
*
* Created on: 11. 7. 2017
* Author: Jan Travnicek
*/
#pragma once
 
#include <abstraction/NaryOperationAbstraction.hpp>
......@@ -12,19 +5,20 @@
 
namespace abstraction {
 
template < class ReturnType, class ... ParamTypes >
class AlgorithmAbstraction : virtual public NaryOperationAbstraction < ParamTypes ... >, virtual public ValueOperationAbstraction < ReturnType > {
std::function < ReturnType ( ParamTypes ... ) > m_callback;
template <class ReturnType, class... ParamTypes>
class AlgorithmAbstraction : virtual public NaryOperationAbstraction<ParamTypes...>, virtual public ValueOperationAbstraction<ReturnType> {
std::function<ReturnType(ParamTypes...)> m_callback;
 
public:
explicit AlgorithmAbstraction ( std::function < ReturnType ( ParamTypes ... ) > callback ) : m_callback ( std::move ( callback ) ) {
}
std::shared_ptr < abstraction::Value > run ( ) override {
return this->template run_helper < ParamTypes ... > ( m_callback, this->getParams ( ) );
}
explicit AlgorithmAbstraction(std::function<ReturnType(ParamTypes...)> callback)
: m_callback(std::move(callback))
{
}
std::shared_ptr<abstraction::Value> run() const override
{
return ValueOperationAbstraction<ReturnType>::template run_helper<ParamTypes...>(m_callback, this->getParams());
}
};
 
} /* namespace abstraction */
/*
* AnyaryOperationAbstraction.hpp
*
* Created on: 20. 8. 2017
* Author: Jan Travnicek
*/
#include "AnyaryOperationAbstraction.hpp"
 
namespace abstraction {
 
void AnyaryOperationAbstractionImpl::attachInput ( const std::shared_ptr < abstraction::Value > & input, size_t index ) {
if ( m_params.size ( ) < index + 1 )
m_params.resize ( index + 1 );
void AnyaryOperationAbstractionImpl::attachInput(const std::shared_ptr<abstraction::Value>& input, size_t index)
{
if (m_params.size() < index + 1)
m_params.resize(index + 1);
 
m_params [ index ] = input;
m_params[index] = input;
}
 
void AnyaryOperationAbstractionImpl::detachInput ( size_t index ) {
if ( index >= m_params.size ( ) )
throw std::invalid_argument ( "Parameter index " + ext::to_string ( index ) + " out of bounds.");
void AnyaryOperationAbstractionImpl::detachInput(size_t index)
{
if (index >= m_params.size())
throw std::invalid_argument("Parameter index " + ext::to_string(index) + " out of bounds.");
 
m_params [ index ] = nullptr;
m_params[index] = nullptr;
}
 
bool AnyaryOperationAbstractionImpl::inputsAttached ( ) const {
auto attached_lambda = [ ] ( const std::shared_ptr < abstraction::Value > & param ) {
return ( bool ) param;
};
bool AnyaryOperationAbstractionImpl::inputsAttached() const
{
auto attached_lambda = [](const std::shared_ptr<abstraction::Value>& param) {
return param != nullptr;
};
 
return std::all_of ( m_params.begin ( ), m_params.end ( ), attached_lambda );
return std::all_of(m_params.begin(), m_params.end(), attached_lambda);
}
 
std::shared_ptr < abstraction::Value > AnyaryOperationAbstractionImpl::eval ( ) {
if ( ! inputsAttached ( ) )
return nullptr;
std::shared_ptr<abstraction::Value> AnyaryOperationAbstractionImpl::eval()
{
if (!inputsAttached())
return nullptr;
 
return this->run ( );
return this->run();
}
 
} /* namespace abstraction */
/*
* AnyaryOperationAbstraction.hpp
*
* Created on: 20. 8. 2017
* Author: Jan Travnicek
*/
#pragma once
 
#include <alib/memory>
#include <ext/memory>
 
#include <abstraction/OperationAbstraction.hpp>
#include <common/AbstractionHelpers.hpp>
......@@ -15,45 +8,46 @@
namespace abstraction {
 
class AnyaryOperationAbstractionImpl : virtual public OperationAbstraction {
ext::vector < std::shared_ptr < abstraction::Value > > m_params;
ext::vector<std::shared_ptr<abstraction::Value>> m_params;
 
protected:
ext::vector < std::shared_ptr < abstraction::Value > > & getParams ( ) {
return m_params;
}
const ext::vector<std::shared_ptr<abstraction::Value>>& getParams() const
{
return m_params;
}
 
virtual std::shared_ptr < abstraction::Value > run ( ) = 0;
virtual std::shared_ptr<abstraction::Value> run() const = 0;
 
private:
void attachInput ( const std::shared_ptr < abstraction::Value > & input, size_t index ) override;
void attachInput(const std::shared_ptr<abstraction::Value>& input, size_t index) override;
 
void detachInput ( size_t index ) override;
void detachInput(size_t index) override;
 
public:
AnyaryOperationAbstractionImpl ( ) = default;
bool inputsAttached ( ) const override;
AnyaryOperationAbstractionImpl() = default;
 
std::shared_ptr < abstraction::Value > eval ( ) override;
bool inputsAttached() const override;
 
size_t numberOfParams ( ) const override {
return m_params.size ( );
}
std::shared_ptr<abstraction::Value> eval() override;
 
size_t numberOfParams() const override
{
return m_params.size();
}
};
 
template < class ParamType >
template <class ParamType>
class AnyaryOperationAbstraction : virtual public AnyaryOperationAbstractionImpl {
public:
ext::type_index getParamTypeIndex ( size_t ) const override {
return ext::type_index ( typeid ( ParamType ) );
}
abstraction::TypeQualifiers::TypeQualifierSet getParamTypeQualifiers ( size_t ) const override {
return abstraction::TypeQualifiers::typeQualifiers < ParamType > ( );
}
core::type_details getParamType(size_t) const override
{
return core::type_details::get<ParamType>();
}
abstraction::TypeQualifiers::TypeQualifierSet getParamTypeQualifiers(size_t) const override
{
return abstraction::TypeQualifiers::typeQualifiers<ParamType>();
}
};
 
} /* namespace abstraction */
/*
* CastAbstraction.hpp
*
* Created on: 11. 7. 2017
* Author: Jan Travnicek
*/
#pragma once
 
#include <abstraction/NaryOperationAbstraction.hpp>
#include <abstraction/ValueOperationAbstraction.hpp>
 
#include <object/ObjectFactory.h>
namespace abstraction {
 
template < class ReturnType, class ParamType >
class CastAbstraction : virtual public NaryOperationAbstraction < const ParamType & >, virtual public ValueOperationAbstraction < ReturnType > {
template <class ReturnType, class ParamType>
class CastAbstraction : virtual public NaryOperationAbstraction<const ParamType&>, virtual public ValueOperationAbstraction<ReturnType> {
public:
std::shared_ptr < abstraction::Value > run ( ) override {
std::shared_ptr < abstraction::Value > & param = std::get < 0 > ( this->getParams ( ) );
return std::make_shared < abstraction::ValueHolder < ReturnType > > ( ReturnType ( retrieveValue < const ParamType & > ( param ) ), true );
}
std::shared_ptr<abstraction::Value> run() const override
{
const std::shared_ptr<abstraction::Value>& param = std::get<0>(this->getParams());
 
return std::make_shared<abstraction::ValueHolder<ReturnType>>(ReturnType(retrieveValue<const ParamType&>(param)), true);
}
};
 
} /* namespace abstraction */