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
1396abd0
Commit
1396abd0
authored
Aug 09, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to check that bootstrapped sources are up-to-date and a script for updating them.
parent
d0f630fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
5 deletions
+110
-5
regenerate-bootstraps.sh
c++/regenerate-bootstraps.sh
+9
-0
bootstrap-test.ekam-rule
c++/src/capnp/bootstrap-test.ekam-rule
+65
-0
capnpc.ekam-rule
c++/src/capnp/capnpc.ekam-rule
+0
-1
capnp.ekam-manifest
c++/src/capnp/compiler/capnp.ekam-manifest
+3
-0
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+22
-4
string.h
c++/src/kj/string.h
+11
-0
No files found.
c++/regenerate-bootstraps.sh
0 → 100755
View file @
1396abd0
#! /bin/bash
set
-euo
pipefail
export
PATH
=
$PWD
/bin:
$PWD
:
$PATH
capnp compile
-Isrc
--no-standard-import
--src-prefix
=
src
-oc
++:src
\
src/capnp/c++.capnp src/capnp/schema.capnp
\
src/capnp/compiler/lexer.capnp src/capnp/compiler/grammar.capnp
c++/src/capnp/bootstrap-test.ekam-rule
0 → 100755
View file @
1396abd0
#! /bin/sh
# Copyright (c) 2013, Kenton Varda <temporal@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 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 OWNER 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.
# This is a one-off test rule.
set
-eu
echo
findProvider special:ekam-interceptor
read
INTERCEPTOR
if
test
"
$INTERCEPTOR
"
=
""
;
then
echo
"error: couldn't find intercept.so."
>
&2
exit
1
fi
echo
findProvider file:capnp
read
CAPNP
if
test
"
$CAPNP
"
=
""
;
then
echo
"error: couldn't find capnp."
>
&2
exit
1
fi
echo
findProvider file:capnpc-c++
read
CAPNPC_CXX
if
test
"
$CAPNPC_CXX
"
=
""
;
then
echo
"error: couldn't find capnpc-c++."
>
&2
exit
1
fi
mkdir
-p
tmp/capnp/bootstrap-test-tmp
INPUTS
=
"src/capnp/c++.capnp src/capnp/schema.capnp src/capnp/compiler/lexer.capnp src/capnp/compiler/grammar.capnp"
$CAPNP
compile
--src-prefix
=
src
-Isrc
--no-standard-import
\
-o
$CAPNPC_CXX
:tmp/capnp/bootstrap-test-tmp
$INPUTS
for
file
in
$INPUTS
;
do
for
ext
in
h c++
;
do
diff
-u
$file
.
$ext
tmp/capnp/bootstrap-test-tmp/
${
file
#src/
}
.
$ext
>
&2
done
done
c++/src/capnp/capnpc.ekam-rule
View file @
1396abd0
...
@@ -65,6 +65,5 @@ if test "$CAPNPC_CXX" = ""; then
...
@@ -65,6 +65,5 @@ if test "$CAPNPC_CXX" = ""; then
exit
1
exit
1
fi
fi
# When exception stack traces are needed, add: +RTS -xc -RTS
LD_PRELOAD
=
$INTERCEPTOR
DYLD_FORCE_FLAT_NAMESPACE
=
DYLD_INSERT_LIBRARIES
=
$INTERCEPTOR
\
LD_PRELOAD
=
$INTERCEPTOR
DYLD_FORCE_FLAT_NAMESPACE
=
DYLD_INSERT_LIBRARIES
=
$INTERCEPTOR
\
$CAPNP
compile
-I
.
-o
$CAPNPC_CXX
"
$INPUT
"
3>&1 4<&0
>
&2
$CAPNP
compile
-I
.
-o
$CAPNPC_CXX
"
$INPUT
"
3>&1 4<&0
>
&2
c++/src/capnp/compiler/capnp.ekam-manifest
0 → 100644
View file @
1396abd0
capnp bin
capnpc-capnp bin
capnpc-c++ bin
c++/src/capnp/compiler/capnpc-c++.c++
View file @
1396abd0
...
@@ -163,11 +163,10 @@ void makeMemberInfoTable(uint parent, MemberList&& members,
...
@@ -163,11 +163,10 @@ void makeMemberInfoTable(uint parent, MemberList&& members,
}
}
kj
::
StringPtr
baseName
(
kj
::
StringPtr
path
)
{
kj
::
StringPtr
baseName
(
kj
::
StringPtr
path
)
{
const
char
*
slashPos
=
strrchr
(
path
.
cStr
(),
'/'
);
KJ_IF_MAYBE
(
slashPos
,
path
.
findLast
(
'/'
))
{
if
(
slashPos
==
nullptr
)
{
return
path
.
slice
(
*
slashPos
+
1
);
return
path
;
}
else
{
}
else
{
return
slashPos
+
1
;
return
path
;
}
}
}
}
...
@@ -1298,7 +1297,26 @@ private:
...
@@ -1298,7 +1297,26 @@ private:
// -----------------------------------------------------------------
// -----------------------------------------------------------------
void
makeDirectory
(
kj
::
StringPtr
path
)
{
KJ_IF_MAYBE
(
slashpos
,
path
.
findLast
(
'/'
))
{
// Make the parent dir.
makeDirectory
(
kj
::
str
(
path
.
slice
(
0
,
*
slashpos
)));
}
if
(
mkdir
(
path
.
cStr
(),
0777
)
<
0
)
{
int
error
=
errno
;
if
(
error
!=
EEXIST
)
{
KJ_FAIL_SYSCALL
(
"mkdir(path)"
,
error
,
path
);
}
}
}
void
writeFile
(
kj
::
StringPtr
filename
,
const
kj
::
StringTree
&
text
)
{
void
writeFile
(
kj
::
StringPtr
filename
,
const
kj
::
StringTree
&
text
)
{
KJ_IF_MAYBE
(
slashpos
,
filename
.
findLast
(
'/'
))
{
// Make the parent dir.
makeDirectory
(
kj
::
str
(
filename
.
slice
(
0
,
*
slashpos
)));
}
int
fd
;
int
fd
;
KJ_SYSCALL
(
fd
=
open
(
filename
.
cStr
(),
O_CREAT
|
O_WRONLY
|
O_TRUNC
,
0666
),
filename
);
KJ_SYSCALL
(
fd
=
open
(
filename
.
cStr
(),
O_CREAT
|
O_WRONLY
|
O_TRUNC
,
0666
),
filename
);
kj
::
FdOutputStream
out
((
kj
::
AutoCloseFd
(
fd
)));
kj
::
FdOutputStream
out
((
kj
::
AutoCloseFd
(
fd
)));
...
...
c++/src/kj/string.h
View file @
1396abd0
...
@@ -87,6 +87,7 @@ public:
...
@@ -87,6 +87,7 @@ public:
inline
bool
endsWith
(
const
StringPtr
&
other
)
const
;
inline
bool
endsWith
(
const
StringPtr
&
other
)
const
;
inline
Maybe
<
size_t
>
findFirst
(
char
c
)
const
;
inline
Maybe
<
size_t
>
findFirst
(
char
c
)
const
;
inline
Maybe
<
size_t
>
findLast
(
char
c
)
const
;
private
:
private
:
inline
StringPtr
(
ArrayPtr
<
const
char
>
content
)
:
content
(
content
)
{}
inline
StringPtr
(
ArrayPtr
<
const
char
>
content
)
:
content
(
content
)
{}
...
@@ -150,6 +151,7 @@ public:
...
@@ -150,6 +151,7 @@ public:
}
}
inline
Maybe
<
size_t
>
findFirst
(
char
c
)
const
{
return
StringPtr
(
*
this
).
findFirst
(
c
);
}
inline
Maybe
<
size_t
>
findFirst
(
char
c
)
const
{
return
StringPtr
(
*
this
).
findFirst
(
c
);
}
inline
Maybe
<
size_t
>
findLast
(
char
c
)
const
{
return
StringPtr
(
*
this
).
findLast
(
c
);
}
private
:
private
:
Array
<
char
>
content
;
Array
<
char
>
content
;
...
@@ -399,6 +401,15 @@ inline Maybe<size_t> StringPtr::findFirst(char c) const {
...
@@ -399,6 +401,15 @@ inline Maybe<size_t> StringPtr::findFirst(char c) const {
}
}
}
}
inline
Maybe
<
size_t
>
StringPtr
::
findLast
(
char
c
)
const
{
const
char
*
pos
=
reinterpret_cast
<
const
char
*>
(
memrchr
(
content
.
begin
(),
c
,
size
()));
if
(
pos
==
nullptr
)
{
return
nullptr
;
}
else
{
return
pos
-
content
.
begin
();
}
}
inline
String
::
operator
ArrayPtr
<
char
>
()
{
inline
String
::
operator
ArrayPtr
<
char
>
()
{
return
content
==
nullptr
?
ArrayPtr
<
char
>
(
nullptr
)
:
content
.
slice
(
0
,
content
.
size
()
-
1
);
return
content
==
nullptr
?
ArrayPtr
<
char
>
(
nullptr
)
:
content
.
slice
(
0
,
content
.
size
()
-
1
);
}
}
...
...
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