Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
83b41822
Commit
83b41822
authored
Sep 24, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A train-trip worth of python3 migration and other polishing
parent
3ed8d7db
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1374 additions
and
1370 deletions
+1374
-1370
huffman_gen.py
bin/varnishtest/huffman_gen.py
+56
-56
witness.py
bin/varnishtest/witness.py
+31
-31
vtc-syntax.py
doc/sphinx/vtc-syntax.py
+42
-43
Makefile.am
include/Makefile.am
+2
-2
generate.py
include/generate.py
+20
-21
h2_settings.h
include/tbl/h2_settings.h
+5
-0
htc.h
include/tbl/htc.h
+4
-3
style.py
include/tbl/style.py
+53
-51
vsl_tags.h
include/tbl/vsl_tags.h
+11
-10
waiters.h
include/tbl/waiters.h
+2
-0
generate.py
lib/libvarnishapi/generate.py
+89
-90
generate.py
lib/libvcc/generate.py
+482
-488
vmodtool.py
lib/libvcc/vmodtool.py
+34
-35
vsctool.py
lib/libvcc/vsctool.py
+371
-366
gcov_digest.py
tools/gcov_digest.py
+139
-139
include_wash.py
tools/include_wash.py
+33
-35
No files found.
bin/varnishtest/huffman_gen.py
View file @
83b41822
...
@@ -11,7 +11,7 @@ if len(sys.argv) != 2:
...
@@ -11,7 +11,7 @@ if len(sys.argv) != 2:
sys
.
exit
(
2
)
sys
.
exit
(
2
)
class
sym
:
class
sym
:
def
__init__
(
self
,
bigval
,
bigvall
,
chr
=
0
,
esc
=
None
):
def
__init__
(
self
,
bigval
,
bigvall
,
chr
=
0
,
esc
=
None
):
self
.
vall
=
bigvall
%
8
if
bigvall
%
8
else
8
self
.
vall
=
bigvall
%
8
if
bigvall
%
8
else
8
self
.
val
=
bigval
&
((
1
<<
self
.
vall
)
-
1
)
self
.
val
=
bigval
&
((
1
<<
self
.
vall
)
-
1
)
self
.
pfx
=
(
bigval
>>
self
.
vall
)
# & 0xff
self
.
pfx
=
(
bigval
>>
self
.
vall
)
# & 0xff
...
@@ -28,7 +28,7 @@ for l in f:
...
@@ -28,7 +28,7 @@ for l in f:
if
not
match
:
if
not
match
:
continue
continue
ch
r
=
int
(
match
.
group
(
grp
),
16
)
cha
r
=
int
(
match
.
group
(
grp
),
16
)
grp
+=
1
grp
+=
1
val
=
int
(
match
.
group
(
grp
),
16
)
val
=
int
(
match
.
group
(
grp
),
16
)
...
@@ -36,12 +36,12 @@ for l in f:
...
@@ -36,12 +36,12 @@ for l in f:
vall
=
int
(
match
.
group
(
grp
))
vall
=
int
(
match
.
group
(
grp
))
s
=
sym
(
val
,
vall
,
ch
r
)
s
=
sym
(
val
,
vall
,
cha
r
)
if
s
.
pfx
not
in
tbls
:
if
s
.
pfx
not
in
tbls
:
tbls
[
s
.
pfx
]
=
{}
tbls
[
s
.
pfx
]
=
{}
if
(
s
.
val
in
tbls
[
s
.
pfx
])
:
if
s
.
val
in
tbls
[
s
.
pfx
]
:
assert
(
tbls
[
s
.
pfx
][
s
.
val
]
.
e
)
assert
tbls
[
s
.
pfx
][
s
.
val
]
.
e
tbls
[
s
.
pfx
][
s
.
val
]
=
s
tbls
[
s
.
pfx
][
s
.
val
]
=
s
# add the escape entry in the "previous" table
# add the escape entry in the "previous" table
...
@@ -76,15 +76,15 @@ struct stbl {
...
@@ -76,15 +76,15 @@ struct stbl {
'''
)
'''
)
for
pfx
in
sorted
(
tbls
.
keys
(),
reverse
=
True
):
for
pfx
in
sorted
(
tbls
.
keys
(),
reverse
=
True
):
msl
=
max
([
x
.
vall
for
x
in
tbls
[
pfx
]
.
values
()
])
msl
=
max
([
x
.
vall
for
x
in
tbls
[
pfx
]
.
values
()
])
for
s
in
tbls
[
pfx
]
.
values
():
for
s
in
tbls
[
pfx
]
.
values
():
s
.
val
=
s
.
val
<<
(
msl
-
s
.
vall
)
s
.
val
=
s
.
val
<<
(
msl
-
s
.
vall
)
tbl
=
sorted
(
tbls
[
pfx
]
.
values
(),
key
=
lambda
x
:
x
.
val
)
tbl
=
sorted
(
tbls
[
pfx
]
.
values
(),
key
=
lambda
x
:
x
.
val
)
print
(
"
\n
static struct ssym sym_{:x}_array[] = {{"
.
format
(
pfx
))
print
(
"
\n
static struct ssym sym_{:x}_array[] = {{"
.
format
(
pfx
))
for
s
in
tbl
:
for
s
in
tbl
:
for
j
in
range
(
2
**
(
msl
-
s
.
vall
)):
for
j
in
range
(
2
**
(
msl
-
s
.
vall
)):
print
(
"
{} {{{}, {:3d}, {}}},"
.
format
(
print
(
"
{} {{{}, {:3d}, {}}},"
.
format
(
"
\t
"
if
j
else
"/* idx {:3d} */"
.
format
(
s
.
val
+
j
),
"
\t
"
if
j
else
"/* idx {:3d} */"
.
format
(
s
.
val
+
j
),
s
.
vall
,
s
.
chr
%
256
,
s
.
vall
,
s
.
chr
%
256
,
s
.
esc
if
s
.
esc
else
"NULL"
))
s
.
esc
if
s
.
esc
else
"NULL"
))
...
...
bin/varnishtest/witness.py
View file @
83b41822
doc/sphinx/vtc-syntax.py
View file @
83b41822
...
@@ -81,4 +81,3 @@ if __name__ == "__main__":
...
@@ -81,4 +81,3 @@ if __name__ == "__main__":
r
=
"*"
r
=
"*"
print
(
re
.
sub
(
r"."
,
r
,
tl
[
section
]),
end
=
""
)
print
(
re
.
sub
(
r"."
,
r
,
tl
[
section
]),
end
=
""
)
print
(
""
.
join
(
cl
[
section
]))
print
(
""
.
join
(
cl
[
section
]))
include/Makefile.am
View file @
83b41822
...
@@ -108,7 +108,7 @@ vcl.h: \
...
@@ -108,7 +108,7 @@ vcl.h: \
$(top_srcdir)/include/vrt.h
\
$(top_srcdir)/include/vrt.h
\
$(top_srcdir)/doc/sphinx/reference/vcl_var.rst
$(top_srcdir)/doc/sphinx/reference/vcl_var.rst
mkdir
-p
$(top_builddir)
/include/tbl
mkdir
-p
$(top_builddir)
/include/tbl
@
PYTHON@
$(top_srcdir)
/lib/libvcc/generate.py
\
${
PYTHON
}
$(top_srcdir)
/lib/libvcc/generate.py
\
$(top_srcdir)
$(top_builddir)
$(top_srcdir)
$(top_builddir)
GEN_H
=
\
GEN_H
=
\
...
@@ -128,7 +128,7 @@ vcs_version.h:
...
@@ -128,7 +128,7 @@ vcs_version.h:
@
if
test
-e
$(top_srcdir)
/.git
||
\
@
if
test
-e
$(top_srcdir)
/.git
||
\
!
test
-f
$(srcdir)
/vmod_abi.h
||
\
!
test
-f
$(srcdir)
/vmod_abi.h
||
\
!
test
-f
$(srcdir)
/vcs_version.h
;
then
\
!
test
-f
$(srcdir)
/vcs_version.h
;
then
\
@PYTHON@
$(srcdir)
/generate.py
\
${
PYTHON
}
$(srcdir)
/generate.py
\
$(top_srcdir)
$(top_builddir)
;
\
$(top_srcdir)
$(top_builddir)
;
\
fi
fi
...
...
include/generate.py
View file @
83b41822
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
subprocess
import
subprocess
import
collections
import
os
import
os
import
sys
import
sys
...
...
include/tbl/h2_settings.h
View file @
83b41822
...
@@ -47,6 +47,7 @@ H2_SETTING( // rfc7540,l,2097,2103
...
@@ -47,6 +47,7 @@ H2_SETTING( // rfc7540,l,2097,2103
0xffffffff
,
0xffffffff
,
0
0
)
)
#ifndef H2_SETTINGS_PARAM_ONLY
#ifndef H2_SETTINGS_PARAM_ONLY
H2_SETTING
(
// rfc7540,l,2105,2114
H2_SETTING
(
// rfc7540,l,2105,2114
ENABLE_PUSH
,
ENABLE_PUSH
,
...
@@ -58,6 +59,7 @@ H2_SETTING( // rfc7540,l,2105,2114
...
@@ -58,6 +59,7 @@ H2_SETTING( // rfc7540,l,2105,2114
H2CE_PROTOCOL_ERROR
H2CE_PROTOCOL_ERROR
)
)
#endif
#endif
H2_SETTING
(
// rfc7540,l,2116,2121
H2_SETTING
(
// rfc7540,l,2116,2121
MAX_CONCURRENT_STREAMS
,
MAX_CONCURRENT_STREAMS
,
max_concurrent_streams
,
max_concurrent_streams
,
...
@@ -67,6 +69,7 @@ H2_SETTING( // rfc7540,l,2116,2121
...
@@ -67,6 +69,7 @@ H2_SETTING( // rfc7540,l,2116,2121
0xffffffff
,
0xffffffff
,
0
0
)
)
H2_SETTING
(
// rfc7540,l,2139,2148
H2_SETTING
(
// rfc7540,l,2139,2148
INITIAL_WINDOW_SIZE
,
INITIAL_WINDOW_SIZE
,
initial_window_size
,
initial_window_size
,
...
@@ -76,6 +79,7 @@ H2_SETTING( // rfc7540,l,2139,2148
...
@@ -76,6 +79,7 @@ H2_SETTING( // rfc7540,l,2139,2148
0x7fffffff
,
0x7fffffff
,
H2CE_FLOW_CONTROL_ERROR
H2CE_FLOW_CONTROL_ERROR
)
)
H2_SETTING
(
// rfc7540,l,2150,2157
H2_SETTING
(
// rfc7540,l,2150,2157
MAX_FRAME_SIZE
,
MAX_FRAME_SIZE
,
max_frame_size
,
max_frame_size
,
...
@@ -85,6 +89,7 @@ H2_SETTING( // rfc7540,l,2150,2157
...
@@ -85,6 +89,7 @@ H2_SETTING( // rfc7540,l,2150,2157
0x00ffffff
,
0x00ffffff
,
H2CE_PROTOCOL_ERROR
H2CE_PROTOCOL_ERROR
)
)
H2_SETTING
(
// rfc7540,l,2159,2167
H2_SETTING
(
// rfc7540,l,2159,2167
MAX_HEADER_LIST_SIZE
,
MAX_HEADER_LIST_SIZE
,
max_header_list_size
,
max_header_list_size
,
...
...
include/tbl/htc.h
View file @
83b41822
...
@@ -42,4 +42,5 @@ HTC_STATUS(MORE, 1, "more", "More data required")
...
@@ -42,4 +42,5 @@ HTC_STATUS(MORE, 1, "more", "More data required")
HTC_STATUS
(
COMPLETE
,
2
,
"complete"
,
"Data complete (no error)"
)
HTC_STATUS
(
COMPLETE
,
2
,
"complete"
,
"Data complete (no error)"
)
HTC_STATUS
(
IDLE
,
3
,
"idle"
,
"Connection was closed while idle"
)
HTC_STATUS
(
IDLE
,
3
,
"idle"
,
"Connection was closed while idle"
)
#undef HTC_STATUS
#undef HTC_STATUS
/*lint -restore */
/*lint -restore */
include/tbl/style.py
View file @
83b41822
...
@@ -7,7 +7,7 @@ from __future__ import print_function
...
@@ -7,7 +7,7 @@ from __future__ import print_function
import
glob
import
glob
def
check_file
(
fn
):
def
check_file
(
fn
):
s
=
0
print
(
"Check"
,
fn
)
ll
=
[]
ll
=
[]
for
l
in
open
(
fn
):
for
l
in
open
(
fn
):
ll
.
append
(
l
)
ll
.
append
(
l
)
...
@@ -20,7 +20,9 @@ def check_file(fn):
...
@@ -20,7 +20,9 @@ def check_file(fn):
assert
len
(
ll
)
>
5
assert
len
(
ll
)
>
5
assert
ll
.
pop
(
0
)
==
"
\n
"
assert
ll
.
pop
(
0
)
==
"
\n
"
assert
ll
.
pop
(
0
)
==
"/*lint -save -e525 -e539 */
\n
"
i
=
ll
.
pop
(
0
)
assert
i
==
"/*lint -save -e525 -e539 */
\n
"
or
\
i
==
"/*lint -save -e525 -e539 -e835 */
\n
"
assert
ll
.
pop
(
0
)
==
"
\n
"
assert
ll
.
pop
(
0
)
==
"
\n
"
assert
ll
.
pop
(
-
1
)
==
"/*lint -restore */
\n
"
assert
ll
.
pop
(
-
1
)
==
"/*lint -restore */
\n
"
...
@@ -31,7 +33,7 @@ def check_file(fn):
...
@@ -31,7 +33,7 @@ def check_file(fn):
assert
ll
[
i
]
!=
")
\n
"
or
ll
[
i
+
1
]
==
"
\n
"
or
ll
[
i
+
1
][
0
]
==
"#"
assert
ll
[
i
]
!=
")
\n
"
or
ll
[
i
+
1
]
==
"
\n
"
or
ll
[
i
+
1
][
0
]
==
"#"
m
=
{}
m
=
{}
while
len
(
ll
)
>
0
:
while
ll
:
i
=
ll
.
pop
(
0
)
i
=
ll
.
pop
(
0
)
if
i
==
"
\n
"
:
if
i
==
"
\n
"
:
continue
continue
...
@@ -43,7 +45,7 @@ def check_file(fn):
...
@@ -43,7 +45,7 @@ def check_file(fn):
l
=
l
.
split
(
'/*'
)[
0
]
l
=
l
.
split
(
'/*'
)[
0
]
l
=
l
.
rstrip
()
l
=
l
.
rstrip
()
if
l
[
-
1
]
!=
')'
:
if
l
[
-
1
]
!=
')'
:
while
ll
.
pop
(
0
)
!=
')
\n
'
:
while
ll
.
pop
(
0
)
.
strip
()
!=
')
'
:
continue
continue
elif
l
[
0
]
==
"#"
:
elif
l
[
0
]
==
"#"
:
j
=
l
[
1
:]
.
lstrip
()
.
split
()
j
=
l
[
1
:]
.
lstrip
()
.
split
()
...
...
include/tbl/vsl_tags.h
View file @
83b41822
...
@@ -181,16 +181,17 @@ SLTM(Length, 0, "Size of object body",
...
@@ -181,16 +181,17 @@ SLTM(Length, 0, "Size of object body",
"Logs the size of a fetch object body.
\n\n
"
"Logs the size of a fetch object body.
\n\n
"
)
)
/* XXX generate HTC info from tbl include */
/*
#if 0
* XXX generate HTC info below from tbl include
#include <stdio.h>
*
int main(void) {
* #include <stdio.h>
#define HTC_STATUS(e, n, s, l) \
* int main(void) {
printf("\t\"\\t* %s (%d): %s\\n\"\n", s, n, l);
* #define HTC_STATUS(e, n, s, l) \
#include "include/tbl/htc.h"
* printf("\t\"\\t* %s (%d): %s\\n\"\n", s, n, l);
return (0);
* #include "include/tbl/htc.h"
}
* return (0);
#endif
* }
*/
SLTM
(
FetchError
,
0
,
"Error while fetching object"
,
SLTM
(
FetchError
,
0
,
"Error while fetching object"
,
"Logs the error message of a failed fetch operation.
\n\n
"
"Logs the error message of a failed fetch operation.
\n\n
"
...
...
include/tbl/waiters.h
View file @
83b41822
...
@@ -44,3 +44,5 @@
...
@@ -44,3 +44,5 @@
WAITER
(
poll
)
WAITER
(
poll
)
#undef WAITER
#undef WAITER
/*lint -restore */
lib/libvarnishapi/generate.py
View file @
83b41822
...
@@ -82,13 +82,13 @@ def emit_vxp_fixed_token(fo, tokens):
...
@@ -82,13 +82,13 @@ def emit_vxp_fixed_token(fo, tokens):
emit
=
dict
()
emit
=
dict
()
for
i
in
tokens
:
for
i
in
tokens
:
j
=
tokens
[
i
]
j
=
tokens
[
i
]
if
(
j
!=
None
)
:
if
j
is
not
None
:
recog
.
append
(
j
)
recog
.
append
(
j
)
emit
[
j
]
=
i
emit
[
j
]
=
i
recog
.
sort
()
recog
.
sort
()
rrecog
=
copy
.
copy
(
recog
)
rrecog
=
copy
.
copy
(
recog
)
rrecog
.
sort
(
key
=
lambda
x
:
-
len
(
x
))
rrecog
.
sort
(
key
=
lambda
x
:
-
len
(
x
))
fo
.
write
(
"""
fo
.
write
(
"""
unsigned
unsigned
...
@@ -99,23 +99,22 @@ vxp_fixed_token(const char *p, const char **q)
...
@@ -99,23 +99,22 @@ vxp_fixed_token(const char *p, const char **q)
"""
)
"""
)
last_initial
=
None
last_initial
=
None
for
i
in
recog
:
for
i
in
recog
:
if
(
i
[
0
]
==
last_initial
)
:
if
i
[
0
]
==
last_initial
:
continue
continue
last_initial
=
i
[
0
]
last_initial
=
i
[
0
]
fo
.
write
(
"
\t
case '
%
s':
\n
"
%
last_initial
)
fo
.
write
(
"
\t
case '
%
s':
\n
"
%
last_initial
)
for
j
in
rrecog
:
for
j
in
rrecog
:
if
(
j
[
0
]
!=
last_initial
)
:
if
j
[
0
]
!=
last_initial
:
continue
continue
fo
.
write
(
"
\t\t
if ("
)
fo
.
write
(
"
\t\t
if ("
)
k
=
1
k
=
1
l
=
len
(
j
)
l
=
len
(
j
)
while
(
k
<
l
)
:
while
k
<
l
:
fo
.
write
(
"p[
%
d] == '
%
s'"
%
(
k
,
j
[
k
]))
fo
.
write
(
"p[
%
d] == '
%
s'"
%
(
k
,
j
[
k
]))
fo
.
write
(
" &&
\n\t\t
"
)
fo
.
write
(
" &&
\n\t\t
"
)
k
+=
1
k
+=
1
fo
.
write
(
"(isword(p[
%
d]) ? !isword(p[
%
d]) : 1)) {
\n
"
%
fo
.
write
(
"(isword(p[
%
d]) ? !isword(p[
%
d]) : 1)) {
\n
"
%
(
l
-
1
,
l
))
(
l
-
1
,
l
))
fo
.
write
(
"
\t\t\t
*q = p +
%
d;
\n
"
%
l
)
fo
.
write
(
"
\t\t\t
*q = p +
%
d;
\n
"
%
l
)
fo
.
write
(
"
\t\t\t
return (
%
s);
\n
"
%
emit
[
j
])
fo
.
write
(
"
\t\t\t
return (
%
s);
\n
"
%
emit
[
j
])
fo
.
write
(
"
\t\t
}
\n
"
)
fo
.
write
(
"
\t\t
}
\n
"
)
...
@@ -132,7 +131,7 @@ def emit_vxp_tnames(fo, tokens):
...
@@ -132,7 +131,7 @@ def emit_vxp_tnames(fo, tokens):
l
.
sort
()
l
.
sort
()
for
i
in
l
:
for
i
in
l
:
j
=
tokens
[
i
]
j
=
tokens
[
i
]
if
j
==
None
:
if
j
is
None
:
j
=
i
j
=
i
if
i
[
0
]
==
"'"
:
if
i
[
0
]
==
"'"
:
j
=
i
j
=
i
...
...
lib/libvcc/generate.py
View file @
83b41822
...
@@ -32,10 +32,6 @@
...
@@ -32,10 +32,6 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
subprocess
import
collections
import
os
#######################################################################
#######################################################################
# These are our tokens
# These are our tokens
...
@@ -194,9 +190,9 @@ class vardef(object):
...
@@ -194,9 +190,9 @@ class vardef(object):
# fo.write("\t{ \"%s\", %s,\n" % (nm, self.typ))
# fo.write("\t{ \"%s\", %s,\n" % (nm, self.typ))
fo
.
write
(
"
\t
sym = VCC_MkSym(tl,
\"
%
s
\"
, "
%
self
.
nam
)
fo
.
write
(
"
\t
sym = VCC_MkSym(tl,
\"
%
s
\"
, "
%
self
.
nam
)
if
(
self
.
typ
==
"HEADER"
)
:
if
self
.
typ
==
"HEADER"
:
fo
.
write
(
" SYM_NONE,
%
d,
%
d);
\n
"
%
(
self
.
vlo
,
self
.
vhi
))
fo
.
write
(
" SYM_NONE,
%
d,
%
d);
\n
"
%
(
self
.
vlo
,
self
.
vhi
))
fo
.
write
(
"
\t
AN(sym);
\n
"
);
fo
.
write
(
"
\t
AN(sym);
\n
"
)
fo
.
write
(
"
\t
sym->wildcard = vcc_Var_Wildcard;
\n
"
)
fo
.
write
(
"
\t
sym->wildcard = vcc_Var_Wildcard;
\n
"
)
else
:
else
:
fo
.
write
(
" SYM_VAR,
%
d,
%
d);
\n
"
%
(
self
.
vlo
,
self
.
vhi
))
fo
.
write
(
" SYM_VAR,
%
d,
%
d);
\n
"
%
(
self
.
vlo
,
self
.
vhi
))
...
@@ -208,7 +204,7 @@ class vardef(object):
...
@@ -208,7 +204,7 @@ class vardef(object):
fo
.
write
(
'
\t
sym->rname = "HDR_'
)
fo
.
write
(
'
\t
sym->rname = "HDR_'
)
fo
.
write
(
self
.
nam
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
self
.
nam
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
'";
\n
'
)
fo
.
write
(
'";
\n
'
)
elif
len
(
self
.
rd
)
:
elif
self
.
rd
:
fo
.
write
(
'
\t
sym->rname = "VRT_r_
%
s(ctx)";
\n
'
%
cnam
)
fo
.
write
(
'
\t
sym->rname = "VRT_r_
%
s(ctx)";
\n
'
%
cnam
)
varproto
(
"VCL_"
+
self
.
typ
+
" VRT_r_
%
s(VRT_CTX)"
%
cnam
)
varproto
(
"VCL_"
+
self
.
typ
+
" VRT_r_
%
s(VRT_CTX)"
%
cnam
)
fo
.
write
(
"
\t
sym->r_methods =
\n
"
)
fo
.
write
(
"
\t
sym->r_methods =
\n
"
)
...
@@ -219,19 +215,19 @@ class vardef(object):
...
@@ -219,19 +215,19 @@ class vardef(object):
fo
.
write
(
'
\t
sym->lname = "HDR_'
)
fo
.
write
(
'
\t
sym->lname = "HDR_'
)
fo
.
write
(
self
.
nam
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
self
.
nam
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
'";
\n
'
)
fo
.
write
(
'";
\n
'
)
elif
len
(
self
.
wr
)
:
elif
self
.
wr
:
fo
.
write
(
'
\t
sym->lname = "VRT_l_
%
s(ctx, ";
\n
'
%
cnam
)
fo
.
write
(
'
\t
sym->lname = "VRT_l_
%
s(ctx, ";
\n
'
%
cnam
)
s
=
"void VRT_l_
%
s(VRT_CTX, "
%
cnam
s
=
"void VRT_l_
%
s(VRT_CTX, "
%
cnam
if
self
.
typ
!=
"STRING"
and
self
.
typ
!=
"BODY"
:
if
self
.
typ
!=
"STRING"
and
self
.
typ
!=
"BODY"
:
s
+=
"VCL_"
+
self
.
typ
+
")"
s
+=
"VCL_"
+
self
.
typ
+
")"
else
:
else
:
s
+=
ctyp
.
c
+
", ...)"
s
+=
ctyp
.
c
+
", ...)"
varproto
(
s
);
varproto
(
s
)
fo
.
write
(
"
\t
sym->w_methods =
\n
"
)
fo
.
write
(
"
\t
sym->w_methods =
\n
"
)
restrict
(
fo
,
self
.
wr
)
restrict
(
fo
,
self
.
wr
)
fo
.
write
(
";
\n
"
)
fo
.
write
(
";
\n
"
)
if
len
(
self
.
uns
)
:
if
self
.
uns
:
varproto
(
"void VRT_u_
%
s(VRT_CTX)"
%
cnam
)
varproto
(
"void VRT_u_
%
s(VRT_CTX)"
%
cnam
)
fo
.
write
(
'
\t
sym->uname = "VRT_u_
%
s(ctx)";
\n
'
%
cnam
)
fo
.
write
(
'
\t
sym->uname = "VRT_u_
%
s(ctx)";
\n
'
%
cnam
)
fo
.
write
(
'
\t
sym->u_methods =
\n
'
)
fo
.
write
(
'
\t
sym->u_methods =
\n
'
)
...
@@ -239,7 +235,7 @@ class vardef(object):
...
@@ -239,7 +235,7 @@ class vardef(object):
fo
.
write
(
";
\n
"
)
fo
.
write
(
";
\n
"
)
def
parse_vcl
(
x
):
def
parse_vcl
(
x
):
vlo
,
vhi
=
(
0
,
99
)
vlo
,
vhi
=
(
0
,
99
)
x
=
x
.
split
()
x
=
x
.
split
()
if
x
[
0
]
==
"VCL"
and
x
[
1
]
==
"<="
:
if
x
[
0
]
==
"VCL"
and
x
[
1
]
==
"<="
:
vhi
=
int
(
float
(
x
[
2
])
*
10
)
vhi
=
int
(
float
(
x
[
2
])
*
10
)
...
@@ -249,18 +245,18 @@ def parse_vcl(x):
...
@@ -249,18 +245,18 @@ def parse_vcl(x):
print
(
"Unknown variable version spec"
)
print
(
"Unknown variable version spec"
)
print
(
"XXX"
,
x
,
vlo
,
vhi
)
print
(
"XXX"
,
x
,
vlo
,
vhi
)
exit
(
2
)
exit
(
2
)
return
vlo
,
vhi
return
vlo
,
vhi
def
parse_var
(
ln
):
def
parse_var
(
ln
):
l1
=
ln
.
pop
(
0
)
.
split
(
"``"
)
l1
=
ln
.
pop
(
0
)
.
split
(
"``"
)
assert
len
(
l1
)
in
(
1
,
3
)
assert
len
(
l1
)
in
(
1
,
3
)
vn
=
l1
[
0
]
.
strip
()
vn
=
l1
[
0
]
.
strip
()
if
vn
[
-
1
]
==
'*'
:
if
vn
[
-
1
]
==
'*'
:
vn
=
vn
[:
-
1
]
vn
=
vn
[:
-
1
]
if
len
(
l1
)
==
3
:
if
len
(
l1
)
==
3
:
vlo
,
vhi
=
parse_vcl
(
l1
[
1
])
vlo
,
vhi
=
parse_vcl
(
l1
[
1
])
else
:
else
:
vlo
,
vhi
=
0
,
99
vlo
,
vhi
=
0
,
99
vr
=
[]
vr
=
[]
vw
=
[]
vw
=
[]
vu
=
[]
vu
=
[]
...
@@ -290,7 +286,6 @@ def parse_var(ln):
...
@@ -290,7 +286,6 @@ def parse_var(ln):
vardef
(
vn
,
vt
,
vr
,
vw
,
vu
,
vlo
,
vhi
)
vardef
(
vn
,
vt
,
vr
,
vw
,
vu
,
vlo
,
vhi
)
def
parse_var_doc
(
fn
):
def
parse_var_doc
(
fn
):
s
=
0
l
=
[]
l
=
[]
for
i
in
open
(
fn
):
for
i
in
open
(
fn
):
l
.
append
(
i
.
rstrip
())
l
.
append
(
i
.
rstrip
())
...
@@ -299,7 +294,7 @@ def parse_var_doc(fn):
...
@@ -299,7 +294,7 @@ def parse_var_doc(fn):
if
len
(
j
)
!=
2
or
j
[
0
]
!=
"Type:"
or
not
l
[
n
][
0
]
.
isspace
():
if
len
(
j
)
!=
2
or
j
[
0
]
!=
"Type:"
or
not
l
[
n
][
0
]
.
isspace
():
continue
continue
m
=
n
m
=
n
while
m
<
len
(
l
)
and
(
l
[
m
]
==
""
or
l
[
m
][
0
]
.
isspace
()
):
while
m
<
len
(
l
)
and
(
l
[
m
]
==
""
or
l
[
m
][
0
]
.
isspace
()
):
m
+=
1
m
+=
1
parse_var
(
l
[
n
-
2
:
m
-
1
])
parse_var
(
l
[
n
-
2
:
m
-
1
])
...
@@ -385,17 +380,16 @@ vcl_fixed_token(const char *p, const char **q)
...
@@ -385,17 +380,16 @@ vcl_fixed_token(const char *p, const char **q)
"""
)
"""
)
last_initial
=
None
last_initial
=
None
for
i
in
recog
:
for
i
in
recog
:
if
(
i
[
0
]
==
last_initial
)
:
if
i
[
0
]
==
last_initial
:
continue
continue
last_initial
=
i
[
0
]
last_initial
=
i
[
0
]
fo
.
write
(
"
\t
case '
%
s':
\n
"
%
last_initial
)
fo
.
write
(
"
\t
case '
%
s':
\n
"
%
last_initial
)
need_ret
=
True
need_ret
=
True
for
j
in
rrecog
:
for
j
in
rrecog
:
if
(
j
[
0
]
!=
last_initial
)
:
if
j
[
0
]
!=
last_initial
:
continue
continue
if
len
(
j
)
==
2
:
if
len
(
j
)
==
2
:
fo
.
write
(
"
\t\t
M2('
%
s',
%
s);
\n
"
%
fo
.
write
(
"
\t\t
M2('
%
s',
%
s);
\n
"
%
(
j
[
1
],
emit
[
j
]))
(
j
[
1
],
emit
[
j
]))
elif
len
(
j
)
==
1
:
elif
len
(
j
)
==
1
:
fo
.
write
(
"
\t\t
M1();
\n
"
)
fo
.
write
(
"
\t\t
M1();
\n
"
)
need_ret
=
False
need_ret
=
False
...
@@ -403,7 +397,7 @@ vcl_fixed_token(const char *p, const char **q)
...
@@ -403,7 +397,7 @@ vcl_fixed_token(const char *p, const char **q)
fo
.
write
(
"
\t\t
if ("
)
fo
.
write
(
"
\t\t
if ("
)
k
=
1
k
=
1
l
=
len
(
j
)
l
=
len
(
j
)
while
(
k
<
l
)
:
while
k
<
l
:
fo
.
write
(
"p[
%
d] == '
%
s'"
%
(
k
,
j
[
k
]))
fo
.
write
(
"p[
%
d] == '
%
s'"
%
(
k
,
j
[
k
]))
fo
.
write
(
" &&"
)
fo
.
write
(
" &&"
)
if
(
k
%
3
)
==
0
:
if
(
k
%
3
)
==
0
:
...
@@ -717,7 +711,7 @@ def restrict(fo, spec):
...
@@ -717,7 +711,7 @@ def restrict(fo, spec):
fo
.
write
(
x
)
fo
.
write
(
x
)
w
+=
len
(
x
)
w
+=
len
(
x
)
p
=
" | "
p
=
" | "
if
len
(
d
)
==
0
:
if
not
d
:
fo
.
write
(
"0"
)
fo
.
write
(
"0"
)
#######################################################################
#######################################################################
...
...
lib/libvcc/vmodtool.py
View file @
83b41822
...
@@ -41,7 +41,6 @@ import sys
...
@@ -41,7 +41,6 @@ import sys
import
re
import
re
import
optparse
import
optparse
import
unittest
import
unittest
import
random
import
copy
import
copy
import
json
import
json
import
hashlib
import
hashlib
...
...
lib/libvcc/vsctool.py
View file @
83b41822
This diff is collapsed.
Click to expand it.
tools/gcov_digest.py
View file @
83b41822
...
@@ -122,7 +122,7 @@ def run_gcov(prog, subdir):
...
@@ -122,7 +122,7 @@ def run_gcov(prog, subdir):
for
ln
in
x
.
split
(
"
\n
"
):
for
ln
in
x
.
split
(
"
\n
"
):
ln
=
ln
.
split
()
ln
=
ln
.
split
()
if
len
(
ln
)
==
0
:
if
not
ln
:
continue
continue
if
ln
[
0
]
==
"Creating"
:
if
ln
[
0
]
==
"Creating"
:
gn
=
ln
[
1
]
.
strip
(
"'"
)
gn
=
ln
[
1
]
.
strip
(
"'"
)
...
@@ -148,10 +148,10 @@ def produce_output(fdo):
...
@@ -148,10 +148,10 @@ def produce_output(fdo):
lnos
.
sort
()
lnos
.
sort
()
pln
=
-
1
pln
=
-
1
pcn
=
-
1
pcn
=
-
1
while
len
(
lnos
)
>
0
:
while
lnos
:
ln
,
cn
=
lnos
.
pop
(
0
)
ln
,
cn
=
lnos
.
pop
(
0
)
lnl
=
ln
lnl
=
ln
while
len
(
lnos
)
>
0
:
while
lnos
:
lnn
,
cnn
=
lnos
[
0
]
lnn
,
cnn
=
lnos
[
0
]
if
lnl
+
1
!=
lnn
or
cnn
!=
cn
:
if
lnl
+
1
!=
lnn
or
cnn
!=
cn
:
break
break
...
@@ -193,7 +193,7 @@ if __name__ == "__main__":
...
@@ -193,7 +193,7 @@ if __name__ == "__main__":
exclude
.
append
(
v
)
exclude
.
append
(
v
)
else
:
else
:
assert
False
assert
False
if
len
(
args
)
==
0
:
if
not
args
:
args
=
[
"."
]
args
=
[
"."
]
for
dn
in
args
:
for
dn
in
args
:
run_gcov
(
gcovprog
,
dn
)
run_gcov
(
gcovprog
,
dn
)
...
...
tools/include_wash.py
View file @
83b41822
...
@@ -8,7 +8,7 @@ def check(fn):
...
@@ -8,7 +8,7 @@ def check(fn):
l
=
[]
l
=
[]
for
i
in
open
(
fn
):
for
i
in
open
(
fn
):
i
=
i
.
strip
()
i
=
i
.
strip
()
if
len
(
i
)
==
0
:
if
not
i
:
continue
continue
if
i
[
0
]
!=
"#"
:
if
i
[
0
]
!=
"#"
:
continue
continue
...
@@ -20,7 +20,7 @@ def check(fn):
...
@@ -20,7 +20,7 @@ def check(fn):
l
.
append
(
i
.
split
(
'"'
)[
1
])
l
.
append
(
i
.
split
(
'"'
)[
1
])
if
"vrt.h"
in
l
:
if
"vrt.h"
in
l
:
vrt
=
l
.
index
(
"vrt.h"
)
vrt
=
l
.
index
(
"vrt.h"
)
if
not
"vdef.h"
in
l
:
if
"vdef.h"
not
in
l
:
print
(
fn
,
"vdef.h not included with vrt.h"
)
print
(
fn
,
"vdef.h not included with vrt.h"
)
vdef
=
l
.
index
(
"vdef.h"
)
vdef
=
l
.
index
(
"vdef.h"
)
if
vdef
>
vrt
:
if
vdef
>
vrt
:
...
@@ -31,11 +31,9 @@ def check(fn):
...
@@ -31,11 +31,9 @@ def check(fn):
for
i
in
(
"cache/cache.h"
,
"cache.h"
):
for
i
in
(
"cache/cache.h"
,
"cache.h"
):
if
i
in
l
:
if
i
in
l
:
for
i
in
(
for
i
in
(
"stddef.h"
,
"stdint.h"
,
"vrt.h"
,
"stddef.h"
,
"stdint.h"
,
"vrt.h"
,
"math.h"
,
"pthread.h"
,
"stdarg.h"
,
"sys/types.h"
,
"math.h"
,
"pthread.h"
,
"stdarg.h"
,
"sys/types.h"
,
"vdef.h"
,
"miniobj.h"
,
"vas.h"
,
"vqueue.h"
,
"vdef.h"
,
"miniobj.h"
,
"vas.h"
,
"vqueue.h"
):
):
if
i
in
l
:
if
i
in
l
:
print
(
fn
,
i
+
" included with cache.h"
)
print
(
fn
,
i
+
" included with cache.h"
)
...
...
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