Commit c1b3fef3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the enum MET/RET macros to vcl.h



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3482 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 8249bacb
...@@ -109,7 +109,7 @@ proc warns {fd} { ...@@ -109,7 +109,7 @@ proc warns {fd} {
puts $fd " *" puts $fd " *"
puts $fd " * NB: This file is machine generated, DO NOT EDIT!" puts $fd " * NB: This file is machine generated, DO NOT EDIT!"
puts $fd " *" puts $fd " *"
puts $fd " * Edit vcc_gen_fixed_token.tcl instead" puts $fd " * Edit and run vcc_gen_fixed_token.tcl instead"
puts $fd " */" puts $fd " */"
puts $fd "" puts $fd ""
} }
...@@ -126,6 +126,29 @@ typedef void vcl_init_f(struct cli *); ...@@ -126,6 +126,29 @@ typedef void vcl_init_f(struct cli *);
typedef void vcl_fini_f(struct cli *); typedef void vcl_fini_f(struct cli *);
typedef int vcl_func_f(struct sess *sp); typedef int vcl_func_f(struct sess *sp);
} }
puts $fo "/* VCL Methods */"
set u 0
foreach m $methods {
if {[string length [lindex $m 0]] < 8} {
set sp "\t"
} else {
set sp ""
}
puts $fo "#define VCL_MET_[string toupper [lindex $m 0]]\t${sp}(1 << $u)"
incr u
}
puts $fo "\n#define VCL_MET_MAX\t\t$u\n"
puts $fo "/* VCL Returns */"
set i 0
foreach k $returns {
puts $fo "#define VCL_RET_[string toupper $k]\t\t(1 << $i)"
incr i
}
puts $fo "\n#define VCL_RET_MAX\t\t$i\n"
puts $fo "struct VCL_conf {" puts $fo "struct VCL_conf {"
puts $fo { unsigned magic; puts $fo { unsigned magic;
#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ #define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */
...@@ -171,13 +194,6 @@ foreach k $returns { ...@@ -171,13 +194,6 @@ foreach k $returns {
} }
incr i incr i
} }
puts $for "#else"
set i 0
foreach k $returns {
puts $for "#define VCL_RET_[string toupper $k] (1 << $i)"
incr i
}
puts $for "#define VCL_RET_MAX $i"
puts $for "#endif" puts $for "#endif"
puts $for "" puts $for ""
puts $for "#ifdef VCL_MET_MAC" puts $for "#ifdef VCL_MET_MAC"
...@@ -186,7 +202,7 @@ foreach m $methods { ...@@ -186,7 +202,7 @@ foreach m $methods {
puts -nonewline $for "VCL_MET_MAC([lindex $m 0]" puts -nonewline $for "VCL_MET_MAC([lindex $m 0]"
puts -nonewline $for ",[string toupper [lindex $m 0]]" puts -nonewline $for ",[string toupper [lindex $m 0]]"
set l [lindex $m 1] set l [lindex $m 1]
puts -nonewline $for ",(\n VCL_RET_[string toupper [lindex $l 0]]" puts -nonewline $for ",\n (VCL_RET_[string toupper [lindex $l 0]]"
foreach r [lrange $l 1 end] { foreach r [lrange $l 1 end] {
puts -nonewline $for "|VCL_RET_[string toupper $r]" puts -nonewline $for "|VCL_RET_[string toupper $r]"
} }
...@@ -194,14 +210,7 @@ foreach m $methods { ...@@ -194,14 +210,7 @@ foreach m $methods {
puts $for ")" puts $for ")"
incr u incr u
} }
puts $for "#else"
set u 0
foreach m $methods {
puts $for "#define VCL_MET_[string toupper [lindex $m 0]]\t(1 << $u)"
incr u
}
puts $for "#endif" puts $for "#endif"
puts $for "#define N_METHODS $u"
close $for close $for
#---------------------------------------------------------------------- #----------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment