summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/mkopcodeh.awk
diff options
context:
space:
mode:
authorjturner <jturner@openbsd.org>2014-03-24 01:37:28 +0000
committerjturner <jturner@openbsd.org>2014-03-24 01:37:28 +0000
commit29ebcee2452a131560f5220abaf585648f84ce40 (patch)
tree844ef4fe135beff619b9e7b632f3b6722d6367e4 /lib/libsqlite3/mkopcodeh.awk
parentannotate some packed structures with the alignment the hardware (diff)
downloadwireguard-openbsd-29ebcee2452a131560f5220abaf585648f84ce40.tar.xz
wireguard-openbsd-29ebcee2452a131560f5220abaf585648f84ce40.zip
Update sqlite to 3.8.4. A list of changes are available here:
http://sqlite.org/changes.html. Tested in a bulk and ok landry@
Diffstat (limited to 'lib/libsqlite3/mkopcodeh.awk')
-rw-r--r--lib/libsqlite3/mkopcodeh.awk58
1 files changed, 55 insertions, 3 deletions
diff --git a/lib/libsqlite3/mkopcodeh.awk b/lib/libsqlite3/mkopcodeh.awk
index 9685c3a0e86..babfdc68d32 100644
--- a/lib/libsqlite3/mkopcodeh.awk
+++ b/lib/libsqlite3/mkopcodeh.awk
@@ -38,6 +38,33 @@
tk[$2] = 0+$3 # tk[x] holds the numeric value for TK symbol X
}
+# Find "/* Opcode: " lines in the vdbe.c file. Each one introduces
+# a new opcode. Remember which parameters are used.
+/^.. Opcode: / {
+ currentOp = "OP_" $3
+ m = 0
+ for(i=4; i<=NF; i++){
+ x = $i
+ if( x=="P1" ) m += 1
+ if( x=="P2" ) m += 2
+ if( x=="P3" ) m += 4
+ if( x=="P4" ) m += 8
+ if( x=="P5" ) m += 16
+ }
+ paramused[currentOp] = m
+}
+
+# Find "** Synopsis: " lines that follow Opcode:
+/^.. Synopsis: / {
+ if( currentOp ){
+ x = $3
+ for(i=4; i<=NF; i++){
+ x = x " " $i
+ }
+ synopsis[currentOp] = x
+ }
+}
+
# Scan for "case OP_aaaa:" lines in the vdbe.c file
/^case OP_/ {
name = $2
@@ -109,8 +136,10 @@ END {
|| name=="OP_VUpdate" \
|| name=="OP_VFilter" \
|| name=="OP_Next" \
+ || name=="OP_NextIfOpen" \
|| name=="OP_SorterNext" \
|| name=="OP_Prev" \
+ || name=="OP_PrevIfOpen" \
){
cnt++
while( used[cnt] ) cnt++
@@ -136,10 +165,22 @@ END {
if( !used[i] ){
def[i] = "OP_NotUsed_" i
}
- printf "#define %-25s %15d", def[i], i
+ printf "#define %-16s %3d", def[i], i
+ com = ""
if( sameas[i] ){
- printf " /* same as %-12s*/", sameas[i]
- }
+ com = "same as " sameas[i]
+ }
+ x = synopsis[def[i]]
+ if( x ){
+ if( com=="" ){
+ com = "synopsis: " x
+ } else {
+ com = com ", synopsis: " x
+ }
+ }
+ if( com!="" ){
+ printf " /* %-42s */", com
+ }
printf "\n"
}
@@ -180,4 +221,15 @@ END {
if( i%8==7 ) printf("\\\n");
}
print "}"
+ if( 0 ){
+ print "\n/* Bitmask to indicate which fields (P1..P5) of each opcode are"
+ print "** actually used.\n*/"
+ print "#define OP_PARAM_USED_INITIALIZER {\\"
+ for(i=0; i<=max; i++){
+ if( i%8==0 ) printf("/* %3d */",i)
+ printf " 0x%02x,", paramused[def[i]]
+ if( i%8==7 ) printf("\\\n");
+ }
+ print "}"
+ }
}