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
6b963515
Commit
6b963515
authored
Jun 20, 2022
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor polish.
In other news: I've gotten much better at writing python.
parent
66860cd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
+26
-20
vmodtool.py
lib/libvcc/vmodtool.py
+26
-20
No files found.
lib/libvcc/vmodtool.py
View file @
6b963515
...
...
@@ -842,7 +842,7 @@ class AliasStanza(Stanza):
def
find_symbol
(
self
,
tbl
,
name
):
for
sym
in
tbl
:
if
sym
.
proto
is
None
:
continue
;
continue
if
sym
.
proto
.
name
==
name
:
return
sym
err
(
"Symbol '
%
s' not found
\n
"
%
name
,
warn
=
False
)
...
...
@@ -1049,7 +1049,7 @@ class vcc(object):
fo
.
write
(
"#endif
\n
"
)
fo
.
write
(
"
\n
"
)
self
.
mkdefs
(
fo
)
;
self
.
mkdefs
(
fo
)
for
j
in
sorted
(
self
.
enums
):
fo
.
write
(
"extern VCL_ENUM VENUM(
%
s);
\n
"
%
j
)
...
...
@@ -1084,22 +1084,31 @@ class vcc(object):
fmt_cstruct
(
fo
,
'.enum_
%
s ='
%
j
,
'&VENUM(
%
s),'
%
j
)
fo
.
write
(
"};
\n
"
)
def
json
(
self
,
fo
):
def
vmod_proto
(
self
,
fo
,
fnx
):
fo
.
write
(
"
\n
static const char Vmod_Proto[] =
\n
"
)
for
i
in
open
(
fnx
):
fo
.
write
(
'
\t
"
%
s
\\
n"
\n
'
%
i
.
rstrip
())
fo
.
write
(
'
\t
"static struct
%
s
%
s;";
\n
'
%
(
self
.
csn
,
self
.
csn
))
def
iter_json
(
self
):
jl
=
[[
"$VMOD"
,
"1.0"
]]
for
j
in
self
.
contents
:
j
.
json
(
jl
)
for
i
in
json
.
dumps
(
jl
,
indent
=
2
,
separators
=
(
","
,
": "
))
.
splitlines
():
yield
i
+
" "
def
json
(
self
,
fo
):
fo
.
write
(
"
\n
static const char Vmod_Json[] = {
\n
"
)
t
=
'
\t
"'
for
i
in
json
.
dumps
(
jl
,
indent
=
2
,
separators
=
(
","
,
": "
)):
if
i
==
'
\n
'
:
fo
.
write
(
t
+
' "
\n
'
)
t
=
'
\t
"'
else
:
if
i
in
'"
\\
'
:
t
+=
'
\\
'
t
+=
i
fo
.
write
(
t
+
'
\\
n"
\n
};
\n
'
)
for
i
in
self
.
iter_json
(
fnx
):
fo
.
write
(
'
\t
"'
)
for
j
in
i
:
if
j
in
'"
\\
'
:
fo
.
write
(
'
\\
'
)
fo
.
write
(
j
)
fo
.
write
(
'"
\n
'
)
fo
.
write
(
'
\t\"\\
n
\"\n
};
\n
'
)
def
vmod_data
(
self
,
fo
):
vmd
=
"Vmod_
%
s_Data"
%
self
.
modname
...
...
@@ -1133,7 +1142,7 @@ class vcc(object):
write_c_file_warning
(
fo
,
self
.
inputfile
)
self
.
mkdefs
(
fx
)
;
self
.
mkdefs
(
fx
)
fo
.
write
(
'#include "config.h"
\n
'
)
for
i
in
[
"vdef"
,
"vrt"
,
self
.
pfx
,
"vmod_abi"
]:
...
...
@@ -1167,17 +1176,14 @@ class vcc(object):
fx
.
close
()
fo
.
write
(
"
\n
static const char Vmod_Proto[] =
\n
"
)
for
i
in
open
(
fnx
):
fo
.
write
(
'
\t
"
%
s
\\
n"
\n
'
%
i
.
rstrip
())
fo
.
write
(
'
\t
"static struct
%
s
%
s;";
\n
'
%
(
self
.
csn
,
self
.
csn
))
os
.
remove
(
fnx
)
self
.
vmod_proto
(
fo
,
fnx
)
self
.
json
(
fo
)
self
.
vmod_data
(
fo
)
os
.
remove
(
fnx
)
fo
.
close
()
#######################################################################
...
...
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