forked from boostorg/regex
Compare commits
13 Commits
issue183
...
use_core_s
Author | SHA1 | Date | |
---|---|---|---|
372d3f7a7e | |||
362c85cf66 | |||
430419705b | |||
1cad53766e | |||
39e5c86f44 | |||
adae246a46 | |||
86b2fbe600 | |||
99653df37d | |||
1a750a42d1 | |||
6213ff03fc | |||
3e4bcb75b6 | |||
2a8e6d9189 | |||
a142dfecda |
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
@ -64,6 +64,31 @@ jobs:
|
||||
- name: Test
|
||||
run: ../../../b2 toolset=$TOOLSET
|
||||
working-directory: ../boost-root/libs/regex/test
|
||||
ubuntu-jammy-standalone:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ g++ ]
|
||||
standard: [ c++11, c++14, c++17, c++2a ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
with:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Set TOOLSET
|
||||
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
|
||||
- name: Add repository
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install libicu-dev
|
||||
- name: Test
|
||||
run: ${{ matrix.compiler }} -std=${{ matrix.standard }} -I../../include *.cpp ../../src/*.cpp -o regress && ./regress
|
||||
working-directory: ./test/regress
|
||||
ubuntu-bionic:
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
|
65
doc/html/boost_regex/configuration/standalone.html
Normal file
65
doc/html/boost_regex/configuration/standalone.html
Normal file
@ -0,0 +1,65 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Use in Standalone Mode (without the rest of Boost)</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../index.html" title="Boost.Regex 7.0.1">
|
||||
<link rel="up" href="../configuration.html" title="Configuration">
|
||||
<link rel="prev" href="compiler.html" title="Compiler Setup">
|
||||
<link rel="next" href="locale.html" title="Locale and traits class selection">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_regex.configuration.standalone"></a><a class="link" href="standalone.html" title="Use in Standalone Mode (without the rest of Boost)">Use in Standalone
|
||||
Mode (without the rest of Boost)</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
This library may now be used in "standalone" mode without the rest
|
||||
of the Boost C++ libraries, in order to do this you must either:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Have a C++17 compiler that supports <code class="computeroutput"><span class="identifier">__has_include</span></code>,
|
||||
in this case if <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> is <span class="bold"><strong>not</strong></span>
|
||||
present then the library will automoatically enter standalone mode. Or:
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Define BOOST_REGEX_STANDALONE when building.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The main difference between the 2 modes, is that when Boost.Config is present
|
||||
the library will automatically configure itself around various compiler defects.
|
||||
In particular in order to use the library with exception support turned off,
|
||||
you will either need a copy of Boost.Config in your include path, or else
|
||||
manually define BOOST_NO_EXCEPTIONS when building.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -215,7 +215,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: March 08, 2022 at 11:25:00 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: December 09, 2022 at 16:44:04 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -198,10 +198,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
inline std::size_t strcat_s(
|
||||
@ -210,11 +210,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -116,10 +116,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
inline std::size_t strcat_s(
|
||||
@ -128,11 +128,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
return 1;
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -18,20 +18,19 @@
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/cregex.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::sprintf;
|
||||
using ::strcpy;
|
||||
using ::strcmp;
|
||||
}
|
||||
#ifndef BOOST_WORKAROUND
|
||||
#define BOOST_WORKAROUND(x, y) false
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/core/snprintf.hpp>
|
||||
#else
|
||||
namespace boost { namespace core { using std::snprintf; } }
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -88,7 +87,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
|
||||
return REG_E_MEMORY;
|
||||
#endif
|
||||
// set default flags:
|
||||
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
|
||||
unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
|
||||
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
|
||||
// and translate those that are actually set:
|
||||
|
||||
@ -177,11 +176,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
// We're converting an integer i to a string, and since i <= REG_E_UNKNOWN
|
||||
// a five character string is *always* large enough:
|
||||
//
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
int r = (::sprintf_s)(localbuf, 5, "%d", i);
|
||||
#else
|
||||
int r = (std::sprintf)(localbuf, "%d", i);
|
||||
#endif
|
||||
int r = (boost::core::snprintf)(localbuf, 5, "%d", i);
|
||||
if(r < 0)
|
||||
return 0; // sprintf failed
|
||||
if(std::strlen(localbuf) < buf_size)
|
||||
@ -189,11 +184,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
return std::strlen(localbuf) + 1;
|
||||
}
|
||||
}
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
int r = (::sprintf_s)(localbuf, 5, "%d", 0);
|
||||
#else
|
||||
int r = (std::sprintf)(localbuf, "%d", 0);
|
||||
#endif
|
||||
int r = (boost::core::snprintf)(localbuf, 5, "%d", 0);
|
||||
if(r < 0)
|
||||
return 0; // sprintf failed
|
||||
if(std::strlen(localbuf) < buf_size)
|
||||
|
@ -24,7 +24,16 @@
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/cregex.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/core/snprintf.hpp>
|
||||
#else
|
||||
namespace boost { namespace core { using std::swprintf; } }
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_WORKAROUND
|
||||
#define BOOST_WORKAROUND(x, y) false
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@ -34,15 +43,6 @@
|
||||
#pragma warning(disable:981)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__)
|
||||
namespace std{
|
||||
# ifndef BOOST_NO_SWPRINTF
|
||||
using ::swprintf;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace {
|
||||
@ -98,7 +98,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
|
||||
return REG_E_MEMORY;
|
||||
#endif
|
||||
// set default flags:
|
||||
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
|
||||
unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
|
||||
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
|
||||
|
||||
// and translate those that are actually set:
|
||||
@ -178,7 +178,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#if !defined(BOOST_NO_SWPRINTF)
|
||||
if(code == REG_ATOI)
|
||||
{
|
||||
wchar_t localbuf[5];
|
||||
@ -191,7 +190,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(std::swprintf)(localbuf, L"%d", i);
|
||||
#else
|
||||
(std::swprintf)(localbuf, 5, L"%d", i);
|
||||
(boost::core::swprintf)(localbuf, 5, L"%d", i);
|
||||
#endif
|
||||
if(std::wcslen(localbuf) < buf_size)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
@ -205,7 +204,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(std::swprintf)(localbuf, L"%d", 0);
|
||||
#else
|
||||
(std::swprintf)(localbuf, 5, L"%d", 0);
|
||||
(boost::core::swprintf)(localbuf, 5, L"%d", 0);
|
||||
#endif
|
||||
if(std::wcslen(localbuf) < buf_size)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
@ -215,7 +214,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
#endif
|
||||
return std::wcslen(localbuf) + 1;
|
||||
}
|
||||
#endif
|
||||
if(code <= (int)REG_E_UNKNOWN)
|
||||
{
|
||||
std::string p;
|
||||
|
@ -16,14 +16,6 @@
|
||||
* DESCRIPTION: main regex test declarations.
|
||||
*/
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
|
||||
// we get unresolved externals from basic_string
|
||||
// unless we do this, a well known Borland bug:
|
||||
#define _RWSTD_COMPILE_INSTANTIATE
|
||||
#endif
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
@ -217,6 +217,13 @@ int main(int argc, char * argv[])
|
||||
return cpp_main(argc, argv);
|
||||
}
|
||||
|
||||
#elif defined(BOOST_REGEX_STANDALONE)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return cpp_main(argc, argv);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
|
@ -27,6 +27,23 @@
|
||||
#pragma warning(disable:1418 981 383 1419 7)
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_WORKAROUND
|
||||
#define BOOST_WORKAROUND(x, y) false
|
||||
#endif
|
||||
#ifdef BOOST_REGEX_STANDALONE
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost { using std::uint32_t; }
|
||||
|
||||
#define BOOST_JOIN(X, Y) BOOST_DO_JOIN(X, Y)
|
||||
#define BOOST_DO_JOIN(X, Y) BOOST_DO_JOIN2(X,Y)
|
||||
#define BOOST_DO_JOIN2(X, Y) X##Y
|
||||
|
||||
#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
|
||||
#define BOOST_DO_STRINGIZE(X) #X
|
||||
|
||||
#endif
|
||||
|
||||
#include <typeinfo>
|
||||
#include "test_not_regex.hpp"
|
||||
#include "test_regex_search.hpp"
|
||||
|
@ -20,10 +20,19 @@
|
||||
// We can only build this if we have ICU support:
|
||||
//
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_ICU) && !defined(BOOST_NO_STD_WSTRING)
|
||||
|
||||
#include <boost/regex/icu.hpp>
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/mpl/int.hpp>
|
||||
#else
|
||||
#include <type_traits>
|
||||
namespace boost { namespace mpl {
|
||||
template <int I>
|
||||
using int_ = ::std::integral_constant<int, I>;
|
||||
} }
|
||||
#endif
|
||||
#include "test.hpp"
|
||||
|
||||
namespace unnecessary_fix{
|
||||
|
@ -19,7 +19,7 @@
|
||||
//
|
||||
// We can only build this if we have ATL support:
|
||||
//
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#ifdef TEST_MFC
|
||||
|
||||
|
Reference in New Issue
Block a user