Skip to content

Commit

Permalink
Renamed the project and project artifacts to sexpp
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Jun 24, 2023
1 parent 803744e commit aca369a
Show file tree
Hide file tree
Showing 27 changed files with 126 additions and 129 deletions.
85 changes: 40 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
cmake_minimum_required(VERSION 3.14)

include(cmake/version.cmake)
determine_version("${CMAKE_CURRENT_SOURCE_DIR}" SEXP)

determine_version("${CMAKE_CURRENT_SOURCE_DIR}" SEXPP)
# project name, etc
project(sexp
VERSION "${SEXP_VERSION}"
project(sexpp
VERSION "${SEXPP_VERSION}"
LANGUAGES C CXX
DESCRIPTION "S-expressions parser and generator C++ library, fully compliant to [https://people.csail.mit.edu/rivest/Sexp.txt]"
)
Expand Down Expand Up @@ -111,7 +110,7 @@ if(NOT MSVC)

endif(NOT MSVC)

add_library(sexp ${TYPE}
add_library(sexpp ${TYPE}
"src/sexp-input.cpp"
"src/sexp-output.cpp"
"src/sexp-object.cpp"
Expand All @@ -120,43 +119,39 @@ add_library(sexp ${TYPE}
"src/sexp-error.cpp"
"src/sexp-depth-manager.cpp"
"src/ext-key-format.cpp"
"include/sexp/sexp.h"
"include/sexp/sexp-error.h"
"include/sexp/ext-key-format.h"
"include/sexpp/sexp.h"
"include/sexpp/sexp-error.h"
"include/sexpp/ext-key-format.h"
)

target_compile_features(sexp PUBLIC cxx_std_11)
target_include_directories(sexp PUBLIC
target_compile_features(sexpp PUBLIC cxx_std_11)
target_include_directories(sexpp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

string(REGEX MATCH "^([0-9]+)\\.[0-9]+\\.[0-9]+$" vmatches "${SEXP_VERSION}")
if (NOT vmatches)
message(FATAL_ERROR "Failed to extract major version from SEXP_VERSION (${SEXP_VERSION}).")
endif()
set(SEXP_MAJOR_VERSION "${CMAKE_MATCH_1}")

set_target_properties(sexp PROPERTIES
set_target_properties(sexpp PROPERTIES
POSITION_INDEPENDENT_CODE ON
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
VERSION "${SEXP_VERSION}"
SOVERSION "${SEXP_MAJOR_VERSION}"
OUTPUT_NAME "sexp"
VERSION "${SEXPP_VERSION}"
SOVERSION "${SEXPP_MAJOR_VERSION}"
OUTPUT_NAME "sexpp"
)

if(WITH_SEXP_CLI)
add_executable (sexp-cli
if (WITH_SEXP_CLI)
add_executable (sexpp-cli
src/sexp-main.cpp
include/sexp/sexp.h
include/sexp/sexp-error.h
include/sexpp/sexp.h
include/sexpp/sexp-error.h
)
target_include_directories (sexp-cli PUBLIC include)
target_link_libraries(sexp-cli PRIVATE sexp)
target_compile_features(sexp-cli PUBLIC cxx_std_11)
set_target_properties(sexp-cli PROPERTIES RUNTIME_OUTPUT_NAME sexp)
set_target_properties(sexp-cli PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif(WITH_SEXP_CLI)
target_include_directories (sexpp-cli PUBLIC include)
target_link_libraries(sexpp-cli PRIVATE sexpp)
target_compile_features(sexpp-cli PUBLIC cxx_std_11)
set_target_properties(sexpp-cli PROPERTIES
RUNTIME_OUTPUT_NAME sexpp
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
endif (WITH_SEXP_CLI)


if(WITH_SEXP_TESTS)
Expand Down Expand Up @@ -194,7 +189,7 @@ if(WITH_SEXP_TESTS)
@ONLY
)

add_executable(sexp-tests
add_executable(sexpp-tests
"tests/src/baseline-tests.cpp"
"tests/src/exception-tests.cpp"
"tests/src/primitives-tests.cpp"
Expand Down Expand Up @@ -229,45 +224,45 @@ if(WITH_SEXP_TESTS)
set(GTest GTest::GTest)

if(NOT MSVC)
target_link_libraries(sexp-tests PRIVATE pthread)
target_link_libraries(sexpp-tests PRIVATE pthread)
endif(NOT MSVC)
endif(DOWNLOAD_GTEST)

target_link_libraries(sexp-tests PRIVATE
sexp
target_link_libraries(sexpp-tests PRIVATE
sexpp
${GTestMain}
${GTest}
)

target_include_directories(sexp-tests PRIVATE
target_include_directories(sexpp-tests PRIVATE
tests/include
include
"${GTEST_INCLUDE_DIRS}"
)

target_compile_features(sexp-tests PUBLIC cxx_std_11)
set_target_properties(sexp-tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
target_compile_features(sexpp-tests PUBLIC cxx_std_11)
set_target_properties(sexpp-tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

gtest_discover_tests(sexp-tests)
gtest_discover_tests(sexpp-tests)
endif(WITH_SEXP_TESTS)

set(CONFIGURED_PC "${CMAKE_CURRENT_BINARY_DIR}/sexp.pc")
set(CONFIGURED_PC "${CMAKE_CURRENT_BINARY_DIR}/sexpp.pc")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/sexp.pc.in"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/sexpp.pc.in"
"${CONFIGURED_PC}"
@ONLY
)

if (WIN32 AND BUILD_SHARED_LIBS)
install(TARGETS sexp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(TARGETS sexp ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(TARGETS sexpp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(TARGETS sexpp ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
else(WIN32 AND BUILD_SHARED_LIBS)
install(TARGETS sexp DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(TARGETS sexpp DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif(WIN32 AND BUILD_SHARED_LIBS)

install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(FILES "${CONFIGURED_PC}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
if(WITH_SEXP_CLI)
install(TARGETS sexp-cli DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES man/sexp.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
install(TARGETS sexpp-cli DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES man/sexpp.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
endif(WITH_SEXP_CLI)
16 changes: 8 additions & 8 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ build with address and other sanitizers (requires clang compiler)



== SEXP command-line utility
== SEXPP command-line utility

The `sexp` command-line utility is reference parser and generator of
The `sexpp` command-line utility is reference parser and generator of
S-Expressions. It can read, parse and print out SEXP in all defined formats.

=== Switches

.`sexp` switches
.`sexpp` switches
[options="header"]
|===
| Switch | Description | Default
Expand Down Expand Up @@ -160,7 +160,7 @@ Prompt for S-Expressions input from console, parse and output it to

[source]
----
$ sexp -o certificate.dat -p -b
$ sexpp -o certificate.dat -p -b
> Input:
> (aa bb (cc dd))
Expand All @@ -173,7 +173,7 @@ advanced transport format with no prompts:

[source,sh]
----
$ sexp -i certificate.dat -x
$ sexpp -i certificate.dat -x
> (2:aa2:bb(2:cc2:dd))
----
Expand All @@ -183,7 +183,7 @@ base64 and advanced format with prompts and no width limitation:

[source,sh]
----
$ sexp -i certificate.dat -a -b -c -p -w 0
$ sexpp -i certificate.dat -a -b -c -p -w 0
> Reading input from certificate.dat
>
Expand All @@ -200,14 +200,14 @@ console in advanced, base64 and canonical formats:

[source,sh]
----
$ sexp -p -a -b -c -x
$ sexpp -p -a -b -c -x
----

or just

[source,sh]
----
$ sexp
$ sexpp
> Input:
> (abc def (ghi jkl))
Expand Down
4 changes: 2 additions & 2 deletions cmake/sexp.pc.in → cmake/sexpp.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: sexp
Description: S-expressions library
Description: C++ library for working with S-Expressions
Version: @PROJECT_VERSION@
URL: https://github.com/rnpgp/sexp
Libs: -L${libdir} -lsexp
Libs: -L${libdir} -lsexpp
Cflags: -I${includedir}
23 changes: 13 additions & 10 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,30 @@ function(extract_version_info version var_prefix)
# extract the main components
# v1.9.0-3-g5b92266+1546836556
# v1.9.0-3-g5b92266-dirty+1546836556
string(REGEX MATCH "^v?([0-9]+\\.[0-9]+\\.[0-9]+)(-([0-9]+)-g([0-9a-f]+)(-dirty)?)?(\\+([0-9]+))?$" matches "${version}")
string(REGEX MATCH "^v?(([0-9]+)\\.[0-9]+\\.[0-9]+)(-([0-9]+)-g([0-9a-f]+)(-dirty)?)?(\\+([0-9]+))?$" matches "${version}")
if (NOT matches)
message(FATAL_ERROR "Failed to extract version components from ${version}.")
endif()
set(${var_prefix}_VERSION "${CMAKE_MATCH_1}" PARENT_SCOPE) # 1.9.0
if (NOT CMAKE_MATCH_3)
set(CMAKE_MATCH_3 "0")
endif()
set(${var_prefix}_VERSION_NCOMMITS "${CMAKE_MATCH_3}" PARENT_SCOPE) # 3
set(${var_prefix}_MAJOR_VERSION "${CMAKE_MATCH_2}" PARENT_SCOPE) # 1
if (NOT CMAKE_MATCH_4)
set(CMAKE_MATCH_4 "0")
endif()
set(${var_prefix}_VERSION_GIT_REV "${CMAKE_MATCH_4}" PARENT_SCOPE) # 5b92266
if (CMAKE_MATCH_5 STREQUAL "-dirty")
set(${var_prefix}_VERSION_NCOMMITS "${CMAKE_MATCH_4}" PARENT_SCOPE) # 3
if (NOT CMAKE_MATCH_5)
set(CMAKE_MATCH_5 "0")
endif()
set(${var_prefix}_VERSION_GIT_REV "${CMAKE_MATCH_5}" PARENT_SCOPE) # 5b92266
if (CMAKE_MATCH_6 STREQUAL "-dirty")
set(${var_prefix}_VERSION_IS_DIRTY TRUE PARENT_SCOPE)
else()
set(${var_prefix}_VERSION_IS_DIRTY FALSE PARENT_SCOPE)
endif()
# timestamp is optional, default to 0
if (NOT CMAKE_MATCH_7)
set(CMAKE_MATCH_7 "0")
if (NOT CMAKE_MATCH_8)
set(CMAKE_MATCH_8 "0")
endif()
set(${var_prefix}_VERSION_COMMIT_TIMESTAMP "${CMAKE_MATCH_7}" PARENT_SCOPE) # 1546836556
set(${var_prefix}_VERSION_COMMIT_TIMESTAMP "${CMAKE_MATCH_8}" PARENT_SCOPE) # 1546836556
endfunction()

function(determine_version source_dir var_prefix)
Expand Down Expand Up @@ -153,7 +154,9 @@ function(determine_version source_dir var_prefix)
# set the results
set(${var_prefix}_VERSION_SUFFIX "${version_suffix}" PARENT_SCOPE)
set(${var_prefix}_VERSION_FULL "${version_full}" PARENT_SCOPE)
set(${var_prefix}_MAJOR_VERSION "${${local_prefix}_MAJOR_VERSION}" PARENT_SCOPE) # 1
# for informational purposes
message(STATUS "${var_prefix}_MAJOR_VERSION: ${${local_prefix}_MAJOR_VERSION}")
message(STATUS "${var_prefix}_VERSION_SUFFIX: ${version_suffix}")
message(STATUS "${var_prefix}_VERSION_FULL: ${version_full}")
endfunction()
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
#pragma once

#include <map>

#include "sexp.h"

namespace ext_key_format {

void ext_key_error(
void ext_key_error(
sexp::sexp_exception_t::severity level, const char *msg, size_t c1, size_t c2, int pos);

class ext_key_input_stream_t;

class extended_private_key_t {
class extended_private_key_t {
public:
// Comparison of names is done case insensitively !!!
struct ci_less {
Expand Down Expand Up @@ -67,7 +68,7 @@ class extended_private_key_t {
void parse(ext_key_input_stream_t &is);
};

class ext_key_input_stream_t : public sexp::sexp_input_stream_t {
class ext_key_input_stream_t : public sexp::sexp_input_stream_t {
private:
static const bool namechar[256]; /* true if allowed in the name field */

Expand Down
4 changes: 2 additions & 2 deletions include/sexp/sexp-error.h → include/sexpp/sexp-error.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace sexp {

class sexp_exception_t : public std::exception {
class sexp_exception_t : public std::exception {
public:
enum severity { error = 0, warning = 1 };

Expand Down Expand Up @@ -65,7 +65,7 @@ class sexp_exception_t : public std::exception {
static void set_interactive(bool new_interactive) { interactive = new_interactive; };
};

void sexp_error(
void sexp_error(
sexp_exception_t::severity level, const char *msg, size_t c1, size_t c2, int pos);

} // namespace sexp

0 comments on commit aca369a

Please sign in to comment.