forked from OctaForge/libostd
Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
Daniel Kolesa | 2286235786 | |
Daniel Kolesa | 6d53597d9a | |
Daniel Kolesa | 89719ba08a | |
Daniel Kolesa | 87038c94b0 | |
Daniel Kolesa | 4b560b54f4 | |
Daniel Kolesa | 2077ff0752 | |
Daniel Kolesa | 78ffcafc00 | |
Daniel Kolesa | 89e9b8726f |
37
COPYING.md
37
COPYING.md
|
@ -1,14 +1,7 @@
|
|||
Libostd is licensed under the University of Illinois/NCSA Open Source License,
|
||||
a permissive, non-copyleft, BSD style license. The license text goes as follows:
|
||||
Copyright (c) 2015-2020 Daniel "q66" Kolesa
|
||||
|
||||
Copyright (c) 2015 Daniel "q66" Kolesa. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
@ -17,17 +10,17 @@ so, subject to the following conditions:
|
|||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of libostd developers nor any contributors may be
|
||||
used to endorse or promote products derived from this Software without
|
||||
specific prior written permission.
|
||||
|
||||
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.**
|
||||
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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.**
|
||||
|
||||
Additionally some code from the libc++ project has been used as a reference;
|
||||
libc++ is a part of the LLVM project.
|
||||
|
@ -41,7 +34,7 @@ to the project here.
|
|||
Additional thanks to Dale Weiler aka graphitemaster (reference code in the
|
||||
Neothyne project) and cppreference.com.
|
||||
|
||||
**The data/UnicodeData-11.0.txt file is taken from the Unicode Character
|
||||
**The data/UnicodeData-13.0.txt file is taken from the Unicode Character
|
||||
Database and provided under the following license:**
|
||||
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
|
File diff suppressed because it is too large
Load Diff
24
meson.build
24
meson.build
|
@ -1,6 +1,6 @@
|
|||
project('libostd', ['cpp'],
|
||||
version: '0.1.0',
|
||||
default_options: ['buildtype=plain', 'cpp_std=c++17'],
|
||||
default_options: ['buildtype=plain', 'cpp_std=c++17', 'warning_level=3'],
|
||||
meson_version: '>=0.46'
|
||||
)
|
||||
|
||||
|
@ -11,15 +11,25 @@ dir_lib = join_paths(dir_prefix, get_option('libdir'))
|
|||
|
||||
dir_package_include = join_paths(dir_include, 'ostd')
|
||||
|
||||
unicode_data = join_paths('data', 'UnicodeData-11.0.txt')
|
||||
unicode_data = join_paths('data', 'UnicodeData-13.0.txt')
|
||||
|
||||
libostd_includes = [include_directories('.')]
|
||||
|
||||
tgt_compiler_id = meson.get_compiler('cpp').get_id()
|
||||
if tgt_compiler_id == 'gcc' or tgt_compiler_id == 'clang'
|
||||
extra_cxxflags = ['-Wextra', '-Wshadow', '-Wold-style-cast']
|
||||
else
|
||||
extra_cxxflags = []
|
||||
cxx = meson.get_compiler('cpp')
|
||||
|
||||
extra_cxxflags = []
|
||||
|
||||
if get_option('buildtype') != 'plain'
|
||||
if cxx.has_argument('-Wshadow')
|
||||
extra_cxxflags += '-Wshadow'
|
||||
endif
|
||||
if cxx.has_argument('-Wold-style-cast')
|
||||
extra_cxxflags += '-Wold-style-cast'
|
||||
endif
|
||||
endif
|
||||
|
||||
if cxx.has_argument('-fvisibility=hidden')
|
||||
extra_cxxflags += '-fvisibility=hidden'
|
||||
endif
|
||||
|
||||
subdir('src')
|
||||
|
|
|
@ -488,7 +488,7 @@ inline UnaryFunction for_each(InputRange range, UnaryFunction func) {
|
|||
for (; !range.empty(); range.pop_front()) {
|
||||
func(range.front());
|
||||
}
|
||||
return std::move(func);
|
||||
return func;
|
||||
}
|
||||
|
||||
/** @brief A pipeable version of ostd::for_each().
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ostd {
|
|||
*/
|
||||
|
||||
/** @brief The error thrown on parsing and other failures. */
|
||||
struct arg_error: std::runtime_error {
|
||||
struct OSTD_EXPORT arg_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
|
||||
/* empty, for vtable placement */
|
||||
|
@ -98,7 +98,7 @@ enum class arg_value {
|
|||
*
|
||||
* This base class is abstract so it cannot be instantiated.
|
||||
*/
|
||||
struct arg_description {
|
||||
struct OSTD_EXPORT arg_description {
|
||||
friend struct arg_description_container;
|
||||
friend struct arg_mutually_exclusive_group;
|
||||
friend struct arg_group;
|
||||
|
@ -138,7 +138,7 @@ protected:
|
|||
*
|
||||
* It's not instantiated directly.
|
||||
*/
|
||||
struct arg_argument: arg_description {
|
||||
struct OSTD_EXPORT arg_argument: arg_description {
|
||||
/* empty, for vtable placement */
|
||||
virtual ~arg_argument();
|
||||
|
||||
|
@ -225,7 +225,7 @@ private:
|
|||
*
|
||||
*See ostd::basic_arg_parser for more.
|
||||
*/
|
||||
struct arg_optional: arg_argument {
|
||||
struct OSTD_EXPORT arg_optional: arg_argument {
|
||||
template<typename HelpFormatter>
|
||||
friend struct basic_arg_parser;
|
||||
friend struct arg_description_container;
|
||||
|
@ -459,7 +459,7 @@ private:
|
|||
*
|
||||
*See ostd::basic_arg_parser for more.
|
||||
*/
|
||||
struct arg_positional: arg_argument {
|
||||
struct OSTD_EXPORT arg_positional: arg_argument {
|
||||
template<typename HelpFormatter>
|
||||
friend struct basic_arg_parser;
|
||||
friend struct arg_description_container;
|
||||
|
@ -603,7 +603,7 @@ private:
|
|||
* A mutually exclusive group can also have the `required` flag set
|
||||
* in which case one of the arguments must always be used.
|
||||
*/
|
||||
struct arg_mutually_exclusive_group: arg_description {
|
||||
struct OSTD_EXPORT arg_mutually_exclusive_group: arg_description {
|
||||
friend struct arg_description_container;
|
||||
|
||||
/* empty, for vtable placement */
|
||||
|
@ -940,7 +940,7 @@ protected:
|
|||
* A group is named and can optionally have a title. The title is
|
||||
* displayed in help listing. If not set, the name is displayed.
|
||||
*/
|
||||
struct arg_group: arg_description, arg_description_container {
|
||||
struct OSTD_EXPORT arg_group: arg_description, arg_description_container {
|
||||
friend struct arg_description_container;
|
||||
|
||||
/* empty, for vtable placement */
|
||||
|
|
|
@ -198,7 +198,7 @@ private:
|
|||
bool p_action = false;
|
||||
};
|
||||
|
||||
struct make_task {
|
||||
struct OSTD_EXPORT make_task {
|
||||
make_task() {}
|
||||
virtual ~make_task();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <stdexcept>
|
||||
#include <memory>
|
||||
|
||||
#include <ostd/platform.hh>
|
||||
#include <ostd/generic_condvar.hh>
|
||||
|
||||
namespace ostd {
|
||||
|
@ -33,7 +34,7 @@ namespace ostd {
|
|||
*/
|
||||
|
||||
/** @brief Thrown when manipulating a channel that has been closed. */
|
||||
struct channel_error: std::logic_error {
|
||||
struct OSTD_EXPORT channel_error: std::logic_error {
|
||||
using std::logic_error::logic_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~channel_error();
|
||||
|
|
|
@ -212,7 +212,7 @@ private:
|
|||
* The `start` method will also set the internal current scheduler pointer
|
||||
* so that APIs such as ostd::spawn() can work.
|
||||
*/
|
||||
struct scheduler {
|
||||
struct OSTD_EXPORT scheduler {
|
||||
private:
|
||||
struct stack_allocator {
|
||||
stack_allocator() = delete;
|
||||
|
@ -544,7 +544,7 @@ namespace detail {
|
|||
|
||||
OSTD_EXPORT extern thread_local csched_task *current_csched_task;
|
||||
|
||||
struct csched_task: coroutine_context {
|
||||
struct OSTD_EXPORT csched_task: coroutine_context {
|
||||
friend struct coroutine_context;
|
||||
|
||||
csched_task() = delete;
|
||||
|
|
|
@ -54,14 +54,14 @@ namespace ostd {
|
|||
*
|
||||
* These can include a dead coroutine/generator call/access.
|
||||
*/
|
||||
struct coroutine_error: std::runtime_error {
|
||||
struct OSTD_EXPORT coroutine_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~coroutine_error();
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
struct stack_free_iface {
|
||||
struct OSTD_EXPORT stack_free_iface {
|
||||
stack_free_iface() {}
|
||||
/* empty, for vtable placement */
|
||||
virtual ~stack_free_iface();
|
||||
|
@ -84,7 +84,7 @@ namespace detail {
|
|||
* managing the coroutine as well as its entry point. All coroutine types
|
||||
* inherit from this.
|
||||
*/
|
||||
struct coroutine_context {
|
||||
struct OSTD_EXPORT coroutine_context {
|
||||
/** @brief Gets the currently executing coroutine context.
|
||||
*
|
||||
* Sometimes custom coroutine types might want to bypass being able
|
||||
|
|
|
@ -55,7 +55,7 @@ enum format_flags {
|
|||
};
|
||||
|
||||
/** @brief Thrown when format string does not properly match the arguments. */
|
||||
struct format_error: std::runtime_error {
|
||||
struct OSTD_EXPORT format_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~format_error();
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include <algorithm>
|
||||
#include <condition_variable>
|
||||
|
||||
#include <ostd/platform.hh>
|
||||
|
||||
namespace ostd {
|
||||
|
||||
/** @addtogroup Concurrency
|
||||
|
@ -23,7 +25,7 @@ namespace ostd {
|
|||
*/
|
||||
|
||||
namespace detail {
|
||||
struct cond_iface {
|
||||
struct OSTD_EXPORT cond_iface {
|
||||
cond_iface() {}
|
||||
virtual ~cond_iface();
|
||||
virtual void notify_one() = 0;
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace detail {
|
|||
*
|
||||
* It inherits from std::runtime_error and has the same methods and behavior.
|
||||
*/
|
||||
struct path_error: std::runtime_error {
|
||||
struct OSTD_EXPORT path_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
|
||||
/* empty, for vtable placement */
|
||||
|
@ -1263,7 +1263,7 @@ using file_time_t = std::chrono::time_point<std::chrono::system_clock>;
|
|||
* up to two paths involved in the operation as ostd::path. Whether those
|
||||
* are used depends on the operation.
|
||||
*/
|
||||
struct fs_error: std::system_error {
|
||||
struct OSTD_EXPORT fs_error: std::system_error {
|
||||
/** @brief Constructs the error without paths. */
|
||||
fs_error(std::string const &warg, std::error_code ec):
|
||||
std::system_error::system_error(ec, warg)
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace ostd {
|
|||
*/
|
||||
|
||||
/** @brief Thrown on errors in ostd::split_args(). */
|
||||
struct word_error: std::runtime_error {
|
||||
struct OSTD_EXPORT word_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~word_error();
|
||||
|
@ -81,7 +81,7 @@ Sink &&split_args(Sink &&out, string_range str) {
|
|||
}
|
||||
|
||||
/** @brief Thrown on errors in ostd::subprocess. */
|
||||
struct subprocess_error: std::runtime_error {
|
||||
struct OSTD_EXPORT subprocess_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~subprocess_error();
|
||||
|
|
|
@ -88,7 +88,7 @@ template<typename T = char, bool = std::is_trivial_v<T>>
|
|||
struct stream_range;
|
||||
|
||||
/** @brief Thrown on stream errors. */
|
||||
struct stream_error: std::system_error {
|
||||
struct OSTD_EXPORT stream_error: std::system_error {
|
||||
using std::system_error::system_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~stream_error();
|
||||
|
@ -102,7 +102,7 @@ struct stream_line_range;
|
|||
* All streams derive from this, for example ostd::file_steram.
|
||||
* They implement the virtual interface provided by this class.
|
||||
*/
|
||||
struct stream {
|
||||
struct OSTD_EXPORT stream {
|
||||
/** @brief The stream offset type. */
|
||||
using offset_type = stream_off_t;
|
||||
|
||||
|
|
|
@ -126,6 +126,14 @@ public:
|
|||
p_beg(v.p_beg), p_end(v.p_end)
|
||||
{}
|
||||
|
||||
/** @brief Slices can be constructed from string views. */
|
||||
template<typename U>
|
||||
basic_char_range(std::basic_string_view<
|
||||
std::remove_const_t<value_type>, U
|
||||
> const &v) noexcept:
|
||||
p_beg{v.data()}, p_end{v.data() + v.size()}
|
||||
{}
|
||||
|
||||
/** @brief Constructs a slice from a pointer or a static array.
|
||||
*
|
||||
* This constructor handles two cases. The input must be convertible
|
||||
|
@ -790,7 +798,7 @@ namespace utf {
|
|||
static inline constexpr char32_t const max_unicode = 0x10FFFF;
|
||||
|
||||
/** @brief Thrown on UTF-8 decoding failure. */
|
||||
struct utf_error: std::runtime_error {
|
||||
struct OSTD_EXPORT utf_error: std::runtime_error {
|
||||
using std::runtime_error::runtime_error;
|
||||
/* empty, for vtable placement */
|
||||
virtual ~utf_error();
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ostd {
|
|||
namespace build {
|
||||
|
||||
/* place the vtable in here */
|
||||
make_task::~make_task() {}
|
||||
OSTD_EXPORT make_task::~make_task() {}
|
||||
|
||||
static bool check_exec(
|
||||
string_range tname, std::vector<string_range> const &deps
|
||||
|
|
|
@ -49,7 +49,7 @@ thread_dep = dependency('threads')
|
|||
libostd_gen_unicode_exe = executable('gen_unicode',
|
||||
['../gen_unicode.cc'],
|
||||
include_directories: libostd_includes,
|
||||
cpp_args: extra_cxxflags + ['-DOSTD_GEN_UNICODE_BUILD'],
|
||||
cpp_args: ['-DOSTD_GEN_UNICODE_BUILD'] + extra_cxxflags,
|
||||
install: false,
|
||||
native: true
|
||||
)
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace ostd {
|
|||
|
||||
/* place the vtables in here */
|
||||
|
||||
path_error::~path_error() {}
|
||||
OSTD_EXPORT path_error::~path_error() {}
|
||||
|
||||
namespace fs {
|
||||
fs_error::~fs_error() {}
|
||||
|
|
Loading…
Reference in New Issue