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
Hide 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):
...
@@ -842,7 +842,7 @@ class AliasStanza(Stanza):
def
find_symbol
(
self
,
tbl
,
name
):
def
find_symbol
(
self
,
tbl
,
name
):
for
sym
in
tbl
:
for
sym
in
tbl
:
if
sym
.
proto
is
None
:
if
sym
.
proto
is
None
:
continue
;
continue
if
sym
.
proto
.
name
==
name
:
if
sym
.
proto
.
name
==
name
:
return
sym
return
sym
err
(
"Symbol '
%
s' not found
\n
"
%
name
,
warn
=
False
)
err
(
"Symbol '
%
s' not found
\n
"
%
name
,
warn
=
False
)
...
@@ -1049,7 +1049,7 @@ class vcc(object):
...
@@ -1049,7 +1049,7 @@ class vcc(object):
fo
.
write
(
"#endif
\n
"
)
fo
.
write
(
"#endif
\n
"
)
fo
.
write
(
"
\n
"
)
fo
.
write
(
"
\n
"
)
self
.
mkdefs
(
fo
)
;
self
.
mkdefs
(
fo
)
for
j
in
sorted
(
self
.
enums
):
for
j
in
sorted
(
self
.
enums
):
fo
.
write
(
"extern VCL_ENUM VENUM(
%
s);
\n
"
%
j
)
fo
.
write
(
"extern VCL_ENUM VENUM(
%
s);
\n
"
%
j
)
...
@@ -1084,22 +1084,31 @@ class vcc(object):
...
@@ -1084,22 +1084,31 @@ class vcc(object):
fmt_cstruct
(
fo
,
'.enum_
%
s ='
%
j
,
'&VENUM(
%
s),'
%
j
)
fmt_cstruct
(
fo
,
'.enum_
%
s ='
%
j
,
'&VENUM(
%
s),'
%
j
)
fo
.
write
(
"};
\n
"
)
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"
]]
jl
=
[[
"$VMOD"
,
"1.0"
]]
for
j
in
self
.
contents
:
for
j
in
self
.
contents
:
j
.
json
(
jl
)
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
"
)
fo
.
write
(
"
\n
static const char Vmod_Json[] = {
\n
"
)
t
=
'
\t
"'
for
i
in
json
.
dumps
(
jl
,
indent
=
2
,
separators
=
(
","
,
": "
)):
for
i
in
self
.
iter_json
(
fnx
):
if
i
==
'
\n
'
:
fo
.
write
(
'
\t
"'
)
fo
.
write
(
t
+
' "
\n
'
)
for
j
in
i
:
t
=
'
\t
"'
if
j
in
'"
\\
'
:
else
:
fo
.
write
(
'
\\
'
)
if
i
in
'"
\\
'
:
fo
.
write
(
j
)
t
+=
'
\\
'
fo
.
write
(
'"
\n
'
)
t
+=
i
fo
.
write
(
'
\t\"\\
n
\"\n
};
\n
'
)
fo
.
write
(
t
+
'
\\
n"
\n
};
\n
'
)
def
vmod_data
(
self
,
fo
):
def
vmod_data
(
self
,
fo
):
vmd
=
"Vmod_
%
s_Data"
%
self
.
modname
vmd
=
"Vmod_
%
s_Data"
%
self
.
modname
...
@@ -1133,7 +1142,7 @@ class vcc(object):
...
@@ -1133,7 +1142,7 @@ class vcc(object):
write_c_file_warning
(
fo
,
self
.
inputfile
)
write_c_file_warning
(
fo
,
self
.
inputfile
)
self
.
mkdefs
(
fx
)
;
self
.
mkdefs
(
fx
)
fo
.
write
(
'#include "config.h"
\n
'
)
fo
.
write
(
'#include "config.h"
\n
'
)
for
i
in
[
"vdef"
,
"vrt"
,
self
.
pfx
,
"vmod_abi"
]:
for
i
in
[
"vdef"
,
"vrt"
,
self
.
pfx
,
"vmod_abi"
]:
...
@@ -1167,17 +1176,14 @@ class vcc(object):
...
@@ -1167,17 +1176,14 @@ class vcc(object):
fx
.
close
()
fx
.
close
()
fo
.
write
(
"
\n
static const char Vmod_Proto[] =
\n
"
)
self
.
vmod_proto
(
fo
,
fnx
)
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
.
json
(
fo
)
self
.
json
(
fo
)
self
.
vmod_data
(
fo
)
self
.
vmod_data
(
fo
)
os
.
remove
(
fnx
)
fo
.
close
()
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