Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
eeb93d83
Commit
eeb93d83
authored
Apr 26, 2017
by
Kenton Varda
Committed by
GitHub
Apr 26, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #451 from sandstorm-io/cmake-http
Add kj-http to cmake build.
parents
561fe0f5
b34a7206
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
3 deletions
+36
-3
CMakeLists.txt
c++/src/kj/CMakeLists.txt
+18
-1
http.c++
c++/src/kj/compat/http.c++
+4
-0
char.h
c++/src/kj/parse/char.h
+8
-0
common.h
c++/src/kj/parse/common.h
+6
-2
No files found.
c++/src/kj/CMakeLists.txt
View file @
eeb93d83
...
...
@@ -126,6 +126,22 @@ if(NOT CAPNP_LITE)
install
(
FILES
${
kj-async_headers
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/kj"
)
endif
()
# kj-http ======================================================================
set
(
kj-http_sources
compat/http.c++
)
set
(
kj-http_headers
compat/http.h
)
if
(
NOT CAPNP_LITE
)
add_library
(
kj-http
${
kj-http_sources
}
)
add_library
(
CapnProto::kj-http ALIAS kj-http
)
target_link_libraries
(
kj-http kj-async kj
)
install
(
TARGETS kj-http
${
INSTALL_TARGETS_DEFAULT_ARGS
}
)
install
(
FILES
${
kj-http_headers
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/kj/compat"
)
endif
()
# Tests ========================================================================
if
(
BUILD_TESTING
)
...
...
@@ -161,8 +177,9 @@ if(BUILD_TESTING)
one-of-test.c++
function-test.c++
threadlocal-pthread-test.c++
compat/http-test.c++
)
target_link_libraries
(
kj-heavy-tests kj-async kj-test kj
)
target_link_libraries
(
kj-heavy-tests kj-
http kj-
async kj-test kj
)
add_dependencies
(
check kj-heavy-tests
)
add_test
(
NAME kj-heavy-tests-run COMMAND kj-heavy-tests
)
...
...
c++/src/kj/compat/http.c++
View file @
eeb93d83
...
...
@@ -215,7 +215,11 @@ struct HeaderNameHash {
// TODO(perf): I wonder if we can beat strcasecmp() by masking bit 0x20 from each byte. We'd
// need to prohibit one of the technically-legal characters '^' or '~' from header names
// since they'd otherwise be ambiguous, but otherwise there is no ambiguity.
#if _MSC_VER
return
_stricmp
(
a
.
cStr
(),
b
.
cStr
())
==
0
;
#else
return
strcasecmp
(
a
.
cStr
(),
b
.
cStr
())
==
0
;
#endif
}
};
...
...
c++/src/kj/parse/char.h
View file @
eeb93d83
...
...
@@ -152,6 +152,13 @@ constexpr inline CharGroup_ charRange(char first, char last) {
return
CharGroup_
().
orRange
(
first
,
last
);
}
#if _MSC_VER
#define anyOfChars(chars) CharGroup_().orAny(chars)
// TODO(msvc): MSVC ICEs on the proper definition of `anyOfChars()`, which in turn prevents us from
// building the compiler or schema parser. We don't know why this happens, but Harris found that
// this horrible, horrible hack makes things work. This is awful, but it's better than nothing.
// Hopefully, MSVC will get fixed soon and we'll be able to remove this.
#else
constexpr
inline
CharGroup_
anyOfChars
(
const
char
*
chars
)
{
// Returns a parser that accepts any of the characters in the given string (which should usually
// be a literal). The returned parser is of the same type as returned by `charRange()` -- see
...
...
@@ -159,6 +166,7 @@ constexpr inline CharGroup_ anyOfChars(const char* chars) {
return
CharGroup_
().
orAny
(
chars
);
}
#endif
// =======================================================================================
...
...
c++/src/kj/parse/common.h
View file @
eeb93d83
...
...
@@ -298,11 +298,15 @@ public:
explicit
constexpr
Sequence_
(
T
&&
firstSubParser
,
U
&&
...
rest
)
:
first
(
kj
::
fwd
<
T
>
(
firstSubParser
)),
rest
(
kj
::
fwd
<
U
>
(
rest
)...)
{}
// TODO(msvc): MSVC ICEs on the return types of operator() and parseNext() unless SubParsers is
// wrapped in `decltype(instance<SubParsers>())`. This is similar to the workaround in
// KJ_CONTEXT().
template
<
typename
Input
>
auto
operator
()(
Input
&
input
)
const
->
Maybe
<
decltype
(
tuple
(
instance
<
OutputType
<
FirstSubParser
,
Input
>>
(),
instance
<
OutputType
<
SubParsers
,
Input
>>
()...))
>
{
instance
<
OutputType
<
decltype
(
instance
<
SubParsers
>
())
,
Input
>>
()...))
>
{
return
parseNext
(
input
);
}
...
...
@@ -311,7 +315,7 @@ public:
Maybe
<
decltype
(
tuple
(
kj
::
fwd
<
InitialParams
>
(
initialParams
)...,
instance
<
OutputType
<
FirstSubParser
,
Input
>>
(),
instance
<
OutputType
<
SubParsers
,
Input
>>
()...))
>
{
instance
<
OutputType
<
decltype
(
instance
<
SubParsers
>
())
,
Input
>>
()...))
>
{
KJ_IF_MAYBE
(
firstResult
,
first
(
input
))
{
return
rest
.
parseNext
(
input
,
kj
::
fwd
<
InitialParams
>
(
initialParams
)...,
kj
::
mv
(
*
firstResult
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment