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 37d8e66
Show file tree
Hide file tree
Showing 28 changed files with 123 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
env:
CC: gcc
CXX: g++
COVERITY_TOKEN: AK2euT-neBcvZB1g_m3pbg
COVERITY_TOKEN: qjcM1CWLcq9PJB3yL0ZXIw
MAKEFLAGS: j4
steps:
- name: Checkout
Expand Down
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)
20 changes: 10 additions & 10 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ image:https://github.com/rnpgp/sexp/workflows/build-and-test-deb/badge.svg["Buil
image:https://github.com/rnpgp/sexp/workflows/build-and-test-msys/badge.svg["Build status MSys", link="https://github.com/rnpgp/sexp/actions?workflow=build-and-test-msys"]


image:https://codecov.io/gh/rnpgp/sexp/branch/feat/g23/graph/badge.svg["Code coverage", link="https://codecov.io/gh/rnpgp/sexp"]
image:https://codecov.io/gh/rnpgp/sexp/branch/feat/g23/graph/badge.svg["Code coverage", link="https://codecov.io/gh/rnpgp/sexpp"]
image:https://github.com/rnpgp/sexp/workflows/CodeQL/badge.svg["CodeQL analysis", link="https://github.com/rnpgp/sexp/actions?workflow=CodeQL"]
image:https://scan.coverity.com/projects/27150/badge.svg["Coverity Scan Build Status", link="https://scan.coverity.com/projects/rnpgp-sexp"]
image:https://scan.coverity.com/projects/28717/badge.svg["Coverity Scan Build Status", link="https://scan.coverity.com/projects/rnpgp-sexpp"]


== Purpose
Expand Down 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,11 +24,12 @@
#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;
Expand Down
2 changes: 1 addition & 1 deletion include/sexp/sexp-error.h → include/sexpp/sexp-error.h
Original file line number Diff line number Diff line change
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
8 changes: 4 additions & 4 deletions include/sexp/sexp.h → include/sexpp/sexp.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace sexp {
* However, we do enforce 'C' locale this way
*/

class sexp_char_defs_t {
class sexp_char_defs_t {
protected:
static const bool base64digit[256]; /* true if c is base64 digit */
static const bool tokenchar[256]; /* true if c can be in a token */
Expand Down Expand Up @@ -100,7 +100,7 @@ class sexp_input_stream_t;

typedef uint8_t octet_t;

class sexp_simple_string_t : public std::basic_string<octet_t>, private sexp_char_defs_t {
class sexp_simple_string_t : public std::basic_string<octet_t>, private sexp_char_defs_t {
public:
sexp_simple_string_t(void) = default;
sexp_simple_string_t(const octet_t *dt) : std::basic_string<octet_t>{dt} {}
Expand Down Expand Up @@ -161,7 +161,7 @@ inline bool operator!=(const sexp_simple_string_t *left, const std::string &righ
* SEXP object
*/

class sexp_object_t {
class sexp_object_t {
public:
virtual ~sexp_object_t(){};

Expand Down Expand Up @@ -201,7 +201,7 @@ class sexp_object_t {
* SEXP string
*/

class sexp_string_t : public sexp_object_t {
class sexp_string_t : public sexp_object_t {
protected:
bool with_presentation_hint;
sexp_simple_string_t presentation_hint;
Expand Down
10 changes: 5 additions & 5 deletions man/sexp.1 → man/sexpp.1
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.TH SEXP "1" "June 2023" "sexp" "User Commands"
.TH SEXPP "1" "June 2023" "sexpp" "User Commands"

.SH NAME

sexp - Read, parse, and print out S-expressions
sexpp - Read, parse, and print out S-expressions

.SH SYNOPSIS

.B cat certificate-file | sexp -a -x
.B cat certificate-file | sexpp -a -x

.SH DESCRIPTION

\fBsexp\fP typically reads an S-expression from standard input and rewrites it to standard output.
\fBsexpp\fP typically reads an S-expression from standard input and rewrites it to standard output.

Running without switches implies: -p -a -b -c -x

Expand Down Expand Up @@ -58,7 +58,7 @@ Changes line width to specified width (0 implies no line-width constraint). Defa

.SH AUTHOR

The \fBsexp\fP project is maintained by Maxim Samsonov on behalf of Ribose, Inc.
The \fBsexpp\fP project is maintained by Maxim Samsonov on behalf of Ribose, Inc.
It is based on code from Ron Rivest and Butler Lampson.
This manual page was written by Daniel Kahn Gillmor for the Debian project, but may be used by others.

Expand Down
Loading

0 comments on commit 37d8e66

Please sign in to comment.