Skip to content

Commit

Permalink
spffl20 skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Nov 21, 2024
1 parent 9257592 commit b38d1fe
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ Standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_subdirectory(spffl)
add_subdirectory(spffl20)
add_subdirectory(lib)
add_subdirectory(cli)

enable_testing()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
add_subdirectory(test)
add_subdirectory(test20)

# ----------------------------------------------------------------
install(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ alias cmg='cmake -B build'
alias cmgd='cmake -B build -DCMAKE_BUILD_TYPE=Debug'

alias cmb='cmake --build build'
alias cmt='cmake --build build --target test'
alias cmt='cmake --build build --target test*'
alias cmi='cmake --build build --target install'

export PATH=$(pwd)/build/cli/spiff:$PATH
Expand Down
3 changes: 3 additions & 0 deletions spffl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is an implementation from about 2004, with an update in 2023 to use `cmake`. The code is highly duplicative.

As of 2024-11 I am considering an update to use C++ 20, with significant positive impacts on code deduplication.
4 changes: 4 additions & 0 deletions spffl/cli_parser/cmd_interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ static void replace(
}
pclose(pipe);

if (buf == 0) {
buf = strdup("");
}

argcout = spffl::base::count_tokens(buf, " \t");
argvout = (char **)malloc(argcout * sizeof(char *));

Expand Down
18 changes: 18 additions & 0 deletions spffl20/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required (VERSION 3.24)

project(spffl20_src)

#add_subdirectory(base)
#add_subdirectory(intmath)
#add_subdirectory(bitrand)
#add_subdirectory(bits)
#add_subdirectory(containers)
#add_subdirectory(polynomials)
#add_subdirectory(rationals)
#add_subdirectory(q_cyclotomic)
#add_subdirectory(random)
#add_subdirectory(factorization)
#add_subdirectory(units)
#add_subdirectory(list)
#add_subdirectory(linalg)
#add_subdirectory(cli_parser)
11 changes: 11 additions & 0 deletions spffl20/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This is a putative --- perhaps never-to-be-completed --- port of `../spffl` to use C++ 20, with significant positive impacts on code deduplication.

To do:

* Use concepts (ring element) for polynomial coefficients
* Polynomial-of class
* Euclidean domain to take `std::is_integral` or is-polynomial
* How to work in the ad-hoc `f2poly` class which uses bit-packing (can't be polynomial-of-byte)
* Templates for residue rings and quotient rings (both requiring Euclidean GCD)
* Templates for matrix and vector; probably use STL
* Still want a specialized class for matrix-of-bit with bit-packing (not matrix-of-byte)
45 changes: 45 additions & 0 deletions test20/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ----------------------------------------------------------------
# catch2 has a set-but-unused-variable warning as of MacOS 13.3.
# So we need to not use -Werror, as that's third-party code out of our control.
#
# See also:
# https://discourse.cmake.org/t/how-to-turn-off-warning-flags-for-project-added-by-fetchcontent-declare/2461

Include(FetchContent)

FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.1
)

cmake_host_system_information(RESULT OS_RELEASE QUERY OS_RELEASE)

if(APPLE AND OS_RELEASE VERSION_GREATER_EQUAL "13.0.0")
get_property(
compile_options
DIRECTORY
PROPERTY COMPILE_OPTIONS
)
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_OPTIONS -Wno-error=unused-but-set-variable
)
endif()

FetchContent_MakeAvailable(Catch2)

if(APPLE AND OS_RELEASE VERSION_GREATER_EQUAL "13.0.0")
set_property(
DIRECTORY
PROPERTY COMPILE_OPTIONS ${compile_options}
)
unset(compile_options)
endif()

# ----------------------------------------------------------------
#add_subdirectory(base)
#add_subdirectory(intmath)
#add_subdirectory(bits)
#add_subdirectory(polynomials)
1 change: 1 addition & 0 deletions test20/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is Catch2 for `../spffl20`.

0 comments on commit b38d1fe

Please sign in to comment.