From 8e761289a2446367267c6c0d9a26e734f0f78306 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 Dec 2020 20:29:05 +0300 Subject: Get rid of legacy build systems and rename cutl/ to libcutl/ --- libcutl/buildfile | 47 ++ libcutl/compiler/code-stream.hxx | 152 ++++++ libcutl/compiler/code-stream.txx | 93 ++++ libcutl/compiler/context.cxx | 53 +++ libcutl/compiler/context.hxx | 136 ++++++ libcutl/compiler/context.txx | 87 ++++ libcutl/compiler/cxx-indenter.cxx | 48 ++ libcutl/compiler/cxx-indenter.hxx | 170 +++++++ libcutl/compiler/cxx-indenter.ixx | 68 +++ libcutl/compiler/cxx-indenter.txx | 816 +++++++++++++++++++++++++++++++++ libcutl/compiler/sloc-counter.hxx | 77 ++++ libcutl/compiler/sloc-counter.txx | 223 +++++++++ libcutl/compiler/traversal.hxx | 170 +++++++ libcutl/compiler/traversal.txx | 143 ++++++ libcutl/compiler/type-id.hxx | 45 ++ libcutl/compiler/type-id.ixx | 43 ++ libcutl/compiler/type-id.txx | 16 + libcutl/compiler/type-info.cxx | 29 ++ libcutl/compiler/type-info.hxx | 110 +++++ libcutl/compiler/type-info.ixx | 94 ++++ libcutl/container/any.hxx | 149 ++++++ libcutl/container/graph.hxx | 214 +++++++++ libcutl/container/graph.txx | 348 ++++++++++++++ libcutl/container/key.hxx | 70 +++ libcutl/container/map-iterator.hxx | 68 +++ libcutl/container/multi-index.hxx | 14 + libcutl/container/pointer-iterator.hxx | 125 +++++ libcutl/exception.cxx | 15 + libcutl/exception.hxx | 22 + libcutl/export.hxx | 40 ++ libcutl/fs/auto-remove.cxx | 30 ++ libcutl/fs/auto-remove.hxx | 82 ++++ libcutl/fs/exception.cxx | 16 + libcutl/fs/exception.hxx | 36 ++ libcutl/fs/path.cxx | 120 +++++ libcutl/fs/path.hxx | 332 ++++++++++++++ libcutl/fs/path.ixx | 70 +++ libcutl/fs/path.txx | 209 +++++++++ libcutl/meta/answer.hxx | 23 + libcutl/meta/class-p.hxx | 26 ++ libcutl/meta/polymorphic-p.hxx | 49 ++ libcutl/meta/remove-c.hxx | 25 + libcutl/meta/remove-cv.hxx | 22 + libcutl/meta/remove-p.hxx | 25 + libcutl/meta/remove-v.hxx | 25 + libcutl/re.hxx | 280 +++++++++++ libcutl/re/re.cxx | 462 +++++++++++++++++++ libcutl/re/re.txx | 68 +++ libcutl/shared-ptr.hxx | 157 +++++++ libcutl/shared-ptr/base.cxx | 61 +++ libcutl/shared-ptr/base.hxx | 91 ++++ libcutl/shared-ptr/base.ixx | 77 ++++ libcutl/shared-ptr/base.txx | 198 ++++++++ libcutl/static-ptr.hxx | 73 +++ libcutl/version.hxx | 0 libcutl/version.hxx.in | 38 ++ 56 files changed, 6280 insertions(+) create mode 100644 libcutl/buildfile create mode 100644 libcutl/compiler/code-stream.hxx create mode 100644 libcutl/compiler/code-stream.txx create mode 100644 libcutl/compiler/context.cxx create mode 100644 libcutl/compiler/context.hxx create mode 100644 libcutl/compiler/context.txx create mode 100644 libcutl/compiler/cxx-indenter.cxx create mode 100644 libcutl/compiler/cxx-indenter.hxx create mode 100644 libcutl/compiler/cxx-indenter.ixx create mode 100644 libcutl/compiler/cxx-indenter.txx create mode 100644 libcutl/compiler/sloc-counter.hxx create mode 100644 libcutl/compiler/sloc-counter.txx create mode 100644 libcutl/compiler/traversal.hxx create mode 100644 libcutl/compiler/traversal.txx create mode 100644 libcutl/compiler/type-id.hxx create mode 100644 libcutl/compiler/type-id.ixx create mode 100644 libcutl/compiler/type-id.txx create mode 100644 libcutl/compiler/type-info.cxx create mode 100644 libcutl/compiler/type-info.hxx create mode 100644 libcutl/compiler/type-info.ixx create mode 100644 libcutl/container/any.hxx create mode 100644 libcutl/container/graph.hxx create mode 100644 libcutl/container/graph.txx create mode 100644 libcutl/container/key.hxx create mode 100644 libcutl/container/map-iterator.hxx create mode 100644 libcutl/container/multi-index.hxx create mode 100644 libcutl/container/pointer-iterator.hxx create mode 100644 libcutl/exception.cxx create mode 100644 libcutl/exception.hxx create mode 100644 libcutl/export.hxx create mode 100644 libcutl/fs/auto-remove.cxx create mode 100644 libcutl/fs/auto-remove.hxx create mode 100644 libcutl/fs/exception.cxx create mode 100644 libcutl/fs/exception.hxx create mode 100644 libcutl/fs/path.cxx create mode 100644 libcutl/fs/path.hxx create mode 100644 libcutl/fs/path.ixx create mode 100644 libcutl/fs/path.txx create mode 100644 libcutl/meta/answer.hxx create mode 100644 libcutl/meta/class-p.hxx create mode 100644 libcutl/meta/polymorphic-p.hxx create mode 100644 libcutl/meta/remove-c.hxx create mode 100644 libcutl/meta/remove-cv.hxx create mode 100644 libcutl/meta/remove-p.hxx create mode 100644 libcutl/meta/remove-v.hxx create mode 100644 libcutl/re.hxx create mode 100644 libcutl/re/re.cxx create mode 100644 libcutl/re/re.txx create mode 100644 libcutl/shared-ptr.hxx create mode 100644 libcutl/shared-ptr/base.cxx create mode 100644 libcutl/shared-ptr/base.hxx create mode 100644 libcutl/shared-ptr/base.ixx create mode 100644 libcutl/shared-ptr/base.txx create mode 100644 libcutl/static-ptr.hxx create mode 100644 libcutl/version.hxx create mode 100644 libcutl/version.hxx.in (limited to 'libcutl') diff --git a/libcutl/buildfile b/libcutl/buildfile new file mode 100644 index 0000000..f3fe4dc --- /dev/null +++ b/libcutl/buildfile @@ -0,0 +1,47 @@ +# file : libcutl/buildfile +# license : MIT; see accompanying LICENSE file + +lib{cutl}: {hxx ixx txx cxx}{** -version} {hxx}{version} + +# Include the generated version header into the distribution (so that we don't +# pick up an installed one) and don't remove it when cleaning in src (so that +# clean results in a state identical to distributed). +# +hxx{version}: in{version} $src_root/manifest +hxx{version}: +{ + dist = true + clean = ($src_root != $out_root) +} + +# Build options. +# +cxx.poptions =+ "-I$out_root" "-I$src_root" + +obja{*}: cxx.poptions += -DLIBCUTL_STATIC_BUILD +objs{*}: cxx.poptions += -DLIBCUTL_SHARED_BUILD + +# Export options. +# +lib{cutl}: cxx.export.poptions = "-I$out_root" "-I$src_root" + +liba{cutl}: cxx.export.poptions += -DLIBCUTL_STATIC +libs{cutl}: cxx.export.poptions += -DLIBCUTL_SHARED + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. See the version module +# for details on the version.* variable values. +# +if $version.pre_release + lib{cutl}: bin.lib.version = @"-$version.project_id" +else + lib{cutl}: bin.lib.version = @"-$version.major.$version.minor" + +# Install into the libcutl/ subdirectory of, say, /usr/include/ recreating +# subdirectories. +# +{hxx ixx txx}{*}: +{ + install = include/libcutl/ + install.subdirs = true +} diff --git a/libcutl/compiler/code-stream.hxx b/libcutl/compiler/code-stream.hxx new file mode 100644 index 0000000..e5fe996 --- /dev/null +++ b/libcutl/compiler/code-stream.hxx @@ -0,0 +1,152 @@ +// file : libcutl/compiler/code-stream.hxx +// license : MIT; see accompanying LICENSE file + +#ifndef LIBCUTL_COMPILER_CODE_STREAM_HXX +#define LIBCUTL_COMPILER_CODE_STREAM_HXX + +#include + +#include + +namespace cutl +{ + namespace compiler + { + // + // + template + class code_stream + { + public: + code_stream () {} + + virtual + ~code_stream (); + + public: + virtual void + put (C) = 0; + + // Unbuffer flushes internal formatting buffers (if any). + // Note that unbuffer is not exactly flushing since it can + // result in formatting errors and in general can not be + // called at arbitrary points. Natural use case would be + // to call unbuffer at the end of the stream when no more + // data is expected. + // + virtual void + unbuffer () = 0; + + private: + code_stream (code_stream const&); + + code_stream& + operator= (code_stream const&); + }; + + // + // + template + class from_streambuf_adapter: public code_stream + { + public: + typedef typename std::basic_streambuf::traits_type traits_type; + typedef typename std::basic_streambuf::int_type int_type; + + class eof: exception {}; + class sync: exception {}; + + public: + from_streambuf_adapter (std::basic_streambuf& stream) + : stream_ (stream) + { + } + + private: + from_streambuf_adapter (from_streambuf_adapter const&); + + from_streambuf_adapter& + operator= (from_streambuf_adapter const&); + + public: + virtual void + put (C c); + + virtual void + unbuffer (); + + private: + std::basic_streambuf& stream_; + }; + + // + // + template + class to_streambuf_adapter: public std::basic_streambuf + { + public: + typedef typename std::basic_streambuf::traits_type traits_type; + typedef typename std::basic_streambuf::int_type int_type; + + public: + to_streambuf_adapter (code_stream& stream) + : stream_ (stream) + { + } + + private: + to_streambuf_adapter (to_streambuf_adapter const&); + + to_streambuf_adapter& + operator= (to_streambuf_adapter const&); + + public: + virtual int_type + overflow (int_type i); + + // Does nothing since calling unbuffer here would be dangerous. + // See the note in code_stream. + // + virtual int + sync (); + + private: + code_stream& stream_; + }; + + // + // + template